~peterpall/maxima/+git/maxima.code:master

Last commit made on 2024-05-08
Get this branch:
git clone -b master https://git.launchpad.net/~peterpall/maxima/+git/maxima.code

Branch merges

Branch information

Name:
master
Repository:
lp:~peterpall/maxima/+git/maxima.code

Recent commits

8a19e9e... by Raymond Toy <email address hidden>

Merge branch 'bug-4299-complex-atanh-error'

4e7bfe3... by PeterPall

.gitignore: new auto-generated files

e32f1ea... by PeterPall

Added a simple demo for solve

Even a simple demo for solve() is better than none at all
and maybe someone will improve or extend this demo one day.

928243e... by Raymond Toy <email address hidden>

Fix 4299: complex-atanh error

The funny error "HOW DID I GET HERE" is a logic mistake where we
didn't handle the case where y = 0 and |x| <= 1. From the formula in
the comment we have imagpart(atanh(z))=1/2*(arg(1+x) - arg(1-x)). The
original code only handled |x| > 1, but clearly the formula is 0 if
|x| <= 1.

Replace the call to `error` with a bigfloat 0.

Manually tested the error case and we don't get an error. The answer
matches what `atanh(- 3.378259464834472b-1)` returns in the repl.

6c36d51... by Raymond Toy <email address hidden>

Fix typos in implementation

386e9ce... by Raymond Toy <email address hidden>

Simplify computation of atan for complex bigfloat

Previously we used a messy method that used meval to call atan.
Instead, use the simple relationship that atan(z) = -%i*atanh(%i*z),
and we have a nice algorithm for atanh. The old meval method ended up
calling risplit many times for basically no reason.

Testsuite passes.

ef7803c... by Raymond Toy <email address hidden>

Merge branch 'bug-4298-atanh-inf-loop'

38a0802... by Raymond Toy <email address hidden>

Update comment on the max n.

Needed to increase the max so that the testsuite passes without errors
with this change.

9e296d2... by Raymond Toy <email address hidden>

Double the number of terms allowed.

The previous setting for the number of terms caused some tests to fail
because the results changed. Increase the limit so that we're more
likely to stop because oans and ans are the same.

Testsuite passes now.

154c2eb... by Raymond Toy <email address hidden>

Fix #4298: Limit the number of terms in the atan sum

In fpatan, for the case |x| <= 1/2, we use a Taylor series to compute
atan. The criteria for termination is if the previous sum equals the
current sum. This happens when the additional term is so small that
it doesn't contribute anymore. But I think round-off causes the
previous sum and current sum to alternate so they're never equal.

To fix this, compute a rough estimate of the number of terms needed so
that the relative error between the term and x is less than a
tolerance (2^(-fpprec)). With this change, the series then terminates
because we reach the limit of the number of terms.

For the test case, we want the atan of -7.7037b-34. The last term
computed is 9.888b-1756, which is way smaller than needed, but at
least we terminate the loop instead of looping forever.