Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

This ode from textbook, and the solution is given in back of book and I verified it is correct.

odetest gives zero also when asked to verify the solution.

but when asked to verify both the solution and the initial conditions, instead of returning [0,0] as expected, it returns [the_ode,0]

Here is an example
 

interface(version);

`Standard Worksheet Interface, Maple 2022.2, Windows 10, October 23 2022 Build ID 1657361`

restart

ode:=diff(y(x), x) = 2*(2*y(x) - x)/(x + y(x));
ic:=y(0) = 2;
booksol:=(x-y(x))^2/( y(x)-2*x)^3 = 1/2;

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

y(0) = 2

(x-y(x))^2/(y(x)-2*x)^3 = 1/2

#this returns zero, so maple agree the book solution is correct
odetest(booksol,ode)

0

#when adding ic, when does it not give [0,0] ?
odetest(booksol,[ode,ic])

[diff(y(x), x)-2*(2*y(x)-x)/(x+y(x)), 0]

 


How shoulld one interpret the above answer?

Download question_on_odetest_nov_14_2022.mw

Consider the following system of differential equations

sys := diff(y(x), x) = z(x)*f1(i), diff(z(x), x) = y(x)*f2(i)

where f1 and f2 are functions that depend on the current iteration. Ultimately, I'd like to index into an array that has the length of the number of iterations, to obtain a value that will be part of the differential equations. It's an array of random numbers, but I'd rather not have to generate them on the fly while dsolve is working.

I've been investigating the use of Events for this, but the documentation is quite atrocious and outdated (and I only know this because, for example, when I try to use certain arguments to dsolve some error messages show that the arguments have changed name)

Please help me to prove that the limit of the following function does not exist:

I've read the documentation on events, and as far as I can tell after an hour or two, I am doing exactly what is in the documentation but not getting the expected result.

Here is a worksheet illustrating the issue: dsolve_events.mw

Basically there is a very simply system of two differential equations and I would simply like to see an event triggered when the dependent variable is above 2. 

This event has no useful interpretation, it was just my attempt at trying to get something to trigger (I have tried multiple things). As far as I can tell from the docs I am using an event specification of form 

[0, c(t,y(x)) < 0]: discrete event with a conditional trigger

ie, [0,2-x<0]

and when that is triggered I set i(x) to something like i(x)+1 (but even something as simple as assigning it to some constant like 7, given that the initial value i(0)=0, would allow me to check when the event is being triggered), where i(x) is defined as a discrete variable (my ultimate goal is to trigger the event on every iteration and have i be the iteration counter. I want to use this iteration counter in the equations)

I run the dsolve command, assign the result to a variable and then call, for example p(3). I would expect to see the event triggered and i(3) not equal to the initial value i(0). But the value of i(x) doesn't change.

Hi got this set of error using the Plot package. Anyone here know what they mean? 

Given any arbitrary function, say... cos(3t)+2sin(2t-3)

How can I generate data from said funciton. Precisely, I want to generat the dataset

t         value

0.1      value1
0.2      value2
...

10.0    value(@t=10)

Surely there has to be some easy way to do this but I cannot seem to find it. the plottool:-getdata does not seem to be able to export the data in the desired t increments.

The following example shows clearly that timelimit is still broken in Maple.

I tried this 10 times, and it hangs each time. I could wait 30 minutes and it still hangs. timelimit simply does not work. I set timelimit to 20 or 30 seconds.  This really makes developing software in Maple very difficult when timelimit itself hangs as it means the whole program comes to halt and becomes frozen and I see no workaround this problem.

 

interface(version);

`Standard Worksheet Interface, Maple 2022.2, Windows 10, October 23 2022 Build ID 1657361`

restart;

ode:=1/2*sqrt((diff(y(x), x) - sqrt(-a^2*(a - b)*(a + b))/a^2)^2 + 2*sqrt(-a^2*(a - b)*(a + b))*(diff(y(x), x) - sqrt(-a^2*(a - b)*(a + b))/a^2)/a^2 + b^2/a^2)/a - 1/2*b^2*ln((2*b^2/a^2 + 2*sqrt(-a^2*(a - b)*(a + b))*(diff(y(x), x) - sqrt(-a^2*(a - b)*(a + b))/a^2)/a^2 + 2*sqrt(b^2/a^2)*sqrt((diff(y(x), x) - sqrt(-a^2*(a - b)*(a + b))/a^2)^2 + 2*sqrt(-a^2*(a - b)*(a + b))*(diff(y(x), x) - sqrt(-a^2*(a - b)*(a + b))/a^2)/a^2 + b^2/a^2))/(diff(y(x), x) - sqrt(-a^2*(a - b)*(a + b))/a^2))/(a^3*sqrt(b^2/a^2)) + 1/2*sqrt((diff(y(x), x) + sqrt(-a^2*(a - b)*(a + b))/a^2)^2 - 2*sqrt(-a^2*(a - b)*(a + b))*(diff(y(x), x) + sqrt(-a^2*(a - b)*(a + b))/a^2)/a^2 + b^2/a^2)/a - 1/2*b^2*ln((2*b^2/a^2 - 2*sqrt(-a^2*(a - b)*(a + b))*(diff(y(x), x) + sqrt(-a^2*(a - b)*(a + b))/a^2)/a^2 + 2*sqrt(b^2/a^2)*sqrt((diff(y(x), x) + sqrt(-a^2*(a - b)*(a + b))/a^2)^2 - 2*sqrt(-a^2*(a - b)*(a + b))*(diff(y(x), x) + sqrt(-a^2*(a - b)*(a + b))/a^2)/a^2 + b^2/a^2))/(diff(y(x), x) + sqrt(-a^2*(a - b)*(a + b))/a^2))/(a^3*sqrt(b^2/a^2)) - 1/2*b*ln(a^2*diff(y(x), x)^2 + a^2 - b^2)/a^2 - y(x) - _C1 = 0:

