Rouben Rostamian

MaplePrimes Activity


These are replies submitted by Rouben Rostamian

As Christian Wolinski has already noted, changing sec to seq fixes the error.  But your observation about leakage from the Physics package is real.  This is demonstrated in this minimal example.

restart;

diff(x(t),t);

diff(x(t), t)

doit := proc()
  uses Physics;
end proc:

After executing the proc above, the typesetting form of the output changes.  It shouldn't.

diff(x(t),t);

diff(x(t), t)


 

Download mw.mw

@Carl Love Thanks for your detailed explanation.  In the last couple of days I had been working with C code where arrays are accessed as M[i][j]. When I wrote the equivalent code in Maple, I just copied the M[i][j] without thinking.

The following further illuminates what you have said:

 M := Matrix(3,3);                                                            
                                   [0    0    0]
                                   [           ]
                              M := [0    0    0]
                                   [           ]
                                   [0    0    0]

> M[1] := <a,b,c>;                                                             
                                          [a]
                                          [ ]
                                  M[1] := [b]
                                          [ ]
                                          [c]

> M;                                                                           
                                 [a    b    c]
                                 [           ]
                                 [0    0    0]
                                 [           ]
                                 [0    0    0]

 

@Christian Wolinski I've been staring at this for the last half hour and couldn't see it :-(

Thanks!

 

@nm You wrote:

y''= y-(y')^(1/2)
And if we try to square both sides, or raise to any power, there will remain a term y' with non integer power on the right side. Hence degree is not defined.
 

You may rearrange that equation into (y')^(/1/2)=y-y'' then square both sides to get rid of the fractional exponent.  The degree of the resulting equation may be 2 or may be undefined, depending precisely what is meant by the degree.

I remain unconvinced of the usefulness of the concept of the "degree of a differential equation" but that's a different story.

@Carl Love Thanks for your note regarding *.mpl versus *.maple.

The Maple code that you have shown does not make much sense, and it is difficult to guess from it what it is that you really want to do.

I suggest that instead of showing Maple code, just state your mathematical problem clearly in words or equations. Then someone should be able to show you how to translate that statement into code.

 

@Kitonum That's clever.  A thumb up!

@Kitonum I suspect that he wishes to get 

I don't know of a short way of getting there.

@dharr In a spearate thread here, the OP asked the same question and I provided a solution that agrees with his expected answer.  The main reason for discrepancy between your solution and his is that there is a typo in his PDE.

@arshl In a separate discussion here, dhar provided a pretty much complete answer to your question.  Here is a slightly tweaked version of his answer.  The differences are: (1) the initial condition needs to be clamped down on the negative x axis.  I have done that with applying the Heaviside function; and (2) it is apparent from your expected answer that you have a typo in the PDE — the (1+2*t) factor should be outside the exponent.  After those changes, Maple's answer agrees with the one that you are expecting.

restart;

with(inttrans):

interface(imaginaryunit=i):

PDEtools:-declare((U)(omega,t)):

` U`(omega, t)*`will now be displayed as`*U

pde := diff(u(x,t),t) + diff(u(x,t),x,x) + u(x,t) - exp(-x)*(1+2*t) = 0;

diff(u(x, t), t)+diff(diff(u(x, t), x), x)+u(x, t)-exp(-x)*(1+2*t) = 0

ic := u(x,0)= x*Heaviside(x);

u(x, 0) = x*Heaviside(x)

bc := u(0,t)=t, D[1](u)(0,t)=exp(-t)-t;

u(0, t) = t, (D[1](u))(0, t) = exp(-t)-t

inttrans:-laplace(pde, x, s):
eval(%, {bc}):
subs(s=i*omega, %):
eval(%,laplace(u(x,t),x,i*omega)=U(omega,t));

-exp(-t)+t-I*omega*t-(1+2*t)/(1+I*omega)+diff(U(omega, t), t)-omega^2*U(omega, t)+U(omega, t) = 0

inttrans:-fourier(ic,x,omega):
eval(%, fourier(u(x,0),x,omega)=U(omega,0));

U(omega, 0) = I*(Pi*Dirac(1, omega)*omega^2+I)/omega^2

 

Download zz.mw

@nm OK, I see. Thanks.

I suppose that your parsing algorithm should be able to figure out that the degree is undefined in the case of the equation of the simple pendulum, d2x / dt2 + sin x = 0.

Note added later:

The degree is undefined for both d2x / dt2 + sin x = 0  and  dx / dt + sin x = 0, but the first one is not solvable in terms of elementary functions, while the second one is. 

What is the meaning of the degree of a differential equation, and why is it of interest? Just curious to know.

@Carl Love 

  1. The section titled  Round-off and simple triggers in the help page ?dsolve,numeric,Events addresses the numerical discretization issue and suggests a way for obtaining an accurate value for the time when an event occurs.  I don't quite understand that section, and found no illustrative examples. If you or someone else can figure it out, I will be happy to learn.
  2. The time of an event's trigger can be accessed just by executing the proc returned by dsolve.  In the example above, doing dsol(1) returns the list
        [x = 0.155008799031827, f(x) = 0.500000000000000]
    from which one may extract the x value.

 

@student_md Then perhaps you can start with something like this:

restart;
local Psi;
N := 4;
Psi := unapply(Vector(N, i->psi[i](x)), x);
C := Matrix(N,N, symbol=c);
Psi(x)^+ . C . Psi(t);    # This is the right-hand side of your equation (2)

 

As far as I know, Maple doesn't do symbolic matrix algebra, so you are out of luck here.  But suppose that it did, and you arrived at equation (9).  Where would you go from there? Just curious.

Aside: Maple can do matrix algebra if matrices and vectors are specified in components.  Thus, you may specify the size N of the vectors and then take Psi to be a vector with components psi[i], i=1..N.

 

First 46 47 48 49 50 51 52 Last Page 48 of 99