Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

To select all pdf files in folder the command is

L1:=FileTools:-ListDirectory(currentdir(),'all','select'="*.pdf");

And to select all dvi files the command is 

 L2:=FileTools:-ListDirectory(currentdir(),'all','select'="*.dvi");

Is there a syntax to select both in one command? THis does not work as input to select must be string. It can not be list nor set.

  FileTools:-ListDirectory(currentdir(),'all','select'=["*.dvi","*.pdf"]);

So I end up doing

L1:=FileTools:-ListDirectory(currentdir(),'all','select'="*.pdf");
L2:=FileTools:-ListDirectory(currentdir(),'all','select'="*.dvi");
the_list := [ op(L1), op(L2) ];

If will be nice if Maple allows one to select based on different extensions in one command.  Imagine you have 5 different extensions to select. Now one has to issue 5 different commands, then collect all the 5 lists into one.

I'm trying to solve a system of two differential equations numerically
 

restart

eq1 := diff(A(t), t) = c1*(A__T-A(t))-c2*A(t)*R(t)

diff(A(t), t) = c1*(A__T-A(t))-c2*A(t)*R(t)

(1)

NULL

eq2 := diff(R(t), t) = (c3+c1)*(R__T-R(t))-c2*Ab(t)*R(t)

diff(R(t), t) = (c3+c1)*(R__T-R(t))-c2*Ab(t)*R(t)

(2)
 

 

sys1 := [eq1, eq2]

[diff(A(t), t) = c1*(A__T-A(t))-c2*A(t)*R(t), diff(R(t), t) = (c3+c1)*(R__T-R(t))-c2*Ab(t)*R(t)]

(3)

A__T := 100

100

(4)

R__T := 100

100

(5)

c2 := 1000

1000

(6)

c1 := 0.2e-4

0.2e-4

(7)

c3 := 2000

2000

(8)

``

InitCond := A(0) = A__T, R(0) = R__T

A(0) = 100, R(0) = 100

(9)

nsol := dsolve(sys1, InitCond, type = numeric)

Error, (in dsolve/numeric/type_check) insufficient initial/boundary value information for procedure defined problem

 

 

It seems to me this problem should be solvable for the initial conditions given.  Am I entering them wrong somehow?

 

NULL

Download dsolve_problem.mw

scmch.mw

I can't get a graph. Is this code is correct.Please help.

sps1.mw

how to plot this.i got error

How to integrate eq (4)? Since 'a', 'b', and 'c' are constant. 

restart

with(DEtools)

declare(z(x), y(x))

declare(z(x), y(x))

(1)

eq1 := (1/2)*(-z(x)^3-2*c*z(x))*(diff(diff(y(x), x), x))-((z(x)^2+2*c)*(diff(y(x), x))+b*z(x)^2+c*k+a)*(diff(z(x), x)) = 0

(1/2)*(-z(x)^3-2*c*z(x))*(diff(diff(y(x), x), x))-((z(x)^2+2*c)*(diff(y(x), x))+b*z(x)^2+c*k+a)*(diff(z(x), x)) = 0

(2)

eq2 := simplify(z(x)*eq1)

-z(x)*(z(x)*((1/2)*z(x)^2+c)*(diff(diff(y(x), x), x))+((z(x)^2+2*c)*(diff(y(x), x))+b*z(x)^2+c*k+a)*(diff(z(x), x))) = 0

(3)

eq3 := eval(int(lhs(eq2), x))

int(-z(x)*(z(x)*((1/2)*z(x)^2+c)*(diff(diff(y(x), x), x))+((z(x)^2+2*c)*(diff(y(x), x))+b*z(x)^2+c*k+a)*(diff(z(x), x))), x)

(4)

NULL

Download integration.mw

sstf.mw

In Graph has curves that are overlapping each other and the values of  S[t] = -1, -2, 1, 2 and also the y axis to range from 0 to 1.

I am trying to separate the real and imaginary parts of a complex expression in Maple to get Eq. (1.5) as in the attached image, but the Re and Im functions do not seem to return the expected results. Instead, Maple leaves the expression unchanged. PD_OD.mw

Is it possible to set a worksheet or maple up to only express trigonometric functions as sines? This is very helpful for certain exotic coordinate systems. Meaning cos(x)=sqrt(1-sin(x)^2)  and NOT equivalently  adding Pi/2 to the argument cos(x)=sin(x+Pi/2).
It is completely useless and futile to do algsubs, as Maple will later just revert back to cosines, so you want to do it in the headers so output is always expressed as sines in the document by default.

