sympy

Ned Batchelder ned at nedbatchelder.com
Wed Mar 30 07:39:10 EDT 2016


On Wednesday, March 30, 2016 at 7:17:33 AM UTC-4, Poul Riis wrote:
> Is it possible to transfer results from sympy to 'normal' python.

Poul, welcome to the group.

> In the case below I think my intention is clear enough but it does not work as intended. How can it be done?
> 
> from sympy import *
> x=Symbol('x')
> ftext=diff(1/(x**2+1),x)
> 
> def f(t):
>     return ftext.subs(x,'t')
> 
> print(f(3))

You'd be surprised how hard it is to understand what someone else thinks
a small chunk of code should do. :)

Even if we can work out what this was meant to do, it will be easier to help
if you are explicit about the outcome you are getting, and how that differs
from the outcome you want.

--Ned.



More information about the Python-list mailing list