## 5062 Reputation

14 years, 248 days

"A map that tried to pin down a sheep trail was just credible,

but it was an optimistic map that tried to fix a the path made by the wind,

or a path made across the grass by the shadow of flying birds."

- _A Walk through H_, Peter Greenaway

## procedures vs expressions...

First, with procedures,

```restart:
f := x -> a*x^2+b*x+c;
f(11);
df := D(f);
df(11);
plot( subs([a=123,b=456,c=789],eval(f)), 0..1000);
```

Now, with expressions,

```restart:
f := a*x^2+b*x+c;
eval(f,x=11);
df := diff(f,x);
eval(df,x=11);
eval(f,[a=123,b=456,c=789])
plot( eval(f,[a=123,b=456,c=789]), x=0..1000);
```

Here's what you were doing before. You set up f as an operator (a type of Maple procedure). And then when you enter f(x) Maple actually evaluates that procedure at the name x. So the result of calling f(x) is then an expression. That's why diff() would succeeds on it as you intend.

So you were mixing functions and expressions. That's not bad, but could be confusing to you. You might find it easier to stick with one or the other, until it becomes familiar.

Notice how, with procedures, the independent variable's name isn't important (and gets left out) when calling D() or plot().

## balloon help for help Examples mode swit...

Help pages Examples now show up in the Standard GUI with their input as 2D Math by default.

This is interesting. On the one hand it can make the math easier to understand. On the other hand there are a few anomalies to be ironed out.

There is a new icon for a button in the help browser's top menu panel. It toggles the input in the help Examples between 2D and 1D. It remembers the mode from the last viewing of a help page, which is good.

The mode toggling icon is missing its own explanatory balloon/bubble help (Linux), which is a bug.

## earlier response...

```ode := (x^2+2)*(diff(diff(y(x), x), x))+3*x*(diff(y(x), x))-y(x) = 0:
T := Slode[mhypergeom_formal_sol](ode, y(x)):
convert(T,factorial);
```

## earlier response...

```ode := (x^2+2)*(diff(diff(y(x), x), x))+3*x*(diff(y(x), x))-y(x) = 0:
T := Slode[mhypergeom_formal_sol](ode, y(x)):
convert(T,factorial);
```

## include...

This is another reason for keeping the source of such larger (here, 80 functions) packages in plaintext form -- the \$include directive can be used to manage code fragments which must go in each routine. Simply insert a common \$include line at the beginning of each routine, and then later changes of such common features involves just a single file edit.

## include...

This is another reason for keeping the source of such larger (here, 80 functions) packages in plaintext form -- the \$include directive can be used to manage code fragments which must go in each routine. Simply insert a common \$include line at the beginning of each routine, and then later changes of such common features involves just a single file edit.

## forget and Cache...

Looking at the code of `forget`, I see calls to Cache:-RemoveTemporary and Cache:-RemovePermanent as well as the familiar subsop(4 = NULL,..) to clear remember tables.

## forget and Cache...

Looking at the code of `forget`, I see calls to Cache:-RemoveTemporary and Cache:-RemovePermanent as well as the familiar subsop(4 = NULL,..) to clear remember tables.

## thanks, but.....

Thanks. I'm hoping for more on the justification, ie. examples illustrating why it helps Maple more than it hinders.

## why the eval?...

Why does the procedure return eval(M) instead of simply M?

## why the eval?...

Why does the procedure return eval(M) instead of simply M?

## attention...

I wasn't actually paying any attention at all to the function in question. I was just showing one or two ways in which procedures may be mapped over lists. As you since noticed, they can also be mapped over sets in various ways. The key bit is that igcd and isprime don't work directly on sets and lists.

## attention...

I wasn't actually paying any attention at all to the function in question. I was just showing one or two ways in which procedures may be mapped over lists. As you since noticed, they can also be mapped over sets in various ways. The key bit is that igcd and isprime don't work directly on sets and lists.

## roundoff...

The range argument to fsolve is interpreted as a box when the 'complex' option is supplied. The left range point represents the lower-left corner and the right range point represents the upper-right corner of this box in the complex plane. If the range points are purely real then the "box" is just a line segment on the real axis. And then any convergence to a point outside that (real) box (line) won't get accepted by fsolve as a valid solution. As Robert said, it appears that roundoff error is producing small imaginary artefacts in the convergent results. I gave the box some height in the complex direction so that results of convergence slightly off the real line could be accepted. It would have been trickier if some other solution with nonzero but small imaginary component existed near the root you were after.

I didn't make the imaginary box height really, really small because fsolve's inner convergence tester checks too often that the sequence of iterates is not going out of bounds. I believe that when this happens fsolve stops the current iteration and starts again from a new initial point. I don't really like that it does that since it's possible for a sequence of iterates to step outside the allowed bounds and then back in again for convergence.

Robert's approach of considering Re(Q(x)) is also good, provided that you check Im(Q(x)) as well. They would both have to be near zero. Or you might try using Re(Q(x))^2+Im(Q(x))^2.

I wasn't able to satisfactorily get a high precision result, though. That's likely made more difficult due to fsolve's not having separate control options for the working precision (Digits) and requested accuracy (epsilon, or tolerances). I think.

Searching for purely real roots of a complex-valued function can be tough. The same can also be true when searching for a root in a range that is measure zero in the function domain.

## small complex range...

Give it a small complex range.

```> fsolve(Q(x),x=0-0.1*I..25+0.1*I,complex);
-11
14.05766281 + 0.1874311051 10    I
```
 First 77 78 79 80 81 Page 79 of 81
﻿