Al86

60 Reputation

5 Badges

4 years, 103 days

MaplePrimes Activity


These are replies submitted by Al86

@tomleslie , I tried using your latest piece of code on the PDE on u but with different boundary conditions, i.e:

D[1](u)(0,t)=0,
        D[1](u)(1,t)=-0.000065*(u(1, t))^4,
        u(x,0)=1;

 

and then I excuted your code, I got the follwoing message:

 

Java(TM) Platform SE binary has stopped working

A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available.

 

Tom, did you try the code in your computer? did it work?

I am using maple 2015.

 

@tomleslie , not quite what I had in mind.

 

I need to plot log ||e||_h vs log h i.e I need to find values of log ||e||_h at different spacesteps h, and then plot log ||e||_h as a function of h.

 

This should be a linear function, and I want to extract the slope of this graph.

 

I appreciate your and others help.

 

@tomleslie , e_j is the value of e(x_j , t) for when x_j = j*h.

 

||e||_h : = (h*(|e(x_0,t)|^2+...+|e(x_N,t)|^2))^(1/2)

 

N is the number of sampling points, for example if I take h=0.01 then there are 100 sampling points.

 

I hoep now this clears matters.

 

@tomleslie , @Carl Love @vv I have another question.

 

I have the same two PDEs as before, but now I want to plot a graph of || e ||_h = \sqrt{\sum_{j=0}^N h |e_j|^2}

 

where e = v-u and h is the spacestep that is being used in pdsolve, N the number of sampling points.

 

I want to plot a graph of log || e||_h vs log h on some (x,t) and also on the boundary (1,t) and (0,t), for each sampling number N, and also extract from the graph the slope of the graph (it should be a straight line).

 

How to do this?

 

@Carl Love yes, works now just fine.

 

@vv , it doesn't seem to be working.

I get the following error message:

Error, `pds` does not evaluate to a module

@Carl Love here's my third try:

 


  restart;
  PDE := diff(u(x, t), t) = diff(u(x, t), x, x)+sin(x+t)-cos(x+t);
  IBC:= D[1](u)(0,t)=sin(t),
        D[1](u)(1,t)=-0.000065*(u(1, t)+cos(1+t))^4+sin(1+t),
        u(x,0)=1-cos(x);
#
# For x=0..1, t=0..1, the solution varies only very slowly
# so I have increased the timestep/spacestep, just to speed
# up results generation for diagnostic purposes
#
  pds := pdsolve( PDE, [IBC], numeric, time = t, range = 0 .. 1,
                  spacestep = 0.1e-1, timestep = 0.1e-1,
                  errorest=true
                )

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

 

int(JacobiTheta3(0, exp(-Pi^2*s))*v(1, t-s)^4, s = 0 .. t)

 

(D[1](u))(0, t) = sin(t), (D[1](u))(1, t) = -0.65e-4*(u(1, t)+cos(1+t))^4+sin(1+t), u(x, 0) = 1-cos(x)

 

_m216736768

(1)

#
# Plot the solution over the ranges x=0..1,
# time=0..1. Not a lot happens!
#
  pds:-plot(x=1, t=0..1);

 

#
# Plot the estimated error over the ranges x=0..1,
# time=0..1
#
  pds:-plot( err(u(x,t)), x=1,t=0..1);

 

#
# Get some numerical solution values
#
  pVal:=pds:-value(u(x,t), output=procedurelist):
  for k from 0 by 0.01 to 1 do
      pVal(1, k)[2], pVal(1, k)[3];
  od;

 

t = 0., u(x, t) = Float(undefined)

 

t = 0.1e-1, u(x, t) = .468132560645211193

 

t = 0.2e-1, u(x, t) = .476620675893991042

 

t = 0.3e-1, u(x, t) = .485164343348984506

 

t = 0.4e-1, u(x, t) = .493759517499287648

 

t = 0.5e-1, u(x, t) = .502406098485052244

 

t = 0.6e-1, u(x, t) = .511102453922395727

 

t = 0.7e-1, u(x, t) = .519848081222815006

 

t = 0.8e-1, u(x, t) = .528641735121694212

 

t = 0.9e-1, u(x, t) = .537482758482757839

 

t = .10, u(x, t) = .546370042906006659

 

