亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

等式返回與連續輸入相同的值

等式返回與連續輸入相同的值

陪伴而非守候 2023-05-11 16:47:17
我當前的項目需要一個曲線方程,但它不是為不同的輸入返回不同的值,而是為幾個連續的輸入返回相同的值。代碼 (星號強調,實際代碼中沒有)console.log(-21.6 + (594.6724 - -21.6)/(1 + (**67**/8.436912)^1.09424));console.log(-21.6 + (594.6724 - -21.6)/(1 + (**68**/8.436912)^1.09424));console.log(-21.6 + (594.6724 - -21.6)/(1 + (**69**/8.436912)^1.09424));console.log(-21.6 + (594.6724 - -21.6)/(1 + (**70**/8.436912)^1.09424));console.log(-21.6 + (594.6724 - -21.6)/(1 + (**71**/8.436912)^1.09424));console.log(-21.6 + (594.6724 - -21.6)/(1 + (**72**/8.436912)^1.09424));console.log(-21.6 + (594.6724 - -21.6)/(1 + (**73**/8.436912)^1.09424));console.log(-21.6 + (594.6724 - -21.6)/(1 + (**74**/8.436912)^1.09424));console.log(-21.6 + (594.6724 - -21.6)/(1 + (**75**/8.436912)^1.09424));console.log(-21.6 + (594.6724 - -21.6)/(1 + (**76**/8.436912)^1.09424));輸出46.8747111111111255.43405000000000655.43405000000000655.43405000000000655.43405000000000655.43405000000000655.43405000000000655.43405000000000655.43405000000000634.42476363636364如您所見,在 68-75 的輸入值之間,輸出沒有變化。我已經嘗試了幾個 IDE 以確保它不是本地問題。有人可以告訴我發生了什么事嗎?鏈接到 jsfiddle: https: //jsfiddle.net/ay4twrm5/
查看完整描述

1 回答

?
白豬掌柜的

TA貢獻1893條經驗 獲得超10個贊

我猜^你的意思是求冪,除了^在 JavaScript 中沒有以這種方式使用(它是按位異或運算符),在你需要使用的 JavaScript 中做指數**(不是為了強調,在實際代碼中):

function f(x) {

? return -21.6 + (594.6724 - -21.6)/(1 + (x/8.436912)**1.09424);

}


console.log(f(67));

console.log(f(68));

console.log(f(69));

console.log(f(70));

console.log(f(71));

console.log(f(72));

console.log(f(73));

console.log(f(74));

console.log(f(75));

console.log(f(76));


或者,您可以使用Math.pow:


function f(x) {

? return -21.6 + (594.6724 - -21.6)/(1 + Math.pow(x/8.436912, 1.09424));

}


console.log(f(67));

console.log(f(68));

console.log(f(69));

console.log(f(70));

console.log(f(71));

console.log(f(72));

console.log(f(73));

console.log(f(74));

console.log(f(75));

console.log(f(76));



查看完整回答
反對 回復 2023-05-11
  • 1 回答
  • 0 關注
  • 118 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號