On Mon, Jul 27, 2015 at 1:09 AM, sairam <sairam.tatiko...@gmail.com> wrote:

> Thank you very much for the reply.  In the integration specified, f is a
> function of y
>
> When I use the following as suggested by you,
>
> x, y, a= var('x,y,a')
> f = function("f", y)
> integrate(integrate((diff(f,y))*(exp(-a*x^2)*cos(y)^2*sin(x)^3), x, 0,
> pi), y, -pi, pi)
>
> Sagemath is dumping  an error. I would appreciate if you can helping me
> sorting out the problem in evaluating the integral.
>
>
A simpler way to get this error (since your double integral is obviously a
product of 2 integrals) is below. I don't understand this error either.

sage: f = function("f", x)
sage: integrate(diff(f,x)*cos(x)^2, x, -pi, pi)
#0:
signum_int(q=cos(2*_SAGE_VAR_x)*'diff('realpart(f(_SAGE_VAR_x)),_SAGE_VAR_x,1)+sin(2*_SAGE_VAR_x)*'diff('imagpart...,x=_SAGE_VAR_x)
#1:
extra_integrate(q=cos(2*_SAGE_VAR_x)*'diff('realpart(f(_SAGE_VAR_x)),_SAGE_VAR_x,1)+sin(2*_SAGE_VAR_x)*'diff('imagpart...,x=_SAGE_VAR_x)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-17-9166435d0d62> in <module>()
----> 1 integrate(diff(f,x)*cos(x)**Integer(2), x, -pi, pi)

/Volumes/Bay3/sagefiles2/sage-6.4.1/local/lib/python2.7/site-packages/sage/misc/functional.pyc
in integral(x, *args, **kwds)
    800     """
    801     if hasattr(x, 'integral'):
--> 802         return x.integral(*args, **kwds)
    803     else:
    804         from sage.symbolic.ring import SR

/Volumes/Bay3/sagefiles2/sage-6.4.1/local/lib/python2.7/site-packages/sage/symbolic/expression.so
in sage.symbolic.expression.Expression.integral
(build/cythonized/sage/symbolic/expression.cpp:50961)()

/Volumes/Bay3/sagefiles2/sage-6.4.1/local/lib/python2.7/site-packages/sage/symbolic/integration/integral.pyc
in integrate(expression, v, a, b, algorithm, hold)
    710         return indefinite_integral(expression, v, hold=hold)
    711     else:
--> 712         return definite_integral(expression, v, a, b, hold=hold)
    713
    714 integral = integrate

/Volumes/Bay3/sagefiles2/sage-6.4.1/local/lib/python2.7/site-packages/sage/symbolic/function.so
in sage.symbolic.function.BuiltinFunction.__call__
(build/cythonized/sage/symbolic/function.cpp:9269)()

/Volumes/Bay3/sagefiles2/sage-6.4.1/local/lib/python2.7/site-packages/sage/symbolic/function.so
in sage.symbolic.function.Function.__call__
(build/cythonized/sage/symbolic/function.cpp:5911)()

/Volumes/Bay3/sagefiles2/sage-6.4.1/local/lib/python2.7/site-packages/sage/symbolic/integration/integral.pyc
in _eval_(self, f, x, a, b)
    173         for integrator in self.integrators:
    174             try:
--> 175                 return integrator(*args)
    176             except NotImplementedError:
    177                 pass

/Volumes/Bay3/sagefiles2/sage-6.4.1/local/lib/python2.7/site-packages/sage/symbolic/integration/external.pyc
in maxima_integrator(expression, v, a, b)
     19         result = maxima.sr_integral(expression,v)
     20     else:
---> 21         result = maxima.sr_integral(expression, v, a, b)
     22     return result._sage_()
     23

/Volumes/Bay3/sagefiles2/sage-6.4.1/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.pyc
in sr_integral(self, *args)
    774         """
    775         try:
--> 776             return
max_to_sr(maxima_eval(([max_integrate],[sr_to_max(SR(a)) for a in args])))
    777         except RuntimeError as error:
    778             s = str(error)

/Volumes/Bay3/sagefiles2/sage-6.4.1/local/lib/python2.7/site-packages/sage/libs/ecl.so
in sage.libs.ecl.EclObject.__call__
(build/cythonized/sage/libs/ecl.c:6877)()

/Volumes/Bay3/sagefiles2/sage-6.4.1/local/lib/python2.7/site-packages/sage/libs/ecl.so
in sage.libs.ecl.ecl_safe_apply (build/cythonized/sage/libs/ecl.c:4734)()

RuntimeError: ECL says: Error executing code in Maxima:

Thank you once again,
>
> Regards,
> sairam
>
> On Sunday, July 26, 2015 at 4:38:59 PM UTC+5:30, David Joyner wrote:
>>
>> In the integrand below, is f simply a function of y or does it also
>> depend on x?
>>
>>
>> On Jul 26, 2015, at 04:25, sairam <sairam.t...@gmail.com> wrote:
>>>
>>>
>>> <https://lh3.googleusercontent.com/-HGLRuiudDNI/VbRfkfqbiNI/AAAAAAAAAFk/gVw9Ejc6pyo/s1600/CodeCogsEqn.gif>
>>>
>>> Hi
>>>
>>> I am new bie to sagemath and trying to find the analytical integration
>>> for the above.
>>>
>>> I have used the following expressions in sagemath
>>>
>>> x, y, a, f = var('x,y,a,f')
>>>
>>>
>>
>> f = function("f", x)
>> or
>> f = function("f",x,y)
>>
>> integrate(integrate((diff(f))*(exp(-a*x^2)*cos(y)^2*sin(x)^3), x, 0, pi),
>>> y, -pi, pi)
>>>
>>>
>> In the first case, you want
>>
>>
>> x, y, a= var('x,y,a')
>> f = function("f", x)
>> integrate(integrate((diff(f,x))*(exp(-a*x^2)*cos(y)^2*sin(x)^3), x, 0,
>> pi), y, -pi, pi)
>>
>> which will give you the partially evaluated integral.
>>
>> The sagemath tutorials have more examples.
>> http://doc.sagemath.org/html/en/tutorial/index.html
>>
>>
>>
>>
>>> Though it gives output for the above expression, it does not consider
>>> the term differential of f,  can you please let me know how to include the
>>> differential in the integration.
>>>
>>> If I use the following, which includes differential with respect to y,
>>> it does not run but dumps an error
>>>
>>> integrate(integrate((diff(f), y)*(exp(-a*x^2)*cos(y)^2*sin(x)^3), x, 0,
>>> pi), y, -pi, pi)
>>>
>>> Any help for  solving the above integration will be highly appreciated.
>>>
>>> Thanks in advance,
>>>
>>> Regards,
>>> sairam
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to