Aaron

Thanks for the tips.

Where are the "issues" located?

I am numerically evaluating x*cos(x)/sin(x) on [-pi/2,pi/2] and the
spurious singularity at x= 0 is giving me grief. x/sin(x)=1 at x=0.

After looking at my problem it seems that I should have asked if there
is and efficient way to embed sin(x)/x or x/sin(x) in a function that
is evaluated at 0. I will probably use a 7th order Taylor series
unless there another clever option.

The series for x/sin(x) has much better convergence than the series
for x*cot(x) in my range of interest (+- pi/2).

In [41]: (x/sin(x)).series(x, 0, 8)
Out[41]: 1 + x**2/6 + 7*x**4/360 + 31*x**6/15120 + O(x**7)



On Jun 2, 12:41 pm, "Aaron S. Meurer" <[email protected]> wrote:
> On Jun 2, 2010, at 9:12 AM, Scott wrote:
>
> > What is the best way to evaluate x * cot(x) evaluated for x=0-pi/2
> > with sympy?
>
> I am not too sure what you mean by 0-pi/2, but you could try limit():
>
> In [3]: limit(x*cot(x), x, 0)
> Out[3]: 1
>
> In [4]: limit(x*cot(x), x, pi/2)
> Out[4]: 0
>
>
>
> > Is there a  better option than coding the Taylor series approximation?
>
> You wouldn't need to code the taylor series, it already is implemented:
>
> In [7]: print (x*cot(x)).series(x)
> 1 - x**2/3 - x**4/45 - 2*x**6/945 + O(x**7)
>
>
>
> > Also with the sympy that shipped  with Ubuntu 10.04 sympy.cot(0) is 0
> > rather than infinity.
>
> This is a bug that still exists in master.  Could you report it in the issues?
>
> Aaron Meurer
>
>
>
> > V/R
>
> > Scott
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "sympy" group.
> > 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 
> > athttp://groups.google.com/group/sympy?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
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/sympy?hl=en.

Reply via email to