Maple 2024 Questions and Posts

These are Posts and Questions associated with the product, Maple 2024

With the latest version of Maple I get an indenting space when I click "Shift+Enter".
For example 

But I don't like it: suggestion? Thanks

Hi, how to rsolve this recursive sequence auto? 

The manual calculation is taking the reciprocal of both sides of the equation, and then do some simple calculations to get the answer:1/(3·2^n-5).

restart; A := 'A'; A[n] := `assuming`([rsolve({A[1] = 1, A[n+1] = A[n]/(5*A[n]+2)}, A[n])], [n::posint]); A[n] := simplify(%); simplify(subs(n = 1, %))

Error, recursive assignment

 

A

 

Error, (in simplify/table) too many levels of recursion

 

Download ask_recrusive_sequence_of_A[n].mw

Something has changed in the past weeks (not sure for how long) and I have not figured out what exactly.

Probably it is me doing something differently while editing an input line. Below is an example where the name data is not italic any more

Anybody else experiencing the same?

My interface seetings:

Hello to whomever this may concern. I am curently trying to estimate parameters and initial conditions for a system of ODEs. I have taken inspiration from the code given by Robert J. Lopez. I am having issues with minimizing the SSE (sum of squared errors) which I named as a procedure using the NLPSolve command from the Optimization package. It returns an error saying there are too many levels of recursion, which I do not understand where it is coming from or how to solve the issue and I was hoping to get an explination on how to solve it.

Below is the code up until the error. Any help or guidance would be greatly appreciated.

Parameter_estimation.mw

when i replace mu=0 in my equation mu[3] and mu[4] also become zero why ?

restart

restart

with(PDEtools)

with(LinearAlgebra)

NULL

with(SolveTools)

undeclare(prime)

`There is no more prime differentiation variable; all derivatives will be displayed as indexed functions`

(1)

NULL

B[1] := 0; mu := 0

0

 

0

(2)

U1 := lambda*(1+sqrt(-lambda)*(cosh(xi*sqrt(-lambda))*B[2]+sinh(xi*sqrt(-lambda))*B[1])*`&+-`(sqrt(lambda/(lambda^2*B[1]^2-lambda^2*B[2]^2-mu^2))))*beta[0]*exp(I*(d*x+e*y+f*t^beta/beta))/(B[1]*cosh(xi*sqrt(-lambda))*lambda+B[2]*sinh(xi*sqrt(-lambda))*lambda+mu)

(1+(-lambda)^(1/2)*cosh(xi*(-lambda)^(1/2))*B[2]*`&+-`((-1/(lambda*B[2]^2))^(1/2)))*beta[0]*exp(I*(d*x+e*y+f*t^beta/beta))/(B[2]*sinh(xi*(-lambda)^(1/2)))

(3)

NULL

V1 := -mu[4]*b*lambda^2*(1+sqrt(-lambda)*(cosh(xi*sqrt(-lambda))*B[2]+sinh(xi*sqrt(-lambda))*B[1])*`&+-`(sqrt(lambda/(lambda^2*B[1]^2-lambda^2*B[2]^2-mu^2))))^2*beta[0]^2/((B[1]*cosh(xi*sqrt(-lambda))*lambda+B[2]*sinh(xi*sqrt(-lambda))*lambda+mu)^2*a*mu[3])

Error, numeric exception: division by zero

 

Download tester.mw

How we can calculate solution of this ODE by give assumption to the equation , we have otehr case too, like lambda>0&mu<0

Any idea why Maple returns empty string when asked for the latex of the Laplace of x(t)?  Am I doing anything wrong here? I do not see it

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1828 and is the same as the version installed in this computer, created 2024, November 18, 7:25 hours Pacific Time.`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

restart;

e:=inttrans:-laplace(x(t),t,s)

laplace(x(t), t, s)

latex(e,'output'='string')

""

 

 

Download latex_of_laplace_nov_21_2024.mw

I was expecting something like this using another software

Did Maple always behave this way for Laplace? I do not have earlier version now to check.  Any workaround?

Is this a known error when using PDEtools:-Solve? I get no error using solve on same input, so thought to ask, just in case it should not happen.

For now, I will change my code to use solve for this.

I am basically solving two equations in Laplace domain for Y1(s) and Y2(s). But since there are initial conditions x(0) and y(0) in the equations, and Laplace has L(x(t),t,s)  then PDEtools:-Solve is not happy, as it sees x(t) and x(0) in same input.

But solve has no problem with this. Who is correct? solve or Solve?

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1828 and is the same as the version installed in this computer, created 2024, November 18, 7:25 hours Pacific Time.`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

