## 1350 Reputation

14 years, 251 days
University of Twente (retired)
Enschede, Netherlands

My "website" consists of a Maple Manual in Dutch

## remove fourth number...

Yes, the four numbers represent [x,y,z,f(x,y,z)]. see ?plot/structure - look for ISOSURFACE(A)

Now for removing the last number in each list:

`ptslist[1..-1,1..-1,1..-1,1..3]:`

## there must have been more backquotes tha...

there must have been more backquotes than the two you removed

`restart;a `:=` 4;Error, missing operator or `;`restart;`a `:=` 4`;                             a  :=  4a, `a `;                             a,  4`a := 4`;                             a := 4b := %;                            b :=  a := 4`

## Clarify...

`diff(phi,x)   or   diff(phi,y)`

I suppose that phi is assigned earlier, as an expression containing x and y (otherwise diff(phi,x) simplifies instantly to zero).
Or do you mean

`diff(phi(x,y),x)`

If so (i.e: phi is a not specified function of x and y), you can do

`restart;alias(phi=phi(x,y)):eqns := {-2/phi^3*u[0]^2*diff(phi,x)-4/phi^3*w[0]*diff(phi,x)-2*u[0]/phi^3*diff(phi,x)^2,      -6/phi^4*u[0]*diff(phi,x)*v[0]+12*v[0]/phi^4*diff(phi,x)^2,      -2/phi^3*v[0]*diff(phi,x)+2/phi^3*w[0]*diff(phi,y)}:U := solve( eqns, {u[0],v[0],w[0]} );  # a sequence of solution setsnops( [U] );  # make a list, and count the number of its elements.                               3`

so there are three solutions

## postpone definition of r1, r2...

Does this what you want?

`restart;f := ln( (r1(x,y)+r2(x,y)+d1)/(r1(x,y)+r2(x,y)-d1) ):df := simplify(diff(f,x));r1 := (x,y) -> sqrt((x-x1)^2+(y-y1)^2+z^2): alias(R1=sqrt((x-x1)^2+(y-y1)^2+z^2)):r2 := (x,y) -> sqrt((x-x2)^2+(y-y2)^2+z^2): alias(R2=sqrt((x-x2)^2+(y-y2)^2+z^2)):d1 := sqrt((x2-x1)^2+(y2-y1)^2): alias(D1=sqrt((x2-x1)^2+(y2-y1)^2)):df;`

## Symbolic solution...

So you really want symbolic solutions?
OK here it comes.
I make all parameters symbolic, there is no need to give some of these as floats.

`Hrs := -n*Np*(Ans*r^(n*Np-1)-Bns*r^(-n*Np-1))*cos(n*Np*theta):mu1 := k1*k2*Hrs^(k2-1):eq1 := Bno*Ro^(-n*Np-1) = Ans*Ro^(n*Np-1)+Bns*Ro^(-n*Np-1):eq2 := -Bno*Ro^(-n*Np-1) = mu1*(Ans*Ro^(n*Np-1)-Bns*Ro^(-n*Np-1)):r := Rs:Hrs :=  -n*Np*(Ans*r^(n*Np-1)-Bns*r^(-n*Np-1))*cos(n*Np*theta):mu1 := k1*k2*Hrs^(k2-1):eq3 := Ans*Rs^(n*Np-1)+Bns*Rs^(-n*Np-1) = Ana*Rs^(n*Np-1)+Bna*Rs^(-n*Np-1):eq4 := mu1*(Ans*Rs^(n*Np-1)-Bns*Rs^(-n*Np-1)) = Ana*Rs^(n*Np-1)-Bna*Rs^(-n*Np-1):eq5 := Ana*Rm^(n*Np-1) + Bna*Rm^(-n*Np-1) =        Anm*Rm^(n*Np-1) + Bnm*Rm^(-n*Np-1)+M/(mu2*(1-(n*Np)^2)):eq6 := Ana*Rm^(n*Np-1) - Bna*Rm^(-n*Np-1) =   mu2*(Anm*Rm^(n*Np-1) - Bnm*Rm^(-n*Np-1)+M/(mu2*n*Np*(1-(n*Np)^2))) -    Mrad/(n*Np):eq7 := Anm*Rr^(n*Np-1) + Bnm*Rr^(-n*Np-1) + M/(mu2*(1-(n*Np)^2)) = Anr*Rr^(n*Np-1):eq8 := mu2*(Anm*Rr^(n*Np-1)-Bnm*Rr^(-n*Np-1)+M/(mu2*n*Np*(1-(n*Np)^2))) - Mrad/(n*Np) = mu3*Anr*Rr^(n*Np-1):`

We see that only eq2 and eq4 are nonlinear, so we make a linear system for the other six equations:

