Rouben Rostamian

MaplePrimes Activity


These are replies submitted by Rouben Rostamian

@Pets71 For the record, I am running Maple 2021 on Ubuntu 20.04 LTS installed on a 10 year old laptop with 4GB of memory. I use it just about every day in my classes for teaching, without a single problem.

I agree with Thomas Richard that what you have described smells very much like a bad RAM in your laptop. That's a hardware problem and has nothing to do with Maple.

See https://linuxhint.com/run_memtest_ubuntu/ on how to test your RAM in Ubuntu.

 

Isn't it more natural to name your variables S[i,j] rather than Sij?  If you do the former, then you may do

local S;
seq(seq(assign(S[i,j]=Vector(datatype=float)),i=1..9),j=1..9);

 

It will be good if you showed some attempt toward solving this homework problem.  You don't want someone else to do your homework for you, do you?

@rlopez My original example required a symbolic solution (x(p) and y(p)). Should a symbolic solution be unattainable, we may resort to a numerical solution, which turns out to be even simpler than the symbolic, as illustrated in the following worksheet.

restart;

with(plots):

Here is a family of function of x defined in terms of a parameter p.

f := (x,p) -> (x-p)^2 + cos(p);

proc (x, p) options operator, arrow; (x-p)^2+cos(p) end proc

The family's envelope is obtained by solving the system
f(x, p) = y

diff(f(x, p), p) = 0.``

Here are two options:

 

Option 1. We solve the system for x and y in terms of p, we obtain a

parametric representation x(p), y(p)of the envelope.

 

Option 2. For a given x, we solve the second equation for p and obtain
p(x).  Then evaluate y = f(x, p(x)), thus obtaining a mapping from
x to y of the points on the envelope.

NULL

I followed Option 1 in my original post.  That option works best if we

are able to solve the system symbolically.

NULL

Option 2 works best if the system is not solvable symbolically and we

need to resort to numerical calculations.

NULL

Here I will solve the original problem numerically to show that we

obtain the same result.NULL

 

Option 2 is implemented in the following proc.  It receives x and
returns y so that (x,y) is on the envelope.

elim := proc(x) option remember;
        if not type (x, realcons) then return 'procname'(args) end if;
        y = f(x,p), D[2](f)(x,p) = 0;
        fsolve({%});
        eval(y, %);
end proc:

Here is the plot of the envelope. It agrees with the result of the previous

symbolic calculation.

plot(elim(x), x=-8..8, color="Blue");

As before, we calculate the area between the central arch of

that graph and the x axis.  The arch's rightmost endpoint is at x = L, where

L := fsolve(elim(x), x=0..2);

1.323245517

Therefore, the area under the arch is

A := int(elim(x), x=-L..L, numeric);

1.586776257

which agrees with the previous result.

 

Download area-under-envelope-numeric.mw

 

@mmcdara As rlopez has noted, the method of lines (MoL) is unrelated to the method of characteristics. When a PDE has both space and time variables, in MoL we discretize space through finite differences, while treating the time variable as continuous.  Thus, the PDE is approximated by a system of ODEs.

About a year ago, I illustrated the MoL in the post https://www.mapleprimes.com/posts/212624-Solving-Multispan-Euler-Beams-With by applying it to the equation of the deflection of a multispan Euler beam.

A wise man once said: "If you don't know how to solve a problem, there is a simpler problem that you don't know how to solve. Try that one first".

In your case, the simpler problem would be the one-dimensional case of the heat equation. Do you know how to do that one?

@vv That's very clever.  Vote up!

Your homework asks you to define a function and then find the optimal solution.  But optimal solution to what? Perhaps you have abbreviated the question too much to be comprehensible.

You attempt to solve f(x,a,b,c)=0 for x.  The x that you would obtain there is called the root of f. In what sense is that related to the optimum of anything?

I can guess what the question is about but that would be only a guess and I don't want to put words in your mouth.  It will be good if you formulate your question in a clearer way.

@C_R Thanks for the data.  I'll see what I can do.

 

