MaplePrimes Questions

Ive been wondering what i can use this for and where maybe it has been overlooked ,if any one has any ideas im really interested, that pi^ cubed

360°/rad/pi^2

 

I

What is the correct syntax in Maple to do integration of variables on 

So that the new integration variable is using the mapping    u=y*x^(1/3) so that the result is 

The problems seems is that there is no option to tell Maple what the new integration variable is. So it does not know it should be y or x?

I looked at help and all my tries failed. Below is worksheet and also examples from another software as reference. The other software has argument to tell change of variable what is the new integration variable should be. But in Maple, there is no such option.,  Does this mean in Maple change of integration variables only works when the right hand side of the transformation has only one symbol and not two or more? i.e. this works   u=y, but not u=y*x

restart;

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

T:=Student:-MultivariateCalculus;
e:=Int(1/(3*u^4 + u + 3),u);
T:-ChangeOfVariables(e,[u=y*x^(1/3)]);
T:-ChangeOfVariables(e,[y=u*x^(-1/3)]);

Student:-MultivariateCalculus

Int(1/(3*u^4+u+3), u)

Error, (in Student:-MultivariateCalculus:-ChangeOfVariables) unable to complete the change-of-variables operation

Error, (in Student:-MultivariateCalculus:-ChangeOfVariables) unable to complete the change-of-variables operation

Student[Calculus1][IntTutor](); #did not help either

 

 

Download change_of_variables_integration_august_31_2024.mw

I searched help and see nothing specific to change of variable for integration, so I assumed the above is the command to use. Am I using the wrong command for integration change of variables in Maple?

For reference, I need to duplicate this in Maple:

Dear All,
My group recently published a DAEsolver in Maple, https://mapletransactions.org/index.php/maple/article/view/16701
This solver is very competive compared to existing large scale DAE solvers (even in other languages) by performing symbolic calculation for analytical Jacobian (including sparsity pattern), and by using parallel sparse direct solver (PARDISO).

The code and paper use ListTools. If the attached procedure can be made threadsafe and parallelized, then the resulting DAEsolver is publishable and will be better than most solvers (from any language) today. We welcome collaborations and suggestions. The code works for N = 40, but kernel connection is lost for higher values of N and it is not stable.

thanks

Dr. Venkat Subramanian
PS, for the specific problem, it is trivial to write the Jacobian and residue in a for loop that can be run in parallel (and it helps us to solve > 1 Million or more DAEs), but the attached code (makeproc) helps in solving DAEs resulting from sophisticated discretization approaches for PDEs without user input.

 

NULL

restart:

Digits:=15;

15

makeproc:=proc(n0,nf,Nt,Eqode::Array,Vars::list,Vars1::list,Equation::Array,j11::Matrix(storage=sparse))
local i,j,LL,LL2,L,i1,varsdir,varsdir1,node,eqs;

for i from n0 to nf do
eqs:=rhs(Eqode[i]):
L:=indets(eqs)minus{t};#print(L);
if nops(L)>0 then
LL := [seq(ListTools:-Search(L[j], Vars),
             j = 1 .. nops(L))];
 LL2 := ListTools:-MakeUnique(LL);
if LL2[nops(LL2)] = 0 then
             LL := [seq(LL2[i1], i1 = 1 .. nops(LL2) - 1)];
         end if;
         if LL2[1]= 0 then LL:=[seq(LL2[i1],i1=2..nops(LL2))]: end:#print(1,LL);
varsdir:=[seq(Vars[LL[i1]]=0.5*uu[LL[i1]]+uu_old[LL[i1]],i1=1..nops(LL))];
else varsdir:=[1=1]:end:

Equation[i]:=uu[i]-deltA*subs(varsdir,t=tnew,eqs):#print(i,Equation[i]);
        L := indets(Equation[i]);
        LL := [seq(ListTools:-Search(L[j], Vars1),j = 1 .. nops(L))];
        LL2 := ListTools:-MakeUnique(LL);
        if LL2[nops(LL2)] = 0 then
            LL := [seq(LL2[i1], i1 = 1 .. nops(LL2) - 1)];
        end if;
        if LL2[1]= 0 then LL:=[seq(LL2[i1],i1=2..nops(LL2))]: end:
        
        for j to nops(LL) do
            j11[i, LL[j]] := diff(Equation[i], uu[LL[j]]);
        end do;
 
od:
end proc:

CodeTools[ThreadSafetyCheck](makeproc);

0, 1

#infolevel[all]:=10;

 

N:=40;h:=1.0/N:

40

with(Threads[Task]):

Eqs:=Array(1..N,1..N):

