问题标签 [taylor-series]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
fortran - 使用泰勒级数计算 cos 的 Fortran 程序打印错误结果,我的阶乘可能出错
我一直在尝试创建一个可以使用泰勒级数计算辐射的cos的程序。我考虑了这个错误,例如:
cos(45)=1.4
一定是这样的: s=(((-1.)**n/(fact*2.*n))*x**(2.*n))*sign
。
编码:
c++ - C++ 泰勒级数估计初值微分方程精度
我被要求使用泰勒级数方法来估计 的初始值问题x(t)'= tx(t) + t^4, x(5) = 3
。我必须编写代码来显示使用泰勒级数方法的估计值0<=t<=5
。
我被教导从 开始t=0
,使用初始条件 att=0
来查找x0
,然后通过计算并找到对应于的下一个t=5
以0.01
递增的方式上升。x'', x''', etc
x
t+0.01
我如何在 c++ 中向后执行此过程,如从开始t=5
并向下递增到 0 ?
c - taylor series with error at most 10^-3
I'm trying to calculate the the taylor series of cos(x)
with error at most 10^-3
and for all x ∈ [-pi/4, pi/4]
, that means my error needs to be less than 0.001
. I can modify the x +=in the for loop to have different result. I tried several numbers but it never turns to an error less than 0.001.
I'm also doing this for e^x
too. For this part, x must in [-2,2]
.
But whenever I changed the number of terms in the for loop, it always have an error that is greater than 1. How am I suppose to change it to have errors less than 10^-3
?
Thanks!
c++ - 泰勒级数展开为 constexpr
我正在尝试sine
使用泰勒级数扩展构建一个简单的函数,可以在编译时使用 C++14 进行评估constexpr
。我的代码正在编译,但编译器不会生成常量。
sine
定义如下:
如果需要power
,我可以提供代码。factorial
它们是微不足道的,也是constexpr
。
我sine
从这样的循环中调用:
我期待编译器可以生成一组结果sine
并将它们放入out
而不需要实际计算泰勒级数。相反,生成的代码sine
就像任何其他非constexpr
函数一样执行。
我的编译器是从 Xcode 7.2 编译的-O3
.
javascript - 递归函数 指数函数
我需要在 Taylor 行的帮助下实现递归函数指数函数 (e^x):e^x = 1 + x + x2/2!+ x3/3!+ ...但我不明白我做错了什么我有下一个代码:
r - 使用泰勒展开估计比率的标准偏差
我有兴趣构建一个 R 函数,我可以用它来测试泰勒级数逼近的极限。我知道我所做的事情是有限制的,但这正是我希望调查的那些限制。
我有两个正态分布的随机变量x
和y
. x
平均值为 7,标准差 (sd) 为 1。y
平均值为 5,sd 为 4。
我知道如何估计 的平均比率y/x
,像这样
然而,我对如何估计比率的标准偏差感到困惑?我意识到我必须使用泰勒展开式,但不是如何使用它。
做一个简单的模拟我得到
python - 余弦 x 的泰勒级数在运行时使用 python 给出逻辑错误
代码编译但输出错误。例如,当我输入一个值 45 时,我得到的输出是 1.0。我使用enthought canopy IDE,我哪里出错了?