Dr. John May

17 years, 5 days
Maplesoft

## Social Networks and Content at Maplesoft.com

I have been a part of the Mathematical Software Group at Maplesoft since 2007. I have a Ph.D in Mathematics from North Carolina State University as well as Masters and Bachelors degrees from the University of Oregon. I have been working on research in computational mathematics since 1997. I currently work on symbolic solvers and visualization as well as other subsystems of Maple.

## 2005 Top 3...

In the 2005 Top 3: Jordan was male 72% of the time (it is a near miss on my list). Alexis was female 80% of the time, and Angel was male 82% of the time.

John

## Less Unisex...

This chart uses a looser definition of "unisex" than I use.

John

## _Env variables...

You don't really need the environment variables for the solve call.   I prefer to avoid using them when possible.

Two options:

```# Explicit as a option to solve:
solve({e1,e2,e3},{x,y,a}, Explicit);# Map allvalues over the solution:map(allvalues, [solve({e1,e2,e3})]);```

The _EnvAllSolutions only really affects equations with an infinite number of solutions, so it doesn't have any effect on this system.

John

## _Env variables...

You don't really need the environment variables for the solve call.   I prefer to avoid using them when possible.

Two options:

```# Explicit as a option to solve:
solve({e1,e2,e3},{x,y,a}, Explicit);# Map allvalues over the solution:map(allvalues, [solve({e1,e2,e3})]);```

The _EnvAllSolutions only really affects equations with an infinite number of solutions, so it doesn't have any effect on this system.

John

## unapply...

I guess this is more what was intended:

` for i from 1 to 5 do cat(`f_`,i) := unapply(i,x); end do;`

John

## unapply...

I guess this is more what was intended:

` for i from 1 to 5 do cat(`f_`,i) := unapply(i,x); end do;`

John

## The problem with not...

The problem with not specifying variables, rather than specifying them all as a list (with variables first) is that you will get parameters solved in terms of variables.

```solve({eq});
{Pi00 = p2 + p6, Pi01 = 1 - p2 - sigma01 - sigma00 - p6, Pi10 = p6,
Pi11 = 1 - p6 - sigma11 - sigma10,
p0 = 1 - p1 - p2 - sigma01 - sigma00 - p6, p1 = p1, p10 = -p11 + sigma10,
p11 = p11, p2 = p2, p3 = 0, p4 = sigma01 - sigma11 - sigma10 + sigma00,
p5 = 0, p6 = p6, p7 = 0, p8 = sigma01, p9 = -sigma01 + sigma11,
sigma00 = sigma00, sigma01 = sigma01, sigma10 = sigma10, sigma11 = sigma11
}
```

While with a list, some of the solvers try to respect the variable order. In this case that works (as below) even if it does not work in every case.

John

## The problem with not...

The problem with not specifying variables, rather than specifying them all as a list (with variables first) is that you will get parameters solved in terms of variables.

```solve({eq});
{Pi00 = p2 + p6, Pi01 = 1 - p2 - sigma01 - sigma00 - p6, Pi10 = p6,
Pi11 = 1 - p6 - sigma11 - sigma10,
p0 = 1 - p1 - p2 - sigma01 - sigma00 - p6, p1 = p1, p10 = -p11 + sigma10,
p11 = p11, p2 = p2, p3 = 0, p4 = sigma01 - sigma11 - sigma10 + sigma00,
p5 = 0, p6 = p6, p7 = 0, p8 = sigma01, p9 = -sigma01 + sigma11,
sigma00 = sigma00, sigma01 = sigma01, sigma10 = sigma10, sigma11 = sigma11
}
```

While with a list, some of the solvers try to respect the variable order. In this case that works (as below) even if it does not work in every case.

John

## System Requirements...

Take a look at:
http://maplesoft.com/products/Maple/system_requirements.aspx

Under Macintosh®, it says "10.4.5 or later" so 10.5.5 is supported.

John

## all the digits...

convert/base basically just calls irem in a loop, so it is definitely better than my function if you want to compute all the digits.

If you just want one digit, computing it directly is probably a better than convert/base.  Especially for large integers.

John

## all the digits...

convert/base basically just calls irem in a loop, so it is definitely better than my function if you want to compute all the digits.

If you just want one digit, computing it directly is probably a better than convert/base.  Especially for large integers.

John

## Of course...

Thanks Dave. Here is a first pass

```----maple----
#!/bin/bash
```
```theargs="\"\$0\"";

for var in "\$@"
do
theargs="\$theargs,\"\$var\""
done
```
```# replace with your maple
/usr/local/maple12/bin/maple -q -s <<__EOM__
NARGS:=\$#-1:
ARGS:=[\$theargs][3..-1]:

__EOM__
----maple----
```

Then

```----script----
#!/usr/bin/env maple

printf("This is an example of using Maple for scripts\n");
print(NARGS,ARGS);
----script----
```

This is okay for "./script foo bar" and should be right for "./script 'foo bar'" too

John

## An example might be choosing...

An example might be choosing the the vertex of a parabola as parameters. Least squares can't fit to a and b directly:

y = (x-a)^2 + b

since the fitting equations will depend on a non-linearly. For each point on the parabola e.g. (x,y)=(-1,1) you get a quadratic equation like 1 = (a+1)^2+b.  Least squares only works on a set of linear equations.

## solve...

solve does not do any numeric root finding.  If you give it a polynomial with floating point coefficient, it will convert them to complex rational numbers and compute exact representations of the roots.  Before returning the answer, it will call evalf on them so that you get floating point answers.

In the case of exact polynomials solve will factor: f(x)=g(x)*h(x) and decompose: f(x) = g(h(x)) to get polynomials of smallest degree possible.  It will then try to compute roots in terms of radicals for degrees 3 and less (or 4 and less if you use the Explicit option) and some other simple cases.  If it cannot compute the root in terms of radicals, it will return the root in RootOf representation.

When evalf is called on a RootOf structure, it calls fsolve to numerically compute a value for the root.  fsolve uses the global root finder in RootFinding:-Isolate for real polynomials if I recall correctly and the algorithms it uses are described in the papers at the bottom of its help page.

John

## One Command...

If you are using Maple 12, a double integral can be entered in 1D input as a single call to int:

int(1/x, [x = y..1, y = 0..1]);

John

 First 9 10 11 12 13 14 15 Last Page 11 of 19
﻿