Published
Edited
Jul 9, 2018
Insert cell
Insert cell
Insert cell
Insert cell
class ODE_Solvers
{
constructor(derivative, initial_condition, x, steps = 1000)
{
this.derivative = derivative;
this.initial_condition = initial_condition;
this.delta = (x - this.initial_condition[0]) / steps;
this.steps = steps;
}
solve()
{
throw new Error("Implementation Required");
}
}
Insert cell
Insert cell
Insert cell
class EulersMethod extends ODE_Solvers
{
constructor(derivative, initial_condition, x, steps = 1000 )
{
super(derivative, initial_condition, x, steps);
}
solve()
{
this.current_point = this.initial_condition;
for(let i = 0; i < this.steps; i++)
{
this.current_point[0] += this.delta;
this.current_point[1] += this.delta * this.derivative(this.current_point[0], this.current_point[1]);
}
return this.current_point;
}
}
Insert cell
Insert cell
Insert cell
Insert cell
new EulersMethod(derivative, initial_condition, x_goal).solve()[1]
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more