MaplePrimes Questions

I am struggling with the output of a procedure. A dummy code is as follows:


fun := x^2+y^2;

temp_proc := proc(x, y)
local out1, out2, out3:

if x > 0 then out1 := fun; out2 := 2*fun; out3 := k*fun;
elif x <= 0 then out1 := fun; out2 := -2*fun; out3 := -k*fun;
end if:

return(out1, out2, out3);
end proc:

xt := -1: yt := 2:
out1_fin := temp_proc(xt, yt)[1];
out2_fin := temp_proc(xt, yt)[2];
out3_fin := temp_proc(xt, yt)[3];


xt and yt are numerical input parameters. I expect to obtain "out1_fin" and "out2_fin" in numerical form and "out3_fin" in symbolic form. All three outputs should substitute xt and yt for x and y, respectively, wherever relevant. 

However, currently, the output I am getting is not after substituting the values of xy and yt. The output is as follows:


out1_fin := x^2+y^2

out2_fin := -2*x^2-2*y^2          

out3_fin := -k*(x^2+y^2)


May I get some help in resolving the issue? 

Also, would a procedure be a good idea for this task, or would a module be better? 

I would appreciate any guidance in this regard. Thank you. 



I keep getting an error: invalid subscript selector on specifically this part of my code:

MuligIndgange := subsop(RemoveList\[i\]=NULL, MuligIndgange).
Whenever I comment out the MuligIndgange := part it works.

I can't for the life of me see why it's happening, and whenever I use this code outside my proc it works aswell.

Any help is appreciated, and if you need more context I'll be happy to give it.

for i to numelems(MuligIndgange) do
     if M1[MuligIndgange[i][1], MuligIndgange[i][2]] =/= 0 then
         RemoveList := [op(RemoveList), i];
      end if;
end do;
for i from numelems(RemoveList) by -1 to 1 do
    MuligIndgange := subsop(RemoveList[i] = NULL, MuligIndgange);
end do;

When I use evala(Minpoly(sqrt(3) + sqrt(2), x)), then I get a right answer: x^4 - 10*x^2 + 1

But when I want to get the minimal polynomial of cos((2*Pi)/7) by evala(Minpoly(cos((2*Pi)/7), x)), I will get a result:

x - cos((2*Pi)/7)

It clearly does not follow the definition of a minimal polynomial. Is it a bug of Minpoly or I have missed something?

Question 1
Let theta a real number in the range 0..2*Pi.
Is there a way to "convert" 

f := theta -> arccos(cos(theta))+arcsin(sin(theta))


f1 := theta -> piecewise(theta < 0, 0, theta < (1/2)*Pi, 2*theta, theta < Pi, Pi, theta <= (3/2)*Pi, 3*Pi-2*theta, 0)

Question 2
As f1 is  2*Pi periodic, is there a way to convert f into a periodic function where the "pattern" is f1(theta)?
To be clearer I thought to something close to what we get when we do this

solve(cos(x)=1, allsolutions);
                            2 Pi _Z2 
Originally _Z1, renamed _Z1~:
  is assumed to be: integer

and I imagined 

Originally _Z1, renamed _Z1~: 
  is assumed to be: integer

For the moment I build the periodized f1 this way

f2 := (theta, K) -> int(f1(theta-z)*add(Dirac(z-2*Pi*k), k=-K..K), z=-infinity..+infinity);
# or
f2 := (theta, K) -> sum(int(f1(theta-z)*Dirac(z-2*Pi*k), z=-infinity..+infinity), k=-K..K);

Thanks in advance.

How do I solve the problem below using maple commands? I'm having trouble finding the commands and believe my answer is incorrect. I am currentley on maple 2022. 
How would I find an equation of the line tangent to the graph of f(x) when x =3?
f(x)= (1-kx)/(1+x^2)
f := x -> x^2 + 2*x + 1;

Thank you.


I would like to generate a ColumnGraph such that the bars are centered over 1, 2, and 3. For example, I have a vector:

x:= Vector([1,2,3]);

When you execute ColumnGraph(x), you a get the first bar centered over 0.375, instead of 1, second bar centered over 1.375, instead of 2, and so on.

Thanks for your help.

I have seen this quite a bit in blocks of code. The `>` symbol seems to appear erratically. I don't know how to specifically reproduce this. Does it mean something? I would post the worksheet but it will not run without the package.


"restart: with(plots):with(DEtools):with(Student[ODEs]):infolevel[Student]:=3 ;"NULL

"maple.ini in users"




NULL#  plot  solutions to a system  of DEs


