Maple 2023 Questions and Posts

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

See attached worksheet in Maple 2023.

This example is taken from the Maple help page. I want to 'zoom in' on a plot3d object. The only way I have found was from responses [1] on the maple primes forum. It uses InlinePlot and the scale option to perform the 'zoom in'. Since InlinePlot generates the plot in terms of XML there is no graphic out, only a text based output. In order to reconstitute the InlinePlot as a plot object I can view visually I need to use some additional commands from the DocumentTool package. This is all great but the output, which in our case is P3, is not a plot object and therefore cannot be exported as a png. Is there a way to convert the InlinePlot with the scaling applied back to a typical plot object so I can export it as a .png, using Export("output_plot.png",P3,base=worksheetdir)?

can_I_convert_InlinePlot(P3)_back_to_a_regular_plot_object_so_I_can_export_it_as_a_png.mw

Can I export a Table as an image like .png, where Table is defined (with DocumentTools)? See Maple worksheet for example.

Why would anyone want to do this? It all started because I wanted to include a color bar(with a specific color range) in my 3dplot. There is no native way to do this with plot3d so I searched Maple Primes for alternative strategies. One strategy is to generate the 3d plot and the color bar(with plot3d) seperately, then combine the plots in a table so they sit side by side, using with(DocumentTools). I have been almost successful with this strategy. There remain two outstanding problems. 1. I can't re-size the table cells since there are no such options with(DocumentTools). The color bar should have a smaller cell because the figure itself is tall and thin. 2. I need to export this combined object as an image(.png) but its a table with plot objects inside, and not itself a plot object and therefore one can't simply export it as a .png like one would a typical plot object. Is there a way to export this table as a png? I am beginning to think that my idea of combining  plots with document tools and attempting the export the resulting table is not feasible. How does a normal person add a custom-color-range color bar to their plot? I'm not trying to move the earth here but it certainly feels like it.

with_document_tools_how_to_i_resize_the_cells_and_export_the_table_as_png.mw

Hello Maple community

I am trying to solve a system of equations, which is a little complicated.

eq1 := w = sqrt(a^2 - (a - y)^2);
eq2 := v + cot(t + arcsin(w/a)) = 0;
eq3 := u = (sqrt(c^2 - (c - z)^2) - v*x - w)/x^2;
eq4 := x = y + z + e;
eq5 := v + cot(T + arcsin((u*x^2 + v*x + w)/c)) + 2*u*x = 0;
eq6 := f = Pi/30*(6*u^2*x^5 + 15*u*v*x^4 + (20*u*w + 10*v^2)*x^3 + 30*v*w*x^2 + 30*x*w^2) - Pi/3*(-z^3 + 3*z^2*c - y^3 + 3*y^2*a);
sols := solve({eq1, eq2, eq3, eq4, eq5, eq6}, {u, v, w, x, y, z});

I tried solving it, but it is running for more than two hours now. I know that the system is very complicated, and Maple will take long to solve this. But my question is

1. Is it reasonable to take this long for this system of equations?

2. Can I speed it up in any way by using additional cores of my system or something? Can someone please tell me how I can achieve this?

Looking forward to any inputs the Community may have.

How do I programmatically control the zoom of a 3d plot ?
SEE THE ATTACHED MAPLESHEET. In the attached code, the 'zoom out' on the blue cylinder is not conserved when I saved the maplesheet but it doesn't change the essential question which is how does one control the zoom programmatically. If you yourself adjust the zoom of the blue cylinder and the run tabulate(), you will see how it resets the plots settings to some default set of values.
How_do_I_programmatically_control_the_zoom_in_a_3d_plot.mw

restart

with(plots)

with(plottools)

with(DocumentTools)

``

Plot two cylinders with plottools and plot3d. Zoom out on the blue cylinder a little.

c1 := display(cylinder([1, 1, 1], 1, 3), orientation = [45, 70], scaling = constrained, color = red, size = [300, 300])

 

c2 := display(cylinder([1, 1, 1], 1, 3), orientation = [45, 70], scaling = constrained, color = blue, size = [300, 300])

 

