Machine Learning Math – Solution To A Stiff Differential Equation

Solved a stiff diff equation using the chainer python module. Taken from wikipedia. The way I did it was to iterate with rng() random as the input with a while loop. That is. Iterate until the model(rng()) outputs the correct number.

Some problems were that dt could not be too small or it would get zero for update(). So I put it at 0.01 which I think is pretty high.

The loop for the initial model outputs.

y0 = model0(rng()) # previous value, y0
y1 = model1(rng()) # next value, y1
yp = (y1-y0)/dt # derivate
loss_eq = F.mean_squared_error(yp,-15*y0) # first error loss equation
loss_initial = F.mean_squared_error(init,y0) # inital error loss
loss = loss_eq + loss_initial
optimizer0.update() # update each model0, model1

source: diff eq y0 = model(rng),y1 = model(rng),dt = model(rng)(1)

dt could not be a model since it was so picky. Had to set it dt = 0.01