lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

      I started putting together a set of libraries under a github repository( to build a Math package for Lua. I needed something I could use from the standard latest Lua interpreter directly so can be embedded into programs that embed the standard interpreter. I am building it as I need features. For now it has the following:

- Complex numbers (Thanks to library from Philippe Castagliola
- Basic plotting (Using IUP and help from Steve Donovan's code
- Solving single variable equations using Newton Raphson method

An example for plotting a bode plot is this:

local plot = require "lua-plot" 

function func(s)
return 1000/((1+s)*(1+s/100))

local bp = plot.bodePlot{
func = func,
ini = 0.01,
finfreq = 1000,
steps = 20

bp.mag:Show({title="Magnitude Plot",size="HALFxHALF"})
bp.phase:Show({title="Phase Plot",size="HALFxHALF"})

More stuff is welcome.