4
$\begingroup$

I am trying to get my calculator to work out how to work out equations that rely on several other equations which I have defined as a variable. For example:

\begin{align}w&=3\\ x&=2y\\ y&=w+2\\ z&=2y+4x\end{align}

In the calculator I have created the variable $3→w$ which sets $w$ as 3. If I type $w$ and hit enter I get $3$. Now to enter the equation for $x$ I have to type:

$$2y→x(w)$$

Now if I want to find $x$ I have to type $x(3)$. I want to be able to just type $x$ and the calculator automatically realises that $x$ is $6$. In this instance it isn't so bad, I just have to type $x(3)$, but it makes the whole process of entering the variable $w$ redundant as I have to enter it in subsequent equations anyway.

When we get to the equation $z$ it gets very messy. I have to enter each variable as a function of such and such. So my question is, how do I get my calculator to save the answer to each variable so it will automatically calculate subsequent equations that use those variables, instead of typing each value for them manually?

$\endgroup$
2
  • $\begingroup$ This seems slightly off-topic here, but I'm not sure on which other site it would be more suitable. $\endgroup$ – TMM Mar 18 '17 at 19:14
  • 1
    $\begingroup$ Wouldn't $x(3)$ give you $10$ since $y=3+2$ and $x=2y$? And maybe this is nitpick, but $3\rightarrow w$ seems to say that three maps to w, when you want to say that w maps to three. $\endgroup$ – Tyberius Mar 18 '17 at 20:54
3
+350
$\begingroup$

This is only possible in a document, not in the calculator application itself.

Create a new document and add the calulator app (press 1).

Now open the menu (menu button) and select "Functions and Programs" (press 9), open the program editor (press 1) and create a new file (press 1).

Name your first function, in your case that would be y. Change the type to "Function" and click OK.

You are now presented with this text

Define y()=

Func

EndFunc

You can now write the function definition between "Func" and "EndFunc" and have it output with the "Return" statement. In your case you would write

Return w+2

Save and check your function with Ctrl+B. You can now use it in your calculator app, which should be empty for now. If you write now y() it will return w+2.

But if you save a value to w, in your case $3→w$, and write y() again, it will return 5.

For x() you can do the same and since you want to use y(), you can define the function like this to access y():

Return 2*y()

Writing x() should now return 10.

As a side note: You have to write the brackets after x and y, because the brackets indicate that a function has to be called, while x and y without brackets would indicate that they are stored values. Also you can't use the normal calulator app, since all the functions in there are pure functions and can't access stored variables. You have to stay within the document.

$\endgroup$
2
  • 1
    $\begingroup$ Thank you. Everything seems to have worked for the most part. I am getting the correct answer for a series of equations but it is enclosed in square parenthesis accompanied by the message below "Scalar has been multiplied by the identity matrix" Do you know why it would be doing this? $\endgroup$ – user88720 Mar 20 '17 at 13:27
  • 1
    $\begingroup$ It probably tried to solve an equation similar to Ax=vx, where A is a matrix, x a vector and v a scalar. This is known as the equation for the eigenvectors of A. When solving for x you get to Ax-vx=0, but cannot continue, because simply factoring x out doesn't make sense. You would get (A-v)x=0, but you can't subtract a scalar from a matrix. So what the calculator does is multiplying by the identity matrix. This is allowed, the same way you are always allowed to multiply by 1. So the equation then looks like Ax-vIx=0. Factoring out: (A-vI)x=0. From here on the calculator can continue normally $\endgroup$ – LionCoder Mar 20 '17 at 16:27

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.