HP Forums
Solver variable question - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Solver variable question (/thread-4251.html)



Solver variable question - TechAlex - 06-28-2015 08:20 PM

Hello all,

I am trying to write a program, actually I got it working, but I want to create variables of two or more letters. How can I accomplish that?

The "FV" local variable down below if I use it, let's say, FV=...., the Solver creates two variables, now the equation is wrong.

I want to create a variable of three characters for "M", like "PMT"

EXPORT TVM_Test()
BEGIN
LOCAL FV;
STARTAPP("Solve");
"F=P*(1+((R/100)/N))^(N*T)+M*((1+((R/100)/N))^(N*T)-1)/((R/100)/N)"▶E1;
PRINT();
PRINT("NOTE: This Equation Will Solve for Any Unknown Variable.");
PRINT(" ");
PRINT("P = Present Value");
PRINT("F = Future Value");
PRINT("R = Interest Rate");
PRINT("T = Numbers of Years");
PRINT("N = Compounds per Year.");
PRINT("M= Amount of payment or deposit.");
PRINT(" ");
PRINT("Press ENTER ↲ to Continue...");
// Display Solver
CHECK(1);
STARTVIEW(2,1);
END;


Thank you.


RE: Solver variable question - roadrunner - 06-28-2015 09:07 PM

Do you mean like this?

Code:

EXPORT PMT;

EXPORT TVM_Test()
BEGIN
 LOCAL FV;
 STARTAPP("Solve");
 "F=P*(1+((R/100)/N))^(N*T)+PMT*((1+((R/100)/N))^(N*T)-1)/((R/100)/N)"▶E1;
 PRINT();
 PRINT("NOTE: This Equation Will Solve for Any Unknown Variable.");
 PRINT(" ");
 PRINT("P = Present Value");
 PRINT("F = Future Value");
 PRINT("R = Interest Rate");
 PRINT("T = Numbers of Years");
 PRINT("N = Compounds per Year.");
 PRINT("PMT= Amount of payment or deposit.");
 PRINT(" ");
 PRINT("Press ENTER ↲ to Continue...");
 // Display Solver
 CHECK(1);
 STARTVIEW(2,1);
END;



RE: Solver variable question - TechAlex - 06-29-2015 12:14 AM

(06-28-2015 09:07 PM)roadrunner Wrote:  Do you mean like this?

Code:

EXPORT PMT;

EXPORT TVM_Test()
BEGIN
 LOCAL FV;
 STARTAPP("Solve");
 "F=P*(1+((R/100)/N))^(N*T)+PMT*((1+((R/100)/N))^(N*T)-1)/((R/100)/N)"▶E1;
 PRINT();
 PRINT("NOTE: This Equation Will Solve for Any Unknown Variable.");
 PRINT(" ");
 PRINT("P = Present Value");
 PRINT("F = Future Value");
 PRINT("R = Interest Rate");
 PRINT("T = Numbers of Years");
 PRINT("N = Compounds per Year.");
 PRINT("PMT= Amount of payment or deposit.");
 PRINT(" ");
 PRINT("Press ENTER ↲ to Continue...");
 // Display Solver
 CHECK(1);
 STARTVIEW(2,1);
END;

I dont think this will work. What I want is to find out how to declares variables of two or more characters, for example, "PMT" instead of just "M", or "FV" instead of "F", or "%R" instead of just "R", etc., so the Solver can use them., so the data entry screen can be more meaningful. See attach image.

Thank you for replying .


RE: Solver variable question - roadrunner - 06-29-2015 03:15 AM

[/quote]
I dont think this will work.
[/quote]
You're right, I type it in wrong before. It wouldn't let me use PMT and FV, I believe because those are already variables built in to the finance app. It did let me use lower case variables, pmt and fv. Like in the attachment:

[attachment=2234]

The HP Prime is a fantastic calculator, but has a very steep learning curve. Right now I am at the bottom of that curve.

Road


RE: Solver variable question - TechAlex - 06-29-2015 03:29 AM

I dont think this will work.
[/quote]
You're right, I type it in wrong before. It wouldn't let me use PMT and FV, I believe because those are already variables built in to the finance app. It did let me use lower case variables, pmt and fv. Like in the attachment:



The HP Prime is a fantastic calculator, but has a very steep learning curve. Right now I am at the bottom of that curve.

Road
[/quote]

Thank you, Road. It works like a charm. I agree with you, the Prime has not match. I got hardware version A, I contacted HP, they replaced it with hardware version C. PM me if you would like to know the details.