## find solution of kind ODE...

restart;
with(PDEtools);
with(DETools);
ode := (gamma + alpha)*diff(diff(U(xi), xi), xi)*lambda^2 + beta[4]*U(xi)^3 + beta[3]*U(xi)^2 + (-alpha*k^2 - w)*U(xi) = 0;
U := xi -> A[0] + A[1]*Q(xi) + B[1]/Q(xi);

Q := xi -> (p__1*exp(q__1*xi) - p__2*exp(q__2*xi))/(p__3*exp(q__3*xi) + p__4*exp(q__4*xi));
NULL;
NULL;


explaning_of_finding_solution.mw

## set up equations and find parameter ...

restart;
with(PolynomialTools);
with(RootFinding);
with(SolveTools);
with(LinearAlgebra);
NULL;
NULL;
E1 := (-alpha*k^2*A[1] - alpha*k^2*B[1] + 3*A[0]^2*A[1]*beta[4] + 3*A[0]^2*B[1]*beta[4] + A[1]^3*beta[4] + 3*A[1]^2*B[1]*beta[4] + 3*A[1]*B[1]^2*beta[4] + B[1]^3*beta[4] + 2*A[0]*A[1]*beta[3] + 2*A[0]*B[1]*beta[3] - w*A[1] - w*B[1])*cosh(xi)^6 + (-alpha*k^2*A[0] + A[0]^3*beta[4] + 3*A[0]*A[1]^2*beta[4] + 6*A[0]*A[1]*B[1]*beta[4] + 3*A[0]*B[1]^2*beta[4] + A[0]^2*beta[3] + A[1]^2*beta[3] + 2*A[1]*B[1]*beta[3] + B[1]^2*beta[3] - w*A[0])*sinh(xi)*cosh(xi)^5 + (2*alpha*k^2*A[1] + alpha*k^2*B[1] - 2*alpha*lambda^2*A[1] + 2*alpha*lambda^2*B[1] - 2*gamma*lambda^2*A[1] + 2*gamma*lambda^2*B[1] - 6*A[0]^2*A[1]*beta[4] - 3*A[0]^2*B[1]*beta[4] - 3*A[1]^3*beta[4] - 6*A[1]^2*B[1]*beta[4] - 3*A[1]*B[1]^2*beta[4] - 4*A[0]*A[1]*beta[3] - 2*A[0]*B[1]*beta[3] + 2*w*A[1] + w*B[1])*cosh(xi)^4 + (alpha*k^2*A[0] - A[0]^3*beta[4] - 6*A[0]*A[1]^2*beta[4] - 6*A[0]*A[1]*B[1]*beta[4] - A[0]^2*beta[3] - 2*A[1]^2*beta[3] - 2*A[1]*B[1]*beta[3] + w*A[0])*sinh(xi)*cosh(xi)^3 + (-alpha*k^2*A[1] + 4*alpha*lambda^2*A[1] + 4*gamma*lambda^2*A[1] + 3*A[0]^2*A[1]*beta[4] + 3*A[1]^3*beta[4] + 3*A[1]^2*B[1]*beta[4] + 2*A[0]*A[1]*beta[3] - w*A[1])*cosh(xi)^2 + (3*A[0]*A[1]^2*beta[4] + A[1]^2*beta[3])*sinh(xi)*cosh(xi) - 2*alpha*lambda^2*A[1] - 2*gamma*lambda^2*A[1] - A[1]^3*beta[4] = 0;
N := 6;
for i from 0 to N do
equ[1][i] := coeff(E1, {cosh(xi)^i, sinh(xi)^i}, i) = 0;
end do;
//        2               2
equ[1][0] := \\-alpha k  A[1] - alpha k  B[1]

2                      2                    3
+ 3 A[0]  A[1] beta[4] + 3 A[0]  B[1] beta[4] + A[1]  beta[4]

2                           2               3
+ 3 A[1]  B[1] beta[4] + 3 A[1] B[1]  beta[4] + B[1]  beta[4]

\
+ 2 A[0] A[1] beta[3] + 2 A[0] B[1] beta[3] - w A[1] - w B[1]/

6   /        2            3
cosh(xi)  + \-alpha k  A[0] + A[0]  beta[4]

2
+ 3 A[0] A[1]  beta[4] + 6 A[0] A[1] B[1] beta[4]

