1 | var R = require("../rlab");
|
2 |
|
3 | // ODE (ordinary differential equation) : dopri() is an implementation of the Dormand-Prince-Runge-Kutta integrator with adaptive time-stepping
|
4 | // https://en.wikipedia.org/wiki/Dormand%E2%80%93Prince_method
|
5 | var ode = R.ODE(0,1,1,(t,y)=>y);
|
6 | print('ode(0,1,1,(t,y)=>y)=', ode.strM());
|
7 | print('at([0.3,0.7])=', ode.at(0.3,0.7));
|
8 |
|
9 | // linear programming
|
10 | print('LP:', R.solveLP([1,1], /* minimize [1,1]*x */
|
11 | [[-1,0],[0,-1],[-1,-2]], /* matrix of inequalities */
|
12 | [0,0,-3]) /* right-hand-side of inequalities */
|
13 | );
|
14 |
|
15 | // Unconstrained minimization
|
16 | var sqr = (x)=>x*x;
|
17 | print('minimize(...) =', R.minimize((x)=>sqr(10*(x[1]-x[0]*x[0]))+sqr(1-x[0]),[-1.2,1])); |
\ | No newline at end of file |