summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/base/ode.asy
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/asymptote/base/ode.asy')
-rw-r--r--Build/source/utils/asymptote/base/ode.asy15
1 files changed, 15 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/base/ode.asy b/Build/source/utils/asymptote/base/ode.asy
new file mode 100644
index 00000000000..5135dd9443f
--- /dev/null
+++ b/Build/source/utils/asymptote/base/ode.asy
@@ -0,0 +1,15 @@
+real euler(real y, real f(real x, real y), real a, real b=a, int n=0,
+ real h=0, bool dynamic=false, real tolmin=0, real tolmax=0)
+{
+ if(h == 0) {
+ if(b == a) return y;
+ if(n == 0) abort("Either n or h must be specified");
+ else h=(b-a)/n;
+ }
+ real x=a;
+ for(int i=0; i < n; ++i) {
+ y += h*f(x,y);
+ x += h;
+ }
+ return y;
+}