Maple Questions and Posts

These are Posts and Questions associated with the product, Maple
_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))*`Δy`[-1]^3+(1/2)*r*(r-1)*`Δy`[-1]^2+(1/120)*r*(r-1)*(r-2)*(r-3)*(r-4)*`Δ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))*`Δy`[-2]^5+((1/6)*r*(r-1)*(r-2)+(1/24)*r*(r-1)*(r-2)*(r-3))*`Δy`[-2]^4+((1/24)*r*(r-1)*(r-2)*(r-3)+(1/60)*r*(r-1)*(r-2)*(r-3)*(r-4))*`Δy`[-3]^7+((1/24)*r*(r-1)*(r-2)*(r-3)+(1/60)*r*(r-1)*(r-2)*(r-3)*(r-4))*`Δy`[-3]^6+r*`Δy`[0]+y[0]

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

y[0]+r*`Δy`[0]+(1/2)*r*(r-1)*`Δy`[-1]^2+(1/6)*r*(r-1)*(1+r)*`Δy`[-1]^3+(1/24)*r*(r-1)*(r-2)*(1+r)*`Δy`[-2]^4+(1/120)*r*(r-1)*(r-2)*(r+2)*(1+r)*`Δy`[-2]^5+(1/120)*r*(r-1)*(r-2)*(r-3)*(r-4)*`Δy`[-2]^7+(1/120)*r*(r-1)*(r-2)*(r-3)*(-3+2*r)*`Δy`[-3]^6+(1/120)*r*(r-1)*(r-2)*(r-3)*(-3+2*r)*`Δ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

Strange behavior. I don't know if this can be made to work.  I replaced an equation with an interpolation object, f(x).

tInt := int(f, 133  .. 134, numeric);
tInt := 324.95206944305  <= Computes a result. I

tInt := int(f, 133  .. 312, numeric);
tInt:= int(fproc, 133. .. 312.) <= Won't compute it. The interpolation object has 3051 points, so that's not the problem. The name "fproc" is not something I have in my  code, just the name, "f".

If I try to make the  integral just slightly more complex by  passing a variable in, it doesn't work at all. This was to see if I could integrate with a varying divisor: f(x)/(x+1)
int(f(x), x = 133 .. 134, numeric); 

Error, (in int) wrong number (or type) of arguments: invalid options or option values passed to definite integration. <=

A fallback  was to use summation, but that doesn't work at all, same typ of error as the Error for int. (Not shown.)

So my fallback is to use a for loop to sum the set. The for loops produce another set of values, and I think I have to make interpolation objects for that as well. And so on. I really  was expecting  Maple to handle this better.

conjcl := proc(k, p, n) local t, L, q; L := []; t := 0; q := p^n - 1; while k*p^t <> k mod q do t := t + 1; L := [op(L), t mod q]; end do; return L; end proc

I'm fairly new to coding with Maple / in general, but basically for my course I need to do the following:
For each t=0,1,... I need to first check if kp^t = k mod (p^n-1), and if it isn't, I compute t mod (p^n-1) then add it to my list. The problem I have is I just can't seem to get it to work. I incliuded both the screenshot of the code and typed it out. Thanks in advance

Good day sirs,

I am having trouble identifying the error in the system of first-order ODEs. It gives the error code of

" Error, (in dsolve/numeric/process_input) received more than one indication of the dependent vars [theta[1](t), theta[2](t), theta[3](t), theta[4](t), theta[5](t), theta[6](t), theta[7](t), theta[8](t), theta[9](t)].

The document is attached below.

Thank you
"  Systems_error.mw

The attached worksheet contains expressions that cause a warning message to appear in my worksheet.  In another post it was suggested that the variable i should be explicitly declared local in the definition of the arrow expression. However, as shown in the same worksheet, this gives rise to an error message. Subsequently, I found a statement in help that suggested this approach would not work in 2-d math notation.  Are there any other ways of eliminating these warnings in 2-d math notation?

warningmessage.mw

Dear all

I run my code, I think evrything is well coded, but I get the following error 

invalid left hand side in assignment

Please, I need a help to solve this problem,  I haven't any idea about the origin of this error 

IOMMcode.mw

Thank you 

In a Maple session I have several worksheets open. When I click on the close cross of a worksheet tab the following can happen:

Closing the worksheet next to it works as normal

 

This occurs irregularly. For far I could not make it reproducible to report it to Maplesoft support. Anyone has seen something like this or ideas what the cause could be? 

Is this new in Maple 2022.2 or was it there before? I have no way now to verify. Could someone please check? I am not using assuming anywhere, so this must be internal.
 

interface(version);

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

restart;

ode := diff(f(Z), Z$2) = 3602879701896397*(3860741894751515/1125899906842624 + (5048392920194975*f(Z)^2)/1073741824 - (2484212754397225*f(Z)^4)/1073741824 - (321579057930643*f(Z)^6)/2147483648 - (4936153155163025*f(Z)^8)/2251799813685248)/(4611686018427387904*f(Z)^3*(4178268760908915/1073741824 + 315761000*f(Z)^2));
dsolve([ode,f(0)=1,D(f)(0)=0])

diff(diff(f(Z), Z), Z) = (3602879701896397/4611686018427387904)*(3860741894751515/1125899906842624+(5048392920194975/1073741824)*f(Z)^2-(2484212754397225/1073741824)*f(Z)^4-(321579057930643/2147483648)*f(Z)^6-(4936153155163025/2251799813685248)*f(Z)^8)/(f(Z)^3*(4178268760908915/1073741824+315761000*f(Z)^2))

Error, (in dsolve) when calling 'assume'. Received: 'the assumed property or properties cannot be satisfied'

 


Maple 2022.2 on windows 10

Download dsolve_nov_10_2022.mw

This integral produces very large result and division by zero when simplified. I do not have earlier version of Maple to check if this is a new problem or not

f:=1/(3*u^(2/3)+3*((-4*u^(1/3)+1)*u^(4/3))^(1/2)-12*u);
anti:=int(f,u);
MmaTranslator:-Mma:-LeafCount(anti);
simplify(anti)

For reference, this is Mathematica's results with leaf count only 35 instead of 41,385 and no problem when simplifying.

f=1/(3*u^(2/3)+3*((-4*u^(1/3)+1)*u^(4/3))^(1/2)-12*u)
anti=Integrate[f,u]
LeafCount[anti]
Simplify[anti]

Could someone please check if this fails same way on earlier Maple version?

4 5 6 7 8 9 10 Last Page 6 of 1962