Programming with variables
06-01-2017, 05:49 AM
Post: #1
 Fluggeil Junior Member Posts: 6 Joined: Jun 2017
Programming with variables
Hello,.....maby someone can helpb. Thanx.....

I want to programm a formular with different variables. And to solve always one variable........this one what i need for my calculations.

For example: v=Ks*Js^1/2*R^2/3. I want to put the arguments v, KS, JS and R in the "export" and to get the variabel what i need. Is this possibile?

Example: Ks=70, Js=35 and v=4 now i want to get R. Next time i need Ks and put all the others inside........

If you can help me would be great.

Thanx.
06-01-2017, 03:50 PM
Post: #2
 KeithB Senior Member Posts: 409 Joined: Jan 2017
RE: Programming with variables
This is exactly what the "Solve" app does.
06-01-2017, 06:29 PM
Post: #3
 Fluggeil Junior Member Posts: 6 Joined: Jun 2017
RE: Programming with variables
Hey! o.k....it works. Thanx a lot!!

Is it possible to use varibales like the greek ones? Or just upper case form?
06-01-2017, 09:34 PM (This post was last modified: 06-01-2017 10:53 PM by BERNARD MICHAUD.)
Post: #4
 BERNARD MICHAUD Member Posts: 149 Joined: Aug 2015
RE: Programming with variables
First NO program
-----------------------------
In the HOME screen type the following:
0 Sto> Ks Prime will ask you if you want to create the variable called Ks
Press OK. do the same for any variables except (A .....Z) which are already defined.

0Sto>Ks 0Sto>Js 0Sto>v (Use '0' or any value.)

Next press Apps. Navigate to the "Solve" app. 'Press Reset'. And 'Start".

Enter your function in E1:v=Ks*Js^(1/2)*R^(2/3) Press OK

Make sure E1: is checked. Press Num

v:0
Ks:0
Js:0
R:0 note R may contain a value if previously used (R is a global variable).

Enter any three variables and Solve for unknown.

In a program:
--------------------------
Enter the following.

EXPORT Ks:=0;
EXPORT Js:=0;
EXPORT v:=0;

EXPORT program name ()
BEGIN
END;

You can also do:
EXPORT Ks:=0,Js:=0,v:=0; up to 8 variables per line.

Run the program and the three variables will be created.
Go to the Slove App (as above) and enter the formula, values and solve.

Bernard
06-01-2017, 10:56 PM (This post was last modified: 06-01-2017 11:00 PM by BERNARD MICHAUD.)
Post: #5
 BERNARD MICHAUD Member Posts: 149 Joined: Aug 2015
RE: Programming with variables
(06-01-2017 06:29 PM)Fluggeil Wrote:  Hey! o.k....it works. Thanx a lot!!

Is it possible to use varibales like the greek ones? Or just upper case form?

You can any Greek or other variables found in the Character menu. (Shift Chars)
You do not declare upper case letters. They are already declared by the system

EXPORT U:=0; will generate a syntax error, you can do lower case only.
06-02-2017, 06:09 AM
Post: #6
 Fluggeil Junior Member Posts: 6 Joined: Jun 2017
RE: Programming with variables
THANX a lot!! [/b]It works perfect!!!!
06-02-2017, 04:54 PM
Post: #7
 Tim Wessman Senior Member Posts: 2,292 Joined: Dec 2013
RE: Programming with variables
Note - the problem with the explained method is that if you *ever* remove those variables, the equation will no longer work properly.

Instead, the best solution is to define your variables in the application program that is linked to your app. This will be the top line in the program catalog when you app is active.

At the top, define your variables:

Ks,Js,v; //declare variables that only appear when this solve app is active

If you want the variables to be global through the system:

EXPORT Ks,Js,v; //declare variables that are global

This way, you are much more certain your variables will remain. keeping them local makes it much less likely they will conflict in other places.

TW

Although I work for HP, the views and opinions I post here are my own.
 « Next Oldest | Next Newest »

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