Rouben Rostamian

MaplePrimes Activity


These are replies submitted by Rouben Rostamian

@vv Consider the parameters m=k=g=mu=1.  Let x(0)=1/2, x'(0)=0.  What is the solution?

From the physics of the problem we can tell that the solution should be x(t)=1/2 for all t > 0.  But in what sense does this solution satisfy the differential equation if signum(0) is undefined?

 

As has been observed by Preben and others, the inequality containing the second derivative of x(t) in the original post is incorrect.  It is supposed to be the first derivative.

This leads to the differential equation

m*diff(x(t),t,t) = - k*x(t) - mu*m*g*signum(v(t));

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

That differential equation does not reflect the problem's physics due to the arbitrariness in the definition of the signum function when v=0.  That's a very significant omission.

The proper formulation of the mathematical model calls for an extension of the idea of differential equations to objects called differential inclusions.  Here is a quick summary:

Define a set-valued extension of the signum function, let's call is Signum (with capital S) through:

Signum(v) = {+1} if v > 0,
          = {-1} if v < 0,
          = [-1,1] if v = 0.
       #  [-1,1] is the closed interval from -1 to +1.

Now that Signum is a set-valued, the differential equation changes to a differential inclusion:

m*diff(x(t),t,t) ∈ - k*x(t) - mu*m*g*Signum(v(t));

There exists extensive literature on the theory and numerical algorithms for solutions of differential inclusion.  A good place to start reading about this is the article

D. E. Stewart and J. C. Trinkle, Dynamics, friction, and complementarity problems

published in Complementarity and variational problems, SIAM, 1997.

A PDF of the mentioned article can be found on the Internet for download.

@Earl To gain some intuitive insight into the process, let's consider the case where the water's velocity is constant throughout, that is, it does not vary from point to point.  If the boat attempts to go to the point directly across the river, there is no gain in heading downstream at any time because then it will have to exert extra effort to bring itself back.  So we expect the heading to be toward upstream throughout the travel.

Let V be the (constant) vector of the water's speed and S the vector of the boat's speed relative to the water.  The vector V points along the y axis.  The vector S has a component along the y axis to counteract V, and a component along the x axis to carry the boat across.  The y components of S and V have to cancel each other to prevent the boat from drifting downstream, therefore the length of S should be longer than the length of V.  That is, the boat's speed should be greater than the water's speed.

That is the intuitive explanation of your observation that one cannot reduce the boat's speed too much.

The requirement of sufficiently large S becomes more severe if the destination is upstream because the boat needs to compensate for the water's speed, and then some, in order to propel itself upstream.

 

 

@vv I don't understand your comment about non-uniqueness and the statment that "because the boat can go back on the same path in the same amount of time".  If the boat goes back on the same path, the the path is still y(x), not y(1-x).

Your observation about the symmetries of V(x) and y(x) is absolutely true.  This may be verified directly in Maple with the help of PDEtoos:-dchange.  To simplify the calculations, and without a loss of generality, it helps to shift the x axis so that the y axis is the axis of symmetry, and assume that V(x)=V(-x).  Then we introduce  new variables x* = -x and y*(x*) = -y(x), and rewrite the differential equation in terms of the new variables. Then we verify that the differential equation is invariant under that transformation.  The attached worksheet, which is a continuation of the previous one, has the details.

boat2-ver3.mw

Earl and vv (and anyone else reading this thread):

There is an interesting consequence to the analysis of the optimal path.  Suppose the water's velocity is uniform throughout the river, that is, the water's velocity vector is <0,V> with a constant V everywhere.  Then it turns out that the fastest path to go from a point on one bank to any point on the opposite bank (not necessarily directly across) is a straight line.

In particular, the fastest path to the point directly across the river is the straight line which is perpendicular to the stream.  Initially I found that to be counter-intuitive but after some thinking about it, I see how it works.

This assumes that the boat's speed, S, is faster than the water's speed, V, otherwise there is no way to sail to the point directly across.

 

A couple of things:

  1. The worksheet is not accessible.  See if you can delete the link and upload it again.
  2. In the problem's statement we have "...crosses the river heading at all times towards its destination".  We also have "captain could constantly vary his heading so as...".  It seems to me that these two statements regarding heading are inconsistent.

 

The question that you have posted is incomplete:

  1. It's hard to tell what the truncation error is if you don't say what it is that is being truncated.
  2. The meaning of the expression that you have shown is unclear.  What does it represent? Shouldn't there be an equal sign somehwere?
  3. I can guess what h is, but what are f, g, and y?
  4. Where do all those fractional coefficients come from?

@vv Ah, I see. I couldn't find the right kind of conversion in the help page for convert(...).  Now I see that the arcsin conversion is documented in the convert/to_special_function page.  That's good to know.  Thanks!

As a side comment, you should beware that a square matrix may have very different looking square roots.  For instance, let

A := <-11, -6; 30, 16>;
B := <-3, -2; 10, 6>;
C := <-13, -6; 30, 14>;

Then B and C are both square roots of A, that is, A = B^2 = C^2.  The functions MatrixPower() and MatrixFunction() mentioned in this thread pick up only one of the four possible square roots, which are ±B and ±C.

 

@Kitonum Your coloring solution is quite nice, however, as far as I can tell, it turns symbols into strings, and therefore they lose their algebraic properties. For instance:
restart;
MakeColored:=(s,c)->Typesetting:-mo(convert(s,string), mathcolor = c):
x:=MakeColored(x, "Red"):
diff(y(x),x);
Error, invalid input: diff received Typesetting:-mo("x", mathcolor = "Red"), which is not valid for its 2nd argument

I don't know how to fix this.

Edgardo, thank you very much for your wonderfully quick reaction to this reported issue.  With this kind of immediate turnaround, Maple sets an enviable standard in the software world.

@Dmitrii Fitting a function to numerical data is called Interpolation. This forms a significant part of the typical introductory course in Numerical Analysis where one studies very many different ways of interpolating data, and the strengths and weaknesses of each.  Splines are a particular class of interpolating functions.

Maple provides all sorts of data interpolation functions.  Look up interpolation in Maple's help.

 

@Dmitrii The help page on Spline has a lot of examples and options.  If the x and y data are presented separately, you may do:

xdata :=[0,1,2,3,4,5];
ydata := [0,2,4,6,8,10];
u(x,0) = CurveFitting:-Spline(xdata, ydata, x, degree=1);

 

@Dmitrii Ah, I see.  I didn't pick up on that part of the question.

You may construct a formula for your numerical initial data by passing a spline curve through the data.  For instance, if your initial data consists of the points [[0,0],[1,1],[2,4],[3,3]], you may define the initial data for pdsolve through:

u(x,0) = CurveFitting:-Spline([[0,0],[1,1],[2,4],[3,3]], x, degree=1);

Change degree=1 to degree=3 if you want a smooth fit.

 

@tomleslie I suppose that the need to delete such copyrighted code is to satisfy Maplesoft's lawyer.  How a lawyer's mind operates is beyond me.

That said, I wish that Maplesoft's technical staff were as quick in reading and fixing bugs reported on MaplePrimes.

First 70 71 72 73 74 75 76 Last Page 72 of 99