Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Greetings,

I am trying to display an array of plots. I did a search and found this: "https://www.maplesoft.com/support/help/view.aspx?path=plot%2Farrayplot".

However, when I try it, I get an error message: "Error, (in plots:-display) element 1 of the rtable is not a valid plot structure".

Here's the code identical to the sample page. If I display(A__1) or display(A__2) individually, it works.

with(plots);
A := Array(1 .. 2);
A__1 := plot(sin(x), x = -Pi .. Pi, axes = framed, labels = [x, sin(x)]);
A__2 := plot(cos(x), x = -Pi .. Pi, axes = boxed, style = point);
display(A);
 

Running Maple 2023 on MacBook Pro Monterey V12.6.5 (latest as far as I know).

Thanks for any assistance.

Hello 

How to remove this error 

3d_plots.mw

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.

Hello, 

Ive followed the examples, and yet not the result the book gave. The question before this one, same type, and i did get the right answer there. 

Would you have a clue why it is not going as planned? 

Translation: "Through a resistancewire with the measured resistance R= (1.5+-0.5)Ohm goes an electric current with the measured strength I= (2.5+-0.05)A, During a timespan of t=(10+-0.5)s develops an amount of heat Q=RI^2*t. Give the estimate of the maximum relative deviation in Q."

Here i got the right answer of .42, and yet when doing the exact same thing in assignment 4, i got the wrong answers. 

Translation: "Two bodies with mass M and m have a massmidpointdistance r. For the gravitational force between these bodies counts: F=y*M*m/r^2, at which y is the gravitational constant. Give an estimation of the maximum realative deviation in F on ground of the following measurementdata: M=(7.0+-0.05)kg, m=(2.0+-0.02)kg and r=(5.0)+-0.05)m."

I had the answer -0.0029. The books says its wrong, but i cant see what i did wrong. 

Translation of the example: "According to the law of Ohm the currentstrength in the stream(/current)circle(circuit) with tension(voltage) U and resistance R is equal to I=U/R. For a given currentcircle((part of a)circuit) is given: U=(30.0+-0.05)Volt and R=(2.5+-0.03)Ohm. Determine the maximum absolute and relative deviation in I. 

Solution

The maximum absolute deviation in I is

This gives the currentstrength:

The maximum realtive deviation in I is: .... or about 1.4%"

Could somebody tell me what i am doing wrong?

Thank you!

Greetings,

The Function

#opdracht 3

R := 1.5; A := 2.5; t := 10; Q := R*A^2*t

1.5

 

2.5

 

10

 

93.750

(1)

NULL

restart

Q := R*A^2*t

R*A^2*t

(2)

diff(R*A^2*t, R)

A^2*t

(3)

diff(R*A^2*t, A)

2*R*A*t

(4)

diff(R*A^2*t, t)

R*A^2

(5)

NULL

R := 1.5; A := 2.5; t := 10

1.5

 

2.5

 

10

(6)

.5*A^2*t+2*R*A*t*0.5e-1+.5*R*A^2

39.6875

(7)

Q := R*A^2*t

93.750

(8)

39.6875/(93.750)

.4233333333

(9)

#Opdracht 4

restart

M := 7; m := 2; r := 5; F := y*M*m/r^2

7

 

2

 

5

 

(14/25)*y

(10)

restart

diff(y*M*m/r^2, M)

y*m/r^2

(11)

diff(y*M*m/r^2, m)

y*M/r^2

(12)

diff(y*M*m/r^2, r)

-2*y*M*m/r^3

(13)

M := 7; m := 2; r := 5; y := 9.81

7

 

2

 

5

 

9.81

(14)

0.5e-1*y*m/r^2+0.2e-1*y*M/r^2+(-2*y*M*m/r^3)*0.5e-1

-0.1569600000e-1

(15)

F := y*M*m/r^2

5.493600000

(16)

-0.1569600000e-1/(5.493600000)

-0.2857142857e-2

(17)

NULL

Download Mapleprimes_Question_Book_2_Paragraph_5.13_Question_4.mw

Why does this not return a quick solution?

sol := solve(.2894606222 = .4090662520/((1+0.1481289280e-2*x)^5.034901366*(1/(1+0.1481289280e-2*x)^5.034901366)^.1986136226), x)

mw.mw

120523_problem_parallel.mw

Last execution block is not producing any output. Why?

The 3x3 nonlinear system I am trying to solve is already a stylized version of my problem, as I already:

  1. Calibrated my equations before attempting to solve for them (search for "Calib_1" in my script)
  2. Split the original 6x6 system into two 3x3 sub-systems (since 3 out of 6 variables only appear in 3 out of 6 equations) and solved for one sub-system

