Maple 2023 Questions and Posts

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

The following program:

with(RealDomain):
sol1 := solve(x-1 > 0, x);
sol2 := solve(1/x^2 > 0, x);
sol3 := solve(1/(x^2-1) > 0, x);
sol4 := solve(x^2+1 > 0, x);
sol5 := solve(x^2+1 < 0, x);

Gives the following output:

sol1 := RealRange(Open(1),infinity)
sol2 := {x <> 0}
sol3 := RealRange(-infinity,Open(-1)), RealRange(Open(1),infinity)
sol4 := x
sol5 := NULL

I would like to force some consistency in the output of solve because I need to feed the output to a third-party program. For example, what's the deal with sol2 and sol3? Why are they formatted differently?

Ideally, I would like the previous output to be:

sol1 := RealRange(Open(1),infinity)
sol2 := RealRange(-infinity,Open(0)), RealRange(Open(0),infinity)
sol3 := RealRange(-infinity,Open(-1)), RealRange(Open(1),infinity)
sol4 := RealRange(-infinity,infinity)
sol5 := NULL

How do I achieve this?

I find that no matter how I modify the style in the Maple command, the LaTeX output seems to be always fixed. This is a bit frustrating. 

G:=Graph(6,{{1,2},{1,4},{4,5},{2,5},{2,3},{3,6},{5,6}});
DrawGraph(G);
vp:=[[0,0],[0.5,0],[1,0],[0,0.5],[0.5,0.5],[1,0.5]]:
SetVertexPositions(G,vp):
DrawGraph(G);

Latex(G, terminal, 100, 100)

\documentclass{amsart}
\begin{document}
\begin{picture}(100,100)
\qbezier(12.40,87.60)(12.40,50.00)(12.40,12.40)
\qbezier(12.40,87.60)(31.20,50.00)(50.00,12.40)
\qbezier(12.40,12.40)(31.20,50.00)(50.00,87.60)
\qbezier(12.40,12.40)(50.00,50.00)(87.60,87.60)
\qbezier(50.00,87.60)(68.80,50.00)(87.60,12.40)
\qbezier(50.00,12.40)(68.80,50.00)(87.60,87.60)
\qbezier(87.60,87.60)(87.60,50.00)(87.60,12.40)
\put(12.400000,87.600000){\circle*{6}}
\put(10.194,96.943){\makebox(0,0){1}}
\put(12.400000,12.400000){\circle*{6}}
\put(8.726,3.531){\makebox(0,0){2}}
\put(50.000000,87.600000){\circle*{6}}
\put(50.000,97.200){\makebox(0,0){3}}
\put(50.000000,12.400000){\circle*{6}}
\put(50.000,2.800){\makebox(0,0){4}}
\put(87.600000,87.600000){\circle*{6}}
\put(91.274,96.469){\makebox(0,0){5}}
\put(87.600000,12.400000){\circle*{6}}
\put(89.806,3.057){\makebox(0,0){6}}
\end{picture}
\end{document}

 

DrawGraph(G,
stylesheet=[vertexborder=false,vertexpadding=20,edgecolor = "Blue",
vertexcolor="Gold",edgethickness=3], font=["Courier",10],size=[180,180])

Even when I change their colors (any other thing), they always go their own way. I don't know if there is a setting that can make the LaTeX output more flexible and in line with our expectations after adjustment.

