You can't use mpmath functions with symbolic SymPy objects. You need to define sinc symbolically. One way is to just define it as a Python function that returns the equivalent (here sin is sympy.sin): def sinc(x): return sin(x)/x Or, you could write your own SymPy class for it. class sinc(Function):...

c,logic,approximation,taylor-series

Your main problem is here: if ((theoval - total) >= FLT_EPSILON) // if it is smaller, then we don't wan't to increment n continue; else n++; The logic is both backwards and unnecessary. It's backwards because you avoid incrementing n in exactly those cases where you want to increment it,...

The algorithm that I'm about to describe is justified mathematically by formal power series. Every function with a Taylor series has a formal power series. The converse is not true, but if we do arithmetic on functions with Taylor series and get a function with a Taylor series, then we...

linux,assembly,x86,att,taylor-series

The FPU stack isn't endless. In your loop you push (fld) more values than you pop (fstp). So the stack becomes full and every new push produces a NaN.

Try (%i1) f(x,y) := ''(ratdisrep(taylor(('x+'y)^3, ['x, 'y], [2, 3], 2))) $ (%i2) f(2, 3); (%o2) 125 or (%i1) define(f(x, y), ratdisrep(taylor(('x+'y)^3, ['x, 'y], [2, 3], 2)))$ (%i2) f(2, 3); (%o2) 125 ...

The Taylor series you use needs x to be expressed in radians. After the input multiply x by π/180 to convert degrees to radians. Also you need to have many iterations, not just x. Try for i=1:1:10 because factorial grows very fast.

Change all float types to double and use double as the return type for the factorial() and poww() functions, too. It's the last two that are most important in this case. Also, the return type on main() should be int, not void. [I just finished removing the dead if statement...

This is essentially directly using Maxima, so (%i11) display2d: false; (%o11) false (%i12) f:r^2*acos((r-h)/r)-(r-h)*sqrt(2*r*h-h^2); (%o12) r^2*acos((r-h)/r)-(r-h)*sqrt(2*h*r-h^2) (%i13) taylor(f,h,0,3); (%o13) 4*sqrt(r)*sqrt(2)*h^(3/2)/3-sqrt(r)*sqrt(2)*h^(5/2)/(5*r) Expanding around other points gives what we expect, so I guess this is some kind of bug (or undocumented feature) in Maxima. (%i22) taylor(sqrt(x),x,0,5); (%o22) +sqrt(x) (%i23) powerseries(sqrt(x),x,0); (%o23) sqrt(x)...

matlab,truncation,taylor-series

I can reproduce your output setting digits(4). Set it back to 32 and everything should be okay. The digits functions allows to set the precision of mupad variable precision arithmetic. The precision was reduced to 4 digits for some reason....