-
×InformationFix Windows 10 Update Issues
Resolve Windows 10 related issues for your HP computers or printers by HP Windows 10 Support Center
-
-
×InformationFix Windows 10 Update Issues
Resolve Windows 10 related issues for your HP computers or printers by HP Windows 10 Support Center
-
- HP Community
- >
- Other Products
- >
- Calculators
- >
- HP Prime Create List That Includes an Expression
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Create an account on the HP Community to personalize your profile and ask a question

HP Prime Create List That Includes an Expression
03-30-2018 06:02 AM

I have been attempting to create a list that includes an expression that I would like to iterate between a lower and upper limit. I’ve tried numerous approaches, all unsuccessful. Here’s what I am trying to accomplish.
Expression = w*(L/2-(x))
Variables w, L and RL have been previously defined in program. I would like to iterate the expression from x=L/10 to L in steps of L/10 and include all iterated values in a list. I also want to include in the list static values at specified locations in the list.
The desired list would look like this:
{0, 15, RL, w*(L/2-(0.1*L), w*(L/2-(0.2*L), w*(L/2-(03*L), w*(L/2-(0.4*L), w*(L/2-(0.5*L), w*(L/2-(0.6*L), w*(L/2-(0.7*L), w*(L/2-(0.8*L), w*(L/2-(0.9*L), w*(L/2-(L), 0}
Any assistance or suggestions would be much appreciated.
03-30-2018 11:06 AM

Hello,
The key is to use quoted expressions to avoid evaluation. QUOTE( ) or else just ' ' around it. Once you have a quoted expression, you can easily then build up the expression as the quote avoid evaluation.
For example: 'A' + 1 / 2 in the homescreen will result in 'A+1/2' being left there.
Here's a bit of code to get you started
EXPORT test()
BEGIN
LOCAL mylist:={ 0, 15, 'RL' }; //see how I quote the RL to avoid evaluation at this time
FOR J FROM 0 TO 10 DO
mylist:=CONCAT(mylist,'W'+J);
END;
END
Now if you are just wanting the final value, you can do that with not quoting your argument when CONCAT is called.
You could also just call EVAL(mylist) at the very end to get your full evaluation at that time if that works better.
Although I work for the HP calculator group as a head developer of the HP Prime, the views and opinions I post here are my own.
Didn't find what you were looking for? Ask the community