You are here

Math

Mathematical functions

matrix_solve.bas

SmallBASIC implementations: 
SmallBASIC syntax groups: 


'program to solve a matrix equation of the form [a]*[b]=[c]
'[a] is a known square matrix
'[b] is an unknown matrix with the same number of rows as [a] has columns
'[c] is a known matrix

'edit matrix size and element values below - data line = row

'known square matrix

planetary_system.bas

SmallBASIC implementations: 
SmallBASIC syntax groups: 


' a star and planetary system governed by newton's laws.
' when the escape velocity of a planet is exceded, it's trajectory turns red
' the range of x values on the screen is -130 to +130
' the range of y values on the screen is -100 to +100

WINDOW -640, -512,640, 512

func gryb (yb, yp, ys, yt) = mp * (yp - yb) / rbp + ms * (ys - yb) / rbs + mt * (yt - yb) / rbt
func grxb (xb, xp, xs, xt) = mp * (xp - xb) / rbp + ms * (xs - xb) / rbs + mt * (xt - xb) / rbt
func gryp (yb, yp, ys, yt) = ms * (ys - yp) / rps + mb * (yb - yp) / rbp + mt * (yt - yp) / rpt

Lorrentz_Attractor.bas

SmallBASIC syntax groups: 
File name: Lorrentz Attractor
Category: Mathematics


' Plot of the "Strange Attractor"
' Define 3 differential equations
func lxt (x, y) = 10 * (y - x)
func
lyt (x, y, z) = 28 * x - y - x * z
func
lzt (x, y, z) = x * y - 8 * z / 3

MAX

SmallBASIC syntax groups: 


Math function MAX


10
20  MAX (…)
30
Maximum value of parameters.


See examples

LINEQN

SmallBASIC syntax groups: 


Math function LINEQN


10
20  LINEQN (a, b [, toler])
30
Returns an array with the values of the unknowns. This function solves equations using the Gauss-Jordan method.


See examples

Pages

Subscribe to RSS - Math