Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Try :

sage: var("x, y, r")
(x, y, r)
sage: theta(x,y)=atan2(y,x)
sage: dx=var("dx", latex_name=r"\mathrm{d}\,x")
sage: dy=var("dy", latex_name=r"\mathrm{d}\,y")
sage: foo = vector(map(lambda u,v:u*v, derivative(theta)(x,y).subs(x^2+y^2==r^2), vector([dx, dy]))).subs(x^2+y^2==r^2)

foo should be :

(dxyr2,dyxr2)

and foo.norm() should be

|dyxr2|2+|dxyr2|2

unless you assume rhat all the variable are real, in which case you should get :

sage: with assuming(x,y,dx,dy,r,"real"): foo.norm()
sqrt(dy^2*x^2/r^4 + dx^2*y^2/r^4)

whose Sage's latexing is ... questionable :

dy2x2r4+dx2y2r4

HTH,

click to hide/show revision 2
No.2 Revision

Try :

sage: var("x, y, r")
(x, y, r)
sage: theta(x,y)=atan2(y,x)
sage: dx=var("dx", latex_name=r"\mathrm{d}\,x")
sage: dy=var("dy", latex_name=r"\mathrm{d}\,y")
sage: foo = vector(map(lambda u,v:u*v, derivative(theta)(x,y).subs(x^2+y^2==r^2), vector([dx, dy]))).subs(x^2+y^2==r^2)
dy])))

foo should be :

(dxyr2,dyxr2)

and foo.norm() should be

|dyxr2|2+|dxyr2|2

unless you assume rhat all the variable are real, in which case you should get :

sage: with assuming(x,y,dx,dy,r,"real"): foo.norm()
sqrt(dy^2*x^2/r^4 + dx^2*y^2/r^4)

whose Sage's latexing is ... questionable :

dy2x2r4+dx2y2r4

HTH,