Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zo-bro-23/euler-method
NPM package for approximating differential equations (using Euler's method)
https://github.com/zo-bro-23/euler-method
Last synced: about 2 months ago
JSON representation
NPM package for approximating differential equations (using Euler's method)
- Host: GitHub
- URL: https://github.com/zo-bro-23/euler-method
- Owner: Zo-Bro-23
- Created: 2023-02-03T08:14:04.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-04T01:09:41.000Z (almost 2 years ago)
- Last Synced: 2024-11-23T21:04:23.829Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://euler-method.vercel.app
- Size: 482 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Euler-Method
> ***Web version live [here](https://euler-method.zohan.tech)!***This is a package for approximating (numerically) the solution to differential equations of the form $y'=f(x,y)$ where $y$ is an implicit function of $x$ and $f(x,y)$ is a function of both $y$ and $x$. [Learn more](https://en.wikipedia.org/wiki/Euler_method).
```js
const eulerMethod = require('euler-method')
console.log(eulerMethod('y', 100, { x: 0, y: 1 }, 0.3))
```### **```eulerMethod(func, iterations, initial, final)```**
#### func - ```Required``` - The mathematical function to evaluate - Ommit the $y'$ part (Input `'y'` for the differential equation $y'=y$, for example) - Uses ```mathjs``` formatting - See [here](https://mathjs.org/docs/expressions/syntax.html) for more information
#### iterations - ```Default: 100``` - Number of times to iterate Euler's Method - More times yields more accurate results (but takes more time)
#### initial - ```Default: { x: 0, y: 1 }``` - A value that is guarenteed to be on the function - Due to the Fundamental Theorem of Calculus, differential equations have an infinite amount of solutions (determined up to a constant), so an "initial" value needs to be provided to calculate a unique value for the function
#### final - ```Default: 0.3``` - This is the value for which the function will be approximated to - The $y$ value will be outputed for this particular $x$ value - Using $y'=y$, for example, a `final` value of $10$ will give the value for $y$ when $x=10$
## Result
```js
{ x: 0.3000000000000002, y: 1.3492527193665074 }
```