for i from 1 to N do for j from 1 to N do
if i = 1 then left:=0: else left:=(c[i,j](t)-c[i-1,j](t))/h:end:
if i = N then right:=-0.1: else right:=(c[i+1,j](t)-c[i,j](t))/h:end:
if j = 1 then bot:=0: else bot:=(c[i,j](t)-c[i,j-1](t))/h:end:
if j = N then top:=-0.1: else top:=(c[i,j+1](t)-c[i,j](t))/h:end:
Eqs[i,j]:=diff(c[i,j](t),t)=(right-left)/h+(top-bot)/h-c[i,j](t)^2:
od:od:

 

eqs1:=Array([seq(seq(Eqs[i,j],i=1..N),j=1..N)]):

ics:=[seq(seq(c[i,j](t)=1.0,i=1..N),j=1..N)]:

Vars:=[seq(seq(c[i,j](t),i=1..N),j=1..N)]:

Vars1:=[seq(uu[i],i=1..N^2)]:

Equation:=Array(1..N^2):j11:=Matrix(1..N^2,1..N^2,storage=sparse):eqs:=copy(Equation):

CodeTools:-Usage(makeproc(1,N^2,N^2,eqs1,Vars,Vars1,Equation,j11));

memory used=21.47MiB, alloc change=24.99MiB, cpu time=235.00ms, real time=231.00ms, gc time=62.50ms

1-deltA*(-1600.00000000000-.50*uu[1600]-1.0*uu_old[1600])

j11[5,5];

1-deltA*(-2400.00000000000-.50*uu[5]-1.0*uu_old[5])

#Equation[1];

makeprocDistribute := proc(i_low, i_high,Nt,Eqode::Array,Vars::list,Vars1::list,Equation::Array,j11::Matrix(storage=sparse))
local i_mid;
if 200 < i_high - i_low then
#if i_low > 250 then
#i_mid := floor(1/2*i_high - 1/2*i_low) + i_low;
i_mid:=iquo(i_low+i_high,2):
Continue(null,
Task = [makeprocDistribute, i_low, i_mid,Nt,Eqode,Vars,Vars1,Equation,j11],
Task = [makeprocDistribute,i_mid + 1, i_high,Nt,Eqode,Vars,Vars1,Equation,j11]);
else
makeproc(i_low, i_high,Nt,Eqode,Vars,Vars1,Equation,j11); end if;
end proc:

j11[5,5];

1-deltA*(-2400.00000000000-.50*uu[5]-1.0*uu_old[5])

N^2;

1600

NN:=N^2;

1600

Equation:=Array(1..N^2):j11:=Matrix(1..N^2,1..N^2,storage=sparse):

CodeTools:-Usage(Start(makeprocDistribute,1,NN,NN,eqs1,Vars,Vars1,Equation,j11)):

memory used=22.01MiB, alloc change=239.31MiB, cpu time=985.00ms, real time=241.00ms, gc time=1.61s

j11[5,5];

1-deltA*(-2400.00000000000-.50*uu[5]-1.0*uu_old[5])

 

NULL


 

Download makeproctest.mw
 

NULL

 

I analyzed the kinetic equation of the system and got this formula. I want to realize the sweep frequency analysis of the kinetic function by changing the size of omega2, but I don't know how to write a program. Want to ask for help

solve831.mw

In the attached file I would like to use the functions "Gradient" and "Hessian". Hessian should also calculate the determinant and check positive definiteness. I was unable to do that. Other questions for me as a beginner are:
How are the long brackets and the > sign on the left edge created? What does a semicolon at the end of the command mean? How is a 3D plot created? What does "restart" mean?

Regards, Alfred_FAF_20240831.mwAF_20240831.mw

 In the calculation process, I selected (num=5). How can I detect the maximum value of num to ensure the series solution would be converged?

seried.mw

If there any way to make text  parallel to a line in textplot3d.

display(line([1,2,3],[4,5,-2],linestyle=longdash),
        point([2.5,3.5,0.5]),
        textplot3d([2.5,3.5,0.5,"not aligned"]))

I know to ways:

- calling the returned procedure with a value for the independend variable

- printing the procedure with interface(verboseproc=2)

The first requires a procedure and a values that work, the second is quite some typing.

Any other ways?

Is one not supposed to make _Z local variable?  If not, then how to insure the global _Z do not have some value assigned to it?

In this example below, I build some integral. I used local _Z for upport limit. But now Maple generate internal error.

If I do not declare _Z as local, and leave it global, then no error is generated.

But if I also declare _Z inside the proc as global _Z, then the error also goes away.

So is one always supposed to use _Z as global? 

The strange thing _Z is protected, so I cant assign to it value from global space. Message says Try declaring `local _Z`; see ?protect for details. but when I do that, I still get an error. 

