Why this
d2bdy2 = b_i.diff(y_i, 2)exec("pprint({{'{0}': {0}}})".format("d2bdy2"))
is not equivalent to
def assign_and_pprint(Name, Expr):
exec("{Name} = {Expr}".format(Name=Name, Expr=Expr))
exec("pprint({{'{Name}': {Name}}})".format(Name=Name))
assign_and_pprint("d2bdy2", b_i.diff(y_i, 2))
Compelete example:
#!/usr/bin/python2.7
from sympy import *
def assign_and_pprint(Name, Expr):
exec("{Name} = {Expr}".format(Name=Name, Expr=Expr))
exec("pprint({{'{Name}': {Name}}})".format(Name=Name))
var("""b_i y_i nu""", positive=True)
b_i = 2**(S(2)/3) / (nu**(S(4)/3) * (y_i - 1)**(S(8)/3))
d2bdy2 = b_i.diff(y_i, 2)exec("pprint({{'{0}': {0}}})".format("d2bdy2"))
assign_and_pprint("d2bdy2", b_i.diff(y_i, 2))
Which gives:
⎧ 2/3 ⎫
⎪ 88⋅2 ⎪
⎨d2bdy2: ───────────────────⎬
⎪ 4/3 14/3⎪
⎩ 9⋅ν ⋅(yᵢ - 1) ⎭
⎧ -1.33333333333333 -4.66666666666667⎫
⎨d2bdy2: 15.5212547303557⋅ν ⋅(yᵢ - 1) ⎬
⎩ ⎭
--
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.
For more options, visit https://groups.google.com/groups/opt_out.