restart;

sys:=[s*laplace(x(t),t,s)-x(0) = -3*laplace(x(t),t,s)+4*laplace(y(t),t,s)+1/(s^2+1), s*laplace(y(t),t,s)-y(0) = -2*laplace(x(t),t,s)+3*laplace(y(t),t,s)+1/s^2];
Ys:=[laplace(x(t),t,s), laplace(y(t),t,s)];

[s*laplace(x(t), t, s)-x(0) = -3*laplace(x(t), t, s)+4*laplace(y(t), t, s)+1/(s^2+1), s*laplace(y(t), t, s)-y(0) = -2*laplace(x(t), t, s)+3*laplace(y(t), t, s)+1/s^2]

[laplace(x(t), t, s), laplace(y(t), t, s)]

solve(sys,Ys);

[[laplace(x(t), t, s) = (x(0)*s^5+4*y(0)*s^4-3*x(0)*s^4+x(0)*s^3+4*y(0)*s^2-3*x(0)*s^2+s^3+s^2+4)/((s^4-1)*s^2), laplace(y(t), t, s) = (y(0)*s^5+3*y(0)*s^4-2*x(0)*s^4+y(0)*s^3+3*y(0)*s^2-2*x(0)*s^2+s^3+s^2+s+3)/((s^4-1)*s^2)]]

PDEtools:-Solve(sys,Ys)

Error, (in PDEtools:-Solve) found functions with same name but depending on different arguments in the given DE system: x(0), x(t). Specification of the dependent variables is required

 

 

Download differenece_between_solve_and_Solve_nov_20_2024.mw

Any reason why the display of a fairly large plot in Maple 2024 (only show a print screen here)


be worst then the display of the same plot in Maple 2020

In 2024, it seams to be rasterized, while in 2020 it is still in vector form. Also the plot does not resize as well in 2024 compare to 2020. Any hint would help!

Maybe large plot are displayed in raster image, there is probably a setting somewhere in the documentation. When I export both are in vector format...

Thanks!

I am experimenting using the this format of  Vector( [Vector] ) to make projective vectors a different data type to Vectors. I don't want to use 1 x 3 or 3 x 1 matrices. The format holds some promise.
I would like to be able to copy the Maple format of Vector or Vector[column]    and Vector[row] for my varaition. 

ProjVectoC and ProjVectorR    so ProjVector or ProjVector[column]   and ProjVector[row]
A secondary question  is on type checking (see previous question How to setup special type check in a procedure? - MaplePrimes  ). Would it be possible to have the type check return ProjVector[column] or ProjVector[row]?
The attached worksheet contains a procedure for factor reducing the vectors to to a minimal format of <x,y,z>. Also   Cross product and Dot product procedures to suit.

I am open to any efficiency improvements.

restart

interface(rtablesize=50)

[10, 10]

(1)

with(LinearAlgebra):

 

