Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

sage integration differes from Mathematica

Hi, I'm trying to integrate

E(x) = ae^(-0.5(x/s)^2)cos(fx+phi)

Mathematica

A = Integrate[a Exp[-0.5 x^2/[Sigma]^2] Cos[f x + [Phi]], x]

gives me

0.626657 a E^(-0.5 f^2 [Sigma]^2) [Sigma] (Erf[(0.707107 x)/[Sigma]+(0.+0.707107 I) f [Sigma]] (Cos[[Phi]]-(0.+1. I) Sin[[Phi]])+Erfi[((0.+0.707107 I) x)/[Sigma]+0.707107 f [Sigma]] ((0.-1. I) Cos[[Phi]]+Sin[[Phi]]))

Doing

E = ae^(-0.5(x/s)^2)cos(fx+phi)

A = integrate(E, x)

Sages result is a different one (sorry, cannot copy output, but you can easily reproduce it yourself). The difference isn't obvious at first glance (at least not to me), but you can see it doing e.g.

A /. {a -> 100, f -> 1, [Sigma] -> 8, [Phi] -> 0, x -> 0}

gives 3.11179*10^-15 + 0. I

and Sage

show(A(a=100, f=1, s=8, phi=0, x=0).n())

results in 1.26977421759869e10-11+101.642197289814i

The result differs at least at zero. Anyone any idea what I'm doing wrong?

Cheers!

Ben