Post Reply 
Dealing with functions
02-01-2014, 11:00 AM (This post was last modified: 02-01-2014 11:18 AM by Mickpc.)
Post: #1
Dealing with functions
I am trying to figure out how to plot a function that is held a solver Variable. If I store the said equation in, say, E1 I can then solve it. But when I want to plot the same function it needs to be in a different format for plotting.

What I am trying to do is store the equation in a program and then solve it and plot it, as well. Is there any trick to this?

For the solver I can use any combinations of variables I want, but when It comes to plotting, you cannot seem to set the dependent and independt variables for the plot.

Oh and as a random question is anyone working on an equation browser?

Mick C

HP_Prime_an_introduction

My ebook
Find all posts by this user
Quote this message in a reply
02-01-2014, 04:36 PM
Post: #2
RE: Dealing with functions
While in the SOLVE apps, hit Num and solve for the variable you want to plot as the independent variable (that field will stay highlighted - - this sets the independent variable). The dependent variable will be E1, E2, ... . Then hit plot and it should work.

You can plot any variable that you solve for by going back to the Solve Numeric view and highlighting a different variable(just make sure that before plotting, you solve for it again; you may have to adjust the scale, of course, if your variables have different magnitudes). You can also trace your function with the cursor keys.

I hope this covers what you were asking.
Find all posts by this user
Quote this message in a reply
02-01-2014, 05:45 PM
Post: #3
RE: Dealing with functions
(02-01-2014 11:00 AM)Mickpc Wrote:  What I am trying to do is store the equation in a program and then solve it and plot it, as well. Is there any trick to this?

Hi Mick,

Here is a simple example of how you can use an equation within a program and either plot it or solve it:

Code:

// Before running this program:
// -->  Create a copy of the Solve App
// (1) Start Apps
// (2) Select the "Solve" app
// (3) Tap on "Save"
// (4) Enter the name for the new app: "Solve_VelAcc"

EXPORT velacc()
BEGIN
 LOCAL var;

 // Assign equation to variable E1
 Solve_VelAcc.E1 := "V^2=U^2+2*A*D";

 // Start the "Solve_ValAcc" App with the symbolic view
 STARTAPP("Solve_VelAcc");
 STARTVIEW(0);

 // Selection of the view
 CHOOSE(var, "Select View","Equation","Plot","Solve","Program Catalogue");

 CASE 
  IF var == 1 THEN
   STARTVIEW(0); // Show equation E1
  END; 
  IF var == 2 THEN
   STARTVIEW(1); // Plot equation E1
  END;
  IF var == 3 THEN
   STARTVIEW(2); // Solve equation E1
  END;
  IF var == 4 THEN
   STARTVIEW(-7); // Back to the Program Catalogue
  END;
 END; // END CASE

END;


This is just a standalone program. It is much more elegant to implement this code within the created App and to define specific views to choose from.

Dominik
Find all posts by this user
Quote this message in a reply
02-02-2014, 12:08 AM
Post: #4
RE: Dealing with functions
(02-01-2014 04:36 PM)Helge Gabert Wrote:  While in the SOLVE apps, hit Num and solve for the variable you want to plot as the independent variable (that field will stay highlighted - - this sets the independent variable). The dependent variable will be E1, E2, ... . Then hit plot and it should work.

You can plot any variable that you solve for by going back to the Solve Numeric view and highlighting a different variable(just make sure that before plotting, you solve for it again; you may have to adjust the scale, of course, if your variables have different magnitudes). You can also trace your function with the cursor keys.

I hope this covers what you were asking.

That is what I needed, thank you everyone.

Kind Regards

Mick C

HP Prime a gentle introduction
Find all posts by this user
Quote this message in a reply
Post Reply 




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