[sympy] Re: NameError with nsolve

2009-08-18 Thread Vinzent Steinberg
On Aug 17, 10:43 am, New2Sympy wrote: > I looked at the all_coeffs() option > before, but could get it to work, probably because of the data types > you explain. It should be fixed in current sympy HEAD. Vinzent --~--~-~--~~~---~--~~ You received this message bec

[sympy] Re: NameError with nsolve

2009-08-17 Thread New2Sympy
Thanks! This puts me on the road again :) That is a great tutorial... I looked at the all_coeffs() option before, but could get it to work, probably because of the data types you explain. I guess it's time that I take a look at the numerical methods courses from my college years. Thanks. Regar

[sympy] Re: NameError with nsolve

2009-08-15 Thread smichr
> > Second Variant (using Poly) kind of works, but there is a small fix > > required. "mypoly.coeffs" ommits the zeros, therefore if the > > coefficients for x^0, x^1 and x^3 are 0, they would not appear. Is > > this a bug or a feature? [cut] > Now there must be a better way to do this [...to get

[sympy] Re: NameError with nsolve

2009-08-15 Thread smichr
On Aug 14, 3:37 pm, New2Sympy wrote: > Hi again, > > I am getting confused now. See the script and the results below. > You are running into numerical issues (underflow, I belileve) because of scaling issues. If you don't normalize your polynomial then the the coefficients of the polynomial are

[sympy] Re: NameError with nsolve

2009-08-14 Thread New2Sympy
Hi again, I am getting confused now. See the script and the results below. First Variant (using nsolve) finds some extra solutions, that probably would be gone changed the tolerance, but using the option tol=1e-25 crashes, in fact, I could not go beyond tol=1e-21. Second Variant (using Poly) ki

[sympy] Re: NameError with nsolve

2009-08-12 Thread smichr
On Aug 12, 4:48 pm, Anartz Unamuno wrote: > Below is the outcome I get when I use myEqConstants.n(100): > > third variant: > [-0.192261149873352 + .0e-21⋅ⅈ, -29.4436689512432 + .0e-19⋅ⅈ, > 27.1235615040264 - .0e-19⋅ⅈ, 0, 0.192368597090154 - .0e-21 > ⋅ⅈ] > > the imaginary parts are zeros, but th

[sympy] Re: NameError with nsolve

2009-08-12 Thread Anartz Unamuno
Below is the outcome I get when I use myEqConstants.n(100): third variant: [-0.192261149873352 + .0e-21⋅ⅈ, -29.4436689512432 + .0e-19⋅ⅈ, 27.1235615040264 - .0e-19⋅ⅈ, 0, 0.192368597090154 - .0e-21 ⋅ⅈ] the imaginary parts are zeros, but they are still in the solution. Should they not disappear? Th

[sympy] Re: NameError with nsolve

2009-08-12 Thread Fredrik Johansson
On Tue, Aug 11, 2009 at 10:58 PM, Vinzent Steinberg wrote: > > # mpmath has a solver for polynomials, but we have to convert it to a > list of > # coefficients (please not that the results are not very accurate, you > can refine > # them using an iterative solver) polyroots should give full accur

[sympy] Re: NameError with nsolve

2009-08-12 Thread New2Sympy
I did use the nsolve before (that was the topic of my first post :)), but I need to find all the solutions in a range, and solutions can be very close to each other depending on the constants. I am trying to optimize a problem, so I would like to check the final outcome for all valid solutions. I

[sympy] Re: NameError with nsolve

2009-08-11 Thread Vinzent Steinberg
There are three variants to solve this using sympy, and you chose the slowest one. ;) Why do you want to solve it symbolically? It's a polynomial of 6th degree, so there are probably very complex symbolic solution, if any. The best way to get the solutions is using mpmath.polyroots, see [1]. Ju

[sympy] Re: NameError with nsolve

2009-08-11 Thread New2Sympy
I think I am in agreement with Vinzent, this would probably solve the issue I am having now... I am trying to obtain the solutions using the linex below. When I solve for the constants assigned to the variables, I get complex solutions with very small imaginary components, that should be real sol

[sympy] Re: NameError with nsolve

2009-08-06 Thread Vinzent Steinberg
On 6 Aug., 19:57, smichr wrote: > On Aug 5, 9:29 pm, Vinzent Steinberg > > wrote: > > On Aug 2, 12:14 am, smichr wrote: > > > > >>> num,den = (1/(.001+a)**3-6/(.9-a)**3).as_numer_denom() > > > >>> nsolve(num,a,.3) # no need for sympy now > > > Maybe solve()/nsolve() should do this for you. What

[sympy] Re: NameError with nsolve

2009-08-06 Thread smichr
On Aug 5, 9:29 pm, Vinzent Steinberg wrote: > On Aug 2, 12:14 am, smichr wrote: > > > >>> num,den = (1/(.001+a)**3-6/(.9-a)**3).as_numer_denom() > > >>> nsolve(num,a,.3) # no need for sympy now > > Maybe solve()/nsolve() should do this for you. What do you think? > > Vinzent I was thinking th

[sympy] Re: NameError with nsolve

2009-08-05 Thread Vinzent Steinberg
On Aug 2, 12:14 am, smichr wrote: > >>> num,den = (1/(.001+a)**3-6/(.9-a)**3).as_numer_denom() > >>> nsolve(num,a,.3) # no need for sympy now Maybe solve()/nsolve() should do this for you. What do you think? Vinzent --~--~-~--~~~---~--~~ You received this message

[sympy] Re: NameError with nsolve

2009-08-03 Thread Ondrej Certik
On Mon, Aug 3, 2009 at 5:55 AM, smichr wrote: > > > > On Aug 3, 1:25 pm, New2Sympy wrote: >> Thanks for your help! that was a complete answer :) >> > > ...I could set my verbose flag to False :-)  But sometimes these > questions are good opportunities for learning, too. It's something > that I've

[sympy] Re: NameError with nsolve

2009-08-03 Thread smichr
On Aug 3, 1:25 pm, New2Sympy wrote: > Thanks for your help! that was a complete answer :) > ...I could set my verbose flag to False :-) But sometimes these questions are good opportunities for learning, too. It's something that I've appreciated about responses on the python tutor list. /c --

[sympy] Re: NameError with nsolve

2009-08-03 Thread New2Sympy
Thanks for your help! that was a complete answer :) Best regards. On Aug 2, 12:14 am, smichr wrote: > On Jul 31, 7:08 pm, New2Sympy wrote: > > > Hi All, > > > I am trying to get the Real root as shown below and keep getting a > > NameError. Any suggestions? > > [cut] > > NameError: global name

[sympy] Re: NameError with nsolve

2009-08-01 Thread smichr
On Jul 31, 7:08 pm, New2Sympy wrote: > Hi All, > > I am trying to get the Real root as shown below and keep getting a > NameError. Any suggestions? > [cut] > NameError: global name 'conjugate' is not defined > When you ask for a numerical solution, the first thing that nsolve does is evaluate