How can I make this type of substitution in maple?

497 Views Asked by At

I have tried using subs but it is not working for what I am trying to do.

I have

r2 := (n_x^2+n_y^2-1);

and I want this expression:

E:=hbar*Pi/(2*M*A)*(n_x^2/L+n_y^2/L);

to put r2 in so I can solve for r2 (using maple). Does anyone know what the command is to do this? I cannot seem to articulate what I want well enough to bring it up in the help search!

1

There are 1 best solutions below

3
On BEST ANSWER

By assigning a value to r2 you made it (nearly) impossible to evaluate any expression and see an r2 in it. Get rid of that assignment:

> r2:= 'r2':

Now subs won't work because the expression you want to be r2 doesn't appear as an operand in E. However, you can use

> simplify(E, {n_x^2+n_y^2-1 = r2});

$${\frac {{\it hbar}\,\pi \,{\it r2}}{2\,MAL}}+{\frac {{\it hbar} \,\pi }{2\,MAL}} $$

or

> algsubs(n_x^2+n_y^2-1 = r2, E);

$$ \frac{{\it hbar}\, \pi ({\it r2}+1)}{2\, MAL}$$