Use tablate to embed the 3d plots in a visual array, for reasons not discussed here.

NULL

DocumentTools:-Tabulate([c1, c2], exterior = none, interior = none)

"Tabulate4"

(1)

Notice how the use of tabulate( ), changes the zoom of the individual plots to some default. There are two questions: 1. How do I programmatically control the zoom of a 3d plot with display( )? I don't want to have to click buttons with the mouse to arrive at my ideal zoom level. 2. How do I programmatically control the zoom of a 3d plot when using Tabulate( ) which envokes the default plot settings?  

Below is a screenshot of the zoom buttons I want to control programmatically.
NULL

NULL


Download How_do_I_programmatically_control_the_zoom_in_a_3d_plot.mw
1. Plot two cylinders with plottools and plot3d. Zoom out on the blue cylinder a little.
2. Use tablate to embed the 3d plots in a visual array, for reasons not discussed here.

3. Notice how the use of tabulate( ), changes the zoom of the individual plots to some default. There are two questions: 1. How do I programmatically control the zoom of a 3d plot with display( )? I don't want to have to click buttons with the mouse to arrive at my ideal zoom level. 2. How do I programmatically control the zoom of a 3d plot when using Tabulate( ) which envokes the default plot settings

Below is a screenshot of the zoom buttons I want to control programmatically.

Using with(plots) and with(plottools), how do you change the color of the line enclosing a disk? I can change the line style of the line, but I can't figure out how to change the color of the line. I didn't find anything in plot options that would fit my purpose.

how_do_i_change_the_color_of_the_line_around_a_disk_while_using_plottools.mw

I am running Maple 2023 - yes I should update - and I found a weird "bug" if you could call it that. For different versions of the Physics package I am getting different answers on the same problem. 
 

This is what I was getting when I run Version 1410:

restart;

with(Physics):

 

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1744. The version installed in this computer is 1410 created 2023, March 11, 12:59 hours Pacific Time, found in the directory /Users/b2hull/maple/toolbox/2023/Physics Updates/lib/`

(1)

Setup(mathematicalnotation=true):

g_[arbitrary]:

_______________________________________________________

 

`Systems of spacetime coordinates are:`*{X = (x1, x2, x3, x4)}

 

`Default differentiation variables for d_, D_ and dAlembertian are:`*{X = (x1, x2, x3, x4)}

 

`Setting `*lowercaselatin_is*` letters to represent `*space*` indices`

 

`The arbitrary metric in coordinates `*[x1, x2, x3, x4]

 

`Signature: `(`- - - +`)

 

_______________________________________________________

(2)

LG :=(g_[~mu,~nu]*Ricci[mu,nu])*sqrt(-%g_[determinant]);

Physics:-g_[`~mu`, `~nu`]*Physics:-Ricci[mu, nu]*(-%g_[determinant])^(1/2)

(3)

SG:=Intc(LG,X)

Int(Int(Int(Int(Physics:-g_[`~mu`, `~nu`]*Physics:-Ricci[mu, nu]*(-%g_[determinant])^(1/2), x1 = -infinity .. infinity), x2 = -infinity .. infinity), x3 = -infinity .. infinity), x4 = -infinity .. infinity)

(4)

EQ:=Fundiff(SG,%g_[~delta,~gamma])/sqrt(-%g_[determinant])

((1/2)*%g_[`~mu`, `~nu`]*Physics:-Ricci[mu, nu]*%g_[delta, gamma]*%g_[determinant]/(-%g_[determinant])^(1/2)+Physics:-Ricci[mu, nu]*(-%g_[determinant])^(1/2)*%g_[delta, `~mu`]*%g_[gamma, `~nu`])/(-%g_[determinant])^(1/2)

(5)

Simplify(subs(%g_=g_,EQ))

-(1/2)*Physics:-g_[delta, gamma]*Physics:-Ricci[nu, `~nu`]+Physics:-Ricci[delta, gamma]

(6)

 

 

 

And this is what I get if I used the latet update for 2023, Version 1683:

restart;

with(Physics):

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1744. The version installed in this computer is 1683 created 2024, March 6, 17:43 hours Pacific Time, found in the directory /Users/b2hull/maple/toolbox/2023/Physics Updates/lib/`

