[SciPy-User] Integration of double integral with integration variable as

Torsten Andre qa@takb....
Fri Jan 15 02:19:33 CST 2010


Jose,
I thank you very much for your help. Well, my example is easy to solve,
indeed. Though this was only an example.

But the trick with the functions does it. Something one could have
figured out...

You bet it helped ;)
Torsten

Jose Amoreira wrote:
> Torsten, 
> Your example is easy!
> Since sin(y) is an odd function, integrating over [-x,x] gives zero and that's 
> it. For a more illustrative example, replace sin with cos (still easy enough 
> to do it quicker analytically). Using scipy.integrate.quad, you do it like 
> this (excerpt from an idle session):
>>>> def g(x):
> 	return quad(cos,-x,x)[0]
> 
>>>> quad(g,0.,1.)[0]
> 0.91939538826372047
> 
> The reason I take the zero-th element of the quad output is that the remaining 
> is an estimate of the error.
> Maybe you should also look into scipy.integrate.dblquad.
> Hope this helps.
> jose
> 
> On Thursday 14 January 2010 09:23:28 am Torsten Andre wrote:
>> Hey everyone,
>>
>> I am new to SciPy, but need to integrate something like this, where the
>> boundaries of the inner integral are terms of outer variable's
>> integration variable:
>>
>> \int{\int{sin(y)dy}_{-x}^{+x}dx}_0^1
>>
>> Is this feasible in SciPy? I tried using quad but it only complains that
>>  x is not defined. Unfortunately I was unable to find anything on the
>> list or in the documentation.
>>
>> Thanks for your time.
>>
>> Cheers,
>> Torsten
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user



More information about the SciPy-User mailing list