2               2               2
+ 3 A[0] B[1]  beta[4] + A[0]  beta[3] + A[1]  beta[3]

2                 \
+ 2 A[1] B[1] beta[3] + B[1]  beta[3] - w A[0]/ sinh(xi)

5   /         2               2
cosh(xi)  + \2 alpha k  A[1] + alpha k  B[1]

2                      2
- 2 alpha lambda  A[1] + 2 alpha lambda  B[1]

2                      2
- 2 gamma lambda  A[1] + 2 gamma lambda  B[1]

2                      2
- 6 A[0]  A[1] beta[4] - 3 A[0]  B[1] beta[4]

3                 2
- 3 A[1]  beta[4] - 6 A[1]  B[1] beta[4]

2
- 3 A[1] B[1]  beta[4] - 4 A[0] A[1] beta[3]

\         4   /
- 2 A[0] B[1] beta[3] + 2 w A[1] + w B[1]/ cosh(xi)  + \alpha

2            3                      2
k  A[0] - A[0]  beta[4] - 6 A[0] A[1]  beta[4]

2                 2
- 6 A[0] A[1] B[1] beta[4] - A[0]  beta[3] - 2 A[1]  beta[3]

\                  3   /
- 2 A[1] B[1] beta[3] + w A[0]/ sinh(xi) cosh(xi)  + \
2                      2                      2
-alpha k  A[1] + 4 alpha lambda  A[1] + 4 gamma lambda  A[1]

2                      3
+ 3 A[0]  A[1] beta[4] + 3 A[1]  beta[4]

2                                            \
+ 3 A[1]  B[1] beta[4] + 2 A[0] A[1] beta[3] - w A[1]/

2
cosh(xi)

/           2               2        \
+ \3 A[0] A[1]  beta[4] + A[1]  beta[3]/ sinh(xi) cosh(xi)

2                      2            3
- 2 alpha lambda  A[1] - 2 gamma lambda  A[1] - A[1]  beta[4] =

\
0/ = 0

equ[1][1] := 0 = 0

equ[1][2] := 0 = 0

equ[1][3] := 0 = 0

equ[1][4] := 0 = 0

equ[1][5] := 0 = 0

equ[1][6] := 0 = 0

NULL;
NULL;



## Can expression trees and/or DAG be displayed grapi...

Is the a print or plot function that can generate from an expression an expression tree

and/or the corresponding expression DAG

Taken from ?ProgrammingGuide,Chapter02

## Units in manual calculation of expression vs using...

I was just using Maple to do a simple calculation but the units came out all complicated.

The expression in question is work done by a van der Waals gas. The units should come out to Joules per mol.

When I do the calculation manually (second expression below) I do get that result, albeit in more basic units than Joules.

In the first expression, in which I am using subs to sub in values with units into the expression, the final expression is very complicated. Why?

 (1)

How do we simplify the units above so they become the same as the units in the same (manual) calculation below?

 (2)

## avoid the flickering points of an animation...

restart;
Proc := proc(t) local t4, l3, R, r, eq, sol; _EnvHorizontalName := 'x'; _EnvVerticalName := 'y'; t4 := thickness = 4; l3 := linestyle = dot; R := 9; r := 1/2*R; geometry:-point(OO, 0, 0); geometry:-circle(Cir, [OO, R]); geometry:-point(K, R*cos(t), R*sin(t)); geometry:-point(Omega, r*cos(t), r*sin(t)); geometry:-circle(cir, [Omega, r]); eq := geometry:-Equation(cir); geometry:-line(XXp, y = 0); geometry:-line(YYp, x = 0); geometry:-line(L1, y = x); geometry:-line(L2, y = -x); geometry:-projection(M1, K, XXp); geometry:-coordinates(M1); geometry:-point(K2, geometry:-coordinates(M1)[1] - 2*R, 0); geometry:-coordinates(K2); geometry:-segment(sT, K2, M1); geometry:-point(N1, 0, R*sin(t)); subs(y = x, eq); sol := solve(%, x); geometry:-point(N2, sol[2], sol[2]); subs(y = -x, eq); sol := solve(%, x); geometry:-point(N3, sol[2], -sol[2]); plots:-display(geometry:-draw([Cir(color = blue, t4), cir(color = grey, t4), sT(color = black, t4), XXp(color = black, l3), YYp(color = black, l3), L1(color = black, l3), L2(color = black, l3), N1(color = blue, symbol = solidcircle, symbolsize = 15), N2(color = blue, symbol = solidcircle, symbolsize = 15), N3(color = blue, symbol = solidcircle, symbolsize = 15), M1(color = blue, symbol = solidcircle, symbolsize = 15)]), axes = none, view = [-30 .. 10, -10 .. 10], size = [800, 800]); end proc;
plots:-animate(Proc, [t], t = 0 .. 2*Pi, frames = 200);
NULL;
I am trying to program  this drawing, how to improve this code ? Thank you.