sys := {diff(x(t), t) = y(t), diff(y(t), t) = -x(t) - 1/2*y(t)}

{diff(x(t), t) = y(t), diff(y(t), t) = -x(t)-(1/2)*y(t)}


DEplot(sys, [x(t), y(t)], t = 0 .. 15, [[x(0) = 1, y(0) = 0]])



This is not working, seems to be simple ...
Have made an attempt to create a procedure from these two commands, but no success
Apparently, I need to learn to use a debugger to determine what is wrong, then?

dv_systeemplot:= proc ( DV1,DV2 ,RV1,RV2 )
                 local t, sys,systeemplot;  
                 sys := {DV1 , DV2 }:
                 systeemplot:= DEplot(sys, [x(t), y(t)], t = 0 .. 15, [[RV1 , RV2]]);
                 return systeemplot;
end proc;

proc (DV1, DV2, RV1, RV2) local t, sys, systeemplot; sys := {DV1, DV2}; systeemplot := DEplot(sys, [x(t), y(t)], t = 0 .. 15, [[RV1, RV2]]); return systeemplot end proc



DV1 := diff(x(t), t) = y(t)

diff(x(t), t) = y(t)


DV2 := diff(y(t), t) = -x(t)-(1/2)*y(t)

diff(y(t), t) = -x(t)-(1/2)*y(t)


RV1 := x(0) = 1

x(0) = 1


RV2 := y(0) = 0

y(0) = 0


dv_systeemplot( DV1,DV2 ,RV1,RV2 );


Error, (in DEtools/DEplot/CheckDE) inputs must be ODEs



Ask AI to get some code: never i got the right Maple code ! :)


"restart: with(plots):with(DEtools):with(Student[ODEs]):infolevel[Student]:=3 ;"``

"maple.ini in users"





systeem := proc(eq1, eq2, beginwaarden)
  local x, y, oplossing;
  x := unapply(rhs(dsolve({eq1, eq2, beginwaarden}, {x(t), y(t)})), t);
  y := unapply(rhs(dsolve({eq1, eq2, beginwaarden}, {x(t), y(t)})), t);
  oplossing := DEplot([x(t), y(t)], t = 0 .. 10, beginwaarden);
end proc;

# Definieer de differentiaalvergelijkingen
eq1 := diff(x(t), t) = y(t);
eq2 := diff(y(t), t) = -x(t);

# Geef de beginwaarden op
beginwaarden := [x(0) = 1, y(0) = 0];

# Roep de procedure aan met de differentiaalvergelijkingen en beginwaarden
systeem(eq1, eq2, beginwaarden);

"maple.ini in users"


proc (eq1, eq2, beginwaarden) local x, y, oplossing; x := unapply(rhs(dsolve({eq1, eq2, beginwaarden}, {x(t), y(t)})), t); y := unapply(rhs(dsolve({eq1, eq2, beginwaarden}, {x(t), y(t)})), t); oplossing := DEplot([x(t), y(t)], t = 0 .. 10, beginwaarden); oplossing end proc


diff(x(t), t) = y(t)


diff(y(t), t) = -x(t)


[x(0) = 1, y(0) = 0]


Error, (in dsolve) invalid input: PDEtools/sdsolve expects its 1st argument, SYS, to be of type Or(set({`<>`, `=`, algebraic}),list({`<>`, `=`, algebraic}),`casesplit/ans`(list,list)), but received {diff(x(t),t) = y(t), diff(y(t),t) = -x(t), [x(0) = 1, y(0) = 0]}


Probably i do need to work with a debugger here?


If we write

restart: alias(po=pochhammer):

assume(abs(z)<1);  F:=z->sum(po(1,n)^2/po(1/2,n)^2*z^n/(n+1),n=1..infinity);

Then the output of F(z) is a hypergeometric series, and