Basically you want to set something in the header of a worksheeet to always use expsincos on output, and then in addition cos(x)=k sqrt(1-sin(x)^2)   k\e{1,-1} on the output.

The modified Liouville equation

How to solve this pde for a general solution ?

The general solution in this form exist.

restart;

with(PDEtools): declare(u(x,t)); U:=diff_table(u(x,t));
PDE1:=U[t,t]=a^2*U[x,x]+b*exp(beta*U[]);
Sol11:=u(x,t)=1/beta*ln(2*(B^2-a^2*A^2)/(b*beta*(A*x+B*t+C)^2));
Sol12:=S->u(x,t)=1/beta*ln(8*a^2*C/(b*beta))
-2/beta*ln(S*(x+A)^2-S*a^2*(t+B)^2+S*C);
Test11:=pdetest(Sol11,PDE1);
Test12:=pdetest(Sol12(1),PDE1);
Test13:=pdetest(Sol12(-1),PDE1);

u(x, t)*`will now be displayed as`*u

 

table( [(  ) = u(x, t) ] )

 

diff(diff(u(x, t), t), t) = a^2*(diff(diff(u(x, t), x), x))+b*exp(beta*u(x, t))

 

u(x, t) = ln(2*(-A^2*a^2+B^2)/(b*beta*(A*x+B*t+C)^2))/beta

 

proc (S) options operator, arrow; u(x, t) = ln(8*a^2*C/(b*beta))/beta-2*ln(S*(x+A)^2-S*a^2*(t+B)^2+S*C)/beta end proc

 

0

 

0

 

0

(1)

The Soll11 can be plotted with a Explore plot in this form of soll11 with th eparameters , but suppose i try to get the general solution in Maple ?

infolevel[pdsolve] := 3

pdsolve(PDE1, generalsolution)

ans := pdsolve(PDE1);

What solvin gstrategy to follow ? : the pde is a non-linear wave eqation  with a exponentiel sourceterm
It seems that the pde can reduced to a ode? :

 

with(PDEtools):
declare(u(x,t));

# Stap 1: Definieer de PDE
PDE := diff(u(x,t), t,t) = a^2 * diff(u(x,t), x,x) + b * exp(beta * u(x,t));

# Stap 2: Definieer de transformatie naar karakteristieke variabelen
# Nieuw: x en t uitgedrukt in ξ en η
tr := {
    x = (xi + eta)/2,
    t = (eta - xi)/(2*a)
};

# Pas de transformatie toe op de PDE
simplified_PDE := dchange(tr, PDE, [xi, eta], params = [a, b, beta], simplify);

# Stap 3: Definieer de algemene oplossing
solution := u(x,t) = (1/beta) * ln(
    (-8*a^2/(b*beta)) *
    diff(_F1(x - a*t), x) * diff(_F2(x + a*t), x) /
    (_F1(x - a*t) + _F2(x + a*t))^2
);

# Stap 4: Controleer de oplossing (optioneel)
pdetest(solution, PDE);  # Moet 0 teruggeven als correct

u(x, t)*`will now be displayed as`*u

 

diff(diff(u(x, t), t), t) = a^2*(diff(diff(u(x, t), x), x))+b*exp(beta*u(x, t))

 

{t = (1/2)*(eta-xi)/a, x = (1/2)*xi+(1/2)*eta}

 

a^2*(diff(diff(u(xi, eta), xi), xi)-2*(diff(diff(u(xi, eta), eta), xi))+diff(diff(u(xi, eta), eta), eta)) = a^2*(diff(diff(u(xi, eta), xi), xi))+2*a^2*(diff(diff(u(xi, eta), eta), xi))+a^2*(diff(diff(u(xi, eta), eta), eta))+b*exp(beta*u(xi, eta))

 

u(x, t) = ln(-8*a^2*(D(_F1))(-a*t+x)*(D(_F2))(a*t+x)/(b*beta*(_F1(-a*t+x)+_F2(a*t+x))^2))/beta

 

0

(2)

missing some steps here : solution u  without  the pde reduced ?
there is a ode ?