t = .11, u(x, t) = .555302850549631022

 

t = .12, u(x, t) = .564280135798000404

 

t = .13, u(x, t) = .573301110735468078

 

t = .14, u(x, t) = .582364762177520312

 

t = .15, u(x, t) = .591470267486582713

 

t = .16, u(x, t) = .600616631094471165

 

t = .17, u(x, t) = .609803004392364567

 

t = .18, u(x, t) = .619028401380561699

 

t = .19, u(x, t) = .628291952956824717

 

t = .20, u(x, t) = .637592677994616164

 

t = .21, u(x, t) = .646929690577315863

 

t = .22, u(x, t) = .656302011574524613

 

t = .23, u(x, t) = .665708740868090065

 

t = .24, u(x, t) = .675148899504965927

 

t = .25, u(x, t) = .684621575110758274

 

t = .26, u(x, t) = .694125787743871014

 

t = .27, u(x, t) = .703660614283566410

 

t = .28, u(x, t) = .713225073056872771

 

t = .29, u(x, t) = .722818231413405732

 

t = .30, u(x, t) = .732439105491770603

 

t = .31, u(x, t) = .742086754125860670

 

t = .32, u(x, t) = .751760191008710610

 

t = .33, u(x, t) = .761458467328929633

 

t = .34, u(x, t) = .771180594220798765

 

t = .35, u(x, t) = .780925615994519151

 

t = .36, u(x, t) = .790692541218692924

 

t = .37, u(x, t) = .800480408015832423

 

t = .38, u(x, t) = .810288222462013707

 

t = .39, u(x, t) = .820115017125833012

 

t = .40, u(x, t) = .829959795725423222

 

t = .41, u(x, t) = .839821585866029507

 

t = .42, u(x, t) = .849699389090256663

 

t = .43, u(x, t) = .859592228597243380

 

t = .44, u(x, t) = .869499103974247789

 

t = .45, u(x, t) = .879419034545566025

 

t = .46, u(x, t) = .889351018193387688

 

t = .47, u(x, t) = .899294070877883156

 

t = .48, u(x, t) = .909247189050718552

 

t = .49, u(x, t) = .919209385802187695

 

t = .50, u(x, t) = .929179656447670532

 

t = .51, u(x, t) = .939157011688529719

 

t = .52, u(x, t) = .949140446014158701

 

t = .53, u(x, t) = .959128968207002330

 

t = .54, u(x, t) = .969121572254020625

 

t = .55, u(x, t) = .979117265479617860

 

t = .56, u(x, t) = .989115041702798292

 

t = .57, u(x, t) = .999113907243194266

 

t = .58, u(x, t) = 1.00911285609529311

 

t = .59, u(x, t) = 1.01911089402067834

 

t = .60, u(x, t) = 1.02910701554026551

 

t = .61, u(x, t) = 1.03910022629866394

 

t = .62, u(x, t) = 1.04908952170027669

 

t = .63, u(x, t) = 1.05907390770885845

 

t = .64, u(x, t) = 1.06905238097441657

 

t = .65, u(x, t) = 1.07902394821156533

 

t = .66, u(x, t) = 1.08898760768213809

 

t = .67, u(x, t) = 1.09894236727932948

 

t = .68, u(x, t) = 1.10888722724634103

 

t = .69, u(x, t) = 1.11882119707896366

 

t = .70, u(x, t) = 1.12874327937397445

 

t = .71, u(x, t) = 1.13865248565033572

 

t = .72, u(x, t) = 1.14854782123258992

 

t = .73, u(x, t) = 1.15842830008022091

 

t = .74, u(x, t) = 1.16829293062122042

 

t = .75, u(x, t) = 1.17814072966983674

 

t = .76, u(x, t) = 1.18797070913415204

 

t = .77, u(x, t) = 1.19778188909438588

 

t = .78, u(x, t) = 1.20757328531600039

 

t = .79, u(x, t) = 1.21734392155340787

 

t = .80, u(x, t) = 1.22709281780686585

 

t = .81, u(x, t) = 1.23681900191025074

 

t = .82, u(x, t) = 1.24652149847591076

 

t = .83, u(x, t) = 1.25619933981954279

 

t = .84, u(x, t) = 1.26585155554231932

 

