Rouben Rostamian

MaplePrimes Activity


These are replies submitted by Rouben Rostamian

@cencen_cj  I don't use the debugger so I cannot be of help here.  Perhaps someone else can offer advice.

 

 

@Carl Love What is wrong with this simple way?  After isolate(coeff1, D__1)*C1  I would do:
int(rhs(%), T[1]);
 

@Joe Riel Thanks for pointing out the SMT. Someone else mentioned that to me a couple of weeks ago in a totally different context. I may look into that when I get the time.

 

@Carl Love Thanks for your comments.  I see things a little more clearly now.

And regarding Whitehead and Russell's Principia, if my memory serves,, they arrive at the derivation of 1+1=2 somewhere in the middle of volume 2, which discourages me from pursuing that avenue :-)

 

@tomleslie The originally stated boundary conditions did not make sense. It was sort of obvious to me what the intention was and I corrected them, as you did. The boundary conditions are not the culprit.

The source of the problem is that the PDE is ill-posed. Its 4th order term has the wrong sign. I can't tell why the OP is interested in that PDE but I suspect that the sign of the 4th order term is incorrect. The coefficient should be −5 instead of +5. The numerical "solution" that appears in my post looks like a nice graph but probably it is total garbage.  It's no wonder that changing the solver's spacestep parameter drastically changes the solver's output.

The following stripped-down version of the PDE illustrates the problem's ill-posed nature.

An ill-posed PDE

Here we solve an initial/boundary value problem

for the ill-posed PDE

"(∂ u)/(∂ t)=((∂)^(4) u)/((∂)^( )x^(4))"
and see what goes wrong in attempting to solve it
numerically.  The PDE is ill-posed in many senses,
the most obvious being the lack of continuous
dependence of the solution on the initial data.

Remark: From the general theory of PDEs it is known that
the well-posed version of that equation would
have a negative sign in front of the fourth order
term, as in:
"(∂ u)/(∂ t)=-((∂)^(4) u)/((∂)^( )x^(4))"

restart;

pde := diff(u(x,t),t) = diff(u(x,t), x$4); # ill-posed

 

diff(u(x, t), t) = diff(diff(diff(diff(u(x, t), x), x), x), x)

bc := u(0,t)=0, D[1,1](u)(0,t)=0,  u(1,t)=0, D[1,1](u)(1,t)=0;

u(0, t) = 0, (D[1, 1](u))(0, t) = 0, u(1, t) = 0, (D[1, 1](u))(1, t) = 0

Exact solution:

sol_exact := exp(Pi^4*t)*sin(Pi*x);

exp(Pi^4*t)*sin(Pi*x)

Verify that we indeed have an exact solution:

pdetest(u(x,t)=sol_exact, [pde, bc]);

[0, 0, 0, 0, 0]

The exact solution has a sine profile that grows exponentially:

plot3d(sol_exact, x=0..1, t=0..0.02);

A (failed) attempt to solve the PDE numerically:

ic := u(x,0)=eval(sol_exact, t=0);

u(x, 0) = sin(Pi*x)

sol_numeric := pdsolve(pde, {bc,ic}, numeric);

_m140073306302784

Here is what the numeric "solution" looks like.  It has no resemblance to

the exact solution.  It is garbage.  

sol_numeric:-plot3d(x=0..1, t=0..0.02);

 

 


 

Download ill-posed-pde.mw

Joe, that's very clever. I knew nothing about the Logic package until now. I would be interested in learning more but I am having a hard time wrapping my head around it. If you get the chance, could you please show how one may formulate the following (very) elementary problem with the Logic tools?

Find integers a and b selected from the set {2,4,5} so that b > a and a^2 + b^2 > 28.

There are two solutions: {a=2,b=5} and {a=4,b=5}, but I will be happy with either one.

I have no idea whether the Logic package is suitable for such a problem.

@vv Smoothing out the discontinuities certainly is an option.  In fact, that was the first solution that I offered when this came up in a recent Question. The problem with smoothing is that it requires an exceedingly fine mesh to achieve good accuracy as we see in your choice of timestep=0.0001. It was the desire to avoid such fine meshes that motivated me to seek an alternative approach which then led to the subject of this Post.

@vv Here is an exact solution corresponding to discontinuous conductivity and discontinuous initial data.

