HP Forums
Plotting a user function? - 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: Plotting a user function? (/thread-641.html)



Plotting a user function? - veeblefester - 02-09-2014 01:09 AM

I have a user function defined and working.

Forgive my ignorance, I cannot figure out how to plot a USER function.

I can enter and 'check' and plot a function in one of the V0 thru V9 built in functions in Advanced Graphing Symbolic View.

How do I plot a USER function from a PROGRAM?

Thanks in advance for any help.


RE: Plotting a user function? - Giancarlo - 02-09-2014 11:01 AM

Hello,
You could:
- assign your equation to V1,V2,.. with a V1:= your_eq_goes_here;
- invoke the advanced graphic application through the STARTAPP("name_of_the_app") command
- uncheck all the other V# with a loop with the command UNCHECK(4); UNCHECK(5),....
- invoke the plot screen via STARTVIEW(1);

I was not very happy when I didn't see a simple calculation program in the prime manual in the programming chapter but now that i am able to do it thanks to this forum, i can appreciate the very long DICE program which shows how to bend the builtin applications for my needs.

Hope it helps,

Giancarlo


RE: Plotting a user function? - veeblefester - 02-10-2014 06:51 AM

Thanks for the response.

The solution, I realized, is that the proper variable in my equation must be named X.

As in f(X).


RE: Plotting a user function? - jte - 02-28-2014 02:21 AM

(02-09-2014 11:01 AM)Giancarlo Wrote:  
- uncheck all the other V# with a loop with the command UNCHECK(4);

Just a comment: you can pass lists to UNCHECK. For example, UNCHECK(MAKELIST(X,X,0,9)) will uncheck all 10 user formulas.


RE: Plotting a user function? - Giancarlo - 02-28-2014 07:00 AM

This shinks the code even more,

Thanks for the trick

Giancarlo


RE: Plotting a user function? - StephenG1CMZ - 10-01-2015 07:17 PM

(02-28-2014 02:21 AM)jte Wrote:  
(02-09-2014 11:01 AM)Giancarlo Wrote:  
- uncheck all the other V# with a loop with the command UNCHECK(4);

Just a comment: you can pass lists to UNCHECK. For example, UNCHECK(MAKELIST(X,X,0,9)) will uncheck all 10 user formulas.

Interestingly, on the Android emulator UNCHECK seems able to handle lists for Function, but not for Solve. The embedded help for UNCHECK only describes the UNCHECK(n) syntax.

Code:

EXPORT TRYS()
BEGIN
 SolveTRY.E1:=QUOTE(X^2+X=0);
 SolveTRY.E2:="X^2+X=0";
 SolveTRY.UNCHECK(1); //WORKS
 Function.UNCHECK({1,2});//LIST WORKS ON FUNCTION
 //SolveTRY.UNCHECK(MAKELIST(X,X,1,9)); //DOESNT WORK ON SOLVE

END;

(The problem relates to the use of a list, the MAKELIST is not significant).


RE: Plotting a user function? - cyrille de brébisson - 10-02-2015 05:26 AM

Hello,

> The embedded help for UNCHECK only describes the UNCHECK(n) syntax.

The list use of most function is NOT described in the function help itself (as a mater of fact, I do not know where it is described)...

The reason for this is that, deep down, the functions do NOT implement list processing.

List processing is implemented at the level evaluating the function, not in the function evaluation.

So, if the system sees a + and see that arg 1is a list and arg 2 is NOT a list, then it will call + n times, with each element of list 1 and with a copy of arg 2 and construct the resulting list. The + function is NOT aware that it is doing list processing.

This is great, because any new function created WILL implement list processing automatically/by itself, without the function creator having to do anything.

But it means that it is often an overlooked function when doing documentation.

Some functions specifically flag the evaluator as: Not list processing friendly. In this case, list processing does get disabled. As a general rule, this is the case for all the functions that have special processing for lists.

Cyrille