[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
New release (v0.8.10rc1)
After making certain claims in comp.text.tex, I had to add a couple of
features. :)
There's a "segment" data structure consisting of two <pair>s, together
with functions for taking the midpoint, translating a segment, or
intersecting two segments:
segment L1 = segment(P(0,0), P(-1,2));
segment L2 = join(P(-2,0), P(1,2));
segment L3 = translate(P(0,1), L1); // translate L1 by (0,1)
pair P1 = midpoint(L3);
pair P2 = intersect(L1,L2);
There's no real error handling; it is a fatal error to intersect parallel
segments, for example.
There's also a working (if simple) implementation of Newton's method, e.g.
double f(double x) { return exp(x) - 4*x; }
double x1 = newton(f, 0);
The second argument is an initial guess. The algorithm terminates normally
when successive guesses are closer than EPIX_EPSILON (10^-4, not very
accurate mathematically speaking, but usually well below the threshold of
visibility), and exits with a warning if more than 20 iterations occur or
a critical point is hit. On abnormal exit, the current guess is returned,
which is almost surely wrong.
--Andy
Andrew D. Hwang ahwang at mathcs dot holycross dot edu
Department of Math and CS http://mathcs.holycross.edu/~ahwang
College of the Holy Cross (508) 793-2458 (Office: 320 Swords)
Worcester, MA, 01610-2395 (508) 793-3530 (fax)