CPII Functions and Programs
CPII Functions and Programs
com/classpad
Tip:
A user-defined function
can only contain a single
mathematical expression
and must not contain any
commands. You may want
to consult the user
manual: As an example, it
is OK to use binomialCDf,
but not binomialCD, as the
former is a function but
the latter is a command!
Once created in Main, a good idea is to shift functions into the library folder, so that the function can be
accessed from within eActivities, as well as the rest of the calculator.
To delete a function, follow the above steps to move the function, but choose Delete rather than Move as
shown in the fourth image.
If a function doesn't behave as expected, try defining it again. If you use an existing user defined function
name, ClassPad will simply overwrite the old function with the new one.
Watch videos 043, 044, 071
Alternatively, functions can be edited in the Program application. at www.classpad.com.au
Make any corrections or edits to your function and then tap Edit, Save File.
Note how to store multiple variable values using just one line. Also note the difference between a text line, as
selected in first image, and a calculation line, as selected in second image. Use and to toggle
between the two types. Bold selected text using .
A help sheet on creating eActivities is available from the www.charliewatson.com/classpad.
Notes
Once your code has been entered, tap Edit, Save File and then tap . Check that the name of the current
program is PT, enter 4 as the parameter (n) and tap . If all goes well, the Status box appears with the
message 'Done' and you can tap OK. Tap to return to the program application.
Tap Edit, Open Editor to edit your program. Choose Compress to reduce file size and prevent further editing
(you will be prompted to save an editable backup).
In the variable manager, within the main folder, you should find PT, PTedit and p amongst the variables.
Delete, move and rename your program from here.
If ... Then ... Else ... IfEnd Program takes two Else is optional.
Use for branching and values and prints out the
decision making. difference. Can also include ElseIf
statement.
For ... Next Program sums the Can add 'Step k' to
Use for repeating fixed squares of all integers increment i in steps of k.
number of times from 1 to n.
While ... WhileEnd Program sums the roots Again, beware of endless
Use for looping, but of integers from 1 to n. loops.
checks for condition at
start of loop.