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:


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!

  • $\begingroup$ Why don't you do it by hand? Clearly, (n_x^2/L+n_y^2/L) is equal to (r2+1)/L. Hence, you can set E:=hbar*Pi/(2*M*A)*(r2+1)/L; and solve whatever you want with that. $\endgroup$ – user53153 Mar 6 '13 at 3:25
  • $\begingroup$ because I know how to do it by hand already @5pm $\endgroup$ – Magpie Mar 6 '13 at 3:25
  • $\begingroup$ Then it's not really a mathematical question, is it? It should not be asked at Math.SE. // Anyway, you can include the information about r2 as additional equation in the system you are solving: solve([hbar*Pi/(2*M*A)*(n_x^2/L+n_y^2/L)=42, r2=(n_x^2+n_y^2-1)], [r2, A, M]); $\endgroup$ – user53153 Mar 6 '13 at 3:26
  • $\begingroup$ While there is no SE for mathematical computing it is fine for math SE, don't you think? $\endgroup$ – Magpie Mar 6 '13 at 3:46
  • $\begingroup$ I don't. The fact that you can't find a better place to ask a question does not mean it's fine to ask it here. $\endgroup$ – user53153 Mar 6 '13 at 3:52

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}} $$


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

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

  • $\begingroup$ The only problem with that is I can't then solve for r2 and this is my motivation for subbing it in. $\endgroup$ – Magpie Mar 6 '13 at 3:44
  • $\begingroup$ Solving for r2 doesn't mean a whole lot when it itself is a relation of two other independent variables, n_x and n_y. The best you will get is a solution manifold, some curve, plane, or other subset of the Cartesian product of n_x and n_y's domains. $\endgroup$ – Emily Mar 6 '13 at 5:11
  • 1
    $\begingroup$ Why not just put in r2 explicitly, solve for it, and then reconcile the issue with n_x and n_y? $\endgroup$ – Emily Mar 6 '13 at 5:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.