aboutsummaryrefslogtreecommitdiffstats
path: root/astro/cosmo_calc/ddivid.cc
diff options
context:
space:
mode:
Diffstat (limited to 'astro/cosmo_calc/ddivid.cc')
-rw-r--r--astro/cosmo_calc/ddivid.cc56
1 files changed, 0 insertions, 56 deletions
diff --git a/astro/cosmo_calc/ddivid.cc b/astro/cosmo_calc/ddivid.cc
deleted file mode 100644
index aa72471..0000000
--- a/astro/cosmo_calc/ddivid.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <cassert>
-
-double ddivid(double (*foo)(double),double x1,double x2,double err)
-{
- assert(x2>x1);
- assert(foo(x2)*foo(x1)<0);
- while(x2-x1>err)
- {
- double x=(x2+x1)/2.;
- double y=foo(x);
- double y1=foo(x1);
- double y2=foo(x2);
- if(y1*y<0)
- {
- x2=x;
- }
- else if(y2*y<0)
- {
- x1=x;
- }
- else
- {
- assert(0);
- }
-
- }
- return (x1+x2)/2.;
-}
-
-
-double ddivid(double (*foo)(double),double z,double x1,double x2,double err)
-{
- assert(x2>x1);
- assert((foo(x2)-z)*(foo(x1)-z)<0);
- while(x2-x1>err)
- {
- double x=(x2+x1)/2.;
- double y=foo(x)-z;
- double y1=foo(x1)-z;
- double y2=foo(x2)-z;
- if(y1*y<0)
- {
- x2=x;
- }
- else if(y2*y<0)
- {
- x1=x;
- }
- else
- {
- assert(0);
- }
-
- }
- return (x1+x2)/2.;
-}