Question: How to remove all occurrences of a variable from an expression.


Consider the worksheet below.

restart

with(Physics[Vectors])

`dτ_` := -I*z*dz*B__0*x^2*_j/d^2-I*y*dz*B__0*x^2*_k/d^2

-I*z*dz*B__0*x^2*_j/d^2-I*y*dz*B__0*x^2*_k/d^2

(1)

I want to integrate the above expression. The differential is already present in the expression. Currently, I have to manually remove the differential to use the int procedure as below.

`τ_` := int(-I*z*B__0*x^2*`#mover(mi("j"),mo("∧"))`/d^2-I*y*B__0*x^2*`#mover(mi("k"),mo("∧"))`/d^2, z = l .. -l)

(2*I)*y*B__0*x^2*_k*l/d^2

(2)

Since I want to put this operation inside a procedure, this removal of dz needs to happen programatically.


For even more context, dtau is a differential torque. 

I am integrating these infinitesimal torques.

dtau is calculated based on a magnetic field B.

I would like to have a procedure that accepts a field B and computes the torque integral.

Download RemoveDifferential.mw

Please Wait...