FactReduce:=overload([
     proc(v::{list,Vector})
          option overload;
          description " removes linear factor from",
                      " a list, vector, matrix or expression";
          uses LinearAlgebra;
          local i, num,tgdc,dnm, V1;
          num:=`ifelse`(type(v,Vector),numelems(v),nops(v));
          dnm:=frontend(lcm, [seq(denom(v[i]),i=1..num)]);
          V1:=radnormal(v*~dnm);
          tgdc:=V1[1];

          for i from 2 to num do
               tgdc:=frontend(gcd, [tgdc, V1[i]]);
          end do;

          return  simplify(V1/~tgdc);
     end proc,

     proc(M::{Matrix})
          option overload;
          uses LinearAlgebra;
          local i, num,r,c, tgdc,dnm, V1, Ml;
          r,c:=Dimension(M);
          num:=r*c;
          V1:=convert(M,list);
          dnm:=frontend(lcm, [seq(denom(V1[i]),i=1..num)]);
          Ml:=radnormal(dnm*~M);
          V1:=convert(Ml,list);#print((dnm,V1));
          tgdc:=V1[1];#print("xx")

          for i from 2 to num do
               tgdc:=frontend(gcd, [tgdc, V1[i]])
          end do;

          return  simplify(Ml/~tgdc);   
     end proc,

     proc(l::{`+`,`*`,`=`, `symbol`,procedure},  {vars::list:=[:-x,:-y]})
          option overload;
          uses LinearAlgebra;
          local i, num,f1,f1a,lv,lr, tgdc,dnm, V1,Vs;
          f1 := `if`(l::procedure, l(vars[]), l);
               f1a:=`if`(f1::`=`,lhs(f1)-rhs(f1),f1)  ; # Remequal(f1);
          lr:=primpart(f1a,vars);
          return lr
end proc

]):

ProjVectorC := proc(a, b, c)
local cfs, vectr;
description " A Projective Column (Line) Vector in Reduced format";
cfs := FactReduce([a, b, c]);
vectr := <[<cfs>]>;
end proc:

 

ProjVectorR := proc(a, b, c)
local cfs, vectr;
description " A Projective Row (Point) Vector";
cfs := sign(c)*FactReduce([a, b, c]);
vectr := <[<cfs>^%T]>^%T;
end proc:

 

`&otimes;` := proc(A, B)
local cp;
description "Cross Product of Projective Vectors in Reduced format";
cp :=sign(c)* FactReduce(LinearAlgebra:-`&x`(A[1], B[1]))^%T;
cp := ifelse(cp[3] <> 0, <[sign(cp[3]) *~ cp]>, cp); #makes sure format is [x,y,z] and not [x,y-z]
end proc:

 

`&odot;` := proc(A, B)
description "Dot Product of Projective Vectors";
(A[1]) . (B[1]);
end proc:

 

V := ProjVectorR(2, 4, -6); W := ProjVectorR(11, 7, 5); S := ProjVectorC(6, -18, 24)

Vector[column](%id = 36893490982610361748)

(2)

whattype(V); `~`[whattype](V)

Vector[row](%id = 36893490982610825812)

(3)

whattype(S); `~`[whattype](S)

Vector[column](%id = 36893490982626471436)

(4)

`~`[whattype](V[1])

Vector[row](%id = 36893490982558545668)

(5)

V[1] . V[1]

14

(6)

`&odot;`(V, V)

14

(7)

R := `&otimes;`(W, V)

Vector[column](%id = 36893490982630825980)

(8)

R := `&otimes;`(V, W)

Vector[column](%id = 36893490982630903548)

(9)

whattype(R)

Vector[column]

(10)

`~`[whattype](R)

Vector[column](%id = 36893490982598861396)

(11)

`~`[whattype](R[1])

Vector[column](%id = 36893490982598866092)

(12)

`&otimes;`(R, S)

Vector[column](%id = 36893490982624872076)

(13)

`&odot;`(R, S)

-85

(14)

`&odot;`(W, R)

0

(15)

`&odot;`(R, `<,>`([`<,>`(x, y, 1)]))

15-31*x+38*y

(16)
 

 

Download 2024-11-21_Q_Projective_Vector_Format.mw

Hello Maple enthusiasts,

I am excited to share a sample worksheet on Ordinary Differential Equations (ODEs), created as part of my ongoing project—a book I am writing for undergraduate students. This book is designed to teach ODEs using Maple, offering an interactive and intuitive approach to solving differential equations.

As far as I know, there aren’t many books available in the Greek language that combine ODEs with Maple. In fact, I believe there’s only one other such resource, which highlights the lack of materials in this niche. My goal is to fill this gap by providing students and educators with a resource that is both practical and accessible, leveraging Maple's powerful capabilities to deepen understanding and simplify complex concepts.

The worksheet I’m sharing includes:

  • Step-by-step solutions to ODEs using Maple.
  • Graphical representations to visualize solutions, which I believe are invaluable for fostering comprehension.

