Kros

5 Reputation

One Badge

5 years, 94 days

MaplePrimes Activity


These are replies submitted by Kros

@tomleslie but I can't find this analytic solution. Program run 2 hours and nothing result...

@tomleslie When I try to solve another equation, for which there is already an analytical solution, it still doesn’t output anything. The same mistake. And you, too, will not output anything?

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

there is an exact solution for this equation:

U(x,t)=exp(-t)sin(x)

 


 

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, April 1, 12:49 hours, found in the directory C:\Users\Admin\maple\toolbox\Physics Updates\lib\`

(1)

#
# Define pde and bcs
#
  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;

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

 

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

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

Error, invalid input: rhs received pdsA, which is not valid for its 1st argument, expr

 

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

 

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

_rtable[18446746166534453598]

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

Error, invalid input: rhs received pdsA, which is not valid for its 1st argument, expr

 

_rtable[18446746166424703214]

(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 pdless.mw

@tomleslie 

@tomleslie how I can solve my problem, help me please?

@tomleslie 

I start, only Evaluating writes and nothing happens

@tomleslie 

The version displayed is the same as yours.
I installed the package, but everything also does not output the exact solution for the equation.

@tomleslie 

`The "Physics Updates" version "635" is installed but is not active. The active version of Physics is within the library C:\\Program Files\\Maple 2020\\lib\\maple.mla, created 2020, March 5, 3:36 hours`

@tomleslie 

restart;
version();
Physics:-Version();
 User Interface: 1455132
         Kernel: 1455132
        Library: 1455132

                            1455132

         The "Physics Updates" package is not installed

 

When i Installed:

ERROR: The package could not be installed.
error PackageTools:-RemoveFromLibname, "while processing result"


 

 

#
# Define pde and bcs
#
  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;

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

 

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

(1)

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

Error, invalid input: rhs received pdsA, which is not valid for its 1st argument, expr

 

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

 

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

_rtable[18446746166534453598]

(2)

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

Error, invalid input: rhs received pdsA, which is not valid for its 1st argument, expr

 

_rtable[18446746166424703214]

(3)

#
# 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})

(4)

 


 

Download 1.mw

@tomleslie 

@tomleslie 

 

I am running a program with code and nothing is being executed for me.

@tomleslie 

if you enter an equation of another type, for example 
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, 
then it should also work?

@tomleslie 

In this way can other types of equations be solved ?

@tomleslie 

can I somehow display the results of the decisions in a table?

@nm 

can I somehow display the results of the decisions in a table?

@tomleslie not work
restart;
  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;
  pds := pdsolve([PDE, IBC]);
  pds:-plot3d( u(x,t), x=0..Pi/2, t=0..10);

1 2 Page 1 of 2