(1)

Setup(mathematicalnotation=true):

g_[arbitrary]:

_______________________________________________________

 

`Systems of spacetime coordinates are:`*{X = (x1, x2, x3, x4)}

 

`Default differentiation variables for d_, D_ and dAlembertian are:`*{X = (x1, x2, x3, x4)}

 

`Setting `*lowercaselatin_is*` letters to represent `*space*` indices`

 

`The arbitrary metric in coordinates `*[x1, x2, x3, x4]

 

`Signature: `(`- - - +`)

 

_______________________________________________________

(2)

LG :=(g_[~mu,~nu]*Ricci[mu,nu])*sqrt(-%g_[determinant]);

Physics:-g_[`~mu`, `~nu`]*Physics:-Ricci[mu, nu]*(-%g_[determinant])^(1/2)

(3)

SG:=Intc(LG,X)

Int(Int(Int(Int(Physics:-g_[`~mu`, `~nu`]*Physics:-Ricci[mu, nu]*(-%g_[determinant])^(1/2), x1 = -infinity .. infinity), x2 = -infinity .. infinity), x3 = -infinity .. infinity), x4 = -infinity .. infinity)

(4)

EQ:=Fundiff(SG,%g_[~delta,~gamma])/sqrt(-%g_[determinant])

-(1/2)*%g_[delta, gamma]*Physics:-g_[`~mu`, `~nu`]*Physics:-Ricci[mu, nu]

(5)

Simplify(subs(%g_=g_,EQ))

-(1/2)*Physics:-g_[delta, gamma]*Physics:-Ricci[nu, `~nu`]

(6)

 

 

Strange right? I bring this up because it makes me wonder about potential errors in other computations...

The answer - equation 6 - in 1410 is the correct answer. This is simply a derivation of the Einstein Tensor. 

Hey there guys, was wondering if I could get some help with this - I'm pretty new to maple. 

I'm trying to take a collection of coupled ODEs I have and get maple put them in state-space form for me. I've tried a few different approaches and messed around with a few different commands but havent managed to quite make it work. At the moment I'm trying to make a DiffEquation object and then use StateSpace to get the state space representation, but I keep getting this "diff-eq is not a polynomial" line as a warning when I run the DiffEquation command and as an error when I try to conver to state space.

Could anyone tell me why I'm getting this and what the best/correct way to go about this is?

Cheers

Triple Cart derivation

with(DynamicSystems)

 

cart1eom := `m__1 `*(diff(v__1(t), t, t))+c__1*(diff(v__1(t), t))+k*(v__1(t)-v__2(t)) = F

`m__1 `*(diff(diff(v__1(t), t), t))+c__1*(diff(v__1(t), t))+k*(v__1(t)-v__2(t)) = F

(1)

cart2eom := m__2*(diff(v__2(t), t, t))+c__2*(diff(v__2(t), t))+k(v__2(t)-v__3(t)) = k*(v__1-v__2(t))

m__2*(diff(diff(v__2(t), t), t))+c__2*(diff(v__2(t), t))+k(v__2(t)-v__3(t)) = k*(v__1-v__2(t))

(2)

cart3eom := m__3*(diff(v__3(t), t, t))+c__3*(diff(v__3(t), t)) = k*(v__2-v__3(t))

m__3*(diff(diff(v__3(t), t), t))+c__3*(diff(v__3(t), t)) = k*(v__2-v__3(t))

(3)

F := alpha*k__m*k__g*V(t)/(R*r)-k__m^2*k__g^2*(diff(v__1(t), t))/(R*r^2)``

expand(cart1eom)

`m__1 `*(diff(diff(v__1(t), t), t))+c__1*(diff(v__1(t), t))+k*v__1(t)-k*v__2(t) = alpha*k__m*k__g*V(t)/(R*r)-k__m^2*k__g^2*(diff(v__1(t), t))/(R*r^2)

(4)

"(->)"

