Skip to content

Instantly share code, notes, and snippets.

@ti-nspire
ti-nspire / rkClassic.lua
Last active October 10, 2017 04:02
rkClassic.lua
-- Lua で常微分方程式を解く / 古典的ルンゲクッタ法
-- http://ti-nspire.hatenablog.com/entry/2017/07/19/143509
function rkClassic(funcs, t0, inits, h, numOfDiv)
local unpack = unpack or table.unpack
local step = h
local t0 = t0
local inits = inits
local dim = #funcs
@ti-nspire
ti-nspire / rkShanks8.lua
Last active September 8, 2017 22:40
rkShanks8.lua
function rkShanks8(funcs, t0, inits, h, numOfDiv)
local unpack = unpack or table.unpack
local step = h
local t0 = t0
local inits = inits
local dim = #funcs
local numOfDiv = numOfDiv or 1
local h = h / numOfDiv
@ti-nspire
ti-nspire / nystroem.lua
Last active October 19, 2017 01:34
nystroem.lua
-- Lua で常微分方程式を解く / 特殊な方程式に対するナイストレム法
function nystroem(funcs, t0, inits, initsDot, h, numOfDiv)
local unpack = unpack or table.unpack
local t0 = t0
local inits = inits
local initsDot = initsDot
local dim = #funcs
local numOfDiv = numOfDiv or 1
@ti-nspire
ti-nspire / fehlberg.lua
Last active October 28, 2017 07:46
fehlberg.lua
-- Lua で常微分方程式を解く / フェールベルク法
function fehlberg(funcs, t0, inits, h, tol)
local unpack = unpack or table.unpack
local t0 = t0
local inits = inits
local dim = #funcs
local tol = tol or 0.001
@ti-nspire
ti-nspire / cowell4.lua
Last active December 20, 2017 01:46
cowell4.lua
-- Lua による常微分方程式の数値解法 / 4 段のカウエル法
function cowell4(funcs, t0, inits, h)
local unpack = unpack or table.unpack
local t0 = t0
local inits = inits
local function maxOfErr(listA, listB)
local sute = {}
for i = 1, #listA do
@ti-nspire
ti-nspire / extrapolation.lua
Last active December 18, 2017 02:19
extrapolation.lua
-- Lua による常微分方程式の数値解法 / 補外法
function extrapolation(funcs, t0, inits, h, numOfDiv)
local unpack = unpack or table.unpack
local numOfDiv = numOfDiv or 1
local step = h
local h = h / numOfDiv
local t0 = t0
local inits = inits
@ti-nspire
ti-nspire / gragg.lua
Last active October 17, 2017 04:50
gragg.lua
-- Lua で常微分方程式を解く / Gragg 法
function gragg(funcs, t0, inits, initsDot, h, numOfDiv)
local unpack = unpack or table.unpack
local numOfDiv = numOfDiv or 1
local step = h
local h = h / numOfDiv
local t0 = t0
@ti-nspire
ti-nspire / cowell7.lua
Last active December 11, 2017 02:08
cowell7.lua
-- Lua で常微分方程式を解く / 7 段のカウェル法
function cowell7(funcs, t0, inits, h)
local unpack = unpack or table.unpack
local t0 = t0
local inits = inits
function staticVals(funcs, inits, h)
local dim = #funcs
local w = {}
local f = {{},{},{},{},{},{},{}}
@ti-nspire
ti-nspire / rkClassicClass.lua
Last active December 20, 2017 01:43
rkClassicClass.lua
-- Lua & TI-Nspire による常微分方程式の数値解法 / 古典的ルンゲクッタ法
rkClassic = class()
function rkClassic:init(funcs, t0, inits, h, numOfDiv)
self.Unpack = unpack or table.unpack
self.funcs = funcs
self.t0 = t0
self.inits = inits
self.dim = #funcs
@ti-nspire
ti-nspire / NystroemClass.lua
Last active December 20, 2017 01:45
NystroemClass.lua
-- Lua & TI-Nspire による常微分方程式の数値解法 / ナイストレム法
Nystroem = class()
function Nystroem:init(funcs, t0, inits, initsDot, h, numOfDiv)
self.Unpack = unpack or table.unpack
self.funcs = funcs
self.t0 = t0
self.inits = inits
self.initsDot = initsDot