A=subs(z=4, F(z);


gives the correct output. But, why do we need to assume that abs(z)<1 if we are evaluating at abs(z)>1?. Observe that if we do not assume it, then the output we get is wrong, why?

I recently watched a video in which the speaker asked the following question: "How many seconds are there in 42 days?".
I think I've done what anyone would do: trying to quickly find an order of magnitude for this number.
But the speaker's answer was both remarkable and obvious when you think of it: "Exactly 10! seconds".

So my question: Given the number 3628800, is there a way to identify it (in the  identify's sense) to 10!  ?
Or maybe some trick to force identify to answer 10! ?

Thanks in advance

Well , honestly I can't make sense of how to do this.

Interactive can be done step by step , but now generalize via a procedure , but can't get a handle on it
How to get the right procedure ?

"maple.ini in users"



" restart: with(plots):with(DEtools):with(Student[ODEs]):infolevel[Student]:=3 ;"

"maple.ini in users"




DV := y(x)*(diff(y(x), x)) = exp(x)

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


opl_1 := dsolve({DV, RV1}, y(x))

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


opl_2 := dsolve({DV, RV2}, y(x))

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


opl := plot({rhs(opl_1), rhs(opl_2)}, x = 0 .. 5, y = -10 .. 10, thickness = 3)

lijnelement := dfieldplot(DV, y(x), x = 0 .. 5, y = -10 .. 10, title = "lijnelementveld met intergaalkromme door (1,1)(1,-1)")

display({opl, lijnelement})



" restart: with(plots):with(DEtools):with(Student[ODEs]):infolevel[Student]:=3 ;"

"maple.ini in users"





DV, RV1, RV2

y(x)*(diff(y(x), x)) = exp(x), y(1) = 1, y(1) = -1





"restart: with(plots):with(DEtools):with(Student[ODEs]):infolevel[Student]:=3 ; "

"maple.ini in users"




          local DV;RV1;RV2;opl_1;opl_2;opl;lijnelement;
          opl_1 := dsolve({DV, RV1}, y(x)):
          opl_2 := dsolve({DV, RV2}, y(x)):
          opl:= plot({rhs(opl_1), rhs(opl_2)}, x = 0 .. 5, y = -10 .. 10, thickness = 3):
          lijnelement:=dfieldplot(DV, y(x), x = 0 .. 5, y = -10 .. 10, title = "lijnelementveld met                intergaalkromme door (1,1)(1,-1)"):
          display({opl, lijnelement});
end proc:


DVA := y(x)*(diff(y(x), x)) = exp(x)

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


RV1A := y(1) = 1

y(1) = 1


RV2A := y(1) = -1

y(1) = -1


DVplot(DVA, RV1A, RV2A)

Error, (in dsolve) not a system with respect to the unknowns [y(x)]




I want to make from a procedure call a single argument function that can be used in function composition.

To illustrate this with a simple example, below the function pow[3] performs a cube operation

pow[3]:=x-> `^`(x,3):

To make the use of pow a bit more generic, I though about doing definitions for other powers in a loop with an inline assignement

for i from -1/2 to 5 by 1/2 do (power[i]:=x-> `^`(x,i)) end do;

This does not work because the i in the rigthhand side of power[i]:=x-> `^`(x,i) does not evaluate to the acutal value of the loop counter. I tried eval and evaln without success. How do I get full evaluation of the inline assignement?

How can I find a relation of a, b, c, d, t (a d <> 0) so that the function f(x) = (a x^2 + b x + c)/(d x +t) is a increasing function on the interval (m, n)? I know that, we have the conditions 
f'(x) >=0 forall x in (m, n) and -t/d not in (m, n)


I have the following procedure that uses the Lie Derivatives of a vector field to build a set of equations.

description "This function returns the system of equations based on the Lie derivative.":
local i,n:=numelems(vars),L:=Array(0..n):
for i from 1 to n do
    L[i]:=inner(f,map((a,b) -> diff(b,a),vars,L[i-1])):
end do:
end proc:

Below it is an example on how to call the procedure.

I used CodeTools:-ThreadSafetyCheck to check all the procedures used within LieDerList and LieDerList itself, but nothing wrong came out. However when I try to run 


where models4 is a list of 1765 elements, maple returns "Error, (in factors) attempting to assign to `LinearAlgebra:-Modular:-Create` which is protected". If I change Threads to Grid, there is no problem at all.  

What am I overlooking? Is there a method to ensure the procedure is thread-safe?

Many thanks.   

PS.  I found one problem - inner, which is related to LinearAlgebra package, is not thread-safe.  

This is not new in Maple 2024, and also happens in Maple 2023. But it causes the famous "kernel connection has been lost" each time. 

I think many of the kernel connection has been lost problems I see might be related. It could be memory problem in this case. I wonder if someone will be able to track what causes it. Is it expected that server.exe crash on such input?

ps. Reported to Maplesoft support.





`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`


`The "Physics Updates" version in the MapleCloud is 1708 and is the same as the version installed in this computer, created 2024, March 27, 16:20 hours Pacific Time.`









For reference, another software give this result instantly and with no crash:

My PC is windows 10, with 128 GB RAM.


First 11 12 13 14 15 16 17 Last Page 13 of 2322