Showing posts with label Function App. Show all posts
Showing posts with label Function App. Show all posts

Sunday, May 1, 2016

HP Prime: The Basics of Graphing (Function App)

HP Prime: The Basics of Graphing (Function App)


Over the last few days, I have seen requests for a tutorial of how to graph functions.  I myself received a request to do one.  

This tutorial assumes that are using the most updated version of the HP Prime.   Be aware there has not been an update on the iOS version yet (last version is 9069 as of 5/1/2016). 

7/27/2016 Update:   Sadly, version 10077 has been pulled due to issues and HP decided to take it off out of caution.  The latest firmware is back to 8151.  :(  Affected areas will be deleted.  Apologizes for any inconvenience.  (yes, this sucks)


We are going to work with the Function App.  Let’s get started.

The Three Main App Keys




[Symb]:  The Symb screen is where you enter up to ten functions, which are defined F1 to F9, then F0. 

[Shift] [Symb]:  You can change the angle measure, number format, and complex number format to be specific to the Function App.  I usually just leave all three set at System (to borrow from System settings from Home Settings)

[Plot]:  The Plot screen is the graph screen.  You may drag the screen to view different parts of the graph. 

[Shift] [Plot]:  This is where you set up the plot screen, where you set the screen’s horizontal boundaries (X Rng), the screen’s vertical boundaries (Y Rng), the tick marks (X Tick, Y Tick).  Scrolling down to page 2, you can turn on or off Axes, Labels, grid dots, and grid lines.  You have other options such as cursor and method options.  With the 10077 firmware, you can set the background if desired. 

For this tutorial, I will have the background turned off.

[Num]:   This will display a numerical table.  (X, F1, F2,…). 

[Shift] [Num]:  Set table options


Plotting Functions


Entering Functions on the Symb Screen


(Defining the function F(1)=X^2+3*X-1 and plotting it)


1.  Press the [Symb] screen.  

Note:  If you want to clear all the functions that are defined, press [Shift] [Esc] (Clear) and press the soft key (OK) to the “Clear all expressions?” prompt.

2.  Enter your function.  The independent variable is the capital X.  Press [Enter] or the soft key (OK) when you are done.
3.  To plot the function, press the [Plot] key. 

Note: You can change a function’s color.  To do so, select the color box to the left of the function and press either [Enter] or the (Choose) soft key.  You can then choose from any of the eight pre-selected colors or a custom color (lower-right square on the color palette). 



Setting Easy Graphing Plot Setups

On the Plot screen, you can select pre-programmed plot setups:  Autoscale (my favorite), Decimal, Integer, or Trig. 

For the screen shots below, cleared the functions then defined F1(X) = SIN(X) + COS(X) and set the calculator to Radian mode. 



 You can see the difference below (based on the example, results may vary depending on the functions defined):



Steps:

1.  Press the [View] key. 
2.  Select the desired zoom setup (options 3 – 6).

Using the Plot Setup Screen

You can also use the plot up screen to set up the boundaries.   To do this:

1.  Press [Shift] [Plot]. 
2.  To set the Horizontal edges, select the X Rng row.   The left box is the Xmin (x-minimum, left side) and the right box is Xmax (x-maximum, right side).
3.  To set the Vertical edges, select the Y Rng row.   The left box is the Ymin (y-minimum, bottom side) and the right box is Ymax (y-maximum, top side).
4.  If desired, you can set the tick marks of the grid.  To do this, change the X Tick and Y Tick. 
5.  If desired, you can press the page down soft key to turn axes, grid dotes, grid lines, and labels on or off.  Turning labels on will show the range values on the plot screen.
6.  To see the changes, press the [Plot] key. 

Note:  If you want to reset the graph screen to default settings, press [Shift] [Esc] (Clear).   The default settings are:  Xmin = -15.9, Xmax = 15.9, Ymin = -10.9, Ymax = 10.9, X Tick = 1, and    Y Tick = 1.


Setting the plot window as the following:  Xmin = 0, Xmax = 2*π ≈ 6.28318530718, Ymin = -2, Ymax = 2.


Tracing the Function

When you first graph functions, tracing is turned on automatically.  That is when you press the directional pad left and right, you follow the function.  If there are two or more functions plotted, you can press up or down to select which function you want to trace.

You can also turn off tracing to allow the cursor to roam freely, press the soft key (Menu) to call the menu.  Press the (Trace ) soft key to toggle the trace settings.   Note when the menu isn’t showing, you are seeing the coordinates of the cursor. 

*(Trace*):  Trace with the dot showing, trace is turned on.  The cursor follows functions.  The cursor shows the X and function values.

*(Trace ):   Trace without the dot showing, trace is turned off.  The cursor is in free roaming mode.  The cursor shows the X and Y values.



Center the Plot Screen to Where the Cursor is Located



1.  Move the cursor to wherever want to center the plot screen.  
2.  Press the (Menu) soft key to bring up the menu.   Press the (Zoom) soft key.
3.  Select Center on Cursor.  That is all there is to it.

Zoom Using a Box


Zoom using a box (F1(X) = 2*COS(X) – 1)

Steps:

1.  Plot the function (use the [Plot] key)
2.  Press the (Menu) soft key to bring up the menu.  Press the (Zoom) soft key.
3.  Select Box…   You will be prompted to select on corner of the box.  Press (OK) or [Enter].
4.  Then select the opposite corner.  You will see the area of zoom by a shaded box.  Once you are satisfied, press (OK) or [Enter].
5.  The plot screen is adjusted to the box you selected.

Move the Cursor to a Specific Position



You can send the cursor to a specific position.  This is a useful function if you need to go to a specific place.  All you have to do is press the (Go To) soft key.  You will be prompted for an X coordinate.

If Trace is turned on, the cursor moves to the X coordinate and the function value.  If Trace is turned off, you will be prompted for both the X and Y coordinates.


For information regarding Definition and Transformation, please see my post on the HP Prime 10077:  http://edspi31415.blogspot.com/2016/04/hp-prime-firmware-update-firmware-10077.html


Let’s explore some basic functions that you can operate on the Function app.


The Root of a Function

To find the root (zero of a function):



1.  On the Plot screen, have Trace turned on (see above).  Select your function.
2.  Press the (Fcn) soft menu and select Root. 
3.  The HP Prime finds the root that is closest to the cursor automatically. 


Integrals

To find the area under the curve (numerical integral):

1.  On the Plot screen, have Trace turned on and select your function.
2.  Press the (Fcn) soft menu and select Signed Area.
3.  Enter the lower limit.  You can use the directional pad or enter a specific X value.
4.  Enter the upper limit.  You can use the directional pad or enter a specific Y value.  Any area above the x-axis is shaded in green and area shaded below the y-axis is shaded in red.
5.  Press (OK) or [Enter].  The area is calculated. 

Derivative

1.  On the Plot screen, have Trace turned on (see above).  Select your function.
2.  Press the (Fcn) soft menu and select Slope. 
3.  The HP Prime displays the slope (derivative) automatically.  You can trace the function to display the slope at other points. 

Intersection of Two Functions (or a Function and an Axis)



1.  On the Plot screen, have Trace turned on (see above).  Select your (first) function, and place the cursor close to the intersection as possible.
2.  Press the (Fcn) soft key and select Intersection. You will be prompted to select the second function or an axis.
3.  The intersection should be displayed. 

Note:  Make sure that the cursor is close to the intersection you want.  Otherwise, the function may not return an answer.


This covers some of the basics of the Function App.  There is a lot more to explore of this app.  

Eddie


This blog is property of Edward Shore, 2016.





Tuesday, October 1, 2013

HP Prime Tip: Changing the Color of a Function

In the graphing apps of the HP Prime, like the Function, Advanced Graphing, Parametric, and Polar apps, expressions can be graphed in various colors.

There are two ways to change the colors of a graph. First, the easy, but limited way.

For this example, I am going to use the Function App with F1(X) = 2 * e^(SIN(X)). Assume the View is set to Autoscale.


1. Press the Symb key. To the left of the expression box is the color box. Move left until the color box is highlighted. You will know that the color box is highlighted when the screen says "Choose graph color".

2. Hit the Choose soft key. An array of nine colors will appear. Choose the desired color and press Enter. For this example I will select red.

Here is F1 graphed in red:

However, what if you want to:
1. Graph the function in a color other than the nine presented in the Symbolic page? (This includes black)
2. Be able to change the color of the function in a program?

We can do that too, with the following:

F1(COLOR):=#RRGGBBh where RRGGBBH is a hexadecimal code, or
F1(COLOR):=RGB(red, green, blue)

You can type the command in either Home mode set to Textbook or Algebraic Entry or Program Editor mode.



Caution: Doing this in CAS mode will result in the color code stored in the function - not desirable.



If you are in Home Mode, RPN Entry, either:

1. Enter the hexadecimal code
2. Press Enter
3. Type 'F#(COLOR)' in single quotes. Press Enter. (use the appropriate name and type).
4. Press Shift+EEX (STO>).

or

1. Enter the red intensity, press Enter
2. Enter the green intensity, press Enter
3. Enter the blue intensity, press Enter
4. Execute RGB(3). In RPN mode, the 3 tells the Prime to take the last three stacks as the arguments of RGB.
5. Type 'F#(COLOR)' in single quotes. Press Enter. (use the appropriate name and type)
6. Press Shift+EEX (STO>).




The maximum values for each of the colors is 255, or FF in base 16. This is similar to the range of colors you can choose from on a typical personal computer program. 0 is the least intense, 255 is the most intense.

For a list of colors and their color codes, one of the web pages you can visit is http://www.rapidtables.com/web/color/Web_Color.htm. Scroll down to see a table that has both hexadecimal and RGB codes.

Let's demonstrate with F1(X) = 2 * e^(SIN(X)).

First graph F1 in black. The RGB code for black is RGB(0,0,0) or #00000h. I have the calculator set to Home Mode, Textbook Entry.

Now plotting F1 in Dodger Blue, RGB(30,144,255) or #1E90FFh in Home Mode, RPN entry:

That is how to plot in color. Until next time,

Eddie


This blog is property of Edward Shore. 2013

RPN: DM32 and DM42: Stopping Sight Distance (Metric)

RPN: DM32 and DM42: Stopping Sight Distance (Metric) The Stopping Sight Distance Formula – Derivation The stopping sight di...