60 Reputation

4 Badges

3 years, 120 days

MaplePrimes Activity

These are questions asked by asceduardo

I am developing an algorythm which returns some differential equation, which I want to simplify. Here is an example:

eqq:= k[t]*(`ℓ`^2)*(diff(q[3](tau), tau, tau)+(5*alpha-sigma+2*theta+1)*q[3](tau)+(-4*alpha+sigma-theta)*q[2](tau)+q[1](tau)*alpha) = -(sqrt(m*(1/k[t]))*`ℓ`*k[t]*`Δθ`*(q[3](tau)-q[2](tau))*sin(sqrt(Lambda*k[t]*(1/m))*sqrt(m*(1/k[t]))*tau)+2*xi*sqrt(lambda*k[t]*m)*(diff(q[3](tau), tau)))*`ℓ`*(1/sqrt(m*(1/k[t])))

I want the parameters to be associated to the the variables, q[1](tau)q[2](tau)q[3](tau) and their derivattives. So, I have used "collect" command, as below:

vars:= {q[1](tau),q[2](tau),q[3](tau),diff(q[1](tau),tau),diff(q[2](tau),tau),diff(q[3](tau),tau),diff(q[1](tau),tau$2),diff(q[2](tau),tau$2),diff(q[3](tau),tau$2)}:

The problem is that the equations remain with non-simplified terms, such as the terms inside the "sine" functions and the term "k[t]*ell^2". The command "simplify" does not have any effect. Ideally, I would like to have something like this:

(diff(q[3](tau), tau, tau))+alpha*q[1](tau)+(-4*alpha+sigma-theta)*q[2](tau)+(5*alpha-sigma+2*theta+1)*q[3](tau)+2*xi*sqrt(lambda)/`ℓ`*(diff(q[3](tau), tau))-`Δθ`*sin(sqrt(Lambda)*tau)*q[2](tau)+`Δθ`*q[3](tau)*sin(sqrt(Lambda)*tau) = 0;

Does anyone know how to solve that?

I would like to plot a graph whose legend has a Greek character with a numeric subscript. Below, there is a small example, where I show what I am trying to do:


# Simplified example, which is not working:

omega0:= 10:
plot(omega^2/omega0, omega = 1..1.5,
legend = [sprintf("%s = %.1f",`ω`[0],omega0)]);

# The character I want to be plotted inside the legend:


I suppose the problem is that " `ω[0]` is not considered a string and, therefore, I can not call it in the legend with a "%s". I do not know how to make it work, though. Does anyone know how to do so?

I would like to define a fourth-order tensor (3x3x3x3) with zeros, for then defining some non-null terms individually. For that, I'm currently doing:

for it1 from 1 to 3 do
    for it2 from 1 to 3 do
        for it3 from 1 to 3 do
            for it4 from 1 to 3 do
                H[it1,it2,it3,it4]:= 0;
            end do:
        end do:
    end do:
end do:

H[1,1,1,1]:= value1:
H[1,2,2,1]:= value2:
# etc.


However, I suppose there is probably a more efficient manner to do do, maybe using Physics package. Does anyone know to do that?

I have the following equation:

eqn := m*`ℓ`^2*(diff(q[1](t), t, t))+k[t]*`ℓ`^2*q[1]+5*k[r]*q[1]-4*k[r]*q[2]+k[r]*q[3]-5*P*`ℓ`*q[1]+2*`ℓ`*P*q[2]+2*`ℓ`*T*q[1]-`ℓ`*T*q[2] = 0;

And I want to execute the following substitutions:

k[r]/(k[t]*`ℓ`^2) = alpha;
P/(k[t]*`ℓ`) = sigma
T/(k[t]*`ℓ`) = theta

For that, I have tried:

eqn1:= algsubs({k[r]/(k[t]*`ℓ`^2) = alpha, P/(k[t]*`ℓ`) = sigma, T/(k[t]*`ℓ`) = theta}, %);


eqn1:= algsubs(k[r]/(k[t]*`ℓ`^2) = alpha, %);
eqn2:= algsubs(P/(k[t]*`ℓ`) = sigma, %);
eqn3:= algsubs(T/(k[t]*`ℓ`) = theta, %);

But none of these have worked. Does anyone know how to solve this?

Thanks in advance.

So, I'm trying to delelop an algorithm for the method of multiple scales. Starting with a simple ODE:

diff(x(t), `$`(t, 2))+x(t) = 0

After scaling, it should be written in the form:

(d/dT[0]+epsilon*d/dT[1]+epsilon^2*d/dT[2])^2*(epsilon^3*X[3]+epsilon^2*X[2]+epsilon*X[1])+epsilon*X[1]+epsilon^2*X[2]+epsilon^3*X[3] = 0

A proto-algorithm would be:

ode := diff(x(t), `$`(t, 2))+x(t) = 0;
i_ini := 1; i_fin := 3; j_ini := 0; j_fin := 2;
PDEtools:-dchange({t = sum(epsilon^j*T[j], j = j_ini .. j_fin), x(t) = sum(epsilon^i*X[i](T[1]), i = i_ini .. i_fin)}, ode, [{T[0], T[1], T[2]}, {X[1], X[2], X[3]}])

It is not working, though. Could anyone help me out?

Thanks in advance.

1 2 Page 2 of 2