# Definieer de ODE # vorige stappen ontbreken van de reduktie
ode := (v^2 - a^2) * diff(f(xi), xi, xi) = b * exp(beta * f(xi));

# Algemene oplossing zoeken
sol := dsolve(ode, f(xi));

(-a^2+v^2)*(diff(diff(f(xi), xi), xi)) = b*exp(beta*f(xi))

 

f(xi) = ln((1/2)*c__1*(tan((1/2)*(-c__1*a^2*beta+c__1*beta*v^2)^(1/2)*(c__2+xi)/(a^2-v^2))^2+1)/b)/beta

(3)

 

, ,

Question : how do i arrive on Soll11   in Maple  ?

 

Download liouville_reduced_2-2-2025_mprimes_vraag.mw

I did some example to change them but i didn't get the same result as book did it and i try to figure out by hand i get another result i know all of them are true but polar is for making the simple shap for ploting so How i can get the simple shape and if possible How do step by step like using totur we have for polar or not? 


 

restart

with(PDEtools)

with(LinearAlgebra)

NULL

with(SolveTools)

with(plots); with(plottools)

with(VectorCalculus)

with(Student:-LinearAlgebra)

with(Student:-MultivariateCalculus)

S := x^2+y^2-1

x^2+y^2-1

(1)

convert(S, polar)

polar(abs(x^2+y^2-1), argument(x^2+y^2-1))

(2)

ChangeOfVariables(S, [cartesian[x, y], polar[r, theta]])

r^2*cos(theta)^2+r^2*sin(theta)^2-1

(3)

solve(%, r)

1, -1

(4)

 

 

T := x^4+2*x^2*y^2+y^4+2*x^3+2*x*y^2-y^2

x^4+2*x^2*y^2+y^4+2*x^3+2*x*y^2-y^2

(5)

ChangeOfVariables(T, [cartesian[x, y], polar[r, theta]])

r^4*cos(theta)^4+2*r^4*cos(theta)^2*sin(theta)^2+r^4*sin(theta)^4+2*r^3*cos(theta)^3+2*r^3*cos(theta)*sin(theta)^2-r^2*sin(theta)^2

(6)

simplify(%)

r^2*(-sin(theta)^2+r*(r+2*cos(theta)))

(7)

solve(%, r)

0, 0, -cos(theta)+(cos(theta)^2+sin(theta)^2)^(1/2), -cos(theta)-(cos(theta)^2+sin(theta)^2)^(1/2)

(8)

R := -3*x^2+y^2-4*x-1

-3*x^2+y^2-4*x-1

(9)

ChangeOfVariables(R, [cartesian[x, y], polar[r, theta]])

-3*r^2*cos(theta)^2+r^2*sin(theta)^2-4*r*cos(theta)-1

(10)

simplify(%)

-4*r^2*cos(theta)^2-4*r*cos(theta)+r^2-1

(11)

solve(%, r)

-1/(2*cos(theta)+1), -1/(2*cos(theta)-1)

(12)

NULL


 

Download polar.mw

Hi All,

Maple is changing fast. It is not possible to run some older codes. 

Is it possible those who have a valid Maple license to have the old versions free of charge?

I have Maple 7, 2018, 2021 licenses but still have problem running older codes.

I read the install.html that is installed with Maple2024 and the instructions to increase stack and heap limits are definately outdated.

None of the files they list there for Linux even exists after the Maple2024 installation.

So where exactly can I set the stack and heap size limits on Linux,  as Maple give me stack and heap errors.

Hello,
I have another vector problem, and I honestly have no idea how to solve it. (I am not even sure if there is a solution). I tried to simplify it as much as possible (also the attached maple file)unknown_vector.mw

We are looking for the vectors v2, v3 and v4 
Given are vector v1 (with its unit vector e1 and magnitude m1), the unit vector of v2 (e2) and the unit vector of v3 (e3)
From vector v4 we don't have any information.
The following should be true:
v2 = v1 + v3 + v4, with the condition that v4 shall be as small as possible, with the goal to find the combination of v1 and v3 that comes as close as possible to v2. Of course, depending on the unit vectors, v4 can also be zero. But we assume that the given unit vectors can not be changed. 
I would be really grateful for any help. Thanks in advance! 
Roman

I have two equations on either side of an inequality that contain like terms such as Am and Ce. Could you simplify the expressions by mathematically eliminating these common terms from both sides? For example, if we have an equation like x+y⋅d+hx=g⋅f+hx , it simplifies to x+y⋅d=g⋅f.

