tomleslie

5348 Reputation

15 Badges

9 years, 275 days

MaplePrimes Activity


These are replies submitted by tomleslie

if you were *consistent* in your use of coordinate labels.

  1. Your worksheet uses (r, theta, phi)
  2. The Wikipedia page which you reference uses (sigma, tau, phi)
  3. The "Jacobian" which you reference uses (theta, eta, phi)

The attached adds your coordinate system to Maple's VectorCalculus() package and computes the Laplacian.

It then compares this result with the Laplacian quoted in the Wikipedia page which you reference - the results are identical

Throughout, I have used the Wikipedia coordinate labels (sigma, tau, phi)

  restart;
  with(VectorCalculus):
#
# Define coordinates
#
  X := a*sinh(tau)*cos(phi)/(cosh(tau) - cos(sigma)):
  Y := a*sinh(tau)*sin(phi)/(cosh(tau) - cos(sigma)):
  Z := a*sin(sigma)/(cosh(tau) - cos(sigma)):
#
# Set up coordinate system. NB this system which the
# OP calls "toroidal" is slightly different from the
# Maple's in-built toroidal system - hence the
# coordinate system name
#
  AddCoordinates( OPToroid[ sigma,
                            tau,
                            phi
                          ],
                 [ X, Y, Z ]):
#
# Compute the Laplacian
#
  LP:= simplify
       ( Laplacian
         ( f(sigma, tau, phi),
           OPToroid[sigma, tau, phi]
         )
       );

-((-cosh(tau)^3+cos(sigma)*cosh(tau)^2+cosh(tau)-cos(sigma))*(diff(diff(f(sigma, tau, phi), sigma), sigma))+(-cosh(tau)^3+cos(sigma)*cosh(tau)^2+cosh(tau)-cos(sigma))*(diff(diff(f(sigma, tau, phi), tau), tau))+(-cosh(tau)+cos(sigma))*(diff(diff(f(sigma, tau, phi), phi), phi))+(cosh(tau)^2*sin(sigma)-sin(sigma))*(diff(f(sigma, tau, phi), sigma))+sinh(tau)*(diff(f(sigma, tau, phi), tau))*(cosh(tau)*cos(sigma)-1))*(cosh(tau)-cos(sigma))/(a^2*sinh(tau)^2)

(1)

#
# Painfully, type in the Laplacian quoted on the
# Wikipedia page
#
# https://en.wikipedia.org/wiki/Toroidal_coordinates
#
  wiki:=  ( cosh(tau)-cos(sigma) )^3/(a^2*sinh(tau))
          *
          ( sinh(tau)*diff(diff(f(sigma,tau,phi), sigma)/(cosh(tau)-cos(sigma)),sigma)
            +
            diff( sinh(tau)*diff(f(sigma,tau,phi),tau)/(cosh(tau)-cos(sigma)),tau)
            +
            diff(f(sigma,tau,phi),phi$2)/(sinh(tau)*(cosh(tau)-cos(sigma)))
          ):
  wiki:= simplify(expand(wiki));

-((-cosh(tau)^3+cos(sigma)*cosh(tau)^2+cosh(tau)-cos(sigma))*(diff(diff(f(sigma, tau, phi), sigma), sigma))+(-cosh(tau)^3+cos(sigma)*cosh(tau)^2+cosh(tau)-cos(sigma))*(diff(diff(f(sigma, tau, phi), tau), tau))+(-cosh(tau)+cos(sigma))*(diff(diff(f(sigma, tau, phi), phi), phi))+(cosh(tau)^2*sin(sigma)-sin(sigma))*(diff(f(sigma, tau, phi), sigma))+sinh(tau)*(diff(f(sigma, tau, phi), tau))*(cosh(tau)*cos(sigma)-1))*(cosh(tau)-cos(sigma))/(a^2*sinh(tau)^2)

(2)

#
# Check whether the Laplacian derived by Maple from the
# definition of the coordinate system above (ie LP) is
# the same as the Laplacian quaoted by Wikipedia (ie wiki)
#
# They *look* the same, but are they???
#
  is(wiki=LP);

true

(3)

 


 

Download lapl2.mw

 

If I ignore all the syntax errors in your worksheet, it seems as if you are specifying the Laplacian in general curvilinear coordinates and then applying this to a specific (new?) coordinate system.

If this is indeed the requirement, then a better approach is add the (new?) coordinate system to those known by the VectorCalculus package using its AddCoordinates() command. For this, all you need to know is the definition of the 'new' coordinate system in terms of Cartesian coordinates

Consider the 'toy' example shown in the attached

