Rouben Rostamian

MaplePrimes Activity


These are replies submitted by Rouben Rostamian

@patient I am a bit suspicious of the solution in your worksheet.  There you set b[] equal to the initial condition, and b[] does not change during the rest of the computation.  Do you really mean that?  That looks very odd to me.

Aside: Your calculations may be simplified quite a bit if you compute the matrix P explicitly, as I outlined earlier.  Since P is constant, its inverse, let's call it Pinv, can be calculated just once, as in Pinv := P^(-1), before the iteration begins.  Then the main loop of the computation takes the form

    set U = a  # Initial condition   
    p := plot(<X|U>;
    for i from 1 to N do
      Q := RightHandSide(U);   # RightHandSide() produces the right hand side of the equation
      U := Pinv.Q;
      p := p, plot(<X|U>;
    end do;

Upon exit from that loop, p will contain a sequence of plots.  To see an animation, do

    plots:-display([p], insequence=true);

@Preben Alsholm That's very clever.  I believe that this is just the right way of solving the problem although I don't quite understand the solution's method.  In order to gain a better understanding, I attempted to modify it slighltly in a way that is more comprehensible to me, but I got answers which were obviously wrong.  I will think about this some more and ask you for help if needed.

@Carl Love  At first reading I thought that your comment was tongue-in-cheek, but then I realized that perhaps you are bring serious.  Like you, I haven't had a need for programmatic use of the with command.  I do, however, find with's output in case of a less-frequently used package quite handy.  I know, for example, that the Laplace transform is in the inttrans package. Now, is it "laplace" or "Laplace"?  And what is the command for the inverse Laplace transform?

Another use of with's command is for classroom teaching.  I don't expect an undergraduate student who is taking four other courses besides mine to remember why I load the plots package when doing a demo for them.  Letting with(plots)'s output to spill onto the screen gives me the opportunity to remind the class that this is so that we may access the display and pointplot commands because they may not remember that from the previous demo from two weeks ago.

 

@Preben Alsholm I will address each of the issues that you have brought up.

1. By de2, v cannot be zero on any interval no matter what value is assigned to signum(0).

You are right.  That's why I said it remains a mystery to me how Maple gets that solution.

But as I also explained, Maple's solution agrees with the hand-calculated exact soluition  of the problem (not the solution of the DE) which I found by splitting the motion into a sequence of stick and slip phases.  The exact solution for the absolute displacement of the house, that is x(t)+X(t), is a piecewise function consisting of sinosoidal and parabolic patches.

2. If you look at an interval where v appears to be zero ... we see rapid oscillation.

Those oscillations are numerical artifacts.  Their amplitude is roughly 0.004, which is in effect zero considering the choice of stepsize=1e-3.  If we set stepsize=1e-4, the amplitude is cut down by a factor of 10.  And if we set stepsize=1e-5, the amplitude is cut down by a factor of 100.

We see that Maple is attempting to produce an identically zero function v(t) on the interval 3.25..3.9.  As you have observed, an identically zero function is inconsistent with the differential equation de2.  But mysteriously, it is consistent with the exact solution which one obtains by hand by splitting the motion into a sequence of stick and slip phases.

3. Making changes in order to match the original problem I tried using g = 9.81, mu=0.8, and cos instead of sin...The results where disturbing.

The results are just right.  With your choice of parameters there will be no slippage, and therefore the solution v(t) should be identically zero.   Maple shows v(t) oscillating with an amplitude of roughly 0.0002, which is in effect zero plus numerical noise.

To elaborate, let f be the horizontal force exerted by the ground on the house.  Newton's law says f = m*(a + A), where as before, A is the acceleration of the ground, and a is the house's acceleration relative to the ground.  In particular, if the house does not slide, then f = m*A.  The house will begin to slide only when |m*A| exceeds the force of friction, which is  mu*m*g.  With your choice of parameters, |m*A(t)| is always less than mu*m*g, therefore the house never slides.

4. Thus I don't trust the results. And I should add: The mathematical model consisting of just de2 (and de1).

I agree.  de2 is definitely inadequate becasue as you have observed, it is inconsistent with v(t) being zero on an interval.  I do not understand how Maple "solves" that incorrect model and magically obtains the  correct solution  solution to the correct model.

 

@Preben Alsholm Your criticism is justified.  The problem is more complex than I presented it.  For some magical reason, however, the following naive approach produces what appears to be the correct solution.  I will explain further down why I believe the solution is correct.

restart;
with(plots):  with(plottools):
de1 := diff(x(t),t) = v(t);
de2 := m*diff(v(t),t) = -mu*m*g*signum(v(t)) - m*A(t);
X := t -> P*sin(omega*t);
V := D(X);
A := D(V);
ic := x(0)=0, v(0)=0;
m:=1: g:=1: P:=1: mu:=0.7: omega:=1:
dsol := dsolve({de1,de2,ic}, numeric, stepsize=1e-3, maxfun=0);
odeplot(dsol, [t, x(t)], t=0..6*Pi/omega);

odeplot(dsol, [t, v(t)], t=0..6*Pi/omega);

 

These pictures agree with the x(t) and v(t) graphs given earlier in this discussion.

Furthermore, I also obtained these same graphs through a totally different approach which I think is quite defensible.  I split the motiun into distinct phases, distinguishing between the case where the house sticks to the ground, and the case when it slips against it.  In the former case the house's moiton coincides with that of the gound,  In the latter case the house moves under the action of the contact force -mu*m*g*signum(v), which is a constant, therefore the velocity is linear in time, and the displacement is quadratic in time.   Therefore the overall displacement over time is a piecewise curve conising of sinusoidal and parabolic patches.  The resulting graphs coincide with those shown above.  It remains a mystery to me why the Maple script shown above produces the same result.

Here is what the motion looks like:

@Preben Alsholm I analyzed the problem from scratch and found the correct equations of motion which I will now describe.  I don't know how to solve the resulting equations in Maple, but probably you know a trick.

Referring to the diagram posted earlier, let X(t) be the displacement of the ground, and x(t) be the displacement of the house relative to the ground.  [Thus, I am replacing the diagram's x_sol(t) with X(t).]  We have
 
X := t -> P*cos(omega*t);   # P for amplitude because we have a better use for A

Let V := dX/dt, A := dV/dt, v := dx/dt, a := dv/dt.

The equations of motion are:

de1 := diff(x(t),t) = v(t);
de2 := diff(v(t),t) =
        -mu*g*sigum(v(t)) - A(t),  if abs(A+a) < mu*g
        0                          otherwise

The first part of de2 is almost like that shown in this discussion's initial post, except that the rightmost term seems to have the wrong sign there.

@Oloyemike I understand your model a little better now, but things are still unclear.  At places you have Q(r, x, tau), at other places you have Q(r, tau), and yet at some other places you have just Q.  Shouldn't there always be three arguments to each Q?

Similarly, at places you have U(x,tau),  and at some other places you have just U.  Shouldn't there always be two arguments to each U?

Mathematics is a precision instrument.  Sloppiness is not acceptable.

Furthermore, based on what you have shown, I can tell you the solution of your system of PDEs, and I don't need Maple to do it.  The solution is U(x,tau) = 0 and Q(r,x,tau) = 0.  Just substitute these in the equations to verify. If this is not what you had expected, then your model needs further adjustments.  Oops, sorry, I take that back -- U(x,tau) = 0 and Q(r,x,tau) = 0 is not a solution.

 

 

 

@Carl Love Let's say we have a ball of radius R, and let r be the distance from the center of the ball.  As we move from the center to the ball's boundary, r goes from 0 to R.  Let's introduce rho = r/R.  Then as we move from the center to the boundary, rho goes from 0 to 1.  In this context, rho is called the dimensionless radius.  Similarly one defines dimensionless time, dimensionless force, etc.  The terminology is quite common in engineering and physics.

@tomleslie The equation shown is slight modification of a standard difference scheme for a parabolic PDE.  There is no "step j" and "step j+1".  The OP's equation expresses a transformation from the array a[] to the array A[], where a[] is the known solution at a certain time step, and A[] is the solution at the next time step.  One needs boundary conditions (not an initial condition) to complete the definition of that transformation  The initial condition only enters at a later stage when that transformation is applied recursively to generate the solution of the PDE.

 

I can't make sense of the phrase "compute A[j] for a[j]".  It will help if you reword.

Furthermore, what are the boundary conditions?  What is the range of the j index?

@Carl Love I haven't used Maple's PDE solver in any substantive way and I know very little about it.  I made a naive attempt, just for learning purposes, to solve a much simpler version of the OP's equations.  Specifically, let's look at Burgers equation

restart;

PDEtools:-declare(u(x,t));

pde := diff(u(x,t),t) + diff(u(x,t)^2/2,x) = 0;

ic := u(x,0) = piecewise(x<-1,-1, x < 1, x, 1);

bc := u(-5,t)= -1;

sol := pdsolve(pde, [ic, bc], [u], numeric, time=t, range=-5..5);

sol:-plot(t=0);

    Error, (in pdsolve/numeric/plot) unable to compute solution for t<HFloat(0.0):
    matrix is singular

I don't know why it doesn't work.  It is straightforward to verify that the problem's exact solution for 0 < t < 4 is:

Here is how the solution evolves as a function of time:

plots:-animate(plot, [U(x,t), x=-6..6], t=0..4);

@Oloyemike I stopped responding because I just don't trust those equations, and therefore I don't want to waste my time.

If you clarify by explaining the physics behind the problem, the geomertry of the domain, and the meanings of the various variables, then I may consider taking another look.

@MDD This begins to smell like a homework assignment, so here is a hint.  Write a proc which will do the equivalent of ArrayTools:-IsZero(). Such a proc is quite short and straightforward.

The elements of a basis set should be linearly independent, by definition.  So if A, B, C, D form a basis, then you cannot express C as a linear combination of A and B.  Reformulate your question.

@Markiyan Hirnyk I have not thought at all about the existence of solutions of such an equation, or the convergence of Euler's scheme.

First 90 91 92 93 94 95 96 Page 92 of 99