A Hamiltonian walk on a connected graph is a closed walk of minimal length which visits every vertex of a graph (and may visit vertices and edges multiple times). (See https://mathworld.wolfram.com/HamiltonianWalk.html)

 

Please note that there is a distinction between a Hamiltonian walk and a Hamiltonian cycle. Any graph can have a Hamiltonian walk, but not necessarily a Hamiltonian cycle.  The Hamiltonian number h(n) of a connected G is the length of a Hamiltonian walk. 

For example, let's consider the graph FriendshipGraph(2).

g:=GraphTheory[SpecialGraphs]:-FriendshipGraph(2);
DrawGraph(g)

Then its Hamiltonian number is 6.  A Hamiltonian walk is as shown in the following picture.

 

 

 

PS: After being reminded by others, I learned that a method in the following post seems to work, but I don't understand why it works for now. 

it's possible to formulate this as a Travelling Salesman Problem by augmenting the sparse graph into a complete graph by adding edges. These new edges represent shortest paths between any two vertices in the original graph and have weight equal to the path length.

 

It seems that the correctness of this transformation requires rigorous proof.

 

I would like to collect in derivatives of a function(s) in a worksheet where I have the Physics package loaded but It does not want to do it. When I bring the expression to a blank worksheet it does everything just fine. Am I missing something small? Or is there additional commands/options I need to input? 

Thoughts?

CollectDiff.mw

The highly oscillatory integrand is: 

(sin(x + sqrt(x)) + x*BesselJ(0, x^2))/(1 + x): # int(%, x = 0 .. infinity, numeric); # Note that the upper limit of `x` is NOT finite.

Unfortunately, Maple still cannot return a result in a few minutes. For instance, 

restart;
infolevel[`evalf/int`] := 1:

smartplot((sin(x+sqrt(x))+x*BesselJ(0, x^2))/(1+x))

 

timelimit(0.1e3, evalf(Int((sin(x+sqrt(x))+x*BesselJ(0, x^2))/(1+x), x = 0 .. infinity)))

Control: Entering NAGInt

trying d01amc (nag_1d_quad_inf)
Control: d01amc failed
evalf/int/control: NAG failed result = result
evalf/int/improper: integrating on interval 0 .. infinity
evalf/int/improper: applying transformation x = 1/x
evalf/int/improper: interval is 0 .. 1 for the integrand:

                        /     (1/2)\            /    2\
                     sin\x + x     / + x BesselJ\0, x /
                     ----------------------------------
                                   1 + x               

and interval is 0 .. 1 for the integrand:

                                                /   1 \
                                         BesselJ|0, --|
                        /       (1/2)\          |    2|
                        |1   /1\     |          \   x /
                     sin|- + |-|     | + --------------
                        \x   \x/     /         x       
                     ----------------------------------
                                 /    1\  2            
                                 |1 + -| x             
                                 \    x/               

Control: Entering NAGInt
Control: trying d01ajc (nag_1d_quad_gen)
Control: d01ajc failed
evalf/int/control: NAG failed result = result

evalf/int/control: singularity at left end-point
evalf/int/transform: series contains {x^(1/2), x^(3/2), x^(5/2), x^(7/2), x^(9/2), x^(11/2), x^(13/2), x^(15/2), x^(17/2), x^(19/2), x^(21/2), x^(23/2), x^(25/2)}

evalf/int/singleft: applying transformation x = x^2
evalf/int/singleft: interval is 0 .. 1. for the integrand:

                  /   / 2            \    2        /    4\\  
                2 \sin\x  + csgn(x) x/ + x  BesselJ\0, x // x
                ---------------------------------------------
                                        2                    
                                   1 + x                     

evalf/int/control: Applying simplify/ln, integrand is 2*(sin(x^2+x)+x^2*BesselJ(0,x^4))/(1+x^2)*x
evalf/int/CreateProc: Trying easyproc
evalf/int/CreateProc: Trying makeproc
evalf/int/ccquad: n = 2 integral estimate = .7758263476953
                    n = 6 integral estimate = .8097413335347
evalf/int/ccquad: n = 18 integral estimate = .8097470386638
                                  error = .8097470386638e-11
From ccquad, result = .8097470386638 integrand evals = 19 error = .8097470386638e-11
Control: Entering NAGInt
Control: trying d01ajc (nag_1d_quad_gen)
Control: d01ajc failed
evalf/int/control: NAG failed result = result

evalf/int/control: singularity at left end-point

evalf/int/transform: series contains {1/x^(3/2), x^(1/2), cos(1/x^2+1/4*Pi), sin((x+x^(1/2))/x^(3/2)), sin(1/4*(4+Pi*x^2)/x^2)}
evalf/int/singleft: applying transformation x = x^2
evalf/int/singleft: interval is 0 .. 1. for the integrand:

                   /   /        /1\  \                    \
                   |   |1 + csgn|-| x|                    |
                   |   |        \x/  |  2          /   1 \|
                 2 |sin|-------------| x  + BesselJ|0, --||
                   |   |      2      |             |    4||
                   \   \     x       /             \   x //
                 ------------------------------------------
                                 3 /     2\                
                                x  \1 + x /                

evalf/int/control: Applying simplify/ln, integrand is 2*(sin((1+x)/x^2)*x^2+BesselJ(0,1/x^4))/x^3/(1+x^2)
evalf/int/control: Applying simplify/trig, integrand is (2*sin((1+x)/x^2)*x^2+2*BesselJ(0,1/x^4))/(x^3+x^5)
evalf/int/control: singularity at left end-point

evalf/int/transform: series contains {cos(1/x^4+1/4*Pi), sin((1+x)/x^2), sin(1/4*(4+Pi*x^4)/x^4)}
evalf/int/transform: no transform found
evalf/int/series: integrating on 0 .. .2493468135214 the series:

       2 (%2)     2 (%2) x   /2 (%2)      \  3   /  2 (%2)      \  5   
      --------- - -------- + |------- - %3| x  + |- ------- + %3| x    
        (1/2)       (1/2)    |  (1/2)     |      |    (1/2)     |      
      Pi      x   Pi         \Pi          /      \  Pi          /      
                                                                       
           /       2 (%2)      \  7   /     2 (%2)      \  9           
         + |- %3 + ------- - %4| x  + |%3 - ------- + %4| x            
           |         (1/2)     |      |       (1/2)     |              
           \       Pi          /      \     Pi          /              
                                                                       
                                                                       
           /2 (%2)           \  11   /          2 (%2) \  13           
         + |------- - %4 - %5| x   + |%4 + %5 - -------| x             
           |  (1/2)          |       |            (1/2)|               
           \Pi               /       \          Pi     /               
                                                                       
           /       2 (%2)      \  15   /     2 (%2)      \  17    / 19\
         + |- %5 + ------- + %6| x   + |%5 - ------- - %6| x   + O\x  /
           |         (1/2)     |       |       (1/2)     |             
           \       Pi          /       \     Pi          /             
                                                                       
                                                                       
                      /        4\                                      
             (1/2)    |4 + Pi x |                                      
      %1 := 2      sin|---------|