Post Reply 
Interval and Parameter
01-06-2022, 06:52 PM
Post: #1
Interval and Parameter
Hello everyone,

I bought an HP Prime G2 some days ago and I like it very much. I previously had a TI 84+ and the HP Prime is much better.

However, there are some features I can't find:
1. Interval:
If I only want to draw a function to, let's say... only x < 2, how do I do that?
On the TI 84+, I wrote the function and put a (x<2) at the end of the function (for example 2X → 2X(x<2)

2. Parameter:
How do I draw a function with many values for parameters? Example: On the TI 84+, I could write all the given values of a parameter in a list, and use it in the function editor. It then would draw as many graphs as there are values saved in the list (5 elements → 5 graphs).

Thanks for the help Big Grin
Find all posts by this user
Quote this message in a reply
01-07-2022, 05:25 PM
Post: #2
RE: Interval and Parameter
1. I'm not sure this was intended by the developers; in the function app typing

(2*X)*IFTE(X<2,1,"")

will plot the function as you want but most functions like slope and extremum won't work.

2. I don't think you can do that on the prime. I recall another TI owner mentioning that a few years ago.

-road
Find all posts by this user
Quote this message in a reply
01-08-2022, 12:22 AM
Post: #3
RE: Interval and Parameter
(01-07-2022 05:25 PM)roadrunner Wrote:  1. I'm not sure this was intended by the developers; in the function app typing

(2*X)*IFTE(X<2,1,"")

will plot the function as you want but most functions like slope and extremum won't work.

2. I don't think you can do that on the prime. I recall another TI owner mentioning that a few years ago.

-road
Thank you very much!
One question though: How do I get the IFTE function other than typing it or searching it up in the catalog?
Find all posts by this user
Quote this message in a reply
01-08-2022, 07:26 AM
Post: #4
RE: Interval and Parameter
For your 1st question you may want to use conditional function definition.
It is located on the button opening the formulas (the one with “Units” written in blue).
Chose the 5th column of the 1st row and define interval functions the way you need.

2nd question, still wondering how to do that. Wink

Thibault - not collector but in love with the few HP models I own - Also musician : http://walruspark.co
Find all posts by this user
Quote this message in a reply
01-08-2022, 08:21 AM
Post: #5
RE: Interval and Parameter
(01-06-2022 06:52 PM)Eulehund99 Wrote:  1. Interval:
If I only want to draw a function to, let's say... only x < 2, how do I do that?
On the TI 84+, I wrote the function and put a (x<2) at the end of the function (for example 2X → 2X(x<2)

Just to clarify, what you are actually doing when you use 2X(X<2) is implied multiplication of 2*X*(X<2), that is you are multiplying 2X times the boolean result of X<2 which is either 1 or 0. In your example, for values of X>2, the graph is simply Y=0 which you can't see on the 84+ because the graph is the same color as the x-axis. If you turn off the axes (2nd-Format) you can see the full graph.

You could do the same thing on the Prime by entering 2X*(X<2), but now you will see the X>2 portion since the graph and x-axis are different colors (just as you would on the TI-84+CE).

A much better way of doing this is to use
{2X if X<2
which you can access in the Math Templates.


(01-06-2022 06:52 PM)Eulehund99 Wrote:  2. Parameter:
How do I draw a function with many values for parameters?
Unfortunately, this feature is not implemented on the Prime (yet?).
Find all posts by this user
Quote this message in a reply
01-08-2022, 03:11 PM (This post was last modified: 01-08-2022 03:16 PM by C.Ret.)
Post: #6
RE: Interval and Parameter
(01-06-2022 06:52 PM)Eulehund99 Wrote:  2. Parameter:
How do I draw a function with many values for parameters?

For example, suppose you want to represent the four curves of functions \( f_n(x) = x^2 + x.a_n + b_n \) respectively defined with the parameters \( a_{1-4} = \{ -2 , -1 , 1 , 2 , \} \) and \( b_{1-4} = \{ 0 , 1 , 2 , 3 \} \).

[attachment=10257]

Simply enter value for the array \( a \) and \( b \) into the global lists L1 and L2:
Press [ shift ] [ List ] button, touch ( Edit ) in bottom menu and enter values in L1 and L2 (see capture)
Press [ App ] button, touche ( Function ) icon to launch Function Application.
In the first slot enter the definition of F1(X) = X ² + L1(1)*X + L2(1). Presse ENTER
Touch Slot1 definition area and press [ shift ] [ Copy ] in order to copy-paste the definition in the following slots.
Edit the corresponding slots so that: F2(X) = X ² + L1(2)*X + L2(2), F3(X) = X ² + L1(3)*X + L2(3) and F4(X) = X ² + L1(4)*X + L2(4).
Press [ Plot ] button to draw the curves.

Changing values in L1 and L2 dynamically change plots.
Find all posts by this user
Quote this message in a reply
01-08-2022, 04:33 PM
Post: #7
RE: Interval and Parameter
Not exactly the same, but from the geometry app, you can define a parameter and a function depending on the parameter, then moving the parameter will represent the corresponding curve.
You can also from the geometry app enter something like that in the SYMB view:
l:=[1,2,3,4]; plotfunc(sin(l*x),x)
In Xcas you could also specify colors, but this does not seem to work on the Prime.
With more parameters, it's a little more complicated:
Code:

S:=set[1,2,3,4]*set[2,4,6];
L:=seq(subst(x^2+a*x+b,[a,b],S[j]),j,0,size(S)-1);
plotfunc(L,x);
or with colors in Xcas
Code:
plotfunc(L,x,color=range(size(L)))
Find all posts by this user
Quote this message in a reply
01-08-2022, 09:58 PM
Post: #8
RE: Interval and Parameter
There's a relatively quick, somewhat cheeky way to limit the interval to what you want. It basically forces the function to return "NaN" when X>=2.

Instead of {2X if X<2, you could use 2X/(X<2). It works because of how "X<2" works. When X is less than 2, the expression "X<2" evaluates to "1". When it's greater than 2, it evaluates to "0".

In the latter case, it simply makes the whole thing evaluate to "NaN" as you have something over zero.
Find all posts by this user
Quote this message in a reply
01-09-2022, 12:49 PM
Post: #9
RE: Interval and Parameter
Thank you guys all for the replies. They really helped me out!

There isn't a fast solution for my second question, which is a bit annoying. But those exercises in class are quite rare, and it's fine if I just copy and place the stuff multiple times.
Find all posts by this user
Quote this message in a reply
01-09-2022, 01:24 PM
Post: #10
RE: Interval and Parameter
(01-08-2022 04:33 PM)parisse Wrote:  Not exactly the same, but from the geometry app, you can define a parameter and a function depending on the parameter, then moving the parameter will represent the corresponding curve.
You can also from the geometry app enter something like that in the SYMB view:
l:=[1,2,3,4]; plotfunc(sin(l*x),x)
In Xcas you could also specify colors, but this does not seem to work on the Prime.
With more parameters, it's a little more complicated:
Code:

S:=set[1,2,3,4]*set[2,4,6];
L:=seq(subst(x^2+a*x+b,[a,b],S[j]),j,0,size(S)-1);
plotfunc(L,x);
or with colors in Xcas
Code:
plotfunc(L,x,color=range(size(L)))

Thanks! I tried it with a list, and it works too. I still kinda wish there is a way of doing it in the function app, as I couldn't trace the functions or get any important points without entering many equations and commands in the NUM and SYMB View.
Find all posts by this user
Quote this message in a reply
Post Reply 




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