Question: How do I simplify the representation/output of code when using the := operator?

I want to substitute a variable r' =sqrt(x^2 + y^2 + z^2).

But how do I change my output so that r' is displayed instead of sqrt(x^2+y^2+z^2)?

E.g. line (5) D(g)(r')x/r' and not D(g)(sqrt(x^2 + y^2 + z^2))*/sqrt(x^2 + y^2 + z^2). 

And one more question. How can I make sure that my output in (6) is only the result on the right side and the left side of the equal sign is not displayed? 


 

restart

with(Physics)

__________________________________________________________________

(1)

with(Vectors)``

Setup(spacetimeindices = greek, spaceindices = lowercaselatin, su2indices = uppercaselatin, signature = `- - - +`, coordinates = cartesian)

[coordinatesystems = {X}, signature = `- - - +`, spaceindices = lowercaselatin, spacetimeindices = greek, su2indices = uppercaselatin]

(2)

diff(r(x), x) := sqrt(x^2+y^2+z^2)

(x^2+y^2+z^2)^(1/2)

(3)

``

g(diff(r(x), x))

g((x^2+y^2+z^2)^(1/2))

(4)

diff(g(diff(r(x), x)), x)

(D(g))((x^2+y^2+z^2)^(1/2))*x/(x^2+y^2+z^2)^(1/2)

(5)

NULL

NULL

H := (x*Psigma[1, matrix]+y*Psigma[2, matrix]+z*Psigma[3, matrix]).Vector(2, {1 = 0, 2 = U(diff(r(x), x))})

(x*Physics:-Psigma[1]+y*Physics:-Psigma[2]+z*Physics:-Psigma[3]).Vector[column](%id = 36893490180036880732) = Vector[column](%id = 36893490180036881092)

(6)

NULL


 

Download representation_of_code.mw

Please Wait...