HI,
I'm trying to write a program that converts electromagnetic equations from
CGS to MKS units. I've run into the following issues:
(1) I have expressions like curl*H - c^(-1)*d_t*D, where curl and d_t
express derivatives. In the process of conversion, sage switches the order
and outputs:
H*curl - D*d_t/c
I thought of defining a free algebra over a symbolic ring, but this turns
out to have problems. Apparently expand and simplify are not defined for
expressions in a free algebra. Sage chokes on the following code.
var('c, pi, c, mu_0,epsilon_0')
F.<curl,H,d_t,D,J> = FreeAlgebra(SR,5,'curl,H,d_t,D,J')
eqCGS = curl*H - c^(-1)*d_t*D
### CGS expression on this line ###
eq = eqCGS * (1/2)*mu_0^(-1/2)*pi^(-1/2)
### Multiplicative factor on this line ###
assume(c>0,mu_0>0,epsilon_0>0)
eq = eq.subs({c == mu_0^(-1/2)*epsilon_0^(-1/2)})
eq = eq.subs({H:2*H})
eq = eq.subs({D : 2*pi^(1/2)*epsilon_0^(-1/2)*D})
eq = eq.subs({J : (1/2)*pi^(-1/2)*epsilon_0^(-1/2)*J})
eq = eq.expand()
eq = eq.simplify()
show('Original~(CGS)~version')
show(eqCGS)
show('MKS~version')
show(eq)
Furthermore, the code does not substitute for c.
Any guidance would be appreciated
--
You received this message because you are subscribed to the Google Groups
"sage-support" 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/sage-support.
For more options, visit https://groups.google.com/d/optout.