Rouben Rostamian

MaplePrimes Activity


These are replies submitted by Rouben Rostamian

@Ioannis You need to be more specific about "the command display doesn't work".  Does it result in an error, or you don't like what it produces?

As to "In the picture we have two paraboloidal surfaces!!! This is only the left!", I disagree. In the picture that I included in my earlier reply, you can clearly see both paraboloids.  Aren't you getting the same things?

 

 

@Ioannis What don't you like about this?
 

plots:-display(LH,LG);

@lcz what do you expect this sum to be:

sum(milk, i=1..5);

That sum is 5*milk.  That's because the i in milk is not an index.  The expression 'milk' represents an atomic symbol; it is not a composite.  In the same way x__i is an atomic symbol; it is not a word with the index i tacked on.  See the suggestions in kitonum's post on how to create indexed symbols.

I have not examined the intricacies of your specific example but as a general answer to your main question, you may consider this.

We have an ODE x' = f(x,t,p), where x=x(t) is an n-vector (n=2 in your case) and p is  a parameter.  Let x1 and x2 be the solutions to the ODE corresponding to the parameter values p1 and p2.  We want to plot the difference x1(t) - x2(t).

Rather than solving the ODE twice, I would solve the system of ODEs

x1' = f(x1, t, p1)
x2' = f(x2, t, p2)

simultaneously as a system of 2n equations in 2n unknowns.  Then plotting the difference should pose no problem.

 

What you have described is quite specialized and I certainly don't have the necessary knowledge to construct a mathematical model of it.  If you have constructed a mathematical model and your difficulty is in its implementation in Maple, then post your worksheet and point out where Maple help is needed.

 

 

You will need to be more specific.  Plotting this function over 0..1000 is instantaneous:

plot(sin(t/100), t=0..1000);

 

@nm In Linux, Maple is launched from a script file in Maple's installation directory.  The script file processes command-line options and sets some environment variables before launching the binary executable.

I must have learned about the "–standalone" option from browsing that script file because the option does not seem to be documented anywhere.  Perhaps that's because it's specific to Linux?  I don't know.  There are some other useful undocumented options there.  The "–j" option, for instance, may be used to increase the Java heap memory allocation size which is sometimes necessary when doing extensive graphics.

 

I don't know about Windows, but in Linux the command-line option "–standalone" starts an independent Maple process.  There ought to be something equivalent in Windows.

 

I know how to solve that problem but I would rather not do your homework for you.

I will be happy to show you how to do it in Maple if you show me how you would go about solving it by hand.

 

@Mo_Jalal To plot u(x,1) we do:
pdsol:-plot(u, t=1);

To obtain solution values, we define U:
U := pdsol:-value(u);
Then U(0.8, 0.2) returns
            [x = 0.8, t = 0.2, u = 0.161382120212466312]
There are a lot of other ways.  Have a look at the help page on pdsolve,numerc.

As you have suspected, those initial conditions are totally wrong.  To pose a proper set of initial and boundary conditions, you need to provide more information about the problem that these equations are supposed to model.  Here I will provide one set of plausible assumptions but these may be entirely different from what you really need.

The main trick here is the introduction of the new variables u_t, u_tt, etc., which converts your original 3rd order system to a first order system.

restart;

sys:={diff(u(x,t),x)+alpha*diff(v(x,t),t,t)+beta*v(x,t)*(u(x,t)^2+v(x,t)^2)+epsilon*diff(u(x,t),t,t,t)+6*(u(x,t)^2+v(x,t)^2)*diff(u(x,t),t)+6*u(x,t)*(u(x,t)*diff(u(x,t),t) +v(x,t)*diff(v(x,t),t))=0,-diff(v(x,t),x)+alpha*diff(u(x,t),t,t)+beta*u(x,t)*(u(x,t)^2+v(x,t)^2)-epsilon*diff(v(x,t),t,t,t)-6*(u(x,t)^2+v(x,t)^2)*diff(v(x,t),t)-6*v(x,t)*(u(x,t)*diff(u(x,t),t) +v(x,t)*diff(v(x,t),t))=0};

{diff(u(x, t), x)+alpha*(diff(diff(v(x, t), t), t))+beta*v(x, t)*(u(x, t)^2+v(x, t)^2)+epsilon*(diff(diff(diff(u(x, t), t), t), t))+6*(u(x, t)^2+v(x, t)^2)*(diff(u(x, t), t))+6*u(x, t)*(u(x, t)*(diff(u(x, t), t))+v(x, t)*(diff(v(x, t), t))) = 0, -(diff(v(x, t), x))+alpha*(diff(diff(u(x, t), t), t))+beta*u(x, t)*(u(x, t)^2+v(x, t)^2)-epsilon*(diff(diff(diff(v(x, t), t), t), t))-6*(u(x, t)^2+v(x, t)^2)*(diff(v(x, t), t))-6*v(x, t)*(u(x, t)*(diff(u(x, t), t))+v(x, t)*(diff(v(x, t), t))) = 0}

eq1 := diff(u(x,t),t) = u__t(x,t);
eq2 := diff(u__t(x,t),t) = u__tt(x,t);
eq3 := diff(v(x,t),t) = v__t(x,t);
eq4 := diff(v__t(x,t),t) = v__tt(x,t);

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

