Name Description Size Visibility
This code tests the matplotlib library of the calculator. It plots ballistic trajectories for a series of different starting angles. It uses libraries math, numpy and matplotlib.pyplot. This code can run on CPython as well. Tested on the calculator using software version 23.2.6.
378 Bytes Public
Bezier curves This script defines functions which can draw Bezier curves using the kandinsky library the function that does the actual drawing is: draw_bezier(funct_bezier,points,Nsteps,col) funct_bezier: either bezier1(), bezier2() or bezier3() points is a list or tuple of (x,y) Nsteps: number of points calculated, are connected with straight lines col: color to draw
2.27 KB Public
By entering the color-bands of a resistor this scripts gives the value and tolerance. Works with 4 band or 5 band resistors. The script also runs in CPython on a PC. Tested on the calculator using software version 23.2.6.
1.58 KB Public
convert number from one base to another base Although micropython can do these convertions using int(), hex(), oct() and bin(). The convertion is coded in Python for fun. There are two functions defined, first function converts from arbitrary base to base 10, second fucntion converts from base 10 to new base tobase10(s, base) convert number to base 10 s: string representation of number base: integer stating number base of s returns: integer version of s in base 10 frombase10(x, base) convert number from base 10 to another base x: integer representation of number base: integer stating number base to convert to returns: string representation of x in new base
1.42 KB Public
Quadratic equations solving using the Durand–Kerner method x**4 + a * x**3 + b * x**2 + c * x + d = 0 The quadratic equation can be solved using a number of iterations according to the Durand–Kerner method. The script accepts the values for coefficients a,b,c,d. It then lists the roots with the residual. Roots can be complex numbers. The script uses no imported libraries, it can also run in CPython on a PC.
3.01 KB Public
There is no closed-form expression for the circumference of an ellipse. This script approximates the circumference using the sum of a series. Height and width can be given, the ellipse is also plotted. Uses math and matplotlib. Tested on the calculator using software version 23.2.6.
1.12 KB Public
This script draws an “Euler’s Spiral” also known as “Cornu Spiral”. Two Fresnel integrals have to be calculated, this code uses a Maclaurin series approximation. It also uses a function coded in Python to draw a line between any two x,y points. It is possible to draw this spiral using the Numworks calculator’s graphing app as well.
1.35 KB Public
Euler’s method using Python On the English YouTube channel of Numworks, there is a tutorial on using the sequences app to apply Euler’s method on a differential equation: Euler’s method using sequences This script does the same calculations, using Python instead. The differential equation: dy/dx = sqrt(x) * y y(1) = 4 For Euler’s method step h=0.25 Tested on the Numworks calculator using software version 24.3.0
661 Bytes Public
EXECUTIVE DECISION MAKER This script is inspired on a device Radio Shack used to sell. Meant as a joke it generates random “executive decisions”. A bit of animation is build in. The script uses the following libraries: kandinsky for drawing and text positioning ion to react on key press time to time the simple animations random to generate the random decisions
1.17 KB Public
The Kandinsky library has functions to directly draw to the screen but it does not contain a function to draw a line between any two points or a function to draw circles. This script defines function connect() which draws a line between two given points and function circle() to draw circles. It uses kandinsky.set_pixel(). The script also contains a test of that function drawing several lines of different color. Tested on the calculator using software version 23.2.6.
1.42 KB Public
This script draws a fedora using the kandinsky library. The drawn shape appears opaque. Tested on the calculator using software version 23.2.6.
482 Bytes Public
The Numworks calculator has the Regression app to find polynomials which best fit given data. The calculator’s Python app has a numpy library which contains the function polyfit() for the same purpose. Another function called polyval() evaluates a polynomial for a set of x values. This script demonstrates numpy.polyfit() and numpy.polyval(). Tested on the calculator using software version 23.2.6. Also works in CPython on a PC
844 Bytes Public
This script draws a “Gingerbread man” fractal. The shape is generated by applying a simple iteration and plotting the x,y values. It has an extra function which keeps track of the distance between successive x,y points in the iterations, this is used to derive the color of the points to make the fractal look more interesting visually. It uses the kandisnky and math libraries. Tested on the calculator using software version 23.2.6.
624 Bytes Public
Defines a function heronarea() which calculates the area of a triangle in terms of the three side lengths. The function can be called with the three lengths as parameters or without parameters. This code can run on CPython as well. Tested on the calculator using software version 23.2.6.
534 Bytes Public
Julia Fractal This code displays a colorful Julia Fractal. It uses the kandinsky and math modules.
611 Bytes Public
King’s Dream Fractal This script draws the fractal defined by iterating the x,y values through the following function x = sin(a*x) + b*sin(a*y) y = sin(c*x) + d*sin(c*y) with constants of a = 2.879879 b = -0.765145 c = -0.966918 d = 0.744728 and initial values of x=2, y=0 At each point x,y the screen color is retrieved and increased The script uses the kandinsky and math libraries. Tested on the calculator using software version 23.2.6.
661 Bytes Public
Koch Snowflake The Koch Snowflake is a fractal curve. The Antisnowflake is a variation. This script uses recursion to construct the fractal. Drawing is done using the turtle module. Two Python functions are defined: draw_koch_curve(length, recursion_depth, draw_anti_snowflake = False) This function draws a Koch curve which is used for the sides of the snow flakes. It calls itself recursively to construct the fractal shape draw_koch_snowflake(center_xy, length_side, recursion_depth, draw_anti_snowflake = False): This function calls draw_koch_curve() three times to draw the snowflake
1.8 KB Public
Linear and polynomial interpolation using Lagrange polynomial try from wikipedia using info from: Linear interpolation Lagrange polynomial Polynomial interpolation Linear interpolation (x0,y0) (x1,y1) succesive data points y1 - y0 y = y0 + (x - x0) ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ x1 - x0 Lagrange polynomial xi, yi : data points n ⎛ x - xj ⎞ p(x) = ∑ ⎜ ∏ ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ ⎟ yi i=0 ⎝ 0≤j≤n xi - xj ⎠ j≠i Lagrange polynomial in second barycentric form xj, yj: data points, wj: barymetric weight wj = ∏ (xj - xm)⁻¹ m≠j k ⎛ wj ⎞ ∑ ⎜ ⎯⎯⎯⎯⎯⎯⎯ yj ⎟ j=0 ⎝ x - xj ⎠ p(x) = ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ k ⎛ wj ⎞ ∑ ⎜ ⎯⎯⎯⎯⎯⎯⎯ ⎟ j=0 ⎝ x - xj ⎠
3.34 KB Public
Leibniz formula for approximation of pi pi ≈ 4 * sum[ (-1)**k / (2*k + 1) ] for k=0 .. inf The script shows the approximation after a first number of iterations. Matplotlib and numpy are used to plot the values. The code optimises the formula by using a variable “denom” which starts at 1 and increases by 2 instead off calculating (2*k + 1) each iteration using variable “sign” which toggles between +1 and -1, instead off calculating (-1)**k
1007 Bytes Public
This script plots sets of 3 expressions x=f(t),y=g(t),z=h(t)using a simple 3D projection. The expressions to plot are defined in a python function which takes one argument t and returns three values for x,y and z. . Plotting is performed by python function line() which takes arguments telling it which function to plot and the ranges on parameter t, and x, y, z axis. An optional text string can be added to the plot. It uses only the math and kandinsky libraries. Tested on the calculator using software version 23.2.6.
1.95 KB Public
The Kandinsky library has functions to directly draw to the screen but it does not contain a function to draw a line between any two point. This script defines function connect() which draws a line between two given points. It uses kandinsky.set_pixel(). The script also contains a test of that function drawing several lines of different color. Tested on the calculator using software version 23.2.6.
781 Bytes Public
Function logistic_map() draws the bifurcation diagram of the logistic map on the screen. Uses libraries math and kandinsky. Can be used with 2 parameters logistic_map(astart, aend). Tested on the calculator using software version 23.2.6.
505 Bytes Public
This script draws a sample solution to the Lorenz System. it uses a simple Euler method to calculate the values. The graph is drawn using kandinsky, it also uses the math library. Tested on the calculator using software version 23.2.6.
1.64 KB Public
Lotka–Volterra predator–prey model This script calculates and plots a solution to the predator–prey model. It uses a simple Euler method, values are stored in numpy arrays for memory efficiency. Lotka–Volterra system is defined by two first order ODEs: dx/dt = alpha.x - beta.x.y dy/dt = -gamma*y + delta.x.y x is the prey population y is the predator population density alpha is the maximum prey per capita growth rate beta is the effect of the presence of predators on the prey death rate gamma is the predator’s per capita death rate delta is the effect of the presence of prey on the predator’s growth rate The script imports numpy and matplotlib.
1.88 KB Public
Determine machine epsilon through test Machine epsilon is smallest value such that (1.0 + epsilon) is still distinguishable from 1.0 by the system In CPython implementations this value can be found directly using import sys print(sys.float_info.epsilon) However the micropython of Numworks does not have a sys module
555 Bytes Public
There is a official Numworks Mandelbrot script. This is a different version made from scratch. Uses the library kandinsky. Tested on the calculator using software version 23.2.6.
309 Bytes Public
This code displays a text output of the Mandelbrot fractal. The text is colored, to achieve this the kandinsky library is used with the draw_string() function. The last digit of the hexadecimal Mandelbrot values is displayed. The color also depends on the value.
661 Bytes Public
Mass-Spring-Damper This script plots a solution for the dampened mass-spring system using a simple Euler method. The second degree ODE has to be modified into two first order ODEs. d²x/dt²+ 2*ζ*ωn*dx/dt + ωn²*x = 0 v = dx/dt => dv/dt + 2*ζ*ωn*v + ωn²*x = 0 => dv/dt = -2*ζ*ωn*v - ωn²*x dx/dt = v ωn = sqrt(k/m) ζ = c/(2*m*ωn) Undamped systems ζ = 0 Underdamped systems ζ < 1 Critically damped systems ζ = 1 Overdamped systems ζ > 1 The script uses matplotlib for plotting.
1.37 KB Public
Mass-Spring-Damper system using Runge-Kutta method This script plots a solution for the dampened mass-spring system using a Runge-Kutta method. The second degree ODE has to be modified into two first order ODEs. d²x/dt²+ 2*ζ*ωn*dx/dt + ωn²*x = 0 v = dx/dt => dv/dt + 2*ζ*ωn*v + ωn²*x = 0 => dv/dt = -2*ζ*ωn*v - ωn²*x dx/dt = v ωn = sqrt(k/m) ζ = c/(2*m*ωn) Undamped systems ζ = 0 Underdamped systems ζ < 1 Critically damped systems ζ = 1 Overdamped systems ζ > 1 The script uses matplotlib for plotting.
1.85 KB Public
matrix This script defines two functions, they can be used to solve a linear system of 2 equations with 2 variables linear system of 3 equations with 3 variables of the form A.x = b The functions are: solve_system_2(A, b) solve_system_3(A, b) A is 2x2 or 3x3 matrix containing the coefficients b is a 2 or 3 element vector containing the constants The matrix and vector are processed as Python lists example: A=[[6, -5], [-7, 2]] b=[2, -3]
3.27 KB Public
This uses Monte Carlo method to calculate the effect of resistor spread on the output voltage of a 2 resistor voltage divider. The function montecarlo can be used with or without arguments. Numpy and matplotlib are used, a histogram is displayed at the end. Tested on the calculator using software version 23.2.6.
1.15 KB Public
This script displays a simplified “Mystify” screensaver known from past versions of MS Windows. It uses the kandinsky library for drawing, random library for the random corner points and the time library to pace the animation. Tested on the calculator using software version 23.2.6.
1.21 KB Public
Ordinary Differential Equation This script allows to compute a solution to a first order ODE. dy/dx = f(x,y) The expression for f(x,y) can be entered along with initial conditions and other parameters. Values are calculated using a Runge-Kutta algoritm. The values for x and y can be listed. The solution is then plotted along with the slope field for the ODE.
2.89 KB Public
This ‘Ohms law helper’ allows you to type the two known variables with the unit added for example 5V or 0.1A or 10000ohm and the script automatically calculates the third variable which was unknown. Uses no imported libraries, also runs in CPython on a PC. Tested on the calculator using software version 23.2.6.
1.39 KB Public
This script simulates the trajectory of orbiting satellites. It shows one geostationary orbit and one elliptical. Uses the libraries kandinsky for output time to pace the simulation math for the sqrt() function ion to be able to stop the simulation by hitting the EXE key
1.44 KB Public
Damped, driven pendulum This script calculates a solution to the ODE for a driven pendulum with damping. I*d(dθ/dt)/dt + m*g*l*sin(θ) + b*dθ/dt = a*cos(Ω*t) This second order non linear ODE has been to be modified to a system of two first order ODEs. dω/dt = 1/I*( -g*m/l*sin(θ) - b*ω + a*cos(Ω*t) ) dθ/dt = ω The script uses a 4th order Runge-Kutta method to calculate a solution of this system. This solution is then plotted. The libraries math, numpy and matplotlib are used.
2.77 KB Public
This script demonstrates a quirk with the numpy implementation in Numworks. when tested with software version 23.2.6. When multiplying a int or float with a numpy array an error occurs if the int or float comes first. For example as in float * array. When the array comes first as in array * float the operation works fine. Also converting the int or float to a one element array eliminates the error.
733 Bytes Public
Two-dimensional Lattice random walk This script shows random walks on a 2D lattice. When the walk goes beyond limits the process starts over. The script uses the turtle library for drawing and the random library to choose a random heading at each step
709 Bytes Public
This script defines a number of functions to calculate the impedance of resistor - capacitor combinations zcap(c,f) impedance of capacitance c at frequency f, returns a complex number for impedance zseries(r,c,f) impedance of series resistance r and capacitance c at frequency f, returns a complex number for impedance zparall(r,c,f) impedance of parallel resistance r and capacitance c at frequency f, returns a complex number for impedance z_all() to keep things interactive, this function asks for input values and returns impedance of bith series and parallel combinations Exponential notation can be used to input values for example 1e-6 for a capacitance value means 0.000001 Farad or 1 micro Farad The code also runs on CPython on a PC
668 Bytes Public
recursive_tree_numworks.py This script draws recursively generated trees. The function def branch(length, depth, width): recursively calls itself, when recursion limit is not yet reached it draws a branch and calls itself twice after changing the heading when recursion limit is reached it draws a leaf A lot of the tree’s parameters have random variation. The code uses Turtle graphics for drawing, the timer function to wait after each tree and random to introduce random variations.
2.38 KB Public
This script finds the best approximation of an arbitrary resistance value using two series or two parallel resistors out of the standard E12 and E24 series. It imports no modules.Tested on the calculator using software version 23.2.6.
1.81 KB Public
This script calculates the average and root mean square values of some common waveforms. After selection of a waveform the avg and rms are shown as function of amplitude. The user can enter amplitude and in case of a pulse the duty-cycle. The numerical values for avg and rms are then calculated. The information about the waveforms is stored in a nested tuple. Only the math library is used. The code also runs on a PC using CPython.
2.03 KB Public
Numerically find multiple roots of a function. As described in NUMERICAL METHODS FOR ENGINEERS 8th Edition Incremental search for sign changes of function adapted from pseudocode on page 142 Combined with Modified False Position root finding method adapted from pseudocode on page 141 This code allows the user to enter a function of x and an interval on the x-axis. The interval is searched for sign changes, these points are further refined yielding the roots using modified false position.
5.98 KB Public
Numerically find multiple roots of a function. As described in NUMERICAL METHODS FOR ENGINEERS 8th Edition Incremental search for sign changes of function adapted from pseudocode on page 142 Combined with Modified False Position root finding method adapted from pseudocode on page 141 This code allows the user to enter a function of x and an interval on the x-axis. The interval is searched for sign changes, these points are further refined yielding the roots using modified false position. Afterwards a plot is shown of the function with the roots
6.26 KB Public
This script implements a simple Reverse Polish Notation calculator. Numbers are entered on the stack before the operators. For example 5*6= would here be entered as 5 [Exe] 6 [Exe] * [Exe] Tested on the calculator using software version 23.2.6
1.73 KB Public
This script uses the 4-order Runge-Kutta method to solve a differential equation. As example a simple exponential decay function is used. The solution is plotted together with the directly calculated exponential function. It uses libraries numpy and matplotlib.pyplot. This code can run on CPython as well. Tested on the calculator using software version 23.2.6.
899 Bytes Public
Draws a Sierpinsky triangle on the screen. Defines one function sierp(), this function can be used with 1 parameter defining the number of iterations. Uses libraries math and kandinsky. Tested on the calculator using software version 23.2.6.
341 Bytes Public
Recursive turtle drawing Sierpinsky Triangle This script uses recursive function calls to draw a Sierpinsky Triangle. The drawing is done using the turtle library
782 Bytes Public
The Numworks calculator can calculate definite integrals without coding using the Calculation or Grapher apps. However this script explores the “1/3 Simpson rule” for definite integrals. It defines the function: simpson(fun,a,b,n) fun is a python function of one variable to apply integration on a, b is the integration interval n is the number of points to be used The rest of the script generates a plot illustrating the function and showing the result as text. Tested on the calculator using software version 23.2.6.
771 Bytes Public
This code draws a rotating sphere using the kandinsky module. It also uses the sleep function of the time module and sin(), cos() from the math module. Tested on the calculator using software version 23.2.6.
711 Bytes Public
Simple but kind of pretty, a colored star. The idea came from a piece of code in the basic language encountered on the web. It uses a function connect() which allows to draw a line between two arbitrary points using set_pixel() from the kandisnky library. This sort of function is not included in kandinsky library. Tested on the calculator using software version 23.2.6.
804 Bytes Public
This implements a simple stopwatch. It uses the time module for the monotonic() function. It also uses kandinsky to put text on the screen at a fixed position and ion to detect key presses. Tested on the calculator using software version 23.2.6.
812 Bytes Public
Stopwatch which displays time in 7 segment characters similar to vintage equipment. The 7 segment characters are drawn using the function kandinsky.fill_rect() A Python dictionary contains the information that decides which segments should be visible when displaying a certain character. The on/off state is stated as boolean literals True or False. The position and orientation of the 7 segments is kept in a nested tuple. The script also uses the time and ion libraries. Tested on the calculator using software version 23.2.6.
2.64 KB Public
This script draws a 3D surface plot. The expression to plot is defined in a python function which takes 2 arguments (x,y) and returns z. Plotting is performed by python function surf() which takes arguments telling it which function to plot and the ranges on x,y and z axis. An optional text string can be added to the plot. It uses only the math and kandinsky libraries. Tested on the calculator using software version 23.2.6.
1.61 KB Public
ballistic trajectory of projectile with drag proportional to square of velocity System of first order ODEs v = sqrt(vx**2 + vy**2) dx/dt = vx dy/dt = vy dvx/dt = -mu * vx * v dvy/dt = -g - mu * vy * v These are solved numerically using Euler’s method. Plot made using matplotlib.
1.4 KB Public
This program draws a tree using recursive function calls. It uses the turtle module for the drawing. Tested on the calculator using software version 23.2.6.
790 Bytes Public
Truchet Tiles using Python & Turtle This script is a strong simplification of a version made for CPython to run on a PC see: GitHub truchet_tiles2.py This numworks version also uses the Turtle library, unlike the PC version it does not have the capability to fill a shape. This script shows a series of patterns of Truchet Tiles. The tiles are drawn using the Turtle libary. All patters are made from 4 different tiles. The patterns are defined as rows and columns of tile numbers, for this nested tuples are used: pattern_X = ( (2,4,3,4,4,2), (2,1,2,2,4,4), (3,4,4,2,2,4), (2,2,4,4,2,1), (4,2,2,4,3,4), (4,4,2,1,2,2) )
3.32 KB Public
Turtle graphics does have a circle function but no ellipse. This script defines a function to draw an ellipse using Turtle graphics. def ellipse(a, b , direction, **kwargs): a, b: size of ellipse direction: positive for counterclockwise, negative for clockwise keyword arguments: extent: part of ellipse to draw as angle in degrees npoints: number of steps to use The ellipse function is then used to draw a python logo using Turtle graphics.
2.54 KB Public
Drawing a xmas tree. Uses following modules: kandinsky for drawing random for colors of stars and position of background stars math to calculate the spirals using cos() and sin() time to pace the color changes of the stars
1.7 KB Public

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.