`m__1 `*(diff(diff(v__1(t), t), t))+c__1*(diff(v__1(t), t))+k*v__1(t)-k*v__2(t)-alpha*k__m*k__g*V(t)/(R*r)+k__m^2*k__g^2*(diff(v__1(t), t))/(R*r^2) = 0

(5)

collect(`m__1 `*(diff(diff(v__1(t), t), t))+c__1*(diff(v__1(t), t))+k*v__1(t)-k*v__2(t)-alpha*k__m*k__g*V(t)/(R*r)+k__m^2*k__g^2*(diff(v__1(t), t))/(R*r^2) = 0, [v__1(t), v__2, diff(v__1(t), t, t), diff(v__1(t), t)])

k*v__1(t)-k*v__2(t)+`m__1 `*(diff(diff(v__1(t), t), t))+(c__1+k__m^2*k__g^2/(R*r^2))*(diff(v__1(t), t))-alpha*k__m*k__g*V(t)/(R*r) = 0

(6)

"(->)"

cart1eom``

(7)

eoms := [cart1eom, cart2eom, cart3eom]

[`m__1 `*(diff(diff(v__1(t), t), t))+c__1*(diff(v__1(t), t))+k*(v__1(t)-v__2(t)) = alpha*k__m*k__g*V(t)/(R*r)-k__m^2*k__g^2*(diff(v__1(t), t))/(R*r^2), m__2*(diff(diff(v__2(t), t), t))+c__2*(diff(v__2(t), t))+k(v__2(t)-v__3(t)) = k*(v__1-v__2(t)), m__3*(diff(diff(v__3(t), t), t))+c__3*(diff(v__3(t), t)) = k*(v__2-v__3(t))]

(8)

NULL

sys_1 := DiffEquation(eoms, [V], [v__3], statevariable = [v__1, v__2, v__3])

_m2358947700544

(9)

StateSpace(sys_1)

_m2358947252000

(10)

NULL

Download 403TripleCart.mw

I`m trying execute the example of Deeplearnig:

with(DeepLearning);
v1 := Vector(8, i -> i, datatype = float[8]);
v2 := Vector(8, [-1.0, 1.0, 5.0, 11.0, 19.0, 29.0, 41.0, 55.0], datatype = float[8]);
model := Sequential([DenseLayer(1, inputshape = [1])]);
model := Vector(2, {(1) = Typesetting:-mi("`DeepLearning 

   Model`"), (2) = Typesetting:-mi("`<keras.engine.sequential.Se\

  quential object at 0x000001C5B6520700>`")})


model:-Compile(optimizer = "sgd", loss = "mean_squared_error");
model:-Fit(v1, v2, epochs = 500);
"<Python object: <keras.callbacks.History object at 0x000001C5CC\

  EE9DE0>>"


convert("<Python object: <keras.callbacks.History object at 0x000001C5CCEE9DE0>>", 'symbol');
<Python object: <keras.callbacks.History object at 0x000001C5CCE\

  E9DE0>>


model:-Predict([10]);

 

But, finally, there is this error:

Error, (in Predict) AttributeError: 'CatchOutErr' object has no attribute 'flush'

['Traceback (most recent call last):\n', '  File "C:\\Program Files\\Maple 2023\\Python.X86_64_WINDOWS\\lib\\site-packages\\keras\\utils\\traceback_utils.py", line 70, in error_handler\n    raise e.with_traceback(filtered_tb) from None\n', '  File "C:\\Program Files\\Maple 2023\\Python.X86_64_WINDOWS\\lib\\site-packages\\keras\\utils\\io_utils.py", line 80, in print_msg\n    sys.stdout.flush()\n', "AttributeError: 'CatchOutErr' object has no attribute 'flush'\n"]

What`s is happening?

Thanks!

Hi,

I want to analyze a quartic equation: rho-analysis.mw. I am interested in positive roots, which I need expressed in explicit/closed form.

I include four questions in the script.

Thanks!

EDIT (since my question was originally tagged as incomplete and even duplicate):
Above all I am trying to understand:

  1. Why implicitplot3d returns a unique strictly positive root for all rho and Gamma but plot() of the quartic evaluated for a specific pair of value returns three positive roots?
  2. rho is a correlation coefficient, thus bounded in (-1,+1): how to adjust the precision of the slider in Explore() so that I can play around with multiple rho values within said range?

