Ask Your Question

BenMoon's profile - activity

2014-10-02 18:33:24 +0200 received badge  Notable Question (source)
2012-12-09 11:45:31 +0200 received badge  Popular Question (source)
2012-02-01 03:20:48 +0200 commented answer sage integration differes from Mathematica

Cheers man! So I've got to evaluate the stuff numerically before plotting. Usually I only do numpy and rarely sympy and recently had a look into sage again after some time. I start liking it ;) Thanks Ben

2012-02-01 03:19:13 +0200 received badge  Supporter (source)
2012-01-31 08:40:57 +0200 commented answer sage integration differes from Mathematica

Agree. Thanks haven't thought about the constant, which is of course right, however I'm not sure if that's actually the problem: Mathematica (for the above function): A(0) = 3.11179*10^-15 + 0. I A(1) = 83.9607 + 0. I A(20) = 3.15709 + 0. I Sage: A(0) = 1.26977421759869e-11+101.642197289814i A(1) = 83.9606807305601 A(20) = 3.15709049993006 To me that doesn't look like a constant... Furthermore I cannot plot the stuff ("plot(A(a=100, f=1, s=8, phi=0), (x, 10, 16))"), with this error: verbose 0 (4190: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (4190: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation' Thanks Ben

2012-01-30 07:22:54 +0200 asked a question 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