@vv That's a very clever construction. I see that the deviation of the answer from a rational in this case is of the order of exp(-10^28)  which is too small to be detected by fsolve().

 

@Mariusz Iwaniuk Thanks for this demo which clearly shows the trend.  If find Ronan's explanation is more insightful.

@Ronan Yes, that's it.  Now that you have pointed this out, it looks so obvious to me.  I have converted your "Reply" to "Answer" in order to give it a Vote Up.

 

A very nice demo.  Vote up!

I would be interested in reproduding this in Maple as I don't have MapleSim.  Can you post the complete set of this demo's parameters?

@Muhammad Usman XJTU As tomleslie as noted, your ode1 with the intitial condition phi(0)=0 admits a unique solution.  Isn't that all you need?  If you have something else in mind, then you should state it clearly, because I find it impossible to understand what you are aiming to do by looking over your worksheet.  It will help if you present your question in words, not in Maple.

@mmcdara That's a good alternative.  But in going over both your solution and my previous solution, I see that it's possible to streamline the process quite a bit. Here it is.

restart;

We have five differential equations:

de1 := diff(u__1(y),y,y) + 1/2*diff(N(y),y) + 1/2*theta__1(y) = 0;

diff(diff(u__1(y), y), y)+(1/2)*(diff(N(y), y))+(1/2)*theta__1(y) = 0

de2 := diff(N(y),y,y) - 2/3 * (2*N(y) + diff(u__1(y),y)) = 0;

diff(diff(N(y), y), y)-(4/3)*N(y)-(2/3)*(diff(u__1(y), y)) = 0

de3 := diff(theta__1(y),y,y) = 0;

diff(diff(theta__1(y), y), y) = 0

de4 := diff(u__2(y),y,y) + theta__2(y) = 0;

diff(diff(u__2(y), y), y)+theta__2(y) = 0

de5 := diff(theta__2(y),y,y) = 0;

diff(diff(theta__2(y), y), y) = 0

Find the general solution:

dsol__general := dsolve({de1,de2,de3,de4,de5});

{N(y) = exp(y)*_C2-exp(-y)*_C3+(1/3)*_C10*y+(1/6)*_C9*y^2+_C4, u__1(y) = -2*_C4*y-(1/3)*_C10*y^2-(1/9)*_C9*y^3-(1/2)*exp(y)*_C2-(1/2)*exp(-y)*_C3+(1/2)*_C9*y+_C1, u__2(y) = -(1/6)*_C7*y^3-(1/2)*_C8*y^2+_C5*y+_C6, theta__1(y) = _C9*y+_C10, theta__2(y) = _C7*y+_C8}

How many integrations constants?

indets(dsol__general, name);

{_C1, _C10, _C2, _C3, _C4, _C5, _C6, _C7, _C8, _C9, y}

So there are 10 integration constants, which is good since we have 10 boundary and interface conditions.

 

Let's evaluate the solutions and their first derivatives at y = -1, y = 0, y = 1:

dsol__general union diff~(dsol__general, y):
convert(%, D):
conditions := eval(%, y=-1) union eval(%, y=0) union eval(%, y=1):

Now let us look at the boundary and interface conditionsj.

bc := {
             # conditions at y=-1
             u__1(-1) = 0,
                N(-1) = 0,
         theta__1(-1) = 1,

             # conditions at y=0
             u__1(0) = u__2(0),
         theta__1(0) = theta__2(0),
      D(theta__1)(0) = D(theta__2)(0),
             D(N)(0) = 0,
          D(u__1)(0) + 1/2*N(0) = 1/2*D(u__2)(0),

             # conditions at y=+1
             u__2(1) = 0,
         theta__2(1) = 0
};

{(D(u__1))(0)+(1/2)*N(0) = (1/2)*(D(u__2))(0), N(-1) = 0, u__1(-1) = 0, u__1(0) = u__2(0), u__2(1) = 0, theta__1(-1) = 1, theta__1(0) = theta__2(0), theta__2(1) = 0, (D(N))(0) = 0, (D(theta__1))(0) = (D(theta__2))(0)}

