## 7781 Reputation

18 years, 19 days

## How to update a matrix in a proc?...

Maple

I expect this proc to return a matrix of all ones but it returns a matrix of all zeros.  Why does it do that?

```doit := proc()
local i, j, M;
M := Matrix(3,3);
for i from 1 to 3 do
for j from 1 to 3 do
M[i][j] := 1;
end do;
end do;
return M;
end proc:

doit();
[0    0    0]
[           ]
[0    0    0]
[           ]
[0    0    0]
```

## Unexpected solution to PDE...

Maple 2019

We solve Laplace's equation in the domain
in polar coordinates subject to prescribed Dirichlet data.

Maple produces a solution in the form of an infinite sum,
but that solution fails to satisfy the boundary condition
on the domain's outer arc.  Is this a bug or am I missing
something?

 > restart;
 > kernelopts(version);

 > with(plots):
 > pde := diff(u(r,t),r,r) + diff(u(r,t),r)/r + diff(u(r,t),t,t)/r^2 = 0;

 > a, b, c, d := 1, 2, Pi/6, Pi/2;

 > bc := u(r,c)=c, u(r,d)=0, u(a,t)=0, u(b,t)=t;

We plot the boundary data on the domain's outer arc:

 > p1 := plots:-spacecurve([b*cos(t), b*sin(t), t], t=c..d, color=red, thickness=5);

Solve the PDE:

 > pdsol := pdsolve({pde, bc});

Truncate the infinite sum at 20 terms, and plot the result:

 > eval(rhs(pdsol), infinity=20): value(%): p2 := plot3d([r*cos(t), r*sin(t), %], r=a..b, t=c..d);

Here is the combined plot of the solution and the boundary condition.
We see that the proposed solution completely misses the boundary condition.

 > plots:-display([p1,p2], orientation=[25,72,0]);

## What is the asymptotic value of the root...

Maple

I am interested in the root of the equation ((2*n-1)*x + 2*n + 1)*x^n = 1 - x, where 0 < x < 1 and n is a large positive integer.  I believe that the root converges to 1 as n goes to infinity.  How does one obtain an asymptotic estimate of the root for large n?

## How to simplify this expression?...

Maple

I don't know how to simplify the expression A/B in the worksheet below.  I know that it should simplify to exp(I*Pi/3).  How do I lead Maple to discover that result without telling it the solution ahead of the time?  All variables other than A and B are real.

 > restart;
 > local gamma:
 > A := I*sqrt(3) + 2*c*exp(I*(gamma+(1/3)*Pi)) + 2*a*exp(I*alpha) - 2*a*exp(I*(alpha+(1/3)*Pi)) - 2*b*exp(I*beta) - 1;

 > B := I*sqrt(3) - 2*a*exp(I*(alpha+(1/3)*Pi)) - 2*b*exp(I*beta) + 2*b*exp(I*(beta+(1/3)*Pi)) + 2*c*exp(I*gamma) + 1;

How to show that ?

## How to specify multiple lights in plot3d...

Maple 2018

This is from the documentation of ?plot3d,light:

light=[phi, theta, r, g, b]

This option adds [my emphasis] a directed light source

from the direction phi, theta in spherical coordinates.

The "adds" in that sentence seems to imply that

multiple light sources are possible, but it does not seem

to work that way.  Each subsequent light option overrides

the previous one as we see in the following illustration

where we render a ball three times by illuminating it

(a) from the north, (b) from the south, and (c) from

both the north and south.  In (c) Maple accounts for only

the south light.

 > restart;
 > with(plots): with(plottools):
 > ball := sphere(1, style=surface, color=gold):
 > display(<     display(ball,light=[0,0,1,1,1])   |     display(ball,light=[180,0,1,1,1]) |     display(ball,light=[0,0,1,1,1], light=[180,0,1,1,1])  >);