## 7596 Reputation

17 years, 163 days

## Applying fsolve to unknowns of type x(0)...

Maple 2020

 > restart;
 > kernelopts(version);

This one works as expected:

 > solve({x + y = 5, x - y = 3});

This one fails:

 > solve({x(0) + y(0) = 5, x(0) - y(0) = 3});

That shouldn't fail.  According to ?solve,details, under the Description

heading, it says that the unknown may be a name or a function.  Note that

 > type(x(0), function);

so there seems to be a contradiction.  Nevertheless, there is a workaround:

 > solve({x(0) + y(0) = 5, x(0) - y(0) = 3}, {x(0), y(0)});

 >

Now try with fsolve().  This one works as expected:

 > fsolve({x + y = 5, x - y = 3});

This one fails:

 > fsolve({x(0) + y(0) = 5, x(0) - y(0) = 3});

But the previous workaround does not help:

 > fsolve({x(0) + y(0) = 5, x(0) - y(0) = 3}, {x(0), y(0)});

I can temporarily rename the variables to plain symbols, or perhaps

freeze/thaw them.  But is there a simpler workaround?

## A gamma puzzle awaiting an explanation...

Maple 2020

Maple's gamma constant appears to misbehave.

 > restart;
 > kernelopts(version);

 > evalf(gamma);     # this one is expected

 > evalf(gamma(0));  # this one may be explained

 > evalf(gamma(1));  # how to explain this one?

Things get more puzzling.  Let's declare gamma as local:

 > local gamma:
 > evalf(gamma);     # this is good

 > evalf(gamma(0));  # expected an unevaluated  here!

 > evalf(gamma(1));  # expected an unevaluated  here!

## Teaching Maple a new rule...

Maple 2020
 Consider the family of functions  where the index  is integer, and .   It is known that  for all .   I want to convey that information to Maple.  For instance, given the input diff(f[3](x),x), Maple should return .  Similarly: diff(f[3](x), x\$2)                   should return    f[4](x)*diff(f[3](x),x)^5   should return    What is a good way of doing that?

## Unexpected leakage from seq...

Maple 2020

Consider

```restart;
L := [1,2,3,4];
x[j];
seq(%, x[j] in L);
x[j];
```

What would you expect the output of the last line to be?

Answer:   Maple says 4.   Why?

## A puzzle on type-specification in a proc...

Maple

I want to write a proc, say f, that takes an single argument Z, as in
f := proc(Z::?) ...
where the only acceptable Z values are pairs [x,y], where x and y are selected from the set {a,b,c,d}. The entries a,b,c,d of that set are prescribed symbolic constants.

Thus, the following are legal calls to f:
f([a,a]), f([a,b]), f([d,c])
but these are illegal:
f([a]), f([a,b,c]), f([a,x])

I don't know what to put for the "::?" in the proc's definition in order to enforce those constraints.  Any ideas?

Extra: In fact, I would prefer to ban the f([a,a]) option as well (no repeated symbols) but that's of secondary importance since it is easy to inspect and handle that within the proc's body.

 3 4 5 6 7 8 9 Last Page 5 of 15
﻿