t = .85, u(x, t) = 1.27547718284112466

 

t = .86, u(x, t) = 1.28507525668193678

 

t = .87, u(x, t) = 1.29464481953920951

 

t = .88, u(x, t) = 1.30418491211861531

 

t = .89, u(x, t) = 1.31369458256549843

 

t = .90, u(x, t) = 1.32317287769875702

 

t = .91, u(x, t) = 1.33261885172483341

 

t = .92, u(x, t) = 1.34203155794780815

 

t = .93, u(x, t) = 1.35141005702225225

 

t = .94, u(x, t) = 1.36075340910752574

 

t = .95, u(x, t) = 1.37006068169009532

 

t = .96, u(x, t) = 1.37933094215266738

 

t = .97, u(x, t) = 1.38856326519400497

 

t = .98, u(x, t) = 1.39775672578593380

 

t = .99, u(x, t) = 1.40691040621648189

 

t = 1.00, u(x, t) = 1.41602338940992412

(2)

 

 restart;
  PDE := diff(v(x, t), t) = diff(v(x, t), x, x);
  IBC:= D[1](v)(0,t)=0,
        D[1](v)(1,t)=-0.000065*v(1, t)^4,
        v(x,0)=1;
#
# For x=0..1, t=0..1, the solution varies only very slowly
# so I have increased the timestep/spacestep, just to speed
# up results generation for diagnostic purposes
#
  pds1 := pdsolve( PDE, [IBC], numeric, time = t, range = 0 .. 1,
                  spacestep = 0.1e-1, timestep = 0.1e-1,
                  errorest=true
                );
#
# Plot the solution over the ranges x=0..1,
# time=0..1. Not a lot happens!
#
  pds1:-plot(x=1, t=0..1);

diff(v(x, t), t) = diff(diff(v(x, t), x), x)

 

int(JacobiTheta3(0, exp(-Pi^2*s))*v(1, t-s)^4, s = 0 .. t)

 

(D[1](v))(0, t) = 0, (D[1](v))(1, t) = -0.65e-4*v(1, t)^4, v(x, 0) = 1

 

_m217228608

 

 

v1 := log(v(1, t)); v2 := log(u(1, t)); plot(v1, v2)

ln(v(1, t))

 

ln(u(1, t))

 

Error, (in plot) unexpected option: ln(u(1, t))

 

NULL


Download PDEcos.mw

@tomleslie here's the code:

 

Download PDE+cos.mw

@Preben Alsholm thanks.

BTW do you know why did the collocation code you wrote doesn't seem to work for n:=91 and T:=[seq(0.1..1,0.01)];?

 

Did you try to excute the code in your machine with the change above that I changed?

 

I appreciate your help, but I would like to use collocation method, so I am puzzled why it's get stuck on what I changed.

 

@Preben Alsholm ,I want to use 100 points for the precision on the accuracy of the numerical solution.

My colleague told me that 10 points of sampling isn't enough for what we want to account for.

 

@Preben Alsholm , if I want to use 100 points, I need to change n:=100 and T:=[seq(0..1,0.01)];

 

I changed half an hour ago to n:=91 and T:=[seq(0.1..1,0.01)]; in the code and the code still evaluates on maple 18, is there a way to shorten the computation time?

One of my colleagues told me that something is wrong in the code if it takes that much time to evaluate?

 

@Preben Alsholm how do I find the numerical values of the approximated solution at the collocation points?

 

@Preben Alsholm For my problem I can use the following discretization scheme:

 

If we take time steps x_i = ih, y_j = jh, then:

 

1/h^2(-u_{i,j-1}-u_{i-1,j}+4u_{i,j} - u_{i+1,j} - u_{i,j+1}) = \sqrt(u_{i,j}) + (u_{i+1,j}-u_{i-1,j})^2/(4h^2 * u_{i,j}^{3/2}

 

But how to implement this in maple?

Thanks.

 

@Preben Alsholm , how can I plot the error of this approximated solution?

 

@Carl Love u(x1,x2,x3,x4) satisfies: d^2u/dx1^2+d^2u/dx2^2 = d^2u/dx3^2+d^2u/dx4^2

and u is twice differentiable.

 

1 2 3 4 Page 3 of 4