Saving, using expressions.equations saved as CAS variables
01-12-2014, 12:48 PM
Post: #1 CR Haeger Member Posts: 275 Joined: Dec 2013
Saving, using expressions.equations saved as CAS variables
Hello,

I have been trying to determine the best approach for saving frequently "used" single/multi variable expressions and equations in the HP Prime. By "used", I mean being to be able to do some or all of the following to them:

- Compute numerical values if I enter values for the variable(s)
- Perform CAS algebra symbolically on one (or more) saved expression or equation
- Perform Toolbox>CAS commands on them, like diff(), int(), solve()...
- Use or send them to the Solver APP for single/multi equation numerical solving
- Send them to the Function APP for graphing, graphical analyses
- Other things I have not thought of yet...

It seems that this generally requires storing them as a CAS variable or CAS program. I understand that Home variables or User Functions may be options, but these seem to have limits as well.

Attached are my thoughts on storing/using expressions, equations in CAS variables. I look forward to hearing how others are approaching this on the HP Prime.

Best,
Carl

PS - I come from an old HP15C user perspective, not the HP42,48-50 series so I don't carry that knowledge (or baggage?)

Attached File(s) HP Prime CAS variables - Google Drive.pdf (Size: 133.19 KB / Downloads: 60)
01-14-2014, 10:35 PM
Post: #2 CR Haeger Member Posts: 275 Joined: Dec 2013
RE: Saving, using expressions.equations saved as CAS variables
Hi. Anyone else dealing with saving and using CAS equations? Any reccomendations?
01-15-2014, 01:27 AM
Post: #3 Han Senior Member Posts: 1,810 Joined: Dec 2013
RE: Saving, using expressions.equations saved as CAS variables
Case #1.

f(x):=x^2-5 creates a mathematical function named $$f$$, whose input (dummy) variable is $$x$$. The CAS is capable of functional algebra. That is, f+g, f*g and f/g are all understood by the CAS, without ever referring to the dummy input variables of each function. As an example, create two functions: f(x):=x^2 and g(t):=2-t. Then in the CAS, type h:=f(g) to create a composition of functions. Even though you did not specify an input variable for $$h$$, the calculator has (in a sense) promoted $$h$$ to a function so that h(3) produces the result 1. (It calculates this as h(3) = f( g(3) ) = f( -1 ) = (-1)^2 = 1). However, commands such as diff() and int() only know how to handle expressions and have no awareness of functional algebra. (There are commands, however, which can compute functional derivatives in xcas, though.) When one evaluates a function using a variable as input, then the result is an expression in terms of that variable. That is, if $$f$$ is evaluated at $$x = t$$ then the result is an expression in terms of $$t$$. (Or at $$x = x$$ then the result is an expression in terms of $$x$$. Therefore, $$f(t)$$ and $$f(x)$$ are valid inputs for diff(), int(), solve(), etc. whereas $$f$$ by itself is not. Case #3 is similar with the slight difference merely being the number of inputs.

Case #2.

Using f:=x^2-5 creates a variable $$f$$ -- as opposed to a mathematical function as above -- and the value of $$f$$ in this case is whatever $$x^2-5$$ simplifies to, if at all (depending on whether $$x$$ was defined when $$f$$ was created as a variable). It does not, however, create a function. Instead, it either creates a numerical value (if $$x$$ is defined) or an algebraic expression (which _could_ evaluate to a numerical value once $$x$$ is defined and the expression evaluated). Case #5 is no different from #2.

In cases 1 through 3, and in 5, you have not created an equations whatsoever in the mathematical sense.

Cases #4

This cases actually results in equations (sometimes). You have created a function whose domain is $$\mathbb{R}[x] \times \mathbb{R}[x] \times \mathbb{R}[x] \times \mathbb{Z}[x]$$, where $$S[x] := S \cup \{ x \}$$ and $$x$$ is a dummy variable (I'm abusing some conventional mathematics notation); and whose range consists of exponential equations (or booleans). This is one means of CREATING a family of equations of a specific form (in this case, an exponential function modeling growth/decay). So you can create an equation such as $$y=50(1+.05)^t$$ by evaluating $$F_{P5}(y,50,.05,t)$$. If all the inputs of $$F_{P5}$$ are numerical, then you essentially create a boolean test as the resulting equality can only be either true or false (there are no variables, after all).

That said, I am still not sure I understand your goal. You mention wanting to "save" a multivariable expression. What is meant by "save" -- are you looking for ways to create a "library" of frequently used formulas? Or are you merely interested in storing intermediate results (obtained by using diff(), int(), etc. on these formulas) for use in other calculations?

Graph 3D | QPI | SolveSys
01-18-2014, 02:27 PM
Post: #4 CR Haeger Member Posts: 275 Joined: Dec 2013
RE: Saving, using expressions.equations saved as CAS variables
(01-15-2014 01:27 AM)Han Wrote:  That said, I am still not sure I understand your goal. You mention wanting to "save" a multivariable expression. What is meant by "save" -- are you looking for ways to create a "library" of frequently used formulas? Or are you merely interested in storing intermediate results (obtained by using diff(), int(), etc. on these formulas) for use in other calculations?

Han - thank you for taking the time to review the cases I was working with. Based on your response, I am beginning to gain a better understanding of how the Prime uses saved CAS expressions/equations in CAS and APPs.

As an Engineer, I am hoping to create libraries of frequently "used" formulas. "Using" these formulas may include: calculating them with known term values, solving numerically for an unknown, solving algebraically for an unknown and graphically plotting/analyzing them using a Prime APP. Furthermore, I may use the Prime to perform fairly simple regressions --> create new formulas for the library. I may need to perform two or more of the above in the same "session" using the Prime.

As a Father of middle/HS students, I am evaluating the Prime for their studies. I expect that they may be faced with evaluating expressions, equations algebraically, numerically and graphically. I want to see if the Prime could easily allow them to (1) key in and save them and (2) use them in CAS, Home and APPs without errors or having to retype everything.

I know this is a fairly broad topic. It seems that there are a few ways to correctly perform these tasks, however there appear to be many ways to run into errors or rework. I'm trying to find the correct path(s) on the Prime.

Best,
Carl
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)