Consider the boundary value problem for the heat equation
"(∂ u)/(∂ t)=(∂)/(∂ x)(c(x)(∂ u)/(∂ x))   " on  `in`(x, -infinity, infinity), t > 0
where
c(x) = piecewise(x < 0, 1, x > 0, 4)    and   u(x, 0) = piecewise(x < 0, -1, x > 0, 1/2)

We show that the function
u__exact(x, t) = piecewise(x < 0, erf(x/(2*sqrt(t))), x > 0, (1/2)*erf(x/(4*sqrt(t))))
is a solution.  For that, we verify that u__exact(x, t) defined
above solves the PDE on the intervals -infinity, 0 and (0,∞), separately,
and at x = 0 the temperature and the heat flux match.

restart;

u__left := erf(x/(2*sqrt(t)));
u__right := 1/2*erf(x/(4*sqrt(t)));

erf((1/2)*x/t^(1/2))

(1/2)*erf((1/4)*x/t^(1/2))

Verify that the initial condition holds:

limit(u__left,  t=0, right) assuming x<0;
limit(u__right, t=0, right) assuming x>0;

-1

1/2

Verify that the solution is continuous at x = 0, t > 0

limit(u__left,  x=0, left)  assuming x<0;
limit(u__right, x=0, right) assuming x>0;

0

0

Verify that the flux is continuous at x = 0, t > 0

limit(1*diff(u__left,x),  x=0, left)  assuming x<0;
limit(4*diff(u__right,x), x=0, right) assuming x>0;

1/(Pi^(1/2)*t^(1/2))

1/(Pi^(1/2)*t^(1/2))

Here is what the solution looks like over the interval-1 < x and x < 1
and 0 < t and t < .1.  In fact, what we see here are the graphs of the
exact solution given above (drawn in blue) and the corresponding
finite difference solution (drawn in red).  The approximation is
so good that it is difficult to distinguish the two graphs.

 

 

I have added this example to the previous worksheet.  Download updated worksheet: heat-finite-difference-v3.mw

@vv and @Bart, I have modified the original worksheet by adding a third example in which I compare the finite difference solution against the exact solution corresponding to a problem with discontinuous initial data.  This animation, extracted from that worksheet, demonstrates that the exact and numerical solutions match quite well.  The graphs of the exact solution (blue) and the finite difference solution (red) are difficult to distinguish.

I have not made an error analysis to determine the accuracy of the method.

By the way, from the geeral theory of parabolic equations we know that although the initial condition is discotiuous, the solution at any t>0 is in C.

 

Download updated worksheet:  heat-finite-difference-v2.mw

@Carl Love and acer, thank your for all your detailed comments on solving tridiagonal systems.  It is now obvious to me that inverting a tridiagonal matrix for solving a linear system is a very bad idea.  That the system needs is solved repeatedly within a for-loop does still not justify inverting the matrix.  I stand corrected.

@vv That's excellent!  Converting the 2nd order PDE into a system of 1st order PDEs does the trick.  In fact, that's what I did in deriving my finite difference scheme but it did not occur to me to apply Maple's pdsolve() to it. It would have saved me some unnecessary work had I thought of it.  Thanks for pointing this out.

 

@wanderson The Fourier condition says that the heat flux is the same on both sides of x=L.  In fact, it's the purpose of the PDE to enforce that the heat flux is the same on both sides of any location; there is nothing special about x=L.  When we solve a single PDE on the entire domain 0 < x < 2*L, the Fourier condition does not enter the calculations because the PDE itself takes care of that.

But if you split the domain into two parts as you proposed to do in your initial post, the PDE on one side needs to communicate with the PDE on the other side.  That's where the Fourier condition comes in. Since I don't split the domain, that issue does not arise.

@Carl Love Your observation regarding the operation count of A^(-1) versus that of a triadiagonal solver is true.  In this case, however, the system A.U=B is solved m times within a for-loop with the same A, while B varies. In my mind I justified doing the inversion once and then applying the inverse m times as being not worse than solving the system m times, but I may be wrong on that.

 

@Chrono1 It is possible to generalize the technique to all other regular polyhedra. I will write up and post the general idea when I get some free time. For now, here is a demo of a geodesic on a cube.

@vv This is the best I could come up with.  Corresponds to the choice of parameters m=2, n=3, a=0.7.

First 42 43 44 45 46 47 48 Last Page 44 of 91