try
  print("Before calling timelimt on odeadvisor");
  timelimit(20,DEtools:-odeadvisor(ode,y(x)));
  print("Did not time out");
catch:
  print("TIMED OUT");
end try;

"Before calling timelimt on odeadvisor"

 


 

Does this hang on your version of Maple? I am using 2022.2 on windows 10.

I was hoping this problem with timelimit has finally been fixed in Maple 2022.2. From this post almost 2 years ago!  it says

"You will also be pleased to know that Maple 2021 addresses the timelimit() issue that you mentioned."

But it is clearly not yet fixed.

 

Some important observations

1) sometimes I noticed if timelimit is small (say 5 or 10), it does not hang. So it the above does timeout for you, please try with larger time out, say 40 or 60 seconds. Since it depens on how fast the PC is.

2)sometimes I  noticed if I close Maple and start new sesstion, the very first time it could timeout OK, but the second time it is called, it hangs. May be because the server caches something to cause this.

All this means, it is completely not predictable what wil happen when starting the maple run. I have no idea how long it will take from one time to another, or even if it will hang or not. For all the years I used Maple, I never had one single time where one run completed without having to restart it at least 2 or 3 times in order to reach the finish line.  This is in addition to all those server.exe crashing on its own many times in between. I noticed more and more of these in Maple 2022.2.  But that is for another topic.

The following screen shot showing one instance when I run the above timelimit (been wainting now for 15 minutes, using timeout of 30 second)., It shows Maple server taking 81% of the CPU

 

And the following is screen shot of the worksheet itself when I took the above screen shot

 

Download timelimit_hangs_on_odeadvisor.mw

 

 

Hello community. I'm trying to use Maple for some study.
My goal is to get the Wiener-Hopf equation in matrix form like in the book (eq 3.56).
So at first i need the gradient of eq 3.53, the result is eq 3.55 (nabla is not printed) .
Could you please provide an example of this operation, if it is possible, thanks.


_local(D);
f := (x, y) -> 3*x^2 - 3*y*x + 6*y^2 - 6*x + 7*y - 9;
coeffs(f(x, y));
A, B, C, D, E, F := %;
theta := 1/2*arctan(B/(A - C));
solve({-2*A*xc - B*yc = D, -B*xc - 2*C*yc = E});
assign(%);
x := xcan*cos(theta) - ycan*sin(theta) + xc;
y := xcan*sin(theta) + ycan*cos(theta) + yc;
Eq := simplify(expand(f(x, y)));
xcan^2/simplify(sqrt(-tcoeff(Eq)/coeff(Eq, xcan^2)))^`2` + ycan^2/simplify(sqrt(-tcoeff(Eq)/coeff(Eq, ycan^2)))^`2` = 1;
a := sqrt(-tcoeff(Eq)/coeff(Eq, xcan^2));
b := sqrt(-tcoeff(Eq)/coeff(Eq, ycan^2));
c := sqrt(a^2 - b^2);
F1 := [xc + c*cos(theta), yc + c*sin(theta)];
evalf(%);
F1 := [xc - c*cos(theta), yc - c*sin(theta)];
evalf(%);
Points := pointplot([F1[], F2[]], symbol = solidcircle, color = [red], symbolsize = 6);
xcan := plot(yc + tan(theta)*('x' - xc), 'x' = -2 .. 3.5, color = black);
ycan := plot(yc - ('x' - xc)/tan(theta), 'x' = 0.1 .. 1.5, color = black);
Ellipse := plots[implicitplot](f('x', 'y'), 'x' = -2 .. 3.5, 'y' = -2 .. 1.5, color = red, thickness = 2, gridrefine = 5);
labels := plots[textplot]([[0.4, 1.3, "ycan"], [3.2, 0.75, "xcan"]], font = [TIMES, ROMAN, 14]);
plots[display](xcan, ycan, Points, Ellipse, labels, scaling = constrained);

