tomleslie

5818 Reputation

17 Badges

10 years, 52 days

MaplePrimes Activity


These are replies submitted by tomleslie

@Kitonum 

because I can't reproduce your problem in anything from Maple 18 onwards -see attachments

restart; with(Optimization); kernelopts(version); LPSolve(5*x1+2*x2+7*x3+6*x4+x5+6*x6+8*x7+6*x8, {10*x1+9*x2+15*x3+3*x4+11*x5+6*x6+3*x7+4*x8 <= 22}, assume = {integer, nonnegative}, maximize = true)

`Maple 18.02, X86 64 WINDOWS, Oct 20 2014, Build ID 991181`

 

[56, [x1 = 0, x2 = 0, x3 = 0, x4 = 0, x5 = 0, x6 = 0, x7 = 7, x8 = 0]]

(1)

Download int18opt.mw

 

restart; with(Optimization); kernelopts(version); LPSolve(5*x1+2*x2+7*x3+6*x4+x5+6*x6+8*x7+6*x8, {10*x1+9*x2+15*x3+3*x4+11*x5+6*x6+3*x7+4*x8 <= 22}, assume = {integer, nonnegative}, maximize = true)

`Maple 2015.2, X86 64 WINDOWS, Dec 20 2015, Build ID 1097895`

 

[56, [x1 = 0, x2 = 0, x3 = 0, x4 = 0, x5 = 0, x6 = 0, x7 = 7, x8 = 0]]

(1)

 

Download int2015opt.mw

 

restart; with(Optimization); kernelopts(version); LPSolve(5*x1+2*x2+7*x3+6*x4+x5+6*x6+8*x7+6*x8, {10*x1+9*x2+15*x3+3*x4+11*x5+6*x6+3*x7+4*x8 <= 22}, assume = {integer, nonnegative}, maximize = true)

`Maple 2016.2, X86 64 WINDOWS, Jan 13 2017, Build ID 1194701`

 

[56, [x1 = 0, x2 = 0, x3 = 0, x4 = 0, x5 = 0, x6 = 0, x7 = 7, x8 = 0]]

(1)

 

Download int2016opt.mw

 

restart; with(Optimization); kernelopts(version); LPSolve(5*x1+2*x2+7*x3+6*x4+x5+6*x6+8*x7+6*x8, {10*x1+9*x2+15*x3+3*x4+11*x5+6*x6+3*x7+4*x8 <= 22}, assume = {integer, nonnegative}, maximize = true)

`Maple 2017.3, X86 64 WINDOWS, Sep 13 2017, Build ID 1262472`

 

[56, [x1 = 0, x2 = 0, x3 = 0, x4 = 0, x5 = 0, x6 = 0, x7 = 7, x8 = 0]]

(1)

 

Download int2017opt.mw

 

restart; with(Optimization); kernelopts(version); LPSolve(5*x1+2*x2+7*x3+6*x4+x5+6*x6+8*x7+6*x8, {10*x1+9*x2+15*x3+3*x4+11*x5+6*x6+3*x7+4*x8 <= 22}, assume = {integer, nonnegative}, maximize = true)

`Maple 2018.2, X86 64 WINDOWS, Nov 16 2018, Build ID 1362973`

 

[56, [x1 = 0, x2 = 0, x3 = 0, x4 = 0, x5 = 0, x6 = 0, x7 = 7, x8 = 0]]

(1)

``

NULL

Download int2018opt.mw

 

restart; with(Optimization); kernelopts(version); LPSolve(5*x1+2*x2+7*x3+6*x4+x5+6*x6+8*x7+6*x8, {10*x1+9*x2+15*x3+3*x4+11*x5+6*x6+3*x7+4*x8 <= 22}, assume = {integer, nonnegative}, maximize = true)

`Maple 2019.2, X86 64 WINDOWS, Nov 26 2019, Build ID 1435526`

 

[56, [x1 = 0, x2 = 0, x3 = 0, x4 = 0, x5 = 0, x6 = 0, x7 = 7, x8 = 0]]

(1)

 

Download int2019opt.mw

 

restart; with(Optimization); kernelopts(version); LPSolve(5*x1+2*x2+7*x3+6*x4+x5+6*x6+8*x7+6*x8, {10*x1+9*x2+15*x3+3*x4+11*x5+6*x6+3*x7+4*x8 <= 22}, assume = {integer, nonnegative}, maximize = true)

`Maple 2020.0, X86 64 WINDOWS, Mar 4 2020, Build ID 1455132`

 

[56, [x1 = 0, x2 = 0, x3 = 0, x4 = 0, x5 = 0, x6 = 0, x7 = 7, x8 = 0]]

(1)

 

Download int2020opt.mw

@MapleUser09 

Maybe the attached?

for i from 1 to 20 do:
    printf("new variable=%2d\n", i)
end do;

new variable= 1
new variable= 2
new variable= 3
new variable= 4
new variable= 5
new variable= 6
new variable= 7
new variable= 8
new variable= 9
new variable=10
new variable=11
new variable=12
new variable=13
new variable=14
new variable=15
new variable=16
new variable=17
new variable=18
new variable=19
new variable=20

 

 


ownload prStuff2.mw

@Kros 

