
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
differential-solver
Advanced tools
A simple Typescript Library for Approximating Solutions to Ordinary Differential Equations using Euler's method.
This project is very simple, but is a proving ground for my future ideas for Mathematics in JS/TS.
Installation is easy using NPM:
Install it directly from NPM
npm i differential-solver
From GitHub
npm i github.com/cooperw824/differential-solver
From Source
git clone github.com/cooperw824/differential-solver
cd path/to/project
npm i path/to/differential-solver
To start, create a new DifferentialEquation object:
new DifferentialEquation(
differential:(x: number, y:number) => number,
independentVarInitialCondition:number,
dependentVarInitialCondition:number )
The DifferentialEquation class takes three parameters:
The Differential Equation to Evaluate (Required)
(x: number, y: number) => number;
The Independent Variable's (x-value) Initial Condition (Required)
The Dependent Variable's (y-value) Initial Condition (Required)
In typescript:
import {DifferentialEquation} from 'differential-solver';
let differential = new DifferentialEquation((x + y) => x+y, 0, 1);
In JavaScript:
import {DifferentialEquation} from 'differential-solver'; // ES Modules Import
// const { DifferentialEquation } = require('differential-solver'); // CommonJS Import
let differential = new DifferentialEquation((x + y) => x+y, 0, 1);
eulersMethod(
targetIndependentVariable: number,
steps: number,
options?: EulersMethodOptions)
To approximate the solution of Differential Equation at certain independent variable, make a call to the Euler's Method function
The Euler's Method function has two different modes: recursive and non recursive, they both return the same answer, but if your desired number of steps is too large you may want to use the non-recursive version.
By default the non-recursive function runs:
import {DifferentialEquation} from 'differential-solver';
let differential = new DifferentialEquation((x + y) => x+y, 0, 1);
// approximates f(1) in 3 steps, when dy/dx = x + y and f(0) = 1
let approximation = differential.eulersMethod(1, 3)
console.log(approximation)
// prints: 2.741
To add more decimals after the decimal point:
import {DifferentialEquation} from 'differential-solver';
let differential = new DifferentialEquation((x + y) => x+y, 0, 1);
// approximates f(1) in 3 steps, when dy/dx = x + y and f(0) = 1
let approximation = differential.eulersMethod(1, 3, {rounding: 10})
console.log(approximation)
// prints: 2.7407407407
Using the recursive version is as easy as setting the recursive option to true:
import {DifferentialEquation} from 'differential-solver';
let differential = new DifferentialEquation((x + y) => x+y, 0, 1);
// approximates f(1) in 3 steps, when dy/dx = x + y and f(0) = 1
let approximation = differential.eulersMethod(1, 3, {recursive: true})
console.log(approximation)
// prints: 2.741
To add more decimals after the decimal point:
import {DifferentialEquation} from 'differential-solver';
let differential = new DifferentialEquation((x + y) => x+y, 0, 1);
// approximates f(1) in 3 steps, when dy/dx = x + y and f(0) = 1
let approximation = differential.eulersMethod(1, 3, {rounding: 10, recursive: true})
console.log(approximation)
// prints: 2.7407407407
evaluateDifferential(independentVar?: number,
dependentVar?: number,
rounding?: number)
Returns the value of the derivative at the given point
Using initial condition:
import {DifferentialEquation} from 'differential-solver';
let differential = new DifferentialEquation((x + y) => x+y, 0, 1);
let derivative = differential.evaluateDifferential()
console.log(derivative)
// Prints 1
Using given values:
import {DifferentialEquation} from 'differential-solver';
let differential = new DifferentialEquation((x + y) => x+y, 0, 1);
let derivative = differential.evaluateDifferential(3.14159, 2.718)
console.log(derivative)
// Prints 5.85959
Using given values, and given rounding:
import {DifferentialEquation} from 'differential-solver';
let differential = new DifferentialEquation((x + y) => x+y, 0, 1);
let derivative = differential.evaluateDifferential(3.14159, 2.718, 3)
console.log(derivative)
// Prints 5.86
// 5.85959 rounds to 5.86
A build is packaged with the code in the dist folder, but to build the program on windows you can just run
npm run build
for other operating systems you may need to adjust the fixup script and copy command.
This is a very small library, but acts as my proving ground for building future JS / TS modules. I have a few ideas for expanding this, but if you have any issues or ideas please open a GitHub issue.
If you have a feature you would to add, fork the repository, implement your feature, add / verify tests, and then open your pull request.
FAQs
Euler's Method Differential Equations Solver
We found that differential-solver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.