I do not why I get this message:

Error, (in plots:-display) expecting plot structure but received: pointplot([17/21-(2/21)*(1407/(-(3/2)*2^(1/2)+9/2)-1407/((3/2)*2^(1/2)+9/2))^(1/2)*cos((1/8)*Pi), -8/21-(2/21)*(1407/(-(3/2)*2^(1/2)+9/2)-1407/((3/2)*2^(1/2)+9/2))^(1/2)*sin((1/8)*Pi), F2[]], symbol = solidcircle, color = [red], symbolsize = 6) NULL;

Thank you for your help.
 

I have an expression and I want to find its maximum value.

expr:=sin(sqrt(3)*t)*cos(sqrt(3)*t)*(sqrt(3)*cos(sqrt(3)*t) - sin(sqrt(3)*t))/3

It is easy to find its maximum value in a numerical form.

Optimization:-Maximize(sin(sqrt(3)*t)*cos(sqrt(3)*t)*(sqrt(3)*cos(sqrt(3)*t) - sin(sqrt(3)*t))/3)

[0.324263244248023330, [t = 1.39084587050767]]

The images of the expression is as follows.

 

But does it exist an acceptable maximum value in symbolic form?  As the function maximize seems to take a lot of time, I don't see any hope so far. Perhaps the expression is indeed complex.

maximize(expr)# it runs long time.

We try to find the derivative of expr and get some points where thier derivatives are 0.

s:=[solve(diff(expr,t),t)]
evalf~(s) # Some solutions seem to have been left out.

[0.7607468963 + 0.*I, -0.4229534936 - 0.*I, 0.2668063857 + 0.*I]

ex:=convert(expr,exp):
s:=[solve(diff(ex,t)=0,t)]:
s1:=evalf~(s);# choose the 6th item: 1.390845877 + (4.655829150*10^(-9))*I
fexpr := unapply(ex, t);
evalf(fexpr(s1[6]));
fexpr (s[6]); # a very long expression that is not quite acceptable.

-I/6*(-sqrt(-(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)*((1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3)*sqrt(3)*I - 2*I*sqrt(3)*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) + (1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3) + 36*I*sqrt(3) + 2*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) - 44))/(6*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)) + 6*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)/sqrt(-(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)*((1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3)*sqrt(3)*I - 2*I*sqrt(3)*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) + (1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3) + 36*I*sqrt(3) + 2*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) - 44)))*(-sqrt(-(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)*((1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3)*sqrt(3)*I - 2*I*sqrt(3)*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) + (1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3) + 36*I*sqrt(3) + 2*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) - 44))/(12*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)) - 3*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)/sqrt(-(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)*((1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3)*sqrt(3)*I - 2*I*sqrt(3)*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) + (1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3) + 36*I*sqrt(3) + 2*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) - 44)))*(sqrt(3)*(-sqrt(-(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)*((1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3)*sqrt(3)*I - 2*I*sqrt(3)*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) + (1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3) + 36*I*sqrt(3) + 2*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) - 44))/(12*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)) - 3*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)/sqrt(-(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)*((1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3)*sqrt(3)*I - 2*I*sqrt(3)*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) + (1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3) + 36*I*sqrt(3) + 2*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) - 44))) + (-sqrt(-(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)*((1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3)*sqrt(3)*I - 2*I*sqrt(3)*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) + (1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3) + 36*I*sqrt(3) + 2*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) - 44))/(6*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)) + 6*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)/sqrt(-(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)*((1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3)*sqrt(3)*I - 2*I*sqrt(3)*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) + (1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3) + 36*I*sqrt(3) + 2*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) - 44)))*I/2)

An interesting problem is that an acceptably concise expression (although it is very subjective) for the maximum value may not exist mathematically. But knowing this in advance is difficult.

Download compute_zlc.mw

During my reaserch on diffusion I am arrived at the integral with argument

exp(-1/sqrt(x^2 + 1)) which Maple is not able to solve.

If some experts in solving integrals is able to solve it please keep me informed.

The file in Maple 2022 is below

primes_integral_diffusion.mw

Hello everyone!

I use this procedure to open my inbox:

>restart;
ShellExecute := define_external('ShellExecuteA', hwnd::(integer[4]), lpOperation::string, lpFile::string, lpParameters::string, lpDirectory::string, nShowCmd::integer[4], 'RETURN'::integer[4], LIB = "C:\\WINDOWS\\SYSTEM32\\shell32.dll"):
OpenBrowser := proc(someURL::string := "http://")

ShellExecute(0, " ", someURL, " ", " ", 1); NULL;

end proc:

Case 1:  I entered the correct email address of my friend who sent me the mail