Your original request was to resolve

restart;
PDE := diff(u(x, t), t) - Laplacian(u(x, t), [x]) - u(x, t) + x - 2*sin(2*x)*cos(x) = 0;

 

IBC := D[1](u)(Pi/2, t) = 1, u(0, t) = 0, u(x, 0) = x;

 

pds := pdsolve(eval(PDE), {IBC}, type = numeric);
Error, (in pdsolve/numeric/process_PDEs) number of dependent variables and number of PDE must be the same

and several responders herw showed you how the above problem could be solved.

Perhaps unfortunately, someone pointed out that this particular problem could also be solved analytcally, so that a numerical solution wasn't really either necessary or desirable.

However you were unable to reproduce the analytical solution because you were (for whatever reason) unable to update the necessary solution packages within Maple. Then possibly(?) you were able to to perform a simple software update? Although no-one here actually knows, because you have never stated whether or not you were able to reproduce the behaviour ( ie an analytical solution for your original problem) which everyone else can achieve

Having failed to provide this information on your original problem, you then moved on to other PDEs, with the complaint that these could not be solved analytically in the same way. I simply have no idea what your objective is here so I will make a few statements, which you should consider

  1. Can Maple provide an analytic solution for any PDE/BC problem which you supply? Answer -NO
  2. Can Maple provide an analytic solution for a given PDE/BC just because you think it looks "similar" to a problem whcy MAple can solve? Answer - No
  3. Can Maple be guaranteed to provide an analytic solution for a a PDE/BC problem, for which you already "know" the analytic solution? Answer - No
  4. Can any other mathematical software ( eg Mathematica/Macsyma/whatever) do better on a given PDE/BC problem? Answer- maybe. All of these have strengths and weaknesses

@Adam Ledger 

that zip archives are allowed. All you have to do is 'zip' your data (ie .csv) file) with your worksheet and then upload here.

If for some reason that is too difficult for you, then chenge the file extension on your csv file to .txt' and upload that instead

This isn't exactly difficult

@Kros 

When I said

Take my worksheet  pdeIss3.mw and run it.

which is the word you don't understand? The worksheet pdeIss3.mw contains the PDE/BCs

    PDE := diff(u(x, t), t) - diff(u(x, t), x$2) - u(x, t) + x - 2*sin(2*x)*cos(x) = 0;
  IBC := D[1](u)(Pi/2, t) = 1, u(0, t) = 0, u(x, 0) = x;

Before you do anything else, you should verify that my response solves your original problem!

In the worksheet you have recently supplied, you have changed the PDE/BCs to something completely different, ie

    PDE := diff(u(x, t), t,t) - diff(u(x, t), x$2) - 10*u(x, t) - 2*sin(2*x)*cos(x) = 0;
  IBC := D[1](u)(Pi/2, t) = 0, u(0, t) = 0, u(x, 0) = 0, D[2](u)(x, 0) = 0;

Why do you believe that just because Maple can analytically solve one PDE/BC combination,  it can analytically solve a completely different PDE/BC combination?

I have actually tried so solve this second  PDE/BC combination, and interrupted Maple after an hour, during which no solution was obtained. I would expect Maple to have more problems (maybe fail??) with this second PDE/BC combination simply because it is second-order in both time and space. The original PDE/BC combination is first order in time and second order in space. Increasing the order of PDEs generally(?) makes them much more difficult to solve.

I think that for this second PDE/BC combination you will be restricted to a numerical-only solution

@Kros 

Making statements like "nothing happens" tells me precisely nothing.

Take my worksheet  pdeIss3.mw and run it.

Don't edit it, don't touch it, don't do anything other than run it

And when I say run it I mean leave it running for at least 30mins.If it hasn't worked after 30mins, then kill the computation and upload the worksheet here

@Kros 

from here https://www.mapleprimes.com/posts/210295-The-Physics-Updates-How-To-Install

I missed the highlighted instructions in my previous post

  • Open Maple,
  • Click the MapleCloud icon in the upper-right corner to open the MapleCloud toolbar 
  • In the MapleCloud toolbar, open Packages
  • Find the Physics Updates package and click the install button, it is the last one under Actions
  • To check for new versions of Physics Updates, click the MapleCloud icon. If the Updates icon has a red dot, click it to install the new version

@c10h20o 

makes a big difference!

Suggest you examine the possibilities in the attached very carefully

  restart;
#
# OP's original expression, with parentheses fixed
#
  expr1:=(7.72-7.72*B)*(-7.717267500*a) = 662204.4444*B^2;
#
# Using 'implicitplot' with NEGATIVE values of 'a'
#
  p1:=plots:-implicitplot(expr1, a = -50000..0, B = 0 .. 1);
#
# Reflect this plot about the y-axis, essentially
# changing the sign of 'a'
#
  plottools:-reflect(p1, [[0,0],[0,1]]);

-7.717267500*(7.72-7.72*B)*a = 662204.4444*B^2

 

 

 

#
# Or one can change the sign of 'a' in the original
# expression by deleting the highlighted minus sign
# in the original expression
#
#  (7.72-7.72*B)*(-7.717267500*a) = 662204.4444*B^2
#
# to get the following, and then use implicitplot()
# with a positive ranges for 'a'
#
  expr2:=(7.72-7.72*B)*(7.717267500*a) = 662204.4444*B^2;
  p2:=plots:-implicitplot(expr2, a = 0..50000, B = 0 .. 1);

