Adri van der Meer

Adri vanderMeer

1355 Reputation

18 Badges

15 years, 105 days
University of Twente (retired)
Enschede, Netherlands

My "website" consists of a Maple Manual in Dutch

MaplePrimes Activity

These are answers submitted by Adri van der Meer

What do you mean by "minimize eq1 and eq2"?
Two (different) points (a,b), minimizing eq1 and eq2 respectively?
Or one point (a,b) minimizing eq1*eq2 or eq1+eq2 or...?
Perhaps "eq1" is an expression, depending on a and b which you want to minimaize, subject to the constraint "eq2", an equation containing a and b?

Use decimal points instead of comma's.

g :=(t,s) -> 999.842594+6.793952*10^(-2)*t-9.95290*10^(-3)*t^2 + 
1.1685*10^(-4)*t^3-1.120083*10^(-6)*t^4 +
6.536332*10^(-4)*t^5+8.24493*10^(-1)*s-4.899*10^(-3)*t*s +
7.6438*10^(-5)*t^2*s-8.2467*10^(-7)*t^3*s +
5.3875*10^(-4)*t^4*s-5.72466*10^(-3)*s^(3/2) +

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:


there must have been more backquotes than the two you removed

a `:=` 4;
Error, missing operator or `;`

`a `:=` 4`;
a := 4
a, `a `;
a, 4
`a := 4`;
a := 4
b := %;
b := a := 4

All your equations contain

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


Please clarify.

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

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,
U := solve( eqns, {u[0],v[0],w[0]} ); # a sequence of solution sets
nops( [U] ); # make a list, and count the number of its elements.

so there are three solutions

Does this what you want?

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)):

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))) -
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:

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]


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 );


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

result in a graph with no hole.

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!).

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);
g := x -> piecewise( x<3, 2*x, 2*x+5 ):

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

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

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)!

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

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);

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

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

instead of

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

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

First 21 22 23 24 25 26 27 Page 23 of 27