自然對數e
實際應用例如同一時間段複利計算的極限
Last updated
實際應用例如同一時間段複利計算的極限
Last updated
function a (n){return (1+1/n) ** n }
// a(9000000000)
// 2.718282053219686function b (n){return (1+n) ** (1/n) }
// b(0.000000000001)
// 2.7185234960372378定義 e 爲下列無窮級數之和://fact用來計算階層的倒數
function fact(x) {
if(x==0) {
return 1;
}
return 1 / x * fact(x-1) ;
}
function c(n) {
var total = fact(n);
for(i = 1; i <= n; i++ ){
total += fact(n - i)
}
return total;
}
//c(345)Math.newsqrt = function(a, b) {
if(b > 0) {
a = Math.sqrt(a);
return Math.newsqrt(a, b - 1);
} else {
return a
}
}
Math.newsqrt(Math.exp(1), Math.exp(1))