`with(LinearAlgebra):A,b := GenerateMatrix( {eq1, eq3, eq5, eq6, eq7, eq8},   [Ana, Anm, Anr, Ans, Bna, Bnm, Bno, Bns] ):`

A is 6 ×8-matrix. When we solve, we get a solution vector with two free parameters:

`sols := LinearSolve(A,b,free='alpha'):`

The indexing of the αi's is unpredictable, so we recover

`awa := [seq(has~(sols,alpha[i]),i=1..8)]:aind := NULL: for i to 8 do   if convert(convert(awa[i],list),`or`) then   aind := aind,i   end if end do:`

Now substitute in the two nonlinear equations, and solve for the free variables.

```s1 := Equate( Vector([Ana, Anm, Anr, Ans, Bna, Bnm, Bno, Bns]), sols ):
salpha := solve ( subs( s1, {eq2,eq4} ), {seq(alpha[i],i=aind)} );          [Length of output exceeds limit of 1000000]```

Voila

## Use remember table...

A more elegant way is to make the function continuous in the origin by putting the value for (0,0) in a remember table:

`f := (x,y) -> sin(sqrt(x^2+y^2))/sqrt(x^2+y^2): f(0.,0.) := 1:`

Caution: not f(0,0) becasuse grid points are floats, so plot3d is looking for an index [0.,0.] (floats), and not for [0,0] (integers).

`plot3d( f, -3..3, -3..3 );`

or

`plot3d( 'f(x,y)', x=-3..3, y=-3..3 );`

result in a graph with no hole.
Caution:

`plot3d( f(x,y), x=-3..3, y=-3..3 );`

doesn't work, because f(x,y) is immediately replaced by the expression sin(sqrt(x^2+y^2))/sqrt(x^2+y^2) in the plot command (premature evaluation!).

## range explained...

Maple makes a plot bij calculating f(x,y) in a number of gridpoints, derived from the ranges for x and y.
In this case f(0,0) is not defined ("division by zero"), so we have to prevent maple from taking (0.0) as a grid point. An easy way to do this, is to shift the ranges by a small amount

`plot3d( sin(sqrt(x^2+y^2))/sqrt(x^2+y^2), x=-3.01..2.99, y=-3.01..2.99);`

## piecewise...

`g := x -> piecewise( x<3, 2*x, 2*x+5 ):plot(g(x));`

## member, subset...

Not exactly the same, but perhaps ?member or ?subset will do:

`a := {1,2,3}:A := {1,2,3,4}:member( 1, A );                              truea subset A;                              true`

## Not a matrix...

By the assignment

`A[m] := ((Ck[m](i,j))/((lam(i,i)-lam(j,j))-(2*m));`

you make A[m] a number, not a matrix
If A is a table of zero-matrices, they can be filled by

` A[m](i,j) := some number `

Additionally: count parentheses (and remove some)!

## Roots of a polynomial...

Perhaps yoy can use Markiyan Hirnyk's answer to this previous question.

## x and y "not independent"...

I'm afraid that there is no other possibiliy than to tell Maple that the two variables are interdependent (btw, what does dx dy mean in this case?) You could do that by

`c3 := Int(Int( subs( [x=f(x,y), y=g(x,y)], x*y+y ), x), y);`

## Simple typing error...

Use " := " for an assignment; only " = " makes an equation. You typed

`k = ln((M-m)/m(k-1))`

`k1 := ln((M-m)/(m*(k-1)))`

(and: don't use the same variable name in both sides of an assignment).

## variable name...

• You typed α:=0,85 where 0.85 is intended (I suppose)
• By
`for k do p[k] := M.p[k-1]; if Norm(p[k]-p[k-1]) < tol then break end if end do:`
you try to build a table p (I suppose), but the variable p is already in use (as a matrix).
So use another name, and don't forget to initialize:
```q[0] := Vector(n, fill=1/n):
for k do q[k] := M.q[k-1]; if Norm(q[k]-q[k-1]) < tol then break end if end do:```

## Choose Maple notation for Input display...

For example: ex is not

`e^x`

but

`exp(x)`

Choose: Tools → Options → Display → Input Display: Maple Notation to get full control over your input.

Perhaps you mean:

```u:= Int( (-4*(16*c+3)*exp(-1/2*sqrt(-16*c-3*Zeta)) )/
(64*exp(-sqrt(-16*c-3*Zeta)) + 256*c*exp(-sqrt(-16*c-3*Zeta)) +
8*exp(-1/(2)*sqrt(-16*c-3*Zeta)) +1), Zeta);```

Then you can try the substitution

```v := IntegrationTools:-Change( u, t=sqrt(-16*c-3*Zeta), t );
value(v);
```
 First 21 22 23 24 25 26 27 Page 23 of 27
﻿