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
# Python version of Euler's method # originally using the sequence app # in Numworks tutorial # https://youtu.be/JIc2p6jtGhs?si=QwTqrjLIRexZK6hJ from math import * # parameters h=0.25 # x step x_init=1 # initial values y_init=4 n_iter=8 # number of steps # function defines differential # equation by returning value # of derivative of y def dy_dx(x,y): value_dy_dx=sqrt(x)*y return value_dy_dx x=x_init # start with initial values y=y_init print("{0:<6} {1:<10}".format("x","y")) print("-"*10) for _ in range(n_iter): print("{0:<6} {1:<10.10f}".format(x,y)) # calculate new y value using Euler y+=dy_dx(x,y) * h x+=h