On 4/7/07, microdev <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> 1- show (integrate(sin(x)^2,x,0,pi)) -> ok =pi/2

First, I cannot reproduce this. I'm using version 2.4 and the
command line, which may explain the difference. In any case,
Your first command is essentially

sage: maxima('sin(x)^2').integrate("x",0,pi)
%pi/2

but then maybe fed through some latex/jmath parser.


>
> 2-show (integrate(sqrt(sin(x)^2),x,0,pi))


This is a Maxima isse. Maxima will not integral |sin(x)| symbolically.
You may want nintegral:

sage: maxima('sin(x)^2').nintegral("x",0,pi)
(1.570796326794897, 1.743934249004316E-14, 21, 0)
sage: maxima('sqrt(sin(x)^2)').nintegral("x",0,pi)
(2.0, 2.220446049250314E-14, 21, 0)
sage: maxima('sin(x)').integral("x",0,pi)
2

The output of nintegral is a 4-tuple" the answer is first, the
error is second, the number of steps is 3rd, and the "error code"
(whatever that is) is the 4th component.


>
> Error:
>
> Exception (click to the left for traceback):
> ...
> TypeError: Unable to convert x (='x') to real number.
> Traceback (most recent call last):
>   File "", line 1, in
>   File "/home/notebook/sage_notebook/worksheets/_scratch_/code/57.py",
> line 4, in
>     show (integrate(sqrt(sin(x)**Integer(2)),x,Integer(0),pi))
>   File "/home/notebook/sage_notebook/worksheets/_scratch_/", line 1,
> in
>
>   File "/usr/local/sage/local/lib/python2.5/site-packages/sage/misc/
> functional.py", line 827, in sqrt
>     except (AttributeError, ValueError): return CDF(x).sqrt()
>   File "complex_double.pyx", line 227, in
> complex_double.ComplexDoubleField_class.__call__
>   File "complex_double.pyx", line 336, in
> complex_double.ComplexDoubleElement.__init__
>   File "/usr/local/sage/local/lib/python2.5/site-packages/sage/
> functions/functions.py", line 237, in __float__
>     return float(self._mpfr_(RR))
>   File "/usr/local/sage/local/lib/python2.5/site-packages/sage/
> functions/functions.py", line 481, in _mpfr_
>     return self.__op(self.__x._mpfr_(R), self.__y._mpfr_(R))
>   File "/usr/local/sage/local/lib/python2.5/site-packages/sage/
> functions/functions.py", line 308, in _mpfr_
>     return self.__f(self.__g._mpfr_(R))
>   File "/usr/local/sage/local/lib/python2.5/site-packages/sage/
> functions/functions.py", line 520, in _mpfr_
>     return R(self.__x)
>   File "real_mpfr.pyx", line 225, in real_mpfr.RealField.__call__
>   File "real_mpfr.pyx", line 580, in real_mpfr.RealNumber._set
> TypeError: Unable to convert x (='x') to real number.
>
> What is wrong?
>
> Félix
> Ps : sorry for this trivial question but I ' am a beginner  
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to