On Tuesday, January 10, 2012 2:14:50 PM UTC+1, Stefan Krastanov wrote:
>
>
>
> On 10 January 2012 12:56, Olivier Grisel <[email protected]> wrote:
>
>> Thank you very much it indeed works with "mpmath" in lambdify. However my 
>> final goal would be to actually use numpy to evaluate that value (as a 
>> function of n and d) in another program that has no dependency on sympy nor 
>> mpmath.
>>
>> Do you think there is a way to make sympy refactor the expression so that 
>> the naive numpy translation would be more stable, especially for the range 
>> of d and n is such that the solution has an imaginary part close to or 
>> exactly zero?
>>
> I don't think it can be done automatically by sympy. But there are many 
> functions that rewrite expressions. I know too little about them to tell 
> but maybe some of them will help. Hopefully someone on the group will know 
> a better way to do it.  
>

I might be able to come up with something that has no dependency on any 
external library by extracting the real and imaginary parts of the root 
separately using sympy.re / sympy.im and then translate them to a pair of 
python expressions that use http://docs.python.org/library/decimal.html for 
arbitrary precision floats.

Thanks for your help, I will let you know when I'll have time to carry on 
with that experiment.

-- 
Olivier

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sympy/-/KW1YL0wGJa0J.
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