You should also be aware that the VectorCalculus package already contains definitions of many curvilinear coordinate systems which may also be used. You can examine these by entering

? VectorCalculus/Coordinates

at the Maple prompt

  restart;
  with(VectorCalculus):
  AddCoordinates(foo[u,v,w], [sqrt(u), sqrt(v), sqrt(w)]);
  Laplacian( f(u,v,w), foo[u,v,w]);

foo

 

8*(-(1/4)*(1/v)^(1/2)*(1/w)^(1/2)*(diff(f(u, v, w), u))/((1/u)^(1/2)*u)+(1/2)*(1/u)^(1/2)*(1/v)^(1/2)*(1/w)^(1/2)*(diff(f(u, v, w), u))+(1/2)*(1/u)^(1/2)*(1/v)^(1/2)*(1/w)^(1/2)*u*(diff(diff(f(u, v, w), u), u))-(1/4)*(1/u)^(1/2)*(1/w)^(1/2)*(diff(f(u, v, w), v))/((1/v)^(1/2)*v)+(1/2)*(1/u)^(1/2)*(1/v)^(1/2)*(1/w)^(1/2)*(diff(f(u, v, w), v))+(1/2)*(1/u)^(1/2)*(1/v)^(1/2)*(1/w)^(1/2)*v*(diff(diff(f(u, v, w), v), v))-(1/4)*(1/u)^(1/2)*(1/v)^(1/2)*(diff(f(u, v, w), w))/((1/w)^(1/2)*w)+(1/2)*(1/u)^(1/2)*(1/v)^(1/2)*(1/w)^(1/2)*(diff(f(u, v, w), w))+(1/2)*(1/u)^(1/2)*(1/v)^(1/2)*(1/w)^(1/2)*w*(diff(diff(f(u, v, w), w), w)))/((1/u)^(1/2)*(1/v)^(1/2)*(1/w)^(1/2))

(1)

 


 

Download lapl.mw

with a bit of care, one can get an almost equally nice plot using the SurfaceOfRevolution() command, as in the attached


 

restart;
with(Student[Calculus1]):
g:=x->(x-4)/(x-2)/(x-6)+15;
SurfaceOfRevolution(g(x), x=2..6, axis=vertical, output=plot, axes=none);

proc (x) options operator, arrow; (x-4)/((x-2)*(x-6))+15 end proc

 

 

 

 

 

 


 

Download SOR3.mw

the following - butI'm not sure(???) the curve you specify will ever produce the plot you want

restart;
with(Student[Calculus1]):

g:=(x,y)->(sqrt(x^2+y^2)-4)/(sqrt(x^2+y^2)-2)/(sqrt(x^2+y^2)-6)+15;
plot( g(x,0), x=-6..6);
SurfaceOfRevolution(g(x,0), x=-6..6, axis=vertical, output=plot, axes=none);

proc (x, y) options operator, arrow; (sqrt(x^2+y^2)-4)/((sqrt(x^2+y^2)-2)*(sqrt(x^2+y^2)-6))+15 end proc

 

 

 

 

 


 

Download SOR.mw

  1. This is a bug
  2. I have checked all versions back to Maple 2015, and all produce an identical error message
  3. In Maple 18 (ie prior to Maple 2015), the pdsolve() command never(?) terminates - so maybe(?) it is stuck in some kind of infinte recursion, which is being "trapped" in subsequent releases
  4. Rather interestingly, the LHS of your PDE is the sum of three terms. Remove any one of these terms and the pdsolve() command completes without error. In two cases it obtains an analytic solution and in the third case it returns no solution

@asma khan 

but maybe something in the attached i what you want

  restart;
#
# Take N=8 as an example
#
  N:=8;
#
# Generate list of x-values
#
  x:=[ seq
       ( -1+j*(1/3),
         j=0..N
       )
     ];
#
# With x-values given above, diagonal entries
# of matrix P1 are given by
#
#       P1[i,i]=-x[i]
#
  P1:= Matrix( N+1,
               N+1,
               (i,j)-> `if`( i=j,
                             -x[i],
                             0
                           )
             );
#
# With x-values given above, diagonal entries
# of matrix P2 are given by
#
#       P2[i,i]=1-x[i]
#
  P2:= Matrix( N+1,
               N+1,
               (i,j)-> `if`( i=j,
                             1-x[i],
                             0
                           )
             );

N := 8

 

x := [-1, -2/3, -1/3, 0, 1/3, 2/3, 1, 4/3, 5/3]

 