I hope this preview sparks your interest and provides insight into the teaching style and structure of the upcoming book. I would love to hear your thoughts, feedback, or suggestions for topics you think should be included.

Solve the following differential equation

diff(y(x), x) = x*y(x)
with initial condition y(0) = 1

restart; with(plots); with(DEtools)

ode := diff(y(x), x) = x*y(x)

diff(y(x), x) = x*y(x)

(1)

ic := y(0) = 1

y(0) = 1

(2)

general_solution := dsolve(ode, y(x))

y(x) = c__1*exp((1/2)*x^2)

(3)

particular_solution := dsolve({ic, ode}, y(x))

y(x) = exp((1/2)*x^2)

(4)

soln := dsolve({ic, ode}, y(x), numeric)

``

(5)

p1 := odeplot(soln, [x, y(x)], x = -5 .. 5, labels = ["x", "y(x)"], color = green)

directionfield := dfieldplot(ode, [y(x)], x = -5 .. 5, y = -5 .. 5, color = blue, arrows = slim, scaling = constrained, axes = boxed)

display([p1, directionfield], view = [-5 .. 5, -5 .. 5])

 

NULL

Solve the following differential equation

diff(y(x), x) = x/y(x)
with initial condition y(0) = 2

restart; with(plots); with(DEtools)

ode1 := diff(y(x), x) = x/y(x)

diff(y(x), x) = x/y(x)

(6)

ic := y(0) = 2

y(0) = 2

(7)

dsolve(ode1, y(x))

y(x) = (x^2+c__1)^(1/2), y(x) = -(x^2+c__1)^(1/2)

(8)

NULL

soln := dsolve({ic, ode1}, y(x), numeric)

p1 := odeplot(soln, [x, y(x)], x = -5 .. 5, labels = ["x", "y(x)"], color = green)

directionfield := dfieldplot(ode1, [y(x)], x = -5 .. 5, y = -5 .. 5, color = blue, arrows = slim, scaling = constrained, axes = boxed)

display([p1, directionfield], view = [-5 .. 5, -5 .. 5])

 

NULL

Solve the following differential equation

dy/dx = e^y/(x^2+1)
with initial condition y(0) = -1

restart; with(plots); with(DEtools)

ode2 := diff(y(x), x) = exp(y(x))/(x^2+1)

diff(y(x), x) = exp(y(x))/(x^2+1)

(9)

ic := y(0) = -1

y(0) = -1

(10)

dsolve(ode2, y(x))

y(x) = ln(-1/(arctan(x)+c__1))

(11)

soln := dsolve({ic, ode2}, y(x), numeric)

p1 := odeplot(soln, [x, y(x)], x = -5 .. 5, labels = ["x", "y(x)"], color = green)

directionfield := dfieldplot(ode2, [y(x)], x = -5 .. 5, y = -5 .. 5, color = blue, arrows = slim, scaling = constrained, axes = boxed)

display([p1, directionfield], view = [-5 .. 5, -5 .. 5])

 

NULL

Solve the following differential equation

dy/dx = y^2+y
with initial condition y(1) = 2

restart; with(plots); with(DEtools)

ode3 := diff(y(x), x) = y(x)+y(x)^2

diff(y(x), x) = y(x)+y(x)^2

(12)

ic := y(1) = 2

y(1) = 2

(13)

dsolve(ode3, y(x))

y(x) = 1/(-1+exp(-x)*c__1)

(14)

soln := dsolve({ic, ode3}, y(x))

y(x) = 2/(-2+3*exp(-x)*exp(1))

(15)

DEplot(ode3, y(x), x = -5 .. 5, y = -5 .. 5, [[y(1) = 2]], color = blue, arrows = slim, scaling = constrained, axes = boxed)

 

NULL

Solve the following differential equation

y*dy/dx-x = 0
with initial condition y(0) = 4, y(1) = 2, y(-1) = -2and y(-2) = -4.

restart; with(plots); with(DEtools)

ode4 := y(x)*(diff(y(x), x))-x = 0

y(x)*(diff(y(x), x))-x = 0

(16)

ic := y(0) = 4

y(0) = 4

