Maple 2022 Questions and Posts

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

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

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"

 

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

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

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

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?

Here is a worksheet with a system of differential equations

Maple_DE_Example.mw

The system is

y'(x)=z(x)*g(x)

z'(x)=y(x)*g(x)

where g(x) is a random number generator seeded by x. That is, for the same x, g gives the same result. 

Using the classical method as an option to dsolve, a solution is plotted. Using rkf45, however, there is pretty much always an error that says

Warning, cannot evaluate the solution further right of ...

Why does it work with classical but not rkf45?

I have to take my equations for velocity, acceleration, and height and evaluate them in 4 second intervals and combine them into one table or columns.

The procedures "getCP" which uses "cpsub" (not exported) acts differently inside the package as opposed to them outside it.
In the package it returns a column matrix which is incorrect. Should return a 2 row matrix. They dismantle a polynomial into it's powers and coefficients. I know one cant run the package here. Included are the two procedures and the text of the notepad file to make the package.

restart

NULL

with(AlgCalc)

[`&oplus;`, FundThrm, SignedArea, diag, diftab, faulD, faulS, getCP]

f := sort(2+x^7+5*x^2-7*x^a+k*x^2, [x], ascending)

2-7*x^a+5*x^2+k*x^2+x^7

getCP(f, x)

Matrix(%id = 36893490212391698668)

NULL

g := sort(5*x^8+k*x^2-7*x^3+x+2, [x], ascending)

2+x+k*x^2-7*x^3+5*x^8

CP := getCP(g, x)

Matrix(%id = 36893490212391688180)

NULL

restart

with(AlgCalc)

[`&oplus;`, FundThrm, SignedArea, diag, diftab, faulD, faulS, getCP]

NULL

f := sort(2+x^7+5*x^2-7*x^a+k*x^2, [x], ascending)

2-7*x^a+5*x^2+k*x^2+x^7

getCP(f, x)

Matrix(%id = 36893490212390043884)

g := sort(5*x^8+k*x^2-7*x^3+x+2, [x], ascending)

2+x+k*x^2-7*x^3+5*x^8

getCP(g, x)

Matrix(%id = 36893490212390032796)

 

restart

 

Dismantlimg a polynomial  uses the following 2 procedures

" cpsub:= proc(t, var:=alpha)  description "used by getCP";       local i,cf,varpwr;                   if   not has(t, var)                  then return < 0,t>:               elif whattype(t)=`^` then return <op(t)[2],1>;                  else varpwr,cf:= selectremove(has,[op(t)],var);                       if op(varpwr)=var then                        return <1, `*`(op(cf))> ;                   end if;                     for i from 1 to nops(varpwr) do                    if numer(varpwr[i])=1  then if op((1)/(varpwr[i]))=alpha then varpwr[i]:=-1 else  varpwr[i] :=-op((1)/(varpwr[i]))[2] end if else  varpwr[i]:=op(varpwr[i])[2]end if                        end do;                   return <`+`(op(varpwr)),`*`(op(cf))>;                   #print(op(t));                                   end if ;            end proc:"

NULL

``

getCP := proc (f, var := alpha) local t; description "Dissmantles a polynomial into powers and coefficients"; if not has(f, var) then return `<,>`(0, f) elif whattype(f) = `^` then return `<,>`(op(f)[2], 1) elif whattype(f) = `*` then return `<|>`(`~`[cpsub]([f], var)[]) else `<|>`(`~`[cpsub]([op(f)], var)[]) end if end proc

NULL

f := sort(2+x^7+5*x^2-7*x^a+k*x^2, [x], ascending)

2-7*x^a+5*x^2+k*x^2+x^7

cp := getCP(f, x)

Matrix(%id = 36893490212391322676)

whattype(cp)

Matrix

NULL

Notepad file to Create AlgCalc.

 

AlgCalc := module ()
export SignedArea,
           `&oplus;`,

             getCP,

             diag,
             diftab,
             faulD,
             faulS,
             FundThrm;
        

 option package;

$include "SignedArea.mm"
$include "`&oplus;`.mm"
$include "cpsub.mm"
$include "getCP.mm"
$include "diag.mm"
$include "diftab.mm"
$include "faulD.mm"
$include "faulS.mm"
$include "FundThrm.mm"

end module;