diff(u__t(x, t), t) = u__tt(x, t)

diff(v(x, t), t) = v__t(x, t)

diff(v__t(x, t), t) = v__tt(x, t)

Substitute the above into the system:

sys_tmp := subs(eq1, eq2, eq3, eq4, sys);

{diff(u(x, t), x)+alpha*v__tt(x, t)+beta*v(x, t)*(u(x, t)^2+v(x, t)^2)+epsilon*(diff(u__tt(x, t), t))+6*(u(x, t)^2+v(x, t)^2)*u__t(x, t)+6*u(x, t)*(u(x, t)*u__t(x, t)+v(x, t)*v__t(x, t)) = 0, -(diff(v(x, t), x))+alpha*u__tt(x, t)+beta*u(x, t)*(u(x, t)^2+v(x, t)^2)-epsilon*(diff(v__tt(x, t), t))-6*(u(x, t)^2+v(x, t)^2)*v__t(x, t)-6*v(x, t)*(u(x, t)*u__t(x, t)+v(x, t)*v__t(x, t)) = 0}

We put all the equations together and obtain a new system consisting of six first order

equations in the six unknowns"u, v, `u__t `, `v__t `, `u__tt` , `v__tt` ."  This is equivalent to the original

system which consisted of two third order (in "t) "equations.

sys_new := sys_tmp union {eq1, eq2, eq3, eq4};

{diff(u(x, t), x)+alpha*v__tt(x, t)+beta*v(x, t)*(u(x, t)^2+v(x, t)^2)+epsilon*(diff(u__tt(x, t), t))+6*(u(x, t)^2+v(x, t)^2)*u__t(x, t)+6*u(x, t)*(u(x, t)*u__t(x, t)+v(x, t)*v__t(x, t)) = 0, -(diff(v(x, t), x))+alpha*u__tt(x, t)+beta*u(x, t)*(u(x, t)^2+v(x, t)^2)-epsilon*(diff(v__tt(x, t), t))-6*(u(x, t)^2+v(x, t)^2)*v__t(x, t)-6*v(x, t)*(u(x, t)*u__t(x, t)+v(x, t)*v__t(x, t)) = 0, diff(u(x, t), t) = u__t(x, t), diff(u__t(x, t), t) = u__tt(x, t), diff(v(x, t), t) = v__t(x, t), diff(v__t(x, t), t) = v__tt(x, t)}

Here is a plausible choice of initial and boundary conditions to go with the new system:

Boundary conditions:

bc :=
        u(0,t) = 0,
        v(1,t) = 0;

u(0, t) = 0, v(1, t) = 0

Initial conditions:

ic :=
    u(x,0) = x*(1-x),
    v(x,0) = 0,
    u__t(x,0) = 0,
    v__t(x,0) = 0,
    u__tt(x,0) = 0,
    v__tt(x,0) = 0;

u(x, 0) = x*(1-x), v(x, 0) = 0, u__t(x, 0) = 0, v__t(x, 0) = 0, u__tt(x, 0) = 0, v__tt(x, 0) = 0

Solve the system:

pdsol := pdsolve(subs(alpha=1, beta=0.5, epsilon=1.5, sys_new), {ic, bc}, numeric);

_m140508142403584

pdsol:-plot3d(u, t=0..1);

pdsol:-plot3d(v, t=0..1);

The growing oscillations are bad news.  That indicates that the numerical scheme for

solving the system is unstable.  You will need to play with the parameters spacestep

and timestep (read help on pdsolve,numeric) to obtain a proper solution.

 

Download mw.mw

 

@nm Thanks for a very clever workaround.  Your suggestion can be a good general advice for anyone working with such series solutions.

 

@Maple_lover1 There have been many requests for a color bar feature in Maple's 3D graphics but unfortunately there is no native support yet for color bars in Maple.  I am hoping that it will be added some day.

If you search for "color bar" in this website's search box, you will see quite a number of hits and a lot of suggestions on hacking together color bars with the currently available tools.  None of these strike me as aesthetically pleasing or easy to use. 

If you insist on color bars, then I can see a justification in your attempt to convert Maple code to Matlab.

 

Your program refers to PlyTable but as far as I can see, it cannot read its value.  To verify that, print the value of the CurrentAngle within your main loop, as in

for i from 1 to NumberPlies do:
    CurrentAngle := PlyTable1[i,1]:
    printf("i = %d, CurrentAngle = %a\n", i, CurrentAngle);
    ...

 By the way, why do you have a colon after "do"?  Remove it.

A general advice: There is an old saying to the effect that for any problem that you cannot solve, there is a simpler problem that you cannot solve.  Try that one first.

Your current program is too complex to debug. I suspect that you received it from someone else and are trying to modify it.  If that's the case, you will be better off by writing your own version, from the beginning and without bells and whistles.  Start simple.  Do away with widgets that can hide data.  You may make your program fancier later, after you have established a foothold and verified that the plain version works.

 

 

 

First 23 24 25 26 27 28 29 Last Page 25 of 91