Dt[x y, Constants ->{x}] in Mma 2.0
- To: mathgroup at yoda.physics.unc.edu
- Subject: Dt[x y, Constants ->{x}] in Mma 2.0
- From: pwm at macaw.jhuapl.edu (Phil W. Miller x8335 1-e138)
- Date: Tue, 4 Feb 92 12:52:08 EST
I am just learning Mma (2.0 for DOS) and I have questions regarding the
following Mma session.
In[1]:= Dt[x y , Constants -> {x}]
Out[1]= x Dt[y, Constants -> {x}]
Why don't I get x Dt[y] as stated on page 783 in the Mma book? How can I make
Dt[y, Constants -> {x}] give me Dt[y]? I talked with the Tech support at WRI
and they suggested manipulating the fullform of z by using
z = Dt[x y, Constants -> {x}]
z = z[[1]] Drop[z[[2]],-1] which will drop the rule from the fullform of z.
But a different syntax in required for
z = Dt[{x y, x y^2}, Constants ->{x}] because the fullform of z has two levels.
Does someone have suggestions for a general method for removing the
Constants -> {x} from the output of Dt? (Giving x the attribute of constant
is not what I what because x is allowed to vary, but as far as the derivative
is concerned it is constant. This discussion is motivated by the need to
compute dr at a fixed time for Lagrange's equations.)
Any help would be greatly appreciated.
Phil Miller
pwm at macaw.jhuapl.edu
The Johns Hopkins University/Applied Physics Laboratory
Johns Hopkins Rd.
Laurel, MD 20723-6099
(301) 953-5000 x8335
-----------------------
P.S. The following are items that took a great deal of time for me to discover
on my own and thought I would include them hoping to save someone else the
same struggle.
In[2]:= Sin[theta - phi]
Out[2]= -Sin[phi - theta]
If I set $StringOrder={"theta","phi"} then Sin[theta - phi] is unchanged.
******
I set WRI a question asking how one finds out what variable names have been
used during a Mma session. What I wanted was similar to the Matlab who
command. I also created the whos function that lists the variables that
are used by the supplied context. I found that the following works.
Is there a better way to do this?
who := ToExpression["?Global`*"]
whos[context_] := ToExpression["?"<>context<>"*"]