7.717267500*(7.72-7.72*B)*a = 662204.4444*B^2

 

 

#
# Or the OP has claimed that he solved for 'a'
# in terms of 'B' and then rotated the result
# anticlockwise by Pi/2, which would be
#
  p3:=plot( rhs(isolate(expr1, a)), B=0..0.85);
  plottools:-rotate(p3, Pi/2);

 

 

 

Download Banda.mw

@Kros 
Because you have you have removed the code at the start of my (perfectly-functional) worksheets, ie this execution group

restart;
version();
Physics:-Version();

and the associated output, I cannot tell exactly which Maple version/subversion you are using. As you can see from the worksheets I have supplied, I am running Maple 2020, build version 1455132, with the Physics updates version 635

However looking at the worksheet you have posted, it is obvious that the command

pdsA:= pdsolve([PDE, IBC]);

is returning nothing, which is why the associated plotting command, ie

p1:= plot3d( rhs(pdsA),
                    x=0..Pi/2,
                    t=0..10,
                    color=red,
                    style=surface
                 );

fails.

Assuming that you are running Maple 2020, the most likely reason that your installation is not returning anything for the analytic solution of your pde, is that you are not running the latest and greatest version of the 'Physics' package. (Amongst other things, this package updates Maple's PDE solvers on a regular basis.)

The "simplest" way to install the latest 'Physics' updates is from the 'cloud' icon in the upper right of your Maple window, immediately below the standard "red cross" to close the application.

Click on this icon, select updates, and install the latest updates ofr the 'Physics' package. You may (or may not) be asked for your MapleSoft account password. Assuming that this installation is successful, restart Maple, and try either of the worksheets I have previously posted, ie

pdeIss2.mw
pdeIss3.mw

again

 

 

@Kros 

Since both the numerical and analytic solution have been determined it is relatively easy to compute these for any given values of the independent variables 'x' and 't' and store the results in any convenient 2-D container.

In the attached, I have extended my previous worksheet to produce matrices of the solutions for both methods, together with a matrix of the 'error' between the two methods

When you ask

In this way can other types of equations be solved ?

I have no idea what this question means!

  restart;
  version();
  Physics:-Version();
  

 User Interface: 1455132
         Kernel: 1455132
        Library: 1455132

 

1455132

 

`The "Physics Updates" version in the MapleCloud is 635 and is the same as the version installed in this computer, created 2020, March 21, 8:19 hours, found in the directory C:\Users\TomLeslie\maple\toolbox\Physics Updates\lib\`

(1)

#
# Define pde and bcs
#
  PDE := diff(u(x, t), t) - diff(u(x, t), x$2) - u(x, t) + x - 2*sin(2*x)*cos(x) = 0;
  IBC := D[1](u)(Pi/2, t) = 1, u(0, t) = 0, u(x, 0) = x;

diff(u(x, t), t)-(diff(diff(u(x, t), x), x))-u(x, t)+x-2*sin(2*x)*cos(x) = 0

 

(D[1](u))((1/2)*Pi, t) = 1, u(0, t) = 0, u(x, 0) = x

(2)

#
# Solve analytically (NB this takes a few minutes!)
# and plot the solution
#
  pdsA:= pdsolve([PDE, IBC]);
  p1:= plot3d( rhs(pdsA),
               x=0..Pi/2,
               t=0..10,
               color=red,
               style=surface
             );

`[Length of output exceeds limit of 1000000]`

 

`[Length of output exceeds limit of 1000000]`

 

u(x, t) = (1/8)*(-exp(-8*t)+1)*sin(3*x)+sin(x)*t+x

 

 

#
# Solve numerically and plot the solution
#
  pdsN:= pdsolve(PDE, {IBC}, type = numeric):
  p2:= pdsN:-plot3d( u(x,t),
                     x=0..Pi/2,
                     t=0..10,
                     color=blue,
                     style=surface
                   );

_m8091742464

 

 

#
# Display the analytic and numeric plots
# on the same graph - Pretty similar!
#
  plots:-display([p1,p2]);

 

#
# Plot the absolute error between the analytic
# and numeric solutions
#
  p3:= pdsN:-plot3d( abs( u(x,t)-rhs(pdsA) ),
                     x=0..Pi/2,
                     t=0..10,
                     color=blue,
                     style=surface
                   );

 

#
# Adjust the output display a little, just to make things
# easier to read. Does not affect calculation accuracy, this
# is just for convenience of display
#
  interface(rtablesize=12):
  interface(displayprecision=6):

#
# Define a function which will return values of u(x,t)
# from the numerical pdsolve() procedure for any supplied
# values of the independent variables 'x' and 't'
#
  uNval:= (p,q)->eval( u(x,t),
                        pdsN:-value
                              ( t=q,
                                output=listprocedure
                              )
                     )(p):
#
# Compute the values for u(x,t) from the numerical
# pdsolve() procedure and store these in a matrix.
# Each row of the matrix corresponds to 't' values
# from 0 to 10 in steps of 1. Each column of the
# matrix corresponds to 'x' values from 0 to Pi/2
# in steps of Pi/20
#
  numM:= Matrix
         ( [ seq
             ( [ seq( uNval(i,j),
                      i = 0..evalf(Pi/2)-1.0e-09, evalf(Pi/20)
                    )
               ],
               j=0..10
             )
           ]
         );

Matrix(11, 10, {(1, 1) = 0., (1, 2) = .1570796, (1, 3) = .3141593, (1, 4) = .4712389, (1, 5) = .6283185, (1, 6) = .7853982, (1, 7) = .9424778, (1, 8) = 1.099557, (1, 9) = 1.256637, (1, 10) = 1.413717, (2, 1) = 0., (2, 2) = .3707308, (2, 3) = .7251787, (2, 4) = 1.049865, (2, 5) = 1.336329, (2, 6) = 1.582278, (2, 7) = 1.791454, (2, 8) = 1.972247, (2, 9) = 2.135382, (2, 10) = 2.291190, (3, 1) = 0., (3, 2) = .5275130, (3, 3) = 1.034879, (3, 4) = 1.504852, (3, 5) = 1.925391, (3, 6) = 2.290902, (3, 7) = 2.602185, (3, 8) = 2.865116, (3, 9) = 3.088403, (3, 10) = 3.280895, (4, 1) = 0., (4, 2) = .6843371, (4, 3) = 1.344665, (4, 4) = 1.959971, (4, 5) = 2.514634, (4, 6) = 2.999759, (4, 7) = 3.413198, (4, 8) = 3.758313, (4, 9) = 4.041785, (4, 10) = 4.270985, (5, 1) = 0., (5, 2) = .8412178, (5, 3) = 1.654563, (5, 4) = 2.415254, (5, 5) = 3.104090, (5, 6) = 3.708871, (5, 7) = 4.224503, (5, 8) = 4.651831, (5, 9) = 4.995511, (5, 10) = 5.261431, (6, 1) = 0., (6, 2) = .9981549, (6, 3) = 1.964572, (6, 4) = 2.870701, (6, 5) = 3.693759, (6, 6) = 4.418239, (6, 7) = 5.036100, (6, 8) = 5.545671, (6, 9) = 5.949581, (6, 10) = 6.252235, (7, 1) = 0., (7, 2) = 1.155149, (7, 3) = 2.274694, (7, 4) = 3.326312, (7, 5) = 4.283639, (7, 6) = 5.127862, (7, 7) = 5.847990, (7, 8) = 6.439833, (7, 9) = 6.903995, (7, 10) = 7.243396, (8, 1) = 0., (8, 2) = 1.312199, (8, 3) = 2.584926, (8, 4) = 3.782088, (8, 5) = 4.873733, (8, 6) = 5.837742, (8, 7) = 6.660173, (8, 8) = 7.334317, (8, 9) = 7.858753, (8, 10) = 8.234914, (9, 1) = 0., (9, 2) = 1.469306, (9, 3) = 2.895271, (9, 4) = 4.238027, (9, 5) = 5.464039, (9, 6) = 6.547877, (9, 7) = 7.472648, (9, 8) = 8.229124, (9, 9) = 8.813854, (9, 10) = 9.226789, (10, 1) = 0., (10, 2) = 1.626469, (10, 3) = 3.205728, (10, 4) = 4.694131, (10, 5) = 6.054558, (10, 6) = 7.258267, (10, 7) = 8.285417, (10, 8) = 9.124254, (10, 9) = 9.769300, (10, 10) = 10.219022, (11, 1) = 0., (11, 2) = 1.783689, (11, 3) = 3.516296, (11, 4) = 5.150399, (11, 5) = 6.645289, (11, 6) = 7.968914, (11, 7) = 9.098478, (11, 8) = 10.019705, (11, 9) = 10.725091, (11, 10) = 11.211612})

(3)

#
# Define a function which will return values of u(x,t)
# from the analytic pdsolve() procedure for any supplied
# values of the independent variables 'x' and 't'
#
  uAval:=unapply(rhs(pdsA), [x,t]):
#
# Compute the values for u(x,t) from the analytical
# pdsolve() procedure and store these in a matrix.
# Each row of the matrix corresponds to 't' values
# from 0 to 10 in steps of 1. Each column of the
# matrix corresponds to 'x' values from 0 to Pi/2
# in steps of Pi/20
#
  analM:= Matrix
          ( evalf~( [ seq
                      ( [ seq( uAval(i,j),
                               i = 0..evalf(Pi/2)-1.0e-09, evalf(Pi/20)
                             )
                        ],
                        j=0..10
                      )
                    ]
                  )
               );

Matrix(11, 10, {(1, 1) = 0., (1, 2) = .157080, (1, 3) = .314159, (1, 4) = .471239, (1, 5) = .628319, (1, 6) = .785398, (1, 7) = .942478, (1, 8) = 1.099557, (1, 9) = 1.256637, (1, 10) = 1.413717, (2, 1) = 0., (2, 2) = .370244, (2, 3) = .724269, (2, 4) = 1.048649, (2, 5) = 1.334946, (2, 6) = 1.580864, (2, 7) = 1.790109, (2, 8) = 1.971016, (2, 9) = 2.134245, (2, 10) = 2.290067, (3, 1) = 0., (3, 2) = .526697, (3, 3) = 1.033320, (3, 4) = 1.502681, (3, 5) = 1.922771, (3, 6) = 2.288000, (3, 7) = 2.599139, (3, 8) = 2.862016, (3, 9) = 3.085277, (3, 10) = 3.277718, (4, 1) = 0., (4, 2) = .683132, (4, 3) = 1.342337, (4, 4) = 1.956671, (4, 5) = 2.510556, (4, 6) = 2.995107, (4, 7) = 3.408156, (4, 8) = 3.753023, (4, 9) = 4.036333, (4, 10) = 4.265406, (5, 1) = 0., (5, 2) = .839566, (5, 3) = 1.651354, (5, 4) = 2.410662, (5, 5) = 3.098342, (5, 6) = 3.702214, (5, 7) = 4.217173, (5, 8) = 4.644029, (5, 9) = 4.987390, (5, 10) = 5.253094, (6, 1) = 0., (6, 2) = .996001, (6, 3) = 1.960371, (6, 4) = 2.864652, (6, 5) = 3.686127, (6, 6) = 4.409320, (6, 7) = 5.026190, (6, 8) = 5.535036, (6, 9) = 5.938446, (6, 10) = 6.240783, (7, 1) = 0., (7, 2) = 1.152435, (7, 3) = 2.269388, (7, 4) = 3.318643, (7, 5) = 4.273912, (7, 6) = 5.116427, (7, 7) = 5.835207, (7, 8) = 6.426042, (7, 9) = 6.889503, (7, 10) = 7.228471, (8, 1) = 0., (8, 2) = 1.308870, (8, 3) = 2.578405, (8, 4) = 3.772633, (8, 5) = 4.861697, (8, 6) = 5.823534, (8, 7) = 6.644224, (8, 8) = 7.317049, (8, 9) = 7.840560, (8, 10) = 8.216159, (9, 1) = 0., (9, 2) = 1.465304, (9, 3) = 2.887422, (9, 4) = 4.226624, (9, 5) = 5.449483, (9, 6) = 6.530641, (9, 7) = 7.453241, (9, 8) = 8.208055, (9, 9) = 8.791616, (9, 10) = 9.203848, (10, 1) = 0., (10, 2) = 1.621739, (10, 3) = 3.196439, (10, 4) = 4.680614, (10, 5) = 6.037268, (10, 6) = 7.237748, (10, 7) = 8.262258, (10, 8) = 9.099062, (10, 9) = 9.742673, (10, 10) = 10.191536, (11, 1) = 0., (11, 2) = 1.778173, (11, 3) = 3.505456, (11, 4) = 5.134605, (11, 5) = 6.625053, (11, 6) = 7.944854, (11, 7) = 9.071275, (11, 8) = 9.990068, (11, 9) = 10.693729, (11, 10) = 11.179224})

(4)

#
# Compute the difference between the matrix of numerical
# solutions and the matrix of analytical solutions. This
# is one measure of the "error" between the two solution
# methods
#
  analM-numM;

Matrix(11, 10, {(1, 1) = 0., (1, 2) = 0., (1, 3) = 0., (1, 4) = 0., (1, 5) = 0., (1, 6) = 0.1110223000e-15, (1, 7) = 0., (1, 8) = 0., (1, 9) = 0., (1, 10) = 0., (2, 1) = 0., (2, 2) = -0.487e-3, (2, 3) = -0.909e-3, (2, 4) = -0.1216433e-2, (2, 5) = -0.1383076e-2, (2, 6) = -0.1414418e-2, (2, 7) = -0.1345005e-2, (2, 8) = -0.1230946e-2, (2, 9) = -0.1137305e-2, (2, 10) = -0.1123447e-2, (3, 1) = 0., (3, 2) = -0.816e-3, (3, 3) = -0.1558834e-2, (3, 4) = -0.2171238e-2, (3, 5) = -0.2619747e-2, (3, 6) = -0.2902076e-2, (3, 7) = -0.3045684e-2, (3, 8) = -0.3100299e-2, (3, 9) = -0.3125648e-2, (3, 10) = -0.3177129e-2, (4, 1) = 0., (4, 2) = -0.1205289e-2, (4, 3) = -0.2327930e-2, (4, 4) = -0.3299680e-2, (4, 5) = -0.4078033e-2, (4, 6) = -0.4652070e-2, (4, 7) = -0.5041620e-2, (4, 8) = -0.5289963e-2, (4, 9) = -0.5451751e-2, (4, 10) = -0.5578783e-2, (5, 1) = 0., (5, 2) = -0.1651448e-2, (5, 3) = -0.3208671e-2, (5, 4) = -0.4592144e-2, (5, 5) = -0.5748675e-2, (5, 6) = -0.6657526e-2, (5, 7) = -0.7329828e-2, (5, 8) = -0.7801516e-2, (5, 9) = -0.8121429e-2, (5, 10) = -0.8337248e-2, (6, 1) = 0., (6, 2) = -0.2154144e-2, (6, 3) = -0.4201092e-2, (6, 4) = -0.6048681e-2, (6, 5) = -0.7631744e-2, (6, 6) = -0.8918530e-2, (6, 7) = -0.9910414e-2, (6, 8) = -0.1063507e-1, (6, 9) = -0.1113481e-1, (6, 10) = -0.1145264e-1, (7, 1) = 0., (7, 2) = -0.2713397e-2, (7, 3) = -0.5305235e-2, (7, 4) = -0.7669353e-2, (7, 5) = -0.9727318e-2, (7, 6) = -0.1143518e-1, (7, 7) = -0.1278348e-1, (7, 8) = -0.1379075e-1, (7, 9) = -0.1449202e-1, (7, 10) = -0.1492511e-1, (8, 1) = 0., (8, 2) = -0.3329227e-2, (8, 3) = -0.6521137e-2, (8, 4) = -0.9454217e-2, (8, 5) = -0.1203547e-1, (8, 6) = -0.1420756e-1, (8, 7) = -0.1594914e-1, (8, 8) = -0.1726867e-1, (8, 9) = -0.1819318e-1, (8, 10) = -0.1875477e-1, (9, 1) = 0., (9, 2) = -0.4001655e-2, (9, 3) = -0.7848843e-2, (9, 4) = -0.1140333e-1, (9, 5) = -0.1455628e-1, (9, 6) = -0.1723576e-1, (9, 7) = -0.1940749e-1, (9, 8) = -0.2106894e-1, (9, 9) = -0.2223841e-1, (9, 10) = -0.2294175e-1, (10, 1) = 0., (10, 2) = -0.4730702e-2, (10, 3) = -0.9288389e-2, (10, 4) = -0.1351676e-1, (10, 5) = -0.1728983e-1, (10, 6) = -0.2051988e-1, (10, 7) = -0.2315864e-1, (10, 8) = -0.2519168e-1, (10, 9) = -0.2662784e-1, (10, 10) = -0.2748618e-1, (11, 1) = 0., (11, 2) = -0.5516386e-2, (11, 3) = -0.1083982e-1, (11, 4) = -0.1579456e-1, (11, 5) = -0.2023619e-1, (11, 6) = -0.2406002e-1, (11, 7) = -0.2720270e-1, (11, 8) = -0.2963701e-1, (11, 9) = -0.3136160e-1, (11, 10) = -0.3238819e-1})

(5)

 


 

Download pdeIss3.mw

 

@Kros 

You can put the analytic and numeric solutions on a single graph, and even plot the discrepancy between the two

See the attached

  restart;
  version();
  Physics:-Version();
  

 User Interface: 1455132
         Kernel: 1455132
        Library: 1455132

 

1455132

 

`The "Physics Updates" version in the MapleCloud is 635 and is the same as the version installed in this computer, created 2020, March 21, 8:19 hours, found in the directory C:\Users\TomLeslie\maple\toolbox\Physics Updates\lib\`

(1)

#
# Define pde and bcs
#
  PDE := diff(u(x, t), t) - diff(u(x, t), x$2) - u(x, t) + x - 2*sin(2*x)*cos(x) = 0;
  IBC := D[1](u)(Pi/2, t) = 1, u(0, t) = 0, u(x, 0) = x;

diff(u(x, t), t)-(diff(diff(u(x, t), x), x))-u(x, t)+x-2*sin(2*x)*cos(x) = 0

 

(D[1](u))((1/2)*Pi, t) = 1, u(0, t) = 0, u(x, 0) = x

(2)

#
# Solve analytically (NB this takes a few minutes!)
# and plot the solution
#
  pdsA:= pdsolve([PDE, IBC]);
  p1:= plot3d( rhs(pdsA),
               x=0..Pi/2,
               t=0..10,
               color=red,
               style=surface
             );

u(x, t) = (1/8)*(-exp(-8*t)+1)*sin(3*x)+sin(x)*t+x

 

 

#
# Solve numerically and plot the solution
#
  pdsN:= pdsolve(PDE, {IBC}, type = numeric);
  p2:= pdsN:-plot3d( u(x,t),
                     x=0..Pi/2,
                     t=0..10,
                     color=blue,
                     style=surface
                   );

_m1918883328

 

 

#
# Display the analytic and numeric plots
# on the same graph - Pretty similar!
#
  plots:-display([p1,p2]);

 

#
# Plot the absolute error between the analytic
# and numeric solutions
#
  p3:= pdsN:-plot3d( abs( u(x,t)-rhs(pdsA) ),
                     x=0..Pi/2,
                     t=0..10,
                     color=blue,
                     style=surface
                   );

 

 


Download pdeIss2.mw

@Zeineb 

12 equations in 16 unknowns?

What are u[4, 0], u[4, 1], u[4, 2], u[4, 3]? These quantities are not in your vector of unknowns, or in your lit of parameters.

See the attached

restart; with(LinearAlgebra)

for i to 3 do eq[i] := -alpha*(u[i+1, 1]+u[i-1, 1])-beta*(u[i, 2]+u[i, 0])+4*u[i, 1] end do

-alpha*(u[2, 1]+u[0, 1])-beta*(u[1, 2]+u[1, 0])+4*u[1, 1]

 

-alpha*(u[3, 1]+u[1, 1])-beta*(u[2, 2]+u[2, 0])+4*u[2, 1]

 

-alpha*(u[4, 1]+u[2, 1])-beta*(u[3, 2]+u[3, 0])+4*u[3, 1]

(1)

for i to 3 do eq[i+3] := -alpha*(u[i+1, 2]+u[i-1, 2])-beta*(u[i, 3]+u[i, 1])+4*u[i, 2] end do

-alpha*(u[2, 2]+u[0, 2])-beta*(u[1, 3]+u[1, 1])+4*u[1, 2]

 

-alpha*(u[3, 2]+u[1, 2])-beta*(u[2, 3]+u[2, 1])+4*u[2, 2]

 

-alpha*(u[4, 2]+u[2, 2])-beta*(u[3, 3]+u[3, 1])+4*u[3, 2]

(2)

for i to 3 do eq[i+6] := -alpha*(u[i-1, 0]+u[i+1, 0])-2*beta*u[i, 1]+4*u[i, 0] end do

-alpha*(u[0, 0]+u[2, 0])-2*beta*u[1, 1]+4*u[1, 0]

 

-alpha*(u[1, 0]+u[3, 0])-2*beta*u[2, 1]+4*u[2, 0]

 

-alpha*(u[2, 0]+u[4, 0])-2*beta*u[3, 1]+4*u[3, 0]

(3)

for i to 3 do eq[i+9] := -alpha*(u[i-1, 3]+u[i+1, 3])-2*beta*u[i, 2]+4*u[i, 3] end do

-alpha*(u[0, 3]+u[2, 3])-2*beta*u[1, 2]+4*u[1, 3]

 

-alpha*(u[1, 3]+u[3, 3])-2*beta*u[2, 2]+4*u[2, 3]

 

-alpha*(u[2, 3]+u[4, 3])-2*beta*u[3, 2]+4*u[3, 3]

(4)

eqsA := [seq(eq[j], j = 1 .. 12)]; eqsB := eval(eqsA, [alpha = 5, beta = 10, u[0, 0] = 100, u[0, 1] = 100, u[0, 2] = 100, u[0, 3] = 100]); numelems(eqsB); `union`(`~`[indets](eqsB, name)[]); numelems(%)

[-alpha*(u[2, 1]+u[0, 1])-beta*(u[1, 2]+u[1, 0])+4*u[1, 1], -alpha*(u[3, 1]+u[1, 1])-beta*(u[2, 2]+u[2, 0])+4*u[2, 1], -alpha*(u[4, 1]+u[2, 1])-beta*(u[3, 2]+u[3, 0])+4*u[3, 1], -alpha*(u[2, 2]+u[0, 2])-beta*(u[1, 3]+u[1, 1])+4*u[1, 2], -alpha*(u[3, 2]+u[1, 2])-beta*(u[2, 3]+u[2, 1])+4*u[2, 2], -alpha*(u[4, 2]+u[2, 2])-beta*(u[3, 3]+u[3, 1])+4*u[3, 2], -alpha*(u[0, 0]+u[2, 0])-2*beta*u[1, 1]+4*u[1, 0], -alpha*(u[1, 0]+u[3, 0])-2*beta*u[2, 1]+4*u[2, 0], -alpha*(u[2, 0]+u[4, 0])-2*beta*u[3, 1]+4*u[3, 0], -alpha*(u[0, 3]+u[2, 3])-2*beta*u[1, 2]+4*u[1, 3], -alpha*(u[1, 3]+u[3, 3])-2*beta*u[2, 2]+4*u[2, 3], -alpha*(u[2, 3]+u[4, 3])-2*beta*u[3, 2]+4*u[3, 3]]

 

[-5*u[2, 1]-500-10*u[1, 2]-10*u[1, 0]+4*u[1, 1], -5*u[3, 1]-5*u[1, 1]-10*u[2, 2]-10*u[2, 0]+4*u[2, 1], -5*u[4, 1]-5*u[2, 1]-10*u[3, 2]-10*u[3, 0]+4*u[3, 1], -5*u[2, 2]-500-10*u[1, 3]-10*u[1, 1]+4*u[1, 2], -5*u[3, 2]-5*u[1, 2]-10*u[2, 3]-10*u[2, 1]+4*u[2, 2], -5*u[4, 2]-5*u[2, 2]-10*u[3, 3]-10*u[3, 1]+4*u[3, 2], -500-5*u[2, 0]-20*u[1, 1]+4*u[1, 0], -5*u[1, 0]-5*u[3, 0]-20*u[2, 1]+4*u[2, 0], -5*u[2, 0]-5*u[4, 0]-20*u[3, 1]+4*u[3, 0], -500-5*u[2, 3]-20*u[1, 2]+4*u[1, 3], -5*u[1, 3]-5*u[3, 3]-20*u[2, 2]+4*u[2, 3], -5*u[2, 3]-5*u[4, 3]-20*u[3, 2]+4*u[3, 3]]

 

12

 

{u[1, 0], u[1, 1], u[1, 2], u[1, 3], u[2, 0], u[2, 1], u[2, 2], u[2, 3], u[3, 0], u[3, 1], u[3, 2], u[3, 3], u[4, 0], u[4, 1], u[4, 2], u[4, 3]}

 

16

(5)

"# #` OP seems uninterested (unaware?) of the unknowns `u[4,0],u[4,1],u[4,2],u[4,3]  #` since (s)he generates the unknowns as` # #` vect_unkown:=`[u[1,0],u[2,0],u[3,0], u[1,1],u[2,1],u[3,1],u[1,2],u[2,2],u[3,2],u[1,3],u[2,3],u[3,3]]; # #` which can be written much more compactly as` #    vect_unknown:=[seq( seq(u[i,j], i=1..3), j=0..3)]; # #` \Produce the coefficient matrix and the "right-hand-side"` #` vector. Note that the latter contains the unknowns` #` u`[4,0],u[4,1],u[4,2],u[4,3] of which the OP is unaware"?" #    interface(rtablesize=12):    A,b := GenerateMatrix(eqsB, vect_unknown)"

vect_unknown := [u[1, 0], u[2, 0], u[3, 0], u[1, 1], u[2, 1], u[3, 1], u[1, 2], u[2, 2], u[3, 2], u[1, 3], u[2, 3], u[3, 3]]

 

Matrix(%id = 18446744074426915286), Vector[column](%id = 18446744074426915166)

(6)

``

Download sysToMat.mw

@Zeineb 

If you use

indets(eqs, 'name')

this will return

{alpha, beta, u[0, 0], u[0, 1], u[0, 2], u[0, 3], u[1, 0], u[1, 1], u[1, 2], u[1, 3], u[2, 0], u[2, 1], u[2, 2], u[2, 3], u[3, 0], u[3, 1], u[3, 2], u[3, 3], u[4, 0], u[4, 1], u[4, 2], u[4, 3]}

However you define 'vect_unkown' as

[u[1, 0], u[2, 0], u[3, 0], u[1, 1], u[2, 1], u[3, 1], u[1, 2], u[2, 2], u[3, 2], u[1, 3], u[2, 3], u[3, 3]]

So what exactly are represented by the quantities alpha, beta, u[0, 0], u[0, 1], u[0, 2], u[0, 3]???

@acer 

your results differ from my original post.

I screwed up when replacing '[]' parentheses.

Corrected(?) version is attached below - which at least now gives the same answers as yours

  restart:
  with(RootFinding):

  r[eD] := 4.5:
  rootfunction:= beta -> BesselY(1, beta)*BesselJ(1, beta*r[eD]) - BesselJ(1, beta)*BesselY(1, beta*r[eD]):
  a := Vector(40, fill = 0):
  StartPoint:=0.001:
  for i from 1 by 1 to 40 do
      a[i]:= NextZero(rootfunction, StartPoint):
      StartPoint:=a[i]:
  od:
  a;

_rtable[18446744074333913206]

(1)

``

  p__D:= (r__D, t__D) ->(2*((r__D^2)/4+t__D))/(r[eD]^2-1)-(r[eD]^2*ln(r__D))/(r[eD]^2-1)-(3*r[eD]^4-4*r[eD]^4*ln(r[eD])-2*r[eD]^2-1)/(4*(r[eD]^2-1)^2)+Pi*add(BesselJ(1,a[i]*r[eD])^2*(BesselJ(1,a[i])*BesselY(0,a[i]*r__D)-BesselY(1,a[i])*BesselJ(0,a[i]*r__D))/(a[i]*(BesselJ(1,a[i]*r[eD])^2-BesselJ(1,a[i])^2))*exp(-a[i]^2*t__D),  i = 1..40  );

proc (r__D, t__D) local i; options operator, arrow; 2*((1/4)*r__D^2+t__D)/(r[eD]^2-1)-r[eD]^2*ln(r__D)/(r[eD]^2-1)-(1/4)*(3*r[eD]^4-4*r[eD]^4*ln(r[eD])-2*r[eD]^2-1)/(r[eD]^2-1)^2+Pi*add(BesselJ(1, a[i]*r[eD])^2*(BesselJ(1, a[i])*BesselY(0, a[i]*r__D)-BesselY(1, a[i])*BesselJ(0, a[i]*r__D))*exp(-a[i]^2*t__D)/(a[i]*(BesselJ(1, a[i]*r[eD])^2-BesselJ(1, a[i])^2)), i = 1 .. 40) end proc

(2)

#
# Check a few values
#
  p__D(1,1);
  p__D(0.5,0.5);

.8021455142

 

1.384740257

(3)

NULL

``

Download diffFunc2.mw

 

@lcz 

It seems as if the GraphTheory package has had a significant upgrade in Maple 2020 - although a lot of it is (just?) layout+visualization

See the attached for a graph with a loop.


 

  restart;
  with(GraphTheory):
  G:=Graph({[1,2],[1,5],[2,5],[2,3],[5,4],[3,4],[4,6]}):
  HasSelfLoop(G);
  DrawGraph(G,style=spring);
  G:=Graph({[1,1],[1,2],[1,5],[2,5],[2,3],[5,4],[3,4],[4,6]}):
  HasSelfLoop(G);
  DrawGraph(G,style=spring);

false

 

 

true

 

 

 

Download gr2020.mw

 

1 2 3 4 5 6 7 Last Page 1 of 153