Rouben Rostamian

MaplePrimes Activity


These are replies submitted by Rouben Rostamian

@assma Here is how:

err := abs(wr(i*dx,j*dy) - w3(i*dx,j*dy));
max_err := max([seq(seq(err, i=0..N), j=0..N)]);

What I have shown here is a direct answer to your question. I suspect, however, that you are not formulating your question correctly, therefore this answer may be of no use.

Specifically, it seems to me that you wish to calculate the error in a finite difference approximation of a differential equation.  If so, then it is likely that w3(x,y) is not  a function at all.  Rather, it is an array w3[i,j].   I cannot provide more help with the little information that you have provided.

 

 

 

What are wr() and w3()?  What is N?

@waseem The two calculations you have shown are not comparable; you can't do in one as you do in the other.

The calculations in your first post express lambda (vertical coordinate) as a function of delta2 (horizontal coordinate).

The calculations in your second post express V (horizontal coordinate) as a function of y (vertical coordinate).

Note the switching of the horizontal/vertical.

 

 

@Alex Bowden 

The mathematical notation (a+b)(x) is inherently ambiguous—is that a multiplication or function application?

Humans resolve the ambiguity in context as vv has already pointed out.  The context is mostly in one's head.

Absent that context, Maple's 2D input attempts to resolve the ambiguity by applying certain rules.  I don't think that it is possible to design rules that satisfactorily resolve all cases.  Not simple rules, anyway.

Maple's 1D input provides a perfectly context-free solution.  Many people, including me, prefer the 1D input for that reason.  You may want to give it a try.

 

@mehdibaghaee In the first example, two planes in 3D intersect to create a line.  The calculations lead to a parametric representation of that line.  Eliminating the parameter makes no sense. The parameter is an essential ingredient of the equation of the line. The equation y+2*x=7 that you have suggested is not the equation of a line at all; it is the equation of a plane that contains the line.  Having  eliminated the parameter, you have lost the line.

@ecterrab 

I take exception to the statement: "look at the solution, with the term under focus of the form _C2*erf(abs(x)) where x::real.  You know erf(-x) = -erf(x); reabsorb now that sign within _C2"

There's the rub.  You cannot absorb that sign into _C2 because the derivation of the solution presupposes that _C2 is a constant.  Now you are making it depend on x (in the form of a step function).

To see the error in that argument more clearly, let's look at another elementary example.  Unlike my first example which was an initial value problem of which you did not approve, this one is a boundary value problem, just like that in the original post.

restart;

Let's look at the boundary value problem

de := diff(y(x),x,x) + y(x) = 0;
bc := y(-Pi)=0, y(Pi)=0;

diff(diff(y(x), x), x)+y(x) = 0

 

y(-Pi) = 0, y(Pi) = 0

 

Here is the classical solution:

dsolve({de,bc});

y(x) = _C1*sin(x)

 

You seem to be saying that the function

u := x -> sin(abs(x));

proc (x) options operator, arrow; sin(abs(x)) end proc

 

is also a solution of the boundary value problem.  I am sorry, but it is not in any commonly

understood sense (classical? weak? distributional?) that I can think of.  Accepting u(x) as

a solution will overturn a good chunk of the Fourier analaysis.

 

Comment: Let's note that applying the pdetest() to u(x) gives

pdetest(y(x)=u(x), de);

signum(1, x)*cos(abs(x))-abs(1, x)^2*sin(abs(x))+sin(abs(x))

 

which is zero everywhere except at x = 0 where it is undefined.
But that does not make u(x)a solution.

 

 

 

@ecterrab 

I agree with most of what you wrote, but I disagree on the "this is not really a bug" part. A function that satisfies a differential equation everywhere except at one point, is not a solution, and a program that produces such a function is buggy and needs to be fixed.

To make this absolutely clear, let's look at this very elementary example.

restart;

Consider the differential equation:

de := diff(y(x),x,x) - y(x) = 0;

diff(diff(y(x), x), x)-y(x) = 0

along with the initial conditions:

ic := y(0)=1, D(y)(0)=1;

y(0) = 1, (D(y))(0) = 1

Here is the customary solution:

dsol := dsolve({de, ic});

y(x) = exp(x)

Let's see if this solution passes the pdetest():

pdetest({dsol, ic}, de);

0

Yes, of course it does.   Now let's introduce the function:

u := x -> piecewise(x<1, exp(x), exp(2-x));

u := proc (x) options operator, arrow; piecewise(x < 1, exp(x), exp(2-x)) end proc

Question: Is u(x) yet another solution of our initial value problem?

 

Let's check:

pdetest({y(x)=u(x), ic}, de);

piecewise(x = 1, undefined, 0)

Conclusion: We see that u(x) satisfies the differential equation except at one point.

That is enough to disqualify it from being the solution of the initial value problem.

If we admit u(x) as a legitimate solution, the whole theory of existence, uniqueness,

and well-posedness of initial value problems of differential equations goes out the window.

 

By the way, here is what u(x) looks like:

plot(u(x), x=0..3, view=0..3);

 

 

 

@torabi It is not difficult to show that zero is the only possibe answer.  Here is how.

restart;

Here are the differential equations:

de1 := (diff(r*(diff(theta(r), r)), r))/r
        + b*(diff(theta(r), r))*(diff(sigma(r), r))
        + a*(diff(theta(r), r))^2 = 0;

(diff(theta(r), r)+r*(diff(diff(theta(r), r), r)))/r+b*(diff(theta(r), r))*(diff(sigma(r), r))+a*(diff(theta(r), r))^2 = 0

de2 := b*diff(r*(diff(sigma(r), r)), r)
     + a*diff(r*(diff(theta(r), r)), r) = 0;

b*(diff(sigma(r), r)+r*(diff(diff(sigma(r), r), r)))+a*(diff(theta(r), r)+r*(diff(diff(theta(r), r), r))) = 0

bc := D(theta)(0)=0, D(sigma)(0)=0, theta(R)=0, sigma(R)=0;

(D(theta))(0) = 0, (D(sigma))(0) = 0, theta(R) = 0, sigma(R) = 0

Let us introduce:

tmp := Diff((b*diff(sigma(r), r) + a*diff(theta(r), r))*r, r) = 0;

Diff((b*(diff(sigma(r), r))+a*(diff(theta(r), r)))*r, r) = 0

We see that tmp is the same as de2:

simplify(tmp - de2);

0 = 0

OK then, tmp implies that

(b*diff(sigma(r), r) + a*diff(theta(r), r))*r = d;

(b*(diff(sigma(r), r))+a*(diff(theta(r), r)))*r = d

where d is an arbitrary constant.  Evaluating that expression at r=0, and in view of the

boundary conditions in bc, we see that d=0, therefore we have arrived at

(b*diff(sigma(r), r) + a*diff(theta(r), r)) = 0;

b*(diff(sigma(r), r))+a*(diff(theta(r), r)) = 0

and consequently

a*theta(r) + b*sigma(r) = c;

a*theta(r)+b*sigma(r) = c

for some constant c.  Solve this for sigma(r):

sigma(r) = ( c - a*theta(r) ) / b;

sigma(r) = (c-a*theta(r))/b

and substitute the result in de1:

eval(de1, sigma(r) = ( c - a*theta(r) ) / b );

(diff(theta(r), r)+r*(diff(diff(theta(r), r), r)))/r = 0

This is equivalent to

Diff(r*diff(theta(r),r), r) = 0;

Diff(r*(diff(theta(r), r)), r) = 0

therefore

r*diff(theta(r),r) = d;

r*(diff(theta(r), r)) = d

for some constant d.  Rewrite as:

diff(theta(r),r) = d/r;

diff(theta(r), r) = d/r

The boundary condition D(theta)(0)=0 cannot hold unless d=0.  But if that's the case, we get

diff(theta(r),r) = 0;

diff(theta(r), r) = 0

and therefore theta(r) is a constant.  But the boundary condition theta(R)=0 implies that

the constant is zero.  We conclude that theta is identically zero.

From the equation a*theta(r) + b*sigma(r) = c obtained earlier it follows that sigma(r) is constant.

Then from the boundary condition sigma(R)=0 we conclude that sigma is identically zero.

@sheriph05 I don't think that a search for a Lyapunov function for these equations will be fruitful.  I suggest that you focus on the analysis of local stability of equilibria through linearization, which is a more attainable goal.  You may worry about global stability afterward.

As Preben has pointed out, a general method for constructing Lyapunov functions is not known, and I seriously doubt whether such a thing is possible at all.  Nevertheless, this 2014 article appears to claim that it offers a method for doing just that.  I don't understand the mathematics in it, and so I cannot pass judgment.

Why do you want underline to those objects?  You may achieve better results through font shape (italic?), weight (bold?),  size (large?), and color (red?).

Decades ago, when people used typewriters to write on paper, they used underlining to emphasize text because there were not many other options—there was only one font.  If you look around in printed media today—newspapers, magazines, books—you will not see much underlining.  One uses a variety of fonts to get one's ideas across.

 

@ Carlos I assume that by x-value you mean y-value since you specify the last x-value yourself as 812.

To see the solution at x=812, type dsol(812).  Or dsol(x) for any numerical value of x.

@Carlos As Preben Alsholm has correctly pointed out, the option method=rkf45 does not do what you have asked.  Change the line dsol=...  to what he has suggested.

@acer As long as you are doing this, you might as well reqest the addition of a linecolor=mycolor option in the plottools package.  Right now there is no access to the default black border color of objects created by plottools, hence the awkward use of [ two plots + display ] in the examples given by me and kitonum.

 

@alfarunner I have shown my worksheet in its entirety.  For your reference, here it is as a link: mw.mw. There is no SetCoordinates() in it. It works for me in Maple 2016 and 2017.  Upload your worksheet if you are having trouble with it.

First 57 58 59 60 61 62 63 Last Page 59 of 91