## 729 Reputation

8 years, 238 days

## Caching in fsolve('f(x)', x)...

```f := x -> x+1:
fsolve('f(x)', x);
-1.000000000

f := x -> x+2:
fsolve('f(x)', x);
-1.000000000
```

It's easy to avoid this, sure, but this can be really confusing. And I think it's wrong that Maple fails to notice that the cached result is no longer valid.

## applyrule with conditional...

```test := proc(x) print("x=", x); op(0, x) = f end proc:
applyrule(conditional(x::anything, _test(x)) = 0, f(1));
"x=", f(1)
"x=", 0
0

test := proc(x) print("x=", x); op(0, x) = g end proc:
applyrule(conditional(x::anything, _test(x)) = 0, f(1));
0
```

First, I think this is wrong. Second, how to make applyrule forget the (apparently) cached result? Third, if it doesn't like me using the underscore with my own function, is there a way to rewrite conditional without it?

EDIT: As Carl pointed out here, gc() can be used as a kind of a universal forget() function. The second applyrule correctly returns f(1) after gc().

## Elliptic integrals...

1. The results are incorrect, because the integral diverges and the p.v. integral exists but is real-valued:

```int(1/((1-16*t^2)*sqrt(1-t^2)*sqrt(1-4*t^2)), t = 0 .. 1/2);
(1/2)*EllipticPi(4, 1/2)

int(1/((1-16*t^2)*sqrt(1-t^2)*sqrt(1-4*t^2)), t = 0 .. 1/2, CauchyPrincipalValue);
(1/2)*EllipticPi(4, 1/2)
```

This integral converges, but the closed form is wrong:

```int(1/((1-1/4*t^2)*sqrt(1-t^2)*sqrt(1-4*t^2)), t = 0 .. 3/2);
(1/2)*EllipticK(1/2)-(1/2)*EllipticF(2/3, 1/2)-(1/2)*EllipticPi(4, 1/2)+
(1/2)*EllipticPi(2/3, 4, 1/2)-(1/2*I)*EllipticK((1/2)*sqrt(3))-
(1/30*I)*EllipticPi(4/5, (1/2)*sqrt(3))+(1/2)*EllipticPi(1/16, 1/2)```

2. The series expansion is wrong, because EllipticPi(1/4,16,2) is undefined:

```series(EllipticPi(1/4+a, 16, 2), a = 0, 2);
EllipticPi(1/4, 16, 2)-(1/45)*sqrt(3)*sqrt(15)*ln(a)+O(a)```

3. None of the methods listed on the evalf/Int page can handle this integral:

`evalf(Int(1/((1-1/4*t^2)*sqrt(1-t^2)*sqrt(1-4*t^2)), t = 0 .. 3/2));`

Although it can be done by splitting the integration range into 0..1/2, 1/2..1, 1..3/2.

None of the methods listed on the evalf/Int page can handle this computation:

`evalf(Int(1/((1-1/4*t^2)*sqrt(1-t^2)*sqrt(1-4*t^2)), t = 1 .. 2-10^(-7), digits = 20));`

4. Since there are values of the parameters for which the integral diverges, this probably needs a condition saying that 1/sqrt(n) and -1/sqrt(n) are not on the segment [0,z]:

```FunctionAdvisor(integral_form, EllipticPi(z, n, k));
[EllipticPi(z, n, k) = Int(1/((-n*`_&alpha;1`^2+1)*sqrt(-`_&alpha;1`^2+1)*
sqrt(-k^2*`_&alpha;1`^2+1)), `_&alpha;1` = 0 .. z),
`with no restrictions on `(z, n, k)]```

Besides, for z=-1-I, n=1/4, k=2, the lhs and the rhs do not agree:

```evalf(subs({z = -1-I, n=1/4, k=2}, %[1]));
-.1413755772+1.748734618*I = -.1413755772-.7752517350*I```

Either the integral representation is not supposed to be valid everywhere, or Maple computes EllipticPi incorrectly.

## seq(i[1], i[1] = 1 .. 2) doesn't restore...

```seq(i[1], i[1] = 1 .. 2);
i[1];
1, 2
2
```

I thought the note saying "The index variable i is NOT private to the seq invocation" referred only to parallel code.

## applyrule with inequalities...

```applyrule((x::anything < y::anything) = 0, a < b);
applyrule('x::anything < y::anything' = 0, a < b);
applyrule(`<`(x::anything, y::anything) = 0, a < b);
applyrule('`<`(x::anything, y::anything)' = 0, a < b);
a < b
a < b
a < b
0
```

All quotes matter, no doubt, but why is `<` different from the infix "<" and why does it need uneval?

 5 6 7 8 9 10 11 Page 7 of 14
﻿