So is the bottom line here is that one should not declare _Z local to a proc, and just assume it is always global symbol that has no assigned value to it, and that will always be safe to do?  I do not assign value to _Z inside my proc. Just wanted to use it for upper limit, as symbol.

restart;

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

foo:=proc()
 local _Z;
 local F,G,H,n;
 F:=x;G:=x;G:=x;n:=4;
 -RootOf(Intat(F^(-n-1)*H^(-2*n+1)*(-G*F*n*H)^n*n^(-n)/(-
         tau*F^(-n-1)*H^(-2*n+1)*(-G*F*n*H)^n*n^(-n)+F^(-n-1)*H^(-2*n+1)*(-G*F
         *n*H)^n*n^(-n)+tau^n),tau = _Z)-Int(-G,x)+C1)/G*H;
end proc:

foo()

Error, (in RootOf) expression independent of, _Z

boo:=proc()
 local F,G,H,n;
 F:=x;G:=x;G:=x;n:=4;
 -RootOf(Intat(F^(-n-1)*H^(-2*n+1)*(-G*F*n*H)^n*n^(-n)/(-
         tau*F^(-n-1)*H^(-2*n+1)*(-G*F*n*H)^n*n^(-n)+F^(-n-1)*H^(-2*n+1)*(-G*F
         *n*H)^n*n^(-n)+tau^n),tau = _Z)-Int(-G,x)+C1)/G*H;
end proc:

boo();

-RootOf(Intat(x^3/(H^3*tau^4-tau*x^3+x^3), tau = _Z)-(Int(-x, x))+C1)*H/x

boo2:=proc()
 global _Z;
 local F,G,H,n;
 F:=x;G:=x;G:=x;n:=4;
 -RootOf(Intat(F^(-n-1)*H^(-2*n+1)*(-G*F*n*H)^n*n^(-n)/(-
         tau*F^(-n-1)*H^(-2*n+1)*(-G*F*n*H)^n*n^(-n)+F^(-n-1)*H^(-2*n+1)*(-G*F
         *n*H)^n*n^(-n)+tau^n),tau = _Z)-Int(-G,x)+C1)/G*H;
end proc:

boo2()

-RootOf(Intat(x^3/(H^3*tau^4-tau*x^3+x^3), tau = _Z)-(Int(-x, x))+C1)*H/x

_Z:=5;

Error, attempting to assign to `_Z` which is protected.  Try declaring `local _Z`; see ?protect for details.

local _Z;
foo();

Warning, A new binding for the name `_Z` has been created. The global instance of this name is still accessible using the :- prefix, :-`_Z`.  See ?protect for details.

_Z

Error, (in RootOf) expression independent of, _Z

 

 

Download using_Z_inside_proc_august_28_2024.mw

For me this result is suspicious. What do you think? 

This ode diff(y(x),x) = f*y(x)^4+g*y(x)+h; is clearly quadrature, since I did not tell Maple that f,g,h depend on x. So this can be solved by just integration. But when asking odeadvisor if it is Chini, it says yes. When asking it what type it is, now it says it is quadrature.

Am I missing something here? I was expecting [NONE] when asking it if it is Chini.