## A simplification / reduction question...

I know this question has been asked time and time again. Starting of with the expr . That is the end goal I want to achieve.  How would I reduce the expansion to get it into 1-f(x,y,z)/g(x,y,z) format?. I have tried all sorts of approaches.

 > restart
 > #
 > expr:=1 - (x__1*x__2 + y__1*y__2 - z__1*z__2)^2/((x__1^2 + y__1^2 - z__1^2)*(x__2^2 + y__2^2 - z__2^2))
 (1)
 > normal( (1) );
 (2)
 > simplify( (2) );
 (3)
 (4)
 > Test:=combine(%)
 (5)
 >
 > n:={op(numer(Test))}
 (6)
 > d:={op(expand(denom(Test)))}
 (7)
 > d subset n
 (8)
 > d intersect n
 (9)
 (10)
 > factor( (10) );
 (11)
 > n minus d
 (12)
 >

## Result to be square root...

Good afternoon, please I have the following question to see if someone can help me.

I am calculating an integral with a root and when Maple gives me the result it does so in power. I want the result to be given in square root, both this integral and others that I am going to solve.

## Maple 2024.1 crashes with "RandomGraph"...

Whenever I call RandomGraph(20,200), Maple crashes both on the laptop and on the PC: any suggestion?

 >
 >
 (1)
 >

## Wrong Latex generated when using _C1 for constant...

This is some serious problem in Latex in Maple 2024.1

I went back to using _C1, _C2 for my own constants of integration.

But I want to get the nice latex for c__1,c__2.

So to do that, my understanding is that I just need to call Maple's dsolve after restart on some random ode in order to set c__1,c__2 for display only and also for latex.

This below seems to confirm this.  But now the latex generated is all wrong and messed up on some places.

My question is: I want to use use _C1,_C2 (i.e. the traditional constants) in my own code I write which generates solution to an ode, but for Latex, I'd like these to come out as c__1,c__2 since they look nicer.

What is the correct way to do this? What Am I doing wrong here? I do not see it.

 > interface(version);

 > #EXAMPLE showing using _C1 for input and latex. All works OK restart;
 > sol:=y(x) = x+_C1/x^2;

 > #correct latex. No problem compiling, but not nice looking _C1 latex(sol)

y \! \left(x \right) = x +\frac{\textit{\_C1}}{x^{2}}

 > #Example showing what happens when making call to dsolve initially restart;
 > dsolve(diff(y(x),x$2)=0); #this call is used to just activate display of nicer constants  > sol:=y(x) = x+_C1/x^2;  > #bad latex, gives error when compiling with texlive latex(sol) y \! \left(x \right) = x +\frac{c}{_} Download latex_problem_maple_2024_july_18_2024.mw And to confirm this is new problem in Maple 2024, I run the same exact worksheet now in Maple 2023.2, and there it works correctly. i.e. Latex generated is correct in both cases. Here is the Maple 2023.2 worksheet, you can see below the difference in Latex.  > interface(version);  > #EXAMPLE showing using _C1 for input and latex. All works OK restart;  > sol:=y(x) = x+_C1/x^2;  > #correct latex. No problem compiling, but not nice looking _C1 latex(sol) y \! \left(x \right) = x +\frac{\textit{\_C1}}{x^{2}}  > #Example showing what happens when making call to dsolve initially restart;  > dsolve(diff(y(x),x$2)=0); #this call is used to just activate display of nicer constants

 > sol:=y(x) = x+_C1/x^2;

 > #good Latex now in Maple 2023.2. latex(sol)

y \! \left(x \right) = x +\frac{c_{1}}{x^{2}}

If it makes any difference to Maple, I am using the typesetting EXTENDED now for everything. But I do not think Latex should care about this, but thought to mention it just in case.