What else can you think of? Should I instead use the parallel solver on the whole 6x6 system rather than just the unsolved 3x3 sub-system?

How to find, if exist, singular solutions? That is, some valuation of some parameters that will yield a solution that cannot be obtained by applying the same valuation to a general solution. Carl Love (who I cannot tag) once mentioned: "The parameter valuations that lead to singular solutions can often be guessed by using valuations that would produce zeros in denominators in the general solution. A singular solution can't be expressed as any instantiation of a generic symbolic solution. By instantiation I mean an assigment of numeric values to some parameters. Here's an example:"

#2x2 matrix and 2x1 vector. 5 parameters (a, b, d, x, y). The 2 decision variables are
#unseen and unnamed in this pure matrix-vector form. Their values are the two entries 
#in the solution vectors S0 and S1.

A:= <a, b; 0, d>;  B:= <x, y>;

#Get a generic solution:
S0:= LinearAlgebra:-LinearSolve(A, B);

#Instantiate 3 parameters (a, d, y) to 0 and solve again:
S1:= LinearAlgebra:-LinearSolve(eval([A, B], [a, d, y]=~ 0)[]);

#Note that no possible instantiation of S0 can produce S1.

Thank you!

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.

 

Hello Everyone;

Hope you are fine. I I have make a code but there is error and dsolve comand is working. I also need to plot. Kindly help me. I am waiting kind response. Code is attached.

restart; Cm := 1.0; ENa := 50.0; EK := -77.0; ELeak := -54.387; gNa := 120.0; gK := 36.0; gLeak := .3; II := piecewise(`and`(t >= 10, t <= 40), 10.0, 0.); alpha_m := proc (V) .1*(V+40.0)/(1.0-exp((-1)*(V+40.0)/10.0)) end proc; beta_m := proc (V) 4.0*exp((-1)*(V+65.0)/18.0) end proc; alpha_h := proc (V) 0.7e-1*exp((-1)*(V+65.0)/20.0) end proc; beta_h := proc (V) 1.0/(1.0+exp((-1)*(V+35.0)/10.0)) end proc; alpha_n := proc (V) 0.1e-1*(V+55.0)/(1.0-exp((-1)*(V+55.0)/10.0)) end proc; beta_n := proc (V) .125*exp((-1)*(V+65.0)/80.0) end proc; eq1 := diff(V(t), t) = (II-gNa*m(t)^3*h(t)*(V(t)-ENa)-gK*n(t)^4*(V(t)-EK)-gLeak*(V(t)-ELeak))/Cm; eq2 := diff(m(t), t) = alpha_m(V(t))*(1-m(t))-beta_m(V(t))*m(t); eq3 := diff(h(t), t) = alpha_h(V(t))*(1-h(t))-beta_h(V(t))*h(t); eq4 := diff(n(t), t) = alpha_n(V(t))*(1-n(t))-beta_n(V(t))*n(t); ics := {V(0) = -65, h(0) = .6, m(0) = 0.5e-1, n(0) = .32}

1.0

 

50.0

 

-77.0

 

-54.387

 

120.0

 

36.0

 

.3

 

20

 

proc (V) .1*(V+40.0)/(1.0-exp((-1)*(V+40.0)/10.0)) end proc

 

proc (V) 4.0*exp((-1)*(V+65.0)/18.0) end proc

 

proc (V) 0.7e-1*exp((-1)*(V+65.0)/20.0) end proc

 

proc (V) 1.0/(1.0+exp((-1)*(V+35.0)/10.0)) end proc

 

proc (V) 0.1e-1*(V+55.0)/(1.0-exp((-1)*(V+55.0)/10.0)) end proc

 

proc (V) .125*exp((-1)*(V+65.0)/80.0) end proc

 

diff(V(t), t) = 3.683900000-120.0000000*m(t)^3*h(t)*(V(t)-50.0)-36.00000000*n(t)^4*(V(t)+77.0)-.3000000000*V(t)

 

diff(m(t), t) = .1*(V(t)+40.0)*(1-m(t))/(1.0-exp(-.1000000000*V(t)-4.000000000))-4.0*exp(-0.5555555556e-1*V(t)-3.611111111)*m(t)

 

diff(h(t), t) = 0.7e-1*exp(-0.5000000000e-1*V(t)-3.250000000)*(1-h(t))-1.0*h(t)/(1.0+exp(-.1000000000*V(t)-3.500000000))

 

