1

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!

Magpie
  • 523
  • 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. –  Mar 06 '13 at 03:25
  • because I know how to do it by hand already @5pm – Magpie Mar 06 '13 at 03:25
  • 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]); –  Mar 06 '13 at 03:26
  • While there is no SE for mathematical computing it is fine for math SE, don't you think? – Magpie Mar 06 '13 at 03:46
  • 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. –  Mar 06 '13 at 03:52
  • It's not a question about how to best keep my laundry colours from dying my lights, it's directly related to mathematics. – Magpie Mar 06 '13 at 03:53
  • @5pm The last time I asked on meta about questions concerning mathematical software here there wasn't a lot of attention. But the answer stated that such questions were welcome. – JSchlather Mar 06 '13 at 06:11

1 Answers1

1

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

Robert Israel
  • 448,999
  • The only problem with that is I can't then solve for r2 and this is my motivation for subbing it in. – Magpie Mar 06 '13 at 03:44
  • 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. – Emily Mar 06 '13 at 05:11
  • 1
    Why not just put in r2 explicitly, solve for it, and then reconcile the issue with n_x and n_y? – Emily Mar 06 '13 at 05:12