## How to retrieve the coefficients of a transcedenta...

Hello

Consider,  as an example,  the following (simple) transcendental equation.

alpha*((epsilon-1)*x+y-3*x*z-epsilon/3*x^3+b*sin(w)+3)

How to retrieve the coefficients and the terms considering that the unknowns are x,y,z and w?   Something like [x,y,x*z,x^3,sin(w),1] and their coefficients.

many thanks

## dsolve does not return solution unless given impli...

I have thought before that Maple's dsolve will try to return implicit solution automatically if unable to find explicit one or for some  other reasons it prefers implicit.

But In this ode, we see Maple returns no solution at all for this first order quadrature ode, even though it can find solution when given implicit option.

Is this a correct behaviour? Should it not have returned this solution automatically?

 > interface(version);

 > Physics:-Version();

 > restart;
 > ode:=diff(y(x),x)=sin(y(x)); IC:=y(a)=b;

 > maple_sol:=dsolve([ode,IC]);

 > maple_sol:=dsolve([ode,IC],explicit);

 > maple_sol:=dsolve([ode,IC],implicit);

## partial derivative of a piecewise function...

I want to obtain the partial derivative of a piecewise function. How it is possible to calculate  the derivative in (0,0) with diff?

I should get, as answer,  a new piecewise function

with(student);
f := (x, y) -> piecewise((x, y) = (0, 0), 0, (x^3*y - x*y^3)/(y^2 + x^2));
f := proc (x, y) options operator, arrow; piecewise((x, y) =

(0, 0), 0, (x^3*y-x*y^3)/(y^2+x^2)) end proc

fx := (x, y) -> diff(f(x, y), x);
fx := proc (x, y) options operator, arrow; diff(f(x, y), x) end

proc

fx(0, 0);
Error, (in fx) invalid input: diff received 0, which is not valid for its 2nd argument

but i obtain an error

anna rita

## How do I compute a transformation matrix in comput...

Hi

I know that (G, A)=Basis(F,output=extended) computes reduced Groebner basis for polynomial ideal F, while  A is a list of lists.  If A is converted to a matrix, we get G=FA. Is there a command to compute matrix B such that F=GB?

Thank you.

This is a simplified case from a colleague who could not get has to work.

While this

I/sqrt(a);
has(%, sqrt(a));
I
------
(1/2)
a

false



is a technically correct output from Maple, false is mathematically an incorrect statement (IMO).

I think new users cannot find the explanation for that on their own because in other instances the output is true

has(I/(1 - sqrt(a)), sqrt(a))

true



Are there better ways than

I/sqrt(a);
has(%, sqrt(a))or has(%,1/sqrt(a));
I
------
(1/2)
a

true



Its a bit complicated to include allways the inverse of an expression to capture all instances of an expression.

Should has do this an give a warning that also the inverse is present?

## How do I solve the error : "could not store", in a...

Hello,

I'm trying to perform a nonlinear curve-fit on a data(named Data in the code) in Maple, but I get an error :

Error, (in Statistics:-NonlinearFit) could not store .476190476190476164*(4.41000000000000014*(4410./[2.08075582127286]^(2/3)+952.380952380952294*[2.08075582127286]^(1/3)+1000.)/[2.08075582127286]^(5/3)-19448.1000000000022/[2.08075582127286]^(7/3)+[1040.37791063642999]-500.-166.666666666666657*(8.82000000000000028/[2.08075582127286]^(2/3)+1.90476190476190466*[2.08075582127286]^(1/3))/[2.08075582127286]-166.666666666666657*(16.8000000000000007/[2.08075582127286]^(1/3)+.907029478458049820*[2.08075582127286]^(2/3))/[2.08075582127286])*[2.08075582127286]-.500000000000000000 in a floating-point rtable

I suspect there's a problem associated with the variable "r". I am trying to find J by solving the equation p__3 = 0. Then J(stored in "r") is used in P__eng1 to perform the curve-fit operation. I have tried using fsolve, and NLPSolve but they ended up in errors. I read the documents but I was unable to solve the problem.

I'm new to Maple and I'd appreciate any comment that helps me solve p__3=0 and to use the J in P__eng1. I have also attached the code.test.mw

Code and data : mapp.zip

Thanks,

 1 2 3 4 5 6 7 Last Page 1 of 2338
﻿