# How do I define an existing equation as a variable in wxMaxima?

This is hard to explain in words, so I will show an image below of what I mean.

Let's say I enter an equation like in %i1, and then solve it to get the answer in %o2. How do I take the output from %o2 and use it to define I1 as it is shown on line %o2? On my HP50G calculator, I simply hit "define" and it gets stored.

So far the only way I found of doing it is to copy the equation, then replace the "=" with a ":". Is there some better way without disrupting the work-flow like this?

Since I'm a new user I'm not allowed to post images. Please see here: wxMaxima problem

-

The output of "solve" is a list containing the solutions, so you have to use "first" to extract the first element of that list. In your example, that first element is an expression of the form I1=Vin/((B+1)*ZL, and you want the right hand member of that expression; that can be obtained through the command "rhs". Lastly, you must use "define" for this task (defining a function). I think the sintaxis is now clear:

I1+B*I1-Vin/ZL=0;

solve(%,I1);

/* Here we define I1 as a function of the three variables, but you can hold any of them fixed, writing for example I1(Vin) if only the dependence on Vin is relevant */

define(I1(Vin,B,ZL),rhs(first(%)));

/* A little check */

I1(1,B,ZL);

-