Additionally, please solve for Cv and Ce.

Note: All terms are positive except R0er and R0m​.

I am attaching the relevant sheet for reference. Q_12.mw

restart; with(PDEtools); declare(F(x, t), G(x, t), H(x, t))

F(x, t)*`will now be displayed as`*F

 

G(x, t)*`will now be displayed as`*G

 

H(x, t)*`will now be displayed as`*H

(1)

q := 1-(diff(diff(log(F(x, t)), x), t)); r := G/F; s := H/F

1-(diff(diff(F(x, t), t), x))/F(x, t)+(diff(F(x, t), x))*(diff(F(x, t), t))/F(x, t)^2

 

G/F

 

H/F

(2)

r1s1 := r*s; r1s1der := diff(r1s1(x, t), x)

qt := diff(q(x, t), t)

eq1B := F(x, t)^3*(qt+r1s1der) = 0; eq12B := simplify(expand(eq1B))

-F(x, t)^3*(diff((diff(diff(F(x, t), t), x))(x, t), t))/(F(x, t))(x, t)+F(x, t)^3*(diff(diff(F(x, t), t), x))(x, t)*(diff((F(x, t))(x, t), t))/(F(x, t))(x, t)^2+F(x, t)^3*(diff((diff(F(x, t), x))(x, t), t))*(diff(F(x, t), t))(x, t)/(F(x, t))(x, t)^2-2*F(x, t)^3*(diff(F(x, t), x))(x, t)*(diff(F(x, t), t))(x, t)*(diff((F(x, t))(x, t), t))/(F(x, t))(x, t)^3+F(x, t)^3*(diff(F(x, t), x))(x, t)*(diff((diff(F(x, t), t))(x, t), t))/(F(x, t))(x, t)^2+F(x, t)*(diff(G(x, t), x))*H(x, t)-2*G(x, t)*H(x, t)*(diff(F(x, t), x))+F(x, t)*G(x, t)*(diff(H(x, t), x)) = 0

(3)

D_x_x_G_F := (diff(G(x, t), x, x))*F(x, t)-2*(diff(G(x, t), x))*(diff(F(x, t), x))+G(x, t)*(diff(F(x, t), x, x)); D_t_t_F_F := F(x, t)*(diff(F(x, t), `$`(t, 2)))-2*(diff(F(x, t), t))^2

(diff(diff(G(x, t), x), x))*F(x, t)-2*(diff(G(x, t), x))*(diff(F(x, t), x))+G(x, t)*(diff(diff(F(x, t), x), x))

 

F(x, t)*(diff(diff(F(x, t), t), t))-2*(diff(F(x, t), t))^2

(4)

NULL

rxt := diff(diff(r(x, t), x), t)

eq2B := -2*q*r+rxt = 0

eq22B := simplify(expand(eq2B))

((-F*F(x, t)*G(x, t)+2*G*F(x, t)^2)*(diff(diff(F(x, t), t), x))+(diff(diff(G(x, t), t), x))*F*F(x, t)^2+((2*F*G(x, t)-2*G*F(x, t))*(diff(F(x, t), x))-F*(diff(G(x, t), x))*F(x, t))*(diff(F(x, t), t))-(diff(G(x, t), t))*(diff(F(x, t), x))*F*F(x, t)-2*G*F(x, t)^3)/(F*F(x, t)^3) = 0

(5)

sxt := diff(diff(s(x, t), x), t)

eq3B := -2*q*s+sxt = 0

eq32B := simplify(expand(eq3B))

((-F*F(x, t)*H(x, t)+2*H*F(x, t)^2)*(diff(diff(F(x, t), t), x))+(diff(diff(H(x, t), t), x))*F*F(x, t)^2+((2*F*H(x, t)-2*H*F(x, t))*(diff(F(x, t), x))-F*(diff(H(x, t), x))*F(x, t))*(diff(F(x, t), t))-(diff(H(x, t), t))*(diff(F(x, t), x))*F*F(x, t)-2*H*F(x, t)^3)/(F*F(x, t)^3) = 0

(6)

"#`# How to simplify Eqs. (3), (5) and (6) and write in terms of following bilineat operators` by using (4)"?""

NULL

NULL

Download BE.mw

3 4 5 6 7 8 9 Last Page 5 of 2184