(17)

dsolve(ode4, y(x))

y(x) = (x^2+c__1)^(1/2), y(x) = -(x^2+c__1)^(1/2)

(18)

DEplot(ode4, y(x), x = -5 .. 5, y = -5 .. 5, [[y(1) = 2], [y(0) = 4], [y(-1) = -2], [y(-2) = -4]], color = blue, arrows = slim, scaling = constrained, axes = boxed)

 

 

 

NULL

Solve the following differential equation

dy/dx = 2*x+2*xy^2/y
with initial condition y(0) = 2.

restart; with(plots); with(DEtools)

ode5 := diff(y(x), x) = (2*x+2*x*y(x)^2)/y(x)

diff(y(x), x) = (2*x+2*x*y(x)^2)/y(x)

(19)

ic := y(0) = 2

y(0) = 2

(20)

dsolve(ode5, y(x))

y(x) = (exp(2*x^2)*c__1-1)^(1/2), y(x) = -(exp(2*x^2)*c__1-1)^(1/2)

(21)

psoln := dsolve({ic, ode5}, y(x))

y(x) = (5*exp(2*x^2)-1)^(1/2)

(22)

soln := dsolve({ic, ode5}, y(x), numeric)

p1 := odeplot(soln, [x, y(x)], x = -5 .. 5, labels = ["x", "y(x)"], color = green)

directionfield := dfieldplot(ode5, [y(x)], x = -5 .. 5, y = -3 .. 10, color = blue, arrows = slim, scaling = constrained, axes = boxed)

display([p1, directionfield], view = [-5 .. 5, -3 .. 10])

 

NULL


 

Download separable_diff_equations.mw

 

The following is not a profound problem, and there is an obvious solution,

but it came up, and I would like to learn more about it.

 

Even though I recommend the add procedure when summing up individual entities,

my students keep showing me how smart the sum procedure is. Which makes

our worksheets more readable and reproducible for Maple users who are less frequent.

 

For example:

 

restart; Xlist := [1, 2, 3]; N := numelems(Xlist)

3

Using palette icon:

sum(Xlist[n], n = 1 .. N)

6

Cool!  Which means

sum(Xlist[n], n = 1 .. N)

6

But if we use the same palette icon for a vector

Xvector := convert(Xlist, Vector); sum(Xvector[n], n = 1 .. N)

Error, bad index into Vector

Because I believe this fails

sum(Xvector[n], n = 1 .. N)

Error, bad index into Vector

 

Would someone please teach me how I can see why the sum of a list

works, but does the sum of a vector fail?

Download MaplePrimes_sum_list_vector.mw

Maple defaults to expressing output in terms of Cosines.

Is it possible to instruct maple to rather calculate the output  with Sine as the default ?

I was not expecting odesteps to show steps for this ode, but crash the server each and everytime?

Anyone could find why? I am using Maple 2024.2 on windows 10 with latest Physics. This might indicate serious problem somewhere. Software should not really crash this easily.

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1827 and is the same as the version installed in this computer, created 2024, November 13, 9:16 hours Pacific Time.`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

restart;

ode:=5*(1+t^2)*diff(y(t),t)=4*t*y(t)*(y(t)^3-1);

5*(t^2+1)*(diff(y(t), t)) = 4*t*y(t)*(y(t)^3-1)

dsolve(ode);

y(t) = 1/((t^2+1)^(6/5)*c__1+1)^(1/3), y(t) = -(1/2)/((t^2+1)^(6/5)*c__1+1)^(1/3)-((1/2)*I)*3^(1/2)/((t^2+1)^(6/5)*c__1+1)^(1/3), y(t) = -(1/2)/((t^2+1)^(6/5)*c__1+1)^(1/3)+((1/2)*I)*3^(1/2)/((t^2+1)^(6/5)*c__1+1)^(1/3)

Student:-ODEs:-ODESteps(ode);


 

Download crash_server_nov_18_2024.mw

here is small movie

 

 

Hello,

I present the rolling of an ellipse along a spatial curve and along curves placed on a surface, also along a Mobius surface.

Attached are the Maple source files.

Best regards.

Source_-_mw.zip






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