HP Forums
function graphing - 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: function graphing (/thread-20393.html)



function graphing - Quadratica - 08-25-2023 10:30 PM

I have defined a function in CAS: angle(x,a)=(a*tan(x+a))+(a-sin(a*x))

I input x and a and it gives the expected answer.

is there a way to directly graph angle(x,2) or angle(x,-1) etc without manually changing 'a' in the definition of angle(x,a) ? changing 'a' in the definition is tedious if I want to plot several graphs for different 'a' .


RE: function graphing - Corruptissima - 08-26-2023 09:53 AM

One way to graph equations in CAS home is to use plotfunc command.

For your sample equation (a*tan(x+a))+(a-sin(a*x)),
you can type in plotfunc((a*tan(x+a))+(a-sin(a*x))|a=-1) etc. It will show a small graph in CAS home. if you select the graph and then touch the Show soft menu then a full-screen graph will be shown.
You can double tap on plotfunc((a*tan(x+a))+(a-sin(a*x))|a=-1) to copy on to the command line then press esc key and then modify just the a= to another value and plot another graph.
Altenatively, use this simple program called pfn.
[attachment=12452][attachment=12453]
[code]
#cas
// Using plotfunc command to plot a function
// in CAS home
pfn(a):=
BEGIN
plotfunc((a*tan(x+a))+(a-sin(a*x)))
END;
#end

Using above program you can simply type pfn(-1) etc


RE: function graphing - BruceH - 08-26-2023 11:23 AM

You can use the 'where' function (the vertical bar symbol - |) to assign a temporary value to a variable in an expression.

For example, in the Function app in degrees mode:
  • F1(X)=SIN(X+a)|a=45
  • F2(X)=SIN(X+a)|a=0
show the effect in the graph.

Note that the variable 'a' needs to have been created before you can use it in a where value.


RE: function graphing - Quadratica - 08-26-2023 05:25 PM

Thanks for those two suggestions, both worked like a treat !