Download 6-11-22_Procedures_acting_differently_in_Package.mw

in the context of solving an ode, sometimes the constant of integration that will satisfy an initial condition is +infinity or -infinity.

But Maple's solve does not find such solutions to the constant of integration. It only can solve for finite value if it can.

When this happens, I manually try taking the limit as the constant of integration goes to +- infinity, until I get an equation where both sides are the same or fail, and then give up.

I was wondering if there is a way or different command/package which will find solution such as infinity (which is valid solution to constant of integration).

Here are two examples

ode:=diff(y(x),x)=1/(LambertW(-exp(-1+_C1+x))+1);
ic:=[diff(y(x),x)=1,x=0];
eq2:=eval(ode,ic);
solution_for_constant := solve(eq2,_C1,'allsolutions'=true,'tryhard'=true);

Maple can not solve for _C1. It gives

But when trying manually few values, I find that _C1=-infinity satisfies the equation

limit(rhs(eq2),_C1=0);
limit(rhs(eq2),_C1=1);
limit(rhs(eq2),_C1=-1);
limit(rhs(eq2),_C1=infinity);
limit(rhs(eq2),_C1=-infinity);

The above shows that _C1 = -infinity is the constant of integration. Another simpler example

eq:=exp(-1 + _C1) = 0;
solution_for_constant:=solve(eq,_C1) assuming real;
limit(lhs(eq),_C1=-infinity)

The above shows that _C1=-infinity is solution for exp(-1+C_1)=0.  which one can see by just looking at it as exp(-infinity)=0.  Adding assumptions did not help.I also tried symbolic option.

I am not familar with SolveTools package, may there is something there.

So for now, my code just try the limit until it finds solution or gives up.

Any suggestions if Maple itself can find such solutions?

Maple 2022.2

Hello,

I'm attempting to scale the vertical axis of a histogram plot such that each bin reflects the percentage of the total bins (all bins sum to 1). Matlab has an option ('probability') for their histogram command which does this. I've attempted to solve this myself in the attached worksheet but I'm not satisfied with the results (just a hack to replace axis labels). Specifically, I would like for the underlying data in the plot to match the axis scaling. An example can be seen in the image below.

Thank you for your consideration,

Ron

Histogram_percentage.mw

 

 

 

I have few questions on this subject.

1) One can view internal maple procs using the command showstats. For example showstat(`dsolve`) prints the dsolve proc. And showstat(`dsolve/SERIES`)  prints the proc called  dsolve/SERIES(). And this i s what I do not understand. What is the signifcance of in the above?    Since dsolve itself is a proc, what does mean? does this means SERIES is an internal proc inside dsolve proc? That is not likely. I see things like convert/tan/simpler again, what does the mean here? it can't be that simpler is an inner proc inside tan proc which is inside convert proc? I never used /  myself in mycode in a proc name.

How are these procs organized physically? I mean inside Maplesoft computers. Is each proc in separate .mpl file? How does the /  comes into play?  I tried to make a proc myself with forward / but got syntax error. So this / must mean some other logical relation, but I do not know to emulate it myself.

 

2) Why one must add ` ` around the names when using showstats for system procs, but not for my own module? For example, I did the following

A:=module()
  export foo:=proc()
      NULL;
  end proc;
end module;
                    
showstat(A:-foo)

And that worked. But if I type showstat(`A:-foo`)  maple gives error Error, (in showstat) procedure name expected

but with system proc, must have the `` there. If I type showstat(convert/tan/simpler) it is an error.

 

3) Why showstat(`DEtools/odeadvisor`)  gives Error, (in showstat) procedure name expected? But help says odeadvisor is in DEtools module.

 

4) Why can't one display the source of the module itself, and it has to be a proc? For example showstat(`DEtools`) gives error, because `DEtools` is not a proc, but a whole module.

Are these things described more somewhere? I only know about with(LibraryTools); 
Browse(); 

I am using GraphTheory:-AutomorphismGroup() command in order to obtain all the automorphisms of a graph. However, the command appears to return a set of generators. How can I get all the automorphisms listed?

Here is an example of my work.

with(GraphTheory)

AutomorphismGroup(CycleGraph(4))

_m4568996768

(1)

NULL

Download auto.mw

First 28 29 30 31 32 33 34 Last Page 30 of 43