>OpenBrowser("https://mail.google.com/mail/u/0/?tab=rm&ogbl#inbox/xxxxxxGqRZXPKXGzrrSrfHscdNWspRJF");

As a result, the content of the message I received was opened with full information.

Case 2:  When I enter an arbitrary email address that is not my friend, the result is that no content is displayed.

>OpenBrowser("https://mail.google.com/mail/u/0/?tab=rm&ogbl#inbox/yyyyyyGqRZXPKXGzrrSrfHscdNWspRJf");

On the email there is only the message: The conversation you requested could not be loaded.

May I ask:  Is there any Maple command to return true in case 1 and to return false in case 2 ?

Thank you very much for your help !

Procedure returns two values. I would like to print a comment after them if possible, without it being a returned value


foo := proc(a, b) 
local x, y; 
x := a^2 - b; 
y := b^2 - a; 
# return x,y, "test on foo"  # returns 3 values
return x, y, print(" tests on return"); end proc;

A, B := foo(6, 3);
                       " tests on return"

                         A, B := 33, 3  #would like "tests on return here"

 

Dear Users!
I hope are fine here. I got the following expression after a lot of computations

((1/2)*r*(r-1)+(1/6)*r*(r-1)*(r-2))*`&Delta;y`[-1]^3+(1/2)*r*(r-1)*`&Delta;y`[-1]^2+(1/120)*r*(r-1)*(r-2)*(r-3)*(r-4)*`&Delta;y`[-2]^7+((1/6)*r*(r-1)*(r-2)+(1/12)*r*(r-1)*(r-2)*(r-3)+(1/120)*r*(r-1)*(r-2)*(r-3)*(r-4))*`&Delta;y`[-2]^5+((1/6)*r*(r-1)*(r-2)+(1/24)*r*(r-1)*(r-2)*(r-3))*`&Delta;y`[-2]^4+((1/24)*r*(r-1)*(r-2)*(r-3)+(1/60)*r*(r-1)*(r-2)*(r-3)*(r-4))*`&Delta;y`[-3]^7+((1/24)*r*(r-1)*(r-2)*(r-3)+(1/60)*r*(r-1)*(r-2)*(r-3)*(r-4))*`&Delta;y`[-3]^6+r*`&Delta;y`[0]+y[0]

Actually, for the above, I want the factorization of each coefficient of `&Delta;y`[0], `&Delta;y`[-1], `&Delta;y`[-2] etc and the above expression shoud be in descending order given as:

y[0]+r*`&Delta;y`[0]+(1/2)*r*(r-1)*`&Delta;y`[-1]^2+(1/6)*r*(r-1)*(1+r)*`&Delta;y`[-1]^3+(1/24)*r*(r-1)*(r-2)*(1+r)*`&Delta;y`[-2]^4+(1/120)*r*(r-1)*(r-2)*(r+2)*(1+r)*`&Delta;y`[-2]^5+(1/120)*r*(r-1)*(r-2)*(r-3)*(r-4)*`&Delta;y`[-2]^7+(1/120)*r*(r-1)*(r-2)*(r-3)*(-3+2*r)*`&Delta;y`[-3]^6+(1/120)*r*(r-1)*(r-2)*(r-3)*(-3+2*r)*`&Delta;y`[-3]^7

I am waiting for your positive response. Thanks

I was trying New-Display-Of-Arbitrary-Constants-And-Functions- but found a small problem.

in my code I build the constants of integrations using parse("_C"||N); where N is an integer that can go up to as many constants of integration are needed. For example, for 4th order ode, there will be 4 of them.

I noticed only the first 2 come out using the nice c__1,c__2 notation, but anything after 2 ,they come out using old notation _C3, _C4.

Here is a MWE

restart;

interface(version);

`Standard Worksheet Interface, Maple 2022.2, Windows 10, October 23 2022 Build ID 1657361`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1346 and is the same as the version installed in this computer, created 2022, October 7, 13:4 hours Pacific Time.`

restart;

dsolve(diff(y(x),x)=1,arbitraryconstants=subscripted);
pdsolve(diff(psi(x,t),x$2)=0,arbitraryfunctions=subscripted);

y(x) = x+c__1

psi(x, t) = f__1(t)*x+f__2(t)

_C1

c__1

for N from 1 to 4 do
    parse("_C"||N);
od;

c__1

c__2

_C3

_C4

 


So now my solution comes out with mixed looking constants. Why does this happen for N>2?

Download problem_with_C.mw

So for now, I went back to using the old method of using alias as follows

restart;

alias(seq(c[k] = _C||k, k = 0..10)):

_C1

c[1]

for N from 1 to 4 do
    parse("_C"||N);
od;

c[1]

c[2]

c[3]

c[4]

 

Download problem_with_C_alias.mw

First 140 141 142 143 144 145 146 Last Page 142 of 2097