Ask Your Question

IvanG's profile - activity

2021-02-13 10:59:44 +0200 received badge  Famous Question (source)
2020-03-30 17:45:32 +0200 received badge  Famous Question (source)
2017-04-25 01:15:52 +0200 received badge  Notable Question (source)
2017-03-19 10:34:10 +0200 received badge  Notable Question (source)
2015-01-14 10:31:08 +0200 received badge  Popular Question (source)
2014-09-08 17:16:03 +0200 received badge  Popular Question (source)
2013-06-18 01:35:12 +0200 received badge  Teacher (source)
2013-06-18 01:35:12 +0200 received badge  Self-Learner (source)
2013-06-18 01:01:46 +0200 answered a question integrate cos(x)*cos(2x)*...*cos(mx) via SAGE

So the answer is - Yes. It is a bug in algorithm='maxima', so use algorithm='mathematica_free' (def new function to find definite integral) or simplify_full() for such product of cos(kx) and than integrate.

2013-06-18 00:51:12 +0200 commented question integrate cos(x)*cos(2x)*...*cos(mx) via SAGE

Thanks! Really if use simplify_full() than answer is correct

2013-06-18 00:49:45 +0200 commented question How to use algorithm='mathematica free' to calculate definite integral?

Thanks for comments!

2013-06-18 00:49:19 +0200 answered a question How to use algorithm='mathematica free' to calculate definite integral?

Thanks for comments!

x=var('x')
f = lambda x : x^2
def defintegral_viaMathFree(f,x,a,b):
F(x)=integrate(f(x),x,algorithm='mathematica_free')
return F(b)-F(a)

And

defintegral_viaMathFree(f,x,0,1)

output: 1/3

2013-06-18 00:09:56 +0200 received badge  Nice Question (source)
2013-06-17 21:57:15 +0200 received badge  Student (source)
2013-06-17 15:46:01 +0200 asked a question How to use algorithm='mathematica free' to calculate definite integral?

Is it possible to use algorithm='mathematica free' to calculate definite integral ?

integrate(x^2,x,algorithm='mathematica_free')

Output:

1/3*x^3

and

integrate(x^2,x,0,1,algorithm='mathematica_free')

Output:

1/3*x^3

but I want 1/3

2013-06-17 13:42:05 +0200 received badge  Editor (source)
2013-06-17 13:39:21 +0200 asked a question integrate cos(x)*cos(2x)*...*cos(mx) via SAGE

I'm going to find $I_m=\int_0^{2\pi} \prod_{k=1}^m cos(kx){}dx$, where $m=1,2,3\ldots$

Simple SAGE code:

x=var('x')
f = lambda m,x : prod([cos(k*x) for k in range(1,m+1)])
for m in range(1,15+1):
    print m, numerical_integral(f(m,x), 0, 2*pi)[0],integrate(f(m,x),x,0,2*pi).n()

Output:

1 -1.47676658757e-16 0.000000000000000
2 -5.27735962315e-16 0.000000000000000
3 1.57079632679 1.57079632679490
4 0.785398163397 0.785398163397448
5 -2.60536121164e-16 0.000000000000000
6 -1.81559273097e-16 0.000000000000000
7 0.392699081699 0.392699081698724
8 0.343611696486 0.147262155637022
9 -1.72448482421e-16 0.294524311274043
10 -1.8747663502e-16 0.196349540849362
11 0.214757310304 0.312932080728671
12 0.190213617698 0.177941771394734
13 -1.30355375996e-16 0.208621387152447
14 -1.25168280013e-16 0.0859029241215959
15 0.138441766107 0.134223318939994

As you can see numerical answer is right, but result of integrate(...) is right for $m=1,2,\ldots,7$ and then there is some bug. We can print indefinite integral:

for m in range(7,11+1):
    print 'm=',m
    print 'Indef_I_m=',integrate(f(m,x),x)

And Output:

m = 7
Indef_I_m = 1/16*x + 1/16*sin(2*x) + 1/32*sin(4*x) + 7/384*sin(6*x) +
7/512*sin(8*x) + 3/320*sin(10*x) + 5/768*sin(12*x) + 5/896*sin(14*x) +
1/256*sin(16*x) + 1/384*sin(18*x) + 1/640*sin(20*x) + 1/704*sin(22*x) +
1/1536*sin(24*x) + 1/1664*sin(26*x) + 1/1792*sin(28*x)
m = 8
Indef_I_m = 3/128*x + 5/256*sin(2*x) + 1/32*sin(3*x) + 5/512*sin(4*x) +
5/768*sin(6*x) + 1/256*sin(8*x) + 1/256*sin(10*x) + 1/256*sin(12*x) +
1/256*sin(14*x) + 1/256*sin(16*x) + 7/2304*sin(18*x) + 3/1280*sin(20*x)
+ 5/2816*sin(22*x) + 1/768*sin(24*x) + 3/3328*sin(26*x) +
1/1792*sin(28*x) + 1/1920*sin(30*x) + 1/4096*sin(32*x) +
1/4352*sin(34*x) + 1/4608*sin(36*x) + 3/32*sin(x)
m = 9
Indef_I_m = 3/64*x + 3/128*sin(2*x) + 23/768*sin(3*x) + 3/256*sin(4*x) +
3/640*sin(5*x) + 1/128*sin(6*x) + 5/1792*sin(7*x) + 5/2304*sin(9*x) +
3/2816*sin(11*x) + 1/832*sin(13*x) + 1/1280*sin(15*x) + 3/4352*sin(17*x)
+ 5/4864*sin(19*x) + 1/1344*sin(21*x) + 3/2944*sin(23*x) +
7/6400*sin(25*x) + 1/1152*sin(27*x) + 3/3712*sin(29*x) +
5/7936*sin(31*x) + 1/2112*sin(33*x) + 3/8960*sin(35*x) +
1/4736*sin(37*x) + 1/4992*sin(39*x) + 1/10496*sin(41*x) +
1/11008*sin ...
(more)
2011-11-14 09:12:00 +0200 received badge  Supporter (source)