Matrix(9, 9, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (1, 6) = 0, (1, 7) = 0, (1, 8) = 0, (1, 9) = 0, (2, 1) = 0, (2, 2) = 2/3, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (2, 7) = 0, (2, 8) = 0, (2, 9) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1/3, (3, 4) = 0, (3, 5) = 0, (3, 6) = 0, (3, 7) = 0, (3, 8) = 0, (3, 9) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0, (4, 5) = 0, (4, 6) = 0, (4, 7) = 0, (4, 8) = 0, (4, 9) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = 0, (5, 5) = -1/3, (5, 6) = 0, (5, 7) = 0, (5, 8) = 0, (5, 9) = 0, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0, (6, 5) = 0, (6, 6) = -2/3, (6, 7) = 0, (6, 8) = 0, (6, 9) = 0, (7, 1) = 0, (7, 2) = 0, (7, 3) = 0, (7, 4) = 0, (7, 5) = 0, (7, 6) = 0, (7, 7) = -1, (7, 8) = 0, (7, 9) = 0, (8, 1) = 0, (8, 2) = 0, (8, 3) = 0, (8, 4) = 0, (8, 5) = 0, (8, 6) = 0, (8, 7) = 0, (8, 8) = -4/3, (8, 9) = 0, (9, 1) = 0, (9, 2) = 0, (9, 3) = 0, (9, 4) = 0, (9, 5) = 0, (9, 6) = 0, (9, 7) = 0, (9, 8) = 0, (9, 9) = -5/3})

 

Matrix(%id = 18446744074372138518)

(1)

 

 

Download doMat.mw

@Hajra Zeb 

and I'll say it again!!!

Upload a worksheet, using the big green up-arrow in the Mapleprimes toolbar.

Trying to diagnose problems by looking at pictures of code is almost impossible. On the other hand if you provide an actual worksheet, then responders here can execute/edit/debug. This way problem can be solved.

@reza gugheri 

I can use the file you have uploaded - but what do you want me to do with it?

@reza gugheri 

Save the worksheet.

Using the big green up-arrow in the Mapleprimes toolbar, navigate to the desired worksheet and upload it

  1. Use CTRL+Alt+Delete to bring up Task Manager. Under the processes tab, check for the entry mserver.exe. If one (or more) of these exist, right-click on each entry and use "End Process Tree"
  2. Try starting Maple again.

It woulld probably be a good idea if you could check whether you have a "start-up" issue or an "install" issue

It is worth checking the installer log for anything "suspicious".

This log file will be located in your installation directory (probably C:\Program Files\Maple 2018) and will be called

Maple_2018_dateTimeString.log

where dateTimeString in the above will depend on the date/time of installation. Dump this into your favourite editor and do a case insensitive search for the string "error" This *may* provide some enlightenment

@Hajra Zeb 

will generate a matrix containing the, unevaluated, indexed entries phi[i,j].

How these entries are evaluated to numbers depends on how you have assigned the entries phi[i,j], which your code snippet does not show.

If you need an explanation of this evaluation, you will have to provide information on the assignments of phi[i,j]

See the attached

N:=3;
getMat:= N-> Matrix
               ( N+1,
                 N+1,
                 (i,j)-> `if`( type(j, odd),
                               `if`( `and`( type(i, odd),
                                            i>=j
                                          ),
                                      phi[ i-1, (i-j)/2 ],
                                      0
                                   ),
                               `if`( `and`( type(i, even),
                                            i>=j
                                          ),
                                      phi[ i-1, (i-j)/2 ],
                                      0
                                   )
                             )
               ):
 Z:= getMat(N)^+;

N := 3

 

Matrix(%id = 18446744074370523494)

(1)

 


 

Download doMat3.mw

 

post low resolution pictures of worksheets which I can barely read

Post the actual, editable, executable worksheet using the big green up-arrow in the Mapleprimes toolbasr

@byrktr 

see the attached


 

restart:

 

 

we:=[1,2,8,9,15,16,22,23,29,30]:

wd:=[3,4,5,6,7,10,11,12,13,14,17,18,19,20,21,24,25,26,27,28]:

#printlevel :=3:

for j from 1 to 30 do
#her gündüz vardiyasında en az 4 hemşire bulunsun
a[j]:=sum(x[i][j][1], i=1..20)>=4:
end do:

A := [seq(a[j],j=1..30)]:

#her gece vardiyasında en az 4 hemşire bulunsun
for j from 1 to 30 do
b[j]:=sum(x[i][j][2], i=1..20)>=4:
end do:

 

B := [seq(b[j],j=1..30)]:

