Aaron S. Meurer wrote:
I think the problem is that you use f.diff(tau) instead of f(tau).diff(tau).
The first evaluates to 0, because it doesn't know that f depends on tau.
Aaron Meurer
On Apr 25, 2010, at 6:02 PM, Alan Bromborsky wrote:
Here is code -
dRdtau = R.diff(tau)
print 'e_tau =',dRdtau
dRdtau_sq = (dRdtau|dRdtau)()
print 'e_tau^2 =',dRdtau_sq
dRdtau_sq = trigsimp(simplify(dRdtau_sq))
print 'e_tau^2 =',dRdtau_sq
dRdtau_sq.subs((g.diff(tau))**2-(f.diff(tau))**2,1)
print 'e_tau^2 =',dRdtau_sq
Here is output -
e_tau =
D(g(tau),tau)*e0+(D(f(tau),tau)*cos(th(tau,xth))-D(th(tau,xth),tau)*f(tau)*sin(th(tau,xth)))*e1+(D(f(tau),tau)*sin(th(tau,xth))+D(th(tau,xth),tau)*cos(th(tau,xth))*f(tau))*e2
e_tau^2 = D(g(tau), tau)**2 - (D(f(tau), tau)*cos(th(tau, xth)) - D(th(tau,
xth), tau)*f(tau)*sin(th(tau, xth)))**2 - (D(f(tau), tau)*sin(th(tau, xth)) +
D(th(tau, xth), tau)*cos(th(tau, xth))*f(tau))**2
e_tau^2 = D(g(tau), tau)**2 - D(f(tau), tau)**2 - D(th(tau, xth),
tau)**2*f(tau)**2
e_tau^2 = D(g(tau), tau)**2 - D(f(tau), tau)**2 - D(th(tau, xth),
tau)**2*f(tau)**2
A constraint is that -
D(g(tau), tau)**2 - D(f(tau), tau)**2 = 1
My use of subs does not do that. How can I make such a substitution?
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
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.
Revised code -
dRdtau_sq.subs((diff(g(tau),tau))**2-(diff(f(tau),tau))**2,1)
Result -
dRdtau_sq.subs((diff(g(tau),tau))**2-(diff(f(tau),tau))**2,1)
File
"/usr/local/lib/python2.6/dist-packages/sympy-0.6.7_git-py2.6.egg/sympy/core/basic.py",
line 1309, in __call__
raise TypeError("argument must be a dictionary")
TypeError: argument must be a dictionary
Revised code again -
dRdtau_sq.subs({(diff(g(tau),tau))**2-(diff(f(tau),tau))**2:1})
Result -
dRdtau_sq.subs({(diff(g(tau),tau))**2-(diff(f(tau),tau))**2:1})
File
"/usr/local/lib/python2.6/dist-packages/sympy-0.6.7_git-py2.6.egg/sympy/core/basic.py",
line 1309, in __call__
raise TypeError("argument must be a dictionary")
TypeError: argument must be a dictionary
More suggestions please.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
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.