Yes, the ode has the form of Chini, which is   y'=f(x)*y^n + g(x)*y + h(x), where n=4 here. But if f,g,h do not depend on x, then this is now just quadrature. Right? Calling it Chini is little misleading I think.

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1796 and is the same as the version installed in this computer, created 2024, August 29, 14:22 hours Pacific Time.`

libname;

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

restart;

ode:=diff(y(x),x) = f*y(x)^4+g*y(x)+h;
DEtools:-odeadvisor(ode,y(x),[Chini]);

diff(y(x), x) = f*y(x)^4+g*y(x)+h

[_Chini]

DEtools:-odeadvisor(ode,y(x))

[_quadrature]

dsolve(ode,y(x),[quadrature]);

x-Intat(1/(_a^4*f+_a*g+h), _a = y(x))-c__1 = 0

dsolve(ode,y(x),[Chini]);

y(x) = -RootOf(Intat(g^4/(_a^4*f*h^3-_a*g^4+g^4), _a = _Z)+g*x+c__1)*h/g

 

 

Download question_on_advisor_august_28_2024.mw

Notice another problem in this solutions. If g=0, then the Chini solution gives divison by zero now, while the quadrature solution still works.

Dear All,

I am facing some problems. I want to draw some plots: I have considered the 4th order momentum equation and the 2nd order energy equation; it requires 6 boundary conditions, which I have provided, but till asking for errors (in dsolve/numeric/bvp/convertsys) too few boundary conditions: expected 7, got 6.

eqn1 := {((kappa[1].phi[1]+kappa[2].phi[2]+kappa[3].phi[3])/(phi[1]+phi[2]+phi[3])+(p-1).kappa[f]+(p-1).(kappa[1].phi[1]+kappa[2].phi[2]+kappa[3].phi[3])-(p-1).(phi[1]+phi[2]+phi[3]).kappa[f])/((kappa[1].phi[1]+kappa[2].phi[2]+kappa[3].phi[3])/(phi[1]+phi[2]+phi[3])+(p-1).kappa[f]-(p-1).(kappa[1].phi[1]+kappa[2].phi[2]+kappa[3].phi[3])+(phi[1]+phi[2]+phi[3]).kappa[f]).(diff(theta(eta), eta, eta)+4/3.N.(diff((1+(K-1).theta(eta))^3.(diff(theta(eta), eta)), eta)))+Pr.(((1-phi[3]).((1-phi[2])*(1-phi[1]+phi[1].(`&rho;c__s1`/`&rho;c__f`))+phi[2].(`&rho;c__s2`/`&rho;c__f`))+phi[3].(`&rho;c__s3`/`&rho;c__f`)).(R.f(eta)+alpha.eta).(diff(theta(eta), eta))+Q.theta(eta)+R.Ec.((diff(f(eta), eta, eta))^2)) = 0, diff(f(eta), eta, eta, eta, eta)-(1-phi[1])^2.5.((1-phi[2])^2.5).((1-phi[3])^2.5).((1-phi[3]).((1-phi[2]).(1-phi[1]+phi[1].(`&rho;__s1`/`&rho;__f`))+phi[2].(`&rho;__s2`/`&rho;__f`))+phi[3].(`&rho;__s3`/`&rho;__f`)).(alpha.(eta.(diff(f(eta), eta, eta, eta))+3.*(diff(f(eta), eta, eta)))+(diff(f(eta), eta, eta, eta)).f(eta)-(diff(f(eta), eta)).(diff(f(eta), eta, eta))).R-(1-phi[1])^2.5.((1-phi[2])^2.5).((1-phi[3])^2.5).A.B.e^(-B.eta) = 0, f(-1) = S, f(1) = 1, theta(-1) = 1, theta(1) = 0, (D(f))(-1) = 0, (D(f))(1) = 0}

sys1 := eval(eqn1, {A = 1, B = .5, Ec = .1, K = 1.5, N = .5, Pr = 2, Q = .4, R = 1, S = -.1, p = 3, alpha = .2, `&rho;__f` = 997.1, `&rho;__s1` = 0, `&rho;__s2` = 0, `&rho;__s3` = 5180, `&rho;c__f` = 997.1.4179, `&rho;c__s1` = 0, `&rho;c__s2` = 0, `&rho;c__s3` = 5180.670, phi[1] = 0., phi[2] = 0., phi[3] = 0.3e-1, kappa[1] = 0, kappa[2] = 0, kappa[3] = 9.7, kappa[f] = .613})

sol1 := dsolve(sys1, numeric);
Error, (in dsolve/numeric/bvp/convertsys) too few boundary conditions: expected 7, got 6
with(plots);
t1 := odeplot(sol1, [eta, diff(f(eta), eta)], eta = -1 .. 1, numpoints = 65, thickness = 0, color = green, linestyle = solid);
plots[plots:-display]({t1})

Download A1.mw

Dear all,

is there a versioning concept similiar to Eclipse ?

I did expect the following two plot statements (MaplePrimes is only rendering one statement) to produce the same plot. What did I do wrong when using mod in plot?

kernelopts(version)

`Maple 2024.1, X86 64 WINDOWS, Jun 25 2024, Build ID 1835466`

(1)

plot([seq([t, `mod`(t, 10)], t = 1 .. 100)])

 

plot(`mod`(t, 10), t = 0 .. 100)

 

NULL

Download mod_in_plot.mw

In my Maple 2020, I noticed my program got stuck (overnight so let's say for at least 8 hours) on factorization of relatively small integer, so I tried the command standalone:

ifactor(630743190664091077)

and it just froze. For comparsion I tried other SW and programming libraries and basically all of them had the answer instantly. Also looking at the Maple's methods, if I force pollard or lenstra, it also gets the answer instantly. If my understanding is correct, it gets stuck on the method 'morrbril' which is part of the default mix (I tried also mpqs and it gave FAIL, but at least instantly). 

Is that something that still happens by default in newer versions? Seems to me if it gets stuck on 18 decimal digit integer, maybe it's not the best default method...

First 12 13 14 15 16 17 18 Last Page 14 of 2363