I have a double for loop which has a numeric integration located inside of the innermost loop. When I try to run my worksheet I recieve an error in which the numeric integration is not computed for a certain set of values in my loops. If I take these two values and input them into my function and then integrate outside of the loop it appears to work just fine. Not sure what to make of this. Any thoughts would be appreciated. 

Secondly, to avoid any confusion about what I am trying to do and if someone has general comments on my worksheet I added some text in the worksheet to describe what I am interested in doing, even though I am sure most people here would be able to figure that out from the commands alone. 

Thanks. 

LoopError.mw

I have a table indexed as A[i][j,k],  Each entry is an expression involving diff which I want to convert to but convert(A,D) doesn't work. Any suggestions on how to do that?

restart;

for i from 1 to 2 do
  for j from 1 to 2 do
    for k from 1 to 2 do
      A[i][j,k] := diff(u[i](x[1],x[2]), x[j], x[k]);
    end do
  end do;
end do;

A[1][1,1];

diff(diff(u[1](x[1], x[2]), x[1]), x[1])

print(A);

A

 
 

Download convert-table.mw

 

Hello,

I'm encountering an issue with the "roots of complex number" message while running my Maple code. Maple seems unable to solve this problem for me.

I would greatly appreciate any ideas or suggestions that could help me resolve this error.

Vib-code.mw

I'm trying derive the equation for a matching resistor pad.  In order for me to get a solution (eg for R2), I had to "manually" solve the one equation and then substitute the resulting value in the other.  Why doesn't solve do the same thing?  

restart

NULLeq1 := (R2+Rhi)*R1/(R1+R2+Rhi) = Rlo

(R2+Rhi)*R1/(R1+R2+Rhi) = Rlo

(1)

NULL

eq2 := R1*Rlo/(R1+Rlo)+R2 = Rhi

R1*Rlo/(R1+Rlo)+R2 = Rhi

(2)

``

R1sol := solve(eq2, R1)

-Rlo*(R2-Rhi)/(R2-Rhi+Rlo)

(3)

R2sol := solve(subs(R1 = R1sol, eq1), R2)

(Rhi^2-Rhi*Rlo)^(1/2), -(Rhi^2-Rhi*Rlo)^(1/2)

(4)

restart

NULLeq1 := (R2+Rhi)*R1/(R1+R2+Rhi) = RloNULL

(R2+Rhi)*R1/(R1+R2+Rhi) = Rlo

(5)

 

NULLeq2 := R1*Rlo/(R1+Rlo)+R2 = RhiNULL

R1*Rlo/(R1+Rlo)+R2 = Rhi

(6)

s := `assuming`([solve({eq1, eq2}, {R1, R2})], [`and`(Rhi > 0, Rlo > 0)])

{R1 = RootOf((Rhi-Rlo)*_Z^2-Rhi)*Rlo, R2 = -(RootOf((Rhi-Rlo)*_Z^2-Rhi)*Rhi-RootOf((Rhi-Rlo)*_Z^2-Rhi)*Rlo-Rhi)/(RootOf((Rhi-Rlo)*_Z^2-Rhi)-1)}

(7)
 

``

Download for_help.mw

I can't figure out what Maple is complaining about with this error.  In fact, this is an exact copy/paste from another section in my document that runs fine.  This section, however, generates the error, "Error, missing operator `;`.

I appreciate any help!

for_mapleprimes_help.mw

I am facing a kind of strange problem.  y'=y/x-5^y/x ,   y(0)=5 Cauche equation  it gives empty round brackets () . If I restart Maple engine and perform the same. Kindly help, what is this? 


restart;
with(DEtools);

de1 := diff(y(x), x) = y(x)/x - 5^(-y(x)/x)

de1 := diff(y(x), x) = y(x)/x - 5^(-y(x)/x)

an := dsolve({de1, y(0) = 5}, y(x))

an := ()

1 2 3 4 5 6 7 Last Page 1 of 28