#her hemşire ayda en az 4 hafta içi gündüz vardiyasında çalışsın
for i from 1 to 20 do
c[i]:=sum(x[i][wd[k]][1], k=1..20)>=4:
end do:

C := [seq(c[i],i=1..20)]:

#her hemşire ayda en az 4 hafta içi gece vardiyasında çalışsın
for i from 1 to 20 do
d[i]:=sum(x[i][wd[k]][2], k=1..20)>=4:
end do:

dd:= [seq(d[i],i=1..20)]:

#her hemşire ayda en az 2 hafta sonu gündüz vardiyasında çalışsın
for i from 1 to 20 do
e[i]:=sum(x[i][we[k]][1], k=1..10)>=2:
end do:

E:= [seq(e[i],i=1..20)]:

#her hemşire ayda en az 2 hafta sonu gece vardiyasında çalışsın
for i from 1 to 20 do
f[i]:=sum(x[i][we[k]][2], k=1..10)>=2:
end do:

F:= [seq(f[i],i=1..20)]:

#gece vardiyasında çalışan hemşire ertesi gündüz ve gece vardiyalarında izinlidir
for i from 1 to 20 do
for j from 1 to 29 do
g[i][j]:=2*x[i][j][2]+x[i][j+1][1]+x[i][j+1][2]<=2:
end do:
end do:

for i from 1 to 20 do
g[i] := seq(g[i][j],j=1..29)
end do:

g:= [seq(g[i],i=1..20)]:

#her hemşirenin toplam çalıştığı vardiya sayısı mümkünse 12 ye en yakın olsun
for i from 1 to 20 do
sum(sum(x[i][c][k],c=1..30),k=1..2)=12+p[i]
end do:

#
# 'p' is not defined anywhere, so goal1 is
# completely undefined
#
  goal1:=sum(p[l],l=1..20);

p[1]+p[2]+p[3]+p[4]+p[5]+p[6]+p[7]+p[8]+p[9]+p[10]+p[11]+p[12]+p[13]+p[14]+p[15]+p[16]+p[17]+p[18]+p[19]+p[20]

(1)

#hemşireler mümkün olduğunca ardışık vardiyalara atanmasın
for i from 1 to 20 do
for j from 1 to 30 do
x[i][j][1]+x[i][j][2]=1+s[i]
end do:
end do:

#
# 't' is not defined anywhere, so goal2 is
# completely undefined
#
goal2:=sum(t[l],l=1..20);

t[1]+t[2]+t[3]+t[4]+t[5]+t[6]+t[7]+t[8]+t[9]+t[10]+t[11]+t[12]+t[13]+t[14]+t[15]+t[16]+t[17]+t[18]+t[19]+t[20]

(2)

with(Optimization):

#
# Since goal1 and goal2 are completely undefined
# goal1+goal2 is completely undefined, so no way the
# following can work
#
# Minimize( goal1+goal2),{A[],B[],C[],dd[],E[],F[],g[]}, assume = binary ):

 

 


 

Download tam3comment.mw

exaclt on whta you want, one of the commands

max([seq( mExact(k)-mNumer(k), k=0..1,0.1)]);
max([seq( evalf(mExact(k)-y(k)), k=0..1,0.1)]);
max([seq( abs(mExact(k)-mNumer(k)), k=0..1,0.1)]);
max([seq( abs(evalf(mExact(k)-y(k))), k=0..1,0.1)]);

will provide the required answer. Output from these commands for your problem is

 0.000000063396252
 0.000000005880000
 0.000000063396252
 0.000000204600000

respectively

@byrktr 

  1. Since you still do not supply a complete worksheet which illustrates Maple "crashing", there is not much anyone here can do
  2. If the problem is a limitation related to Maple's in-built Optimization:-Minimize() command, then other (free) optimizer packages are available for Maple (eg DirectSearch) which may be successful.
  3. Whether any package could definitively provide a global minimum is almost certain to depend on whether or not the problem is strictly convex. As far as I can tell from what you have provided so far all constraints appear(?) to be linear, so if the objective function (not supplied) is also linear in all unknowns, then the overall problem *ought* to be convex, and hence solvable
  4. AFAIK the assume=binary option is not available for the Optimization:-Minimize() command. A closely related restriction (binaryvariables=true) is available in the Optimization:-LPSolve() command. Using the latter command would require that the objective function and constraints are linear in all variables. This may be a better choice, but since you have not provide the objective function, I can't try this
  5. When using the DirectSearch() package it is possible to require that all variables are "binary", even for non-linear problems. Again, without a complete statement of the problem, I can't try this either.
First 7 8 9 10 11 12 13 Last Page 9 of 148