diff(n(t), t) = 0.1e-1*(V(t)+55.0)*(1-n(t))/(1.0-exp(-.1000000000*V(t)-5.500000000))-.125*exp(-0.1250000000e-1*V(t)-.8125000000)*n(t)

 

{V(0) = -65, h(0) = .6, m(0) = 0.5e-1, n(0) = .32}

(1)

sol := dsolve({eq1, eq2, eq3, eq4, ics})

Error, (in dsolve) invalid input: solve expects its 1st argument, eqs, to be of type {`and`, `not`, `or`, algebraic, relation(algebraic), ({list, set})({`and`, `not`, `or`, algebraic, relation(algebraic)})}, but received {{V(0) = -65, h(0) = 3/5, m(0) = 1/20, n(0) = 8/25}}

 

NULL

Download Question1.mw

Thanks

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|---------|                                      
                      |     4   |                                      
                      \  4 x    /                                      
                    /1 + x\   (1/2)                                    
      %2 := %1 + sin|-----| Pi                                         
                    |  2  |                                            
                    \ x   /                                            
             (1/2)    /1    1   \                                      
            2      cos|-- + - Pi|                                      
                      | 4   4   |                                      
                      \x        /                                      
      %3 := ---------------------                                      
                      (1/2)                                            
                  4 Pi                                                 
                        /        4\                                    
               (1/2)    |4 + Pi x |                                    
            9 2      sin|---------|                                    
                        |     4   |                                    
                        \  4 x    /                                    
      %4 := -----------------------                                    
                       (1/2)                                           
                  64 Pi                                                
                (1/2)    /1    1   \                                   
            53 2      cos|-- + - Pi|                                   
                         | 4   4   |                                   
                         \x        /                                   
      %5 := ------------------------                                   
                        (1/2)                                          
                  512 Pi                                               
                           /        4\                                 
                  (1/2)    |4 + Pi x |                                 
            1371 2      sin|---------|                                 
                           |     4   |                                 
                           \  4 x    /                                 
      %6 := --------------------------                                 
                          (1/2)                                        
                  16384 Pi                                             

evalf/int/CreateProc: Trying easyproc
evalf/int/CreateProc: Trying makeproc

evalf/int/CreateProc: Trying procmake
evalf/int/control: applying double-exponential method
evalhf mode unsuccessful -- retry in software floats
evalf/int/quadexp: applying double-exponential method

Error, (in tools/sign) time expired

 

time() =

3999.500

(1)

 =

%?

Download oscillatoryInt.mws

I tried to specify another method (as described in evalf/int), but it seems that this doesn't work. Any ideas?

For example, if I want to replace all "x" in t:={x1,x2,x3...x100} to get t:={y1,y2,y3...y100}, how can maple do this, please? Thanks a lot! 

The answers from the book dont make any sense after using their solution. Its not producing the expected results. 

This is the translation by the way: "A battery that has a voltage U, is in series with a resistor R, and a condenser with capacity C. The current strength on a given time "t" in this circuit is given by i=i(t)=U/R*e^-(t/R*C). Determine R and C based on the data given in table 5.6, the current is U=100V."

Greetings,

The Function


 

restart

U := 100

100

(1)

R := 4900

4900

(2)

C := 20*(1/1000)

1/50

(3)

"v(t):=U/(R)*(e)^(-(t/(R*C)))"

proc (t) options operator, arrow, function_assign; U*exp(-t/(R*C))/R end proc

(4)

v(.1)

0.2038734923e-1

(5)

NULL

data := LinearAlgebra:-Transpose(`<,>`(`<|>`(.1, .2, .3, .4, .5), `<|>`(7.36, 2.7, .99, .37, .13)))

Matrix(%id = 18446746712187741238)

(6)

plot(data, style = point)

 

X := data[() .. (), 1]; Y := data[() .. (), 2]

Vector(5, {(1) = .1, (2) = .2, (3) = .3, (4) = .4, (5) = .5})

 

Vector[column](%id = 18446746712187761598)

(7)

sumX := add(X); sumY := add(Y); sumX2 := add(x^2, `in`(x, X)); sumXY := X.Y

1.5

 

11.55

 

.55

 

1.78600000000000003

(8)

eq1 := numelems(X)*a+b*sumX = sumY; eq2 := a*sumX+b*sumX2 = sumXY

5*a+1.5*b = 11.55

 

1.5*a+.55*b = 1.78600000000000003

(9)

solve({eq1, eq2}, {a, b})

{a = 7.347000000, b = -16.79000000}

(10)

``

Download Mapleprimes_Question_Book_2_Paragraph_5.12_Question_5.mw

First 200 201 202 203 204 205 206 Last Page 202 of 2218