Apply the previously calculated expressions for u__1(-1), (D(u__1))(-1), etc., to the boundary conditions:

eqns := eval(bc, conditions);

{_C10 = _C8, _C9 = _C7, _C10-_C9 = 1, -(3/2)*_C4+(1/2)*_C9 = (1/2)*_C5, _C7+_C8 = 0, _C2+_C3+(1/3)*_C10 = 0, -(1/2)*_C2-(1/2)*_C3+_C1 = _C6, -(1/6)*_C7-(1/2)*_C8+_C5+_C6 = 0, exp(-1)*_C2-exp(1)*_C3-(1/3)*_C10+(1/6)*_C9+_C4 = 0, 2*_C4-(1/3)*_C10-(7/18)*_C9-(1/2)*exp(-1)*_C2-(1/2)*exp(1)*_C3+_C1 = 0}

Solve this system of 10 equations in the 10 unknown coefficients:

the_coeffs := solve(eqns);

{_C1 = -(1/6)*(6*exp(-1)*exp(1)-21*exp(-1)-5*exp(1))/(11*exp(-1)+9*exp(1)), _C10 = 1/2, _C2 = -(1/18)*(27*exp(1)-67)/(11*exp(-1)+9*exp(1)), _C3 = -(1/18)*(33*exp(-1)+67)/(11*exp(-1)+9*exp(1)), _C4 = -(1/36)*(12*exp(-1)*exp(1)+35*exp(-1)+53*exp(1))/(11*exp(-1)+9*exp(1)), _C5 = (1/12)*(12*exp(-1)*exp(1)-31*exp(-1)-exp(1))/(11*exp(-1)+9*exp(1)), _C6 = -(1/12)*(12*exp(-1)*exp(1)-53*exp(-1)-19*exp(1))/(11*exp(-1)+9*exp(1)), _C7 = -1/2, _C8 = 1/2, _C9 = -1/2}

Apply the calculated coefficients to obtain the final form of the solutions to the ODEs:

dsol := eval(dsol__general, the_coeffs);

{N(y) = -(1/18)*exp(y)*(27*exp(1)-67)/(11*exp(-1)+9*exp(1))+(1/18)*exp(-y)*(33*exp(-1)+67)/(11*exp(-1)+9*exp(1))+(1/6)*y-(1/12)*y^2-(1/36)*(12*exp(-1)*exp(1)+35*exp(-1)+53*exp(1))/(11*exp(-1)+9*exp(1)), u__1(y) = (1/18)*(12*exp(-1)*exp(1)+35*exp(-1)+53*exp(1))*y/(11*exp(-1)+9*exp(1))-(1/6)*y^2+(1/18)*y^3+(1/36)*exp(y)*(27*exp(1)-67)/(11*exp(-1)+9*exp(1))+(1/36)*exp(-y)*(33*exp(-1)+67)/(11*exp(-1)+9*exp(1))-(1/4)*y-(1/6)*(6*exp(-1)*exp(1)-21*exp(-1)-5*exp(1))/(11*exp(-1)+9*exp(1)), u__2(y) = (1/12)*y^3-(1/4)*y^2+(1/12)*(12*exp(-1)*exp(1)-31*exp(-1)-exp(1))*y/(11*exp(-1)+9*exp(1))-(1/12)*(12*exp(-1)*exp(1)-53*exp(-1)-19*exp(1))/(11*exp(-1)+9*exp(1)), theta__1(y) = -(1/2)*y+1/2, theta__2(y) = -(1/2)*y+1/2}

plots:-display(
        plot(eval(u__1(y),dsol), y=-1..0, color=red),
        plot(eval(u__2(y),dsol), y=0..1, color=blue),
labels=[y, u(y)]);

plots:-display(
        plot(eval(theta__1(y),dsol), y=-1..0, color=red),
        plot(eval(theta__2(y),dsol), y=0..1, color=blue),
labels=[y, theta(y)]);

plot(eval(N(y),dsol), y=-1..1, color="Green", labels=[y, N(y)]);

 

 

Download mw2.mw

 

First 17 18 19 20 21 22 23 Last Page 19 of 91