plot_implicit also has issues at that point (see attached file).  There is
some kind of singularity there.

[image: Inline image 1]
Aaron Meurer


On Tue, Apr 30, 2013 at 3:29 AM, Stefan Krastanov <
[email protected]> wrote:

> Probably your tolerance is too high.
>
> In any case, this is already implemented:
> http://docs.sympy.org/0.7.2/modules/plotting.html#sympy.plotting.plot_implicit.plot_implicit
>
>
> On 30 April 2013 11:23, Pushpak Dagade <[email protected]> wrote:
>
>> I am trying to create a simple 2d plot by solving a equation in x and y,
>> for given y.
>> I am using sympy.mpmath.findroot to solve the equation. It solves it
>> correctly for all 'y' points, except for a few ones, where the 'x' I get on
>> solving starts diverging (giving no solution if I take points even more
>> finely). I have also attached the associated plot. What I expect is a
>> simple quadratic plot, for all 'y' points (from 0 to ).
>>
>> This is the code -
>>
>> #################################################################
>>
>> from numpy import arange
>>
>> from sympy import *
>>
>> import matplotlib.pyplot as plt
>>
>>
>> p,q,r = -0.000116108381457823, 0.180075602770215, 12.0188009030456
>>
>>
>> Y_ = arange(0,1,0.01)
>>
>> X = []
>>
>> Y = []
>>
>>
>> x = symbols('x')
>>
>>
>> for y in Y_:
>>
>> def f1(x):
>>
>> y0 = ( -(x - y/2 + q/2 - p) + sqrt((x - y/2 + q/2 - p)**2 - \
>>
>> 4.60844*(p*y-x*q)*(y-q)) )/(2.30422*(y-q))
>>
>> return (y0 - y)
>>
>>
>>  try:
>>
>> X.append(mpmath.findroot(f1, 0, verbose=False, tol=1e-3, verify=True))
>>
>> Y.append(y)
>>
>> except ValueError:
>>
>> print '.',
>>
>>
>> plt.plot(X, Y)
>>
>> plt.show()
>>
>> #################################################################
>>
>>
>> <https://lh4.googleusercontent.com/-nJYWoNYqwpM/UX-NBTejvgI/AAAAAAAADEA/s-JJjlsMHTE/s1600/sympy_mpmath_findroot.png>
>>
>>
>> Kindly help me finding what is wrong here. (Note, I need to get 10 such
>> plots).
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sympy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/sympy?hl=en-US.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


<<image.png>>

Reply via email to