The version of Python available on your NumWorks calculator is MicroPython 1.17, compatible with Python 3.4.

When you enter the application, you can see the list of saved scripts. When you first use the application, four scripts are defined as examples: `squares.py`

, `parabola.py`

, `mandelbrot.py`

and `polynomial.py`

.

You can add up to 8 scripts on the list.

- Select the
**Add a script**cell at the bottom of the list. - Confirm by pressing
.*ok*

A new script appears on the list. You can then enter a name for your new script.

To delete a script, select the settings icon next to the script name and press ** ok**. Choose

To change a script name, select the settings icon next to the script name and press ** ok**. Choose

To write to a script, simply select the script name and press ** ok**. The editor opens and you can write your code inside.

To help you write, press ** toolbox**. A menu will open with some shortcuts to make editing easier. The menu

`for`

and `while`

loops, `if`

tests and a series of If you want to copy and paste part of a text, select the characters to be copied by holding down the ** shift** key and using

The script editor has an autocompletion feature. When you begin typing, the app will make a suggestion in gray.

- To accept the suggestion, press the
or*right*key.*ok* - To decline the suggestion, press
or just continue typing.*back* - To get a new suggestion, press the
or*up*key.*down* - All possible suggestions from the prefix you entered are listed in the menu of the
key.*var*

Automatic import is automatically enabled for your scripts. This means that the command `from script_name import *`

is systematically entered when the shell is opened so that you can use the functions you defined in the scripts inside the console.

To disable automatic import of a script, select the settings icon next to the script name and press ** ok**. Choose

At the bottom of the list of scripts is the **Python shell** button which allows access to the interactive shell of Python.

The triple arrows `>>>`

prompt you to enter a command.

You can use the shortcuts on the ** toolbox** menu to make text entry easier. The menu of the

To interrupt the execution of a script, press the ** back** key on the keyboard. If the script is stuck in an infinite loop, press and hold

The modules present in this version of Python are: `math`

, `cmath`

, `matplotlib.pyplot`

, `random`

, `turtle`

, `ion`

, `time`

and `kandinsky`

modules.

Here is the complete description of the `math`

module. You can get this list on your calculator by pressing ** toolbox** and going to

`e`

The constant `e=2.718281828459045`

.

`pi`

The constant `pi=3.141592653589793`

.

`sqrt(x)`

Square root, type `sqrt(x)`

for $\sqrt{x}$.

`pow(x,y)`

Power, type `pow(x,y)`

for $x^y$.

`exp(x)`

Exponential, type `exp(x)`

for $e^x$.

`expm1(x)`

Exponential minus 1, type `expm1(x)`

for $e^x-1$.

`log(x)`

Natural logarithm: `log(x)`

calculates $ln(x)$.

`log2(x)`

Base-2 logarithm, type `log2(x)`

for $\frac{ln(x)}{ln(2)}$.

`log10(x)`

Base-10 logarithm, type `log10(x)`

for $\frac{ln(x)}{ln(10)}=log(x)$.

`cosh(x)`

Hyperbolic cosine.

`sinh(x)`

Hyperbolic sine.

`tanh(x)`

Hyperbolic tangent.

`acosh(x)`

Inverse hyperbolic cosine.

`asinh(x)`

Inverse hyperbolic sine.

`atanh(x)`

Inverse hyperbolic tangent.

`cos(x)`

Cosine in radians.

`sin(x)`

Sine in radians.

`tan(x)`

Tangent in radians.

`acos(x)`

Arc cosine.

`asin(x)`

Arc sine.

`atan(x)`

Arc tangent.

`atan2(y,x)`

Type `atan2(y,x)`

to calculate $atan(\frac{y}{x})$.

`ceil(x)`

Ceiling.

`copysign(x,y)`

Returns `x`

with the sign of `y`

, for instance `copysign(3,-1)=-3`

.

`fabs(x)`

Absolute value, `fabs(x)`

returns $\mid x\mid$.

`floor(x)`

Floor, type `floor(x)`

to calculate $\lfloor x \rfloor$.

`fmod(a,b)`

`fmod(a,b)`

returns $a$ modulo $b$.

`frexp(x)`

Mantissa and exponent of `x`

: for instance, `frexp(10)`

returns `(0.625,4)`

because $10=0.625\times2^4$.

`gcd(a,b)`

Greatest common divisor or `a`

and `b`

.

`ldexp(x,i)`

Inverse of `frexp(x)`

, that is $x\times2^i$.

`modf(x)`

Fractional and integer parts, for instance `modf(5.1)=(0.1,5.0)`

.

`isfinite(x)`

Checks if `x`

is finite.

`isinf(x)`

Checks if `x`

is infinite.

`isnan(x)`

Checks if `x`

is `NaN`

.

`trunc(x)`

Returns `x`

truncated to an integer, for instance `trunc(6.7)=6`

.

`radians(x)`

Converts `x`

from degrees to radians, for instance `radians(180)`

returns `3.141592653589793`

.

`degrees(x)`

Converts `x`

from radians to degrees, for instance `degrees(pi)`

returns `180`

.

`erf(x)`

Error function, $erf(x) = \frac{2}{\pi}\int_0^x e^{-t^2} \, \mathrm dt$.

`erfc(x)`

Complementary error function, $erfc(x) = 1-erf(x)$.

`gamma(x)`

Gamma function.

`lgamma(x)`

Log-gamma, $lgamma(x)=ln(gamma(x))$.

This is the complete description of the `cmath`

module. You can get this list on your calculator by pressing ** toolbox** and going to

`e`

The constant `e=2.718281828459045`

.

`pi`

The constant `pi=3.141592653589793`

.

`phase(z)`

Phase of `z`

in radians, for instance `phase(1j)=1.570796326794897`

.

`polar(z)`

Representation of `z`

in polar coordinates: `polar(1j)`

returns `(1.0, 1.570796326794897)`

.

`rect(z)`

Representation of `z`

in cartesian coordinates: `rect(1,pi/4)`

returns `0.70710+0.70710j`

.

`exp(x)`

Exponential function, for instance `exp(i*pi/4)`

returns `0.70710+0.70710j`

.

`log(x)`

Natural logarithm, for instance `log(1j)`

returns `1.570796326794897j`

.

`sqrt(x)`

Square root.

`cos(x)`

Cosine.

`sin(x)`

Sine.

This is the complete description of the `matplotlib.pyplot`

module. You can get this list on your calculator by pressing ** toolbox** and going to

`arrow(x,y,dx,dy)`

Draws an arrow from point `(x,y)`

to point `(x+dx,y+dy)`

. It is possible to use an optional argument to adjust the size of the arrow by writing: `head_width = 0.1`

. Another optional argument can be used to choose the color of the line by writing: `color="red"`

.

`axis((xmin,xmax,ymin,ymax))`

Sets the display window to `(xmin,xmax,ymin,ymax)`

. The `axis()`

instruction returns the list of values for the axes boundaries. In addition, `axis("off")`

or `axis(False)`

hides the axes while `axis("on")`

or `axis(True)`

displays them. To reset the axes with the automatic setting, you can use the `axis("auto")`

instruction.

`bar(x,height,bin_width,bottom)`

Draws a bar plot using the values in the `x`

list and the counts in the `height`

list. The last two arguments are optional. The `bin_width`

argument allows you to set the width of the bars whose default value is 0.8. The `bottom`

argument is the list of the starting ordinates of the bars, set to 0 by default. It is possible to place an optional argument to choose the color of the line by writing: `color="red"`

.

`grid()`

Displays the grid if it is hidden or hides the grid if it is displayed. The `grid(True)`

and `grid(False)`

instructions allow you to show or hide the grid.

`hist(x,bins)`

Plots a histogram using the values in the `x`

list. The second argument is optional. If the second argument is an integer, it sets the number of rectangles that constitute the histogram. This number is 10 by default. If the second argument is a list, it allows you to choose the bins of the histogram. For example, if `bin`

is `[0,1,3,5]`

, the bins will be: `[0,1[`

, `[1,3[`

and `[3,5]`

. It is possible to place an optional argument to choose the color of the line by writing: `color="red"`

.

`plot(x,y)`

Plots the `y`

list versus the `x`

list. The `(x,y)`

points are connected by segments. If only one `y`

list is given, the `x`

is assumed to be `[0,1,2,3...]`

. The `color`

argument is optional. It allows you to choose the color of the line.

`scatter(x,y)`

Plots a scatterplot based on `(x,y)`

values. The arguments of the function can be numbers or lists of the same length. It is possible to place an optional argument to choose the color of the line by writing: `color="red"`

.

`show()`

Draws the figure.

`text(x,y,"text")`

Displays the text set as an argument at the `(x,y)`

coordinates.

Here is the complete description of the `numpy`

module. You can get this list on your calculator by pressing ** toolbox** and going to

`array(list)`

Creates an array from a list.

`arange(start,stop)`

Returns an array of integers from `start`

to `stop-1`

.

`concatenate((a,b))`

Returns an array that joins array `b`

to array `a`

.

`linspace(start,stop,n)`

Returns an array of `n`

values evenly spaced over the specified interval.

`ones(n)`

Returns an array of size `n`

filled with ones.

`zeros(n)`

Returns an array of size `n`

filled with zeros.

`array.flatten()`

Returns a copy of an array collapsed into one dimension.

`array.reshape((n,m))`

Transforms an array to an array of size `(n,m)`

.

`array.shape`

Returns the size of the array in the form `(n,m)`

.

`array.tolist()`

Converts an array into a list.

`array.transpose()`

Returns a transposed array.

`argmax(a)`

Returns the indicies of the maximum values.

`argmin(a)`

Returns the indicies of the minimum values.

`dot(a,b)`

Returns the dot product of two arrays.

`cross(a,b)`

Returns the cross product of two arrays.

`max(a)`

Returns the maximum of the elements.

`min(a)`

Returns the minimum of the elements.

`mean(a)`

Returns the mean of the elements.

`median(a)`

Returns the median of the elements.

`polyfit(x,y,d)`

Fits a polynomial regression of degree `d`

to the points `(x,y)`

Returns a vector of coefficents that minimizes the squared error in the order `d`

, `d-1`

,…`0`

.

`polyval(p,x)`

Evaluates the polynomial `p`

at `x`

.

`size(a)`

Returns the number of elements in the array.

`sort(a)`

Sorts the array in ascending order.

`std(a)`

Returns the standard deviation of the elements.

`sum(a)`

Returns the sum of the elements.

This is the complete description of the `turtle`

module. You can get this list on your calculator by pressing ** toolbox** and going to

`forward(x)`

Move forward by `x`

pixels.

`backward(x)`

Move backward by `x`

pixels.

`right(a)`

Turn right by `a`

degrees.

`left(a)`

Turn left by `a`

degrees.

`goto(x,y)`

Move to (`x`

,`y`

) coordinates.

`setheading(a)`

Set the orientation by `a`

degrees.

`circle(r)`

Circle of radius `r`

pixels.

`speed(x)`

Drawing speed (`x`

between 0 and 10).

`position()`

Return the current (`x`

,`y`

) location.

`heading()`

Return the current heading.

`pendown()`

Pull the pen down.

`penup()`

Pull the pen up.

`pensize(x)`

Set the line thickness to `x`

pixels.

`write("text")`

Writes the text placed as an argument at the position of the turtle.

`isdown()`

Return `True`

if the pen is down.

`reset()`

Reset the drawing.

`showturtle()`

Show the turtle.

`hideturtle()`

Hide the turtle.

`color('c')`

or `color(r,g,b)`

Set the pen color.

`colormode(x)`

`colormode(1.0)`

changes the color mode to 1.0 and the colors must be defined by tuples of type `(0.5,1.0,0.5)`

while `colormode(255)`

changes the color mode to 255 and the colors are then defined by tuples of type `(128,255,128)`

. By default the color mode is 255.

`blue`

Blue color.

`red`

Red color.

`green`

Green color.

`yellow`

Yellow color.

`brown`

Brown color.

`black`

Black color.

`white`

White color.

`pink`

Pink color.

`orange`

Orange color.

`purple`

Purple color.

`grey`

Gray color.

This is the complete description of the `random`

module. You can get this list on your calculator by pressing ** toolbox** and going to

`getrandbits(k)`

Returns an integer with `k`

random bits.

`seed(x)`

Initialize the random number generator.

`randrange(start,stop)`

Returns a random number in `range(start,stop)`

.

`randint(a,b)`

Returns an integer in `[a,b]`

.

`choice(list)`

Returns a random number in the list.

`random()`

Returns a random floating point number in `[0,1)`

.

`uniform(a,b)`

Returns a random floating point number in `[a,b]`

.

This is the complete description of the `kandinsky`

module. You can get this list on your calculator by pressing ** toolbox** and going to

`color(r,g,b)`

Defines the color from the values of `r`

,`g`

,`b`

. You can also simply use a tuple to define a color: `(r,g,b)`

.

`get_pixel(x,y)`

Returns the pixel `x`

,`y`

color as a tuple `(r,g,b)`

.

`set_pixel(x,y,color)`

Colors the pixel `x`

,`y`

of the `color`

color.

`draw_string(text,x,y,[color1],[color2])`

Displays `text`

from the pixel `x`

,`y`

. The arguments `color1`

(text color) and `color2`

(background color) are optional.

`fill_rect(x,y,width,height,color)`

Fills a rectangle at pixel `(x,y)`

with the color `color`

.

This is the description of the `ion`

module. You can get this list on your calculator by pressing ** toolbox** and going to

`keydown(k)`

Returns `True`

if the `k`

key in argument is pressed and `False`

otherwise.

The other items in this menu indicate the syntax used to identify the keys on the keyboard.

Here is the description of the `time`

module. You can get this list on your calculator by pressing ** toolbox** and going to

`monotonic()`

Returns the value of the clock at the time the function is called.

`sleep(t)`

Pauses execution for `t`

seconds.

In the script editor, the menu of the ** var** key lists the autocompletion suggestions available.

In the execution console, the menu of the key ** var** lists all the functions defined in your imported scripts (not containing any error) as well as the global variables.

The ** toolbox** key menu contains four sections for faster editing of your scripts.

Contains instructions for `for`

and `while`

loops as well as `if`

tests.

Contains the functions available in the `math`

, `cmath`

, `random`

, `matplotlib.pyplot`

, `ion`

, `time`

, `turtle`

and `kandinsky`

modules.

Contains the functions that can be used in Python, especially those of the modules but also functions like `print()`

and `input()`

. An alphabetical search with the letters of the keyboard is possible.

Contains instructions for defining a function: `def function(argument):`

and `return`

.