## How does isolve work, what is the mathematical bac...

what is the mathematics behind isolve? How can one selct special solutions?

## How do I modify the following maple code in a simp...

Dear Colleague.

I am trying to improve the results of abs(res[i] - exy) in the following codes.

```restart;
Digits := 30:

# Define the function
f := proc(n)
-0.5*y[n] + 0.5*sin(x[n] - Pi)
end proc:

# Define equations
e1 := y[n+2] = 2*h*delta[n] + y[n] - h^2*(-2*sin(u)*f(n)*u^2 - 2*sin(u)*f(n+2)*u^2 + 2*sin(2*u)*f(n+1)*u^2 + 2*cos(u)*f(n)*u - 2*cos(u)*f(n+2)*u + 2*cos(2*u)*f(n+1)*u - 2*cos(2*u)*f(n)*u - 2*sin(u)*f(n) + 2*sin(u)*f(n+2) + sin(2*u)*f(n) - sin(2*u)*f(n+2) - 2*f(n+1)*u + 2*f(n+2)*u)/((2*sin(u) - sin(2*u))*u^2):
e2 := y[n+1] = h*delta[n] + y[n] - (1/2)*h^2*(-sin(u)*f(n)*u^2 - sin(u)*f(n+2)*u^2 + sin(2*u)*f(n+1)*u^2 + 2*cos(u)*f(n)*u - 2*cos(u)*f(n+2)*u + 2*cos(2*u)*f(n+1)*u - 2*cos(2*u)*f(n)*u + 4*sin(u)*f(n+1) - 4*sin(u)*f(n) - 2*sin(2*u)*f(n+1) + 2*sin(2*u)*f(n) - 2*f(n+1)*u + 2*f(n+2)*u)/((2*sin(u) - sin(2*u))*u^2):
e3 := h*delta[n+2] = h*delta[n] + h^2*(2*sin(u)*f(n)*u + 2*sin(u)*f(n+2)*u - 2*sin(2*u)*f(n+1)*u - 2*cos(2*u)*f(n+1) + cos(2*u)*f(n) + cos(2*u)*f(n+2) + 2*f(n+1) - f(n) - f(n+2))/(u*(2*sin(u) - sin(2*u))):

with(LinearAlgebra):
epsilon := 10^(-10):
inx := 0:
ind := 1:
iny := 0:
h := 0.01:
n := 0:
omega := 1:
u := omega * h:
tol := 1e-4:
N := solve(h * p = 8 * Pi, p):

err := Vector(round(N)):
exy_lst := Vector(round(N)):

c := 1:
for j from 0 to 2 do
t[j] := inx + j * h:
end do:

vars := y[n+1], y[n+2], delta[n+2]:

step := [seq(eval(x, x = c * h), c = 1 .. N)]:
printf("%6s%15s%15s%16s%15s%15s%15s\n", "h", "Num.y", "Num.z", "Ex.y", "Ex.z", "Error y", "Error z");

st := time():
for k from 1 to N / 2 do
par1 := x[0] = t[0], x[1] = t[1], x[2] = t[2]:
par2 := y[n] = iny, delta[n] = ind:

res := eval(<vars>, fsolve(eval({e1, e2, e3}, [par1, par2]), {vars}));

for i from 1 to 2 do
exy := eval(sin(c * h)):
exz := eval(cos(c * h)):
printf("%6.5f%17.9f%15.9f%15.9f%15.9f%13.5g%15.5g\n", h * c, res[i], res[i+1], exy, exz, abs(res[i] - exy), abs(res[i+1] - exz));

err[c] := abs(evalf(res[i] - exy));
if Norm(err) <= tol then
h := 0.1 * h * (c + 1) * (tol/Norm(err))^(0.2);
else
break
end if;
exy_lst[c] := exy;
numerical_y1[c] := res[i];
c := c + 1;
end do;
iny := res[2];
ind := res[3];
inx := t[2];
for j from 0 to 2 do
t[j] := inx + j * h;
end do;
end do:
v := time() - st;
v / 4;
printf("Maximum error is %.13g\n", max(err));
NFE = evalf((N / 4 * 3) + 1);

# Get array of numerical and exact solutions for y1
numerical_array_y1 := [seq(numerical_y1[i], i = 1 .. N)]:
exact_array_y1 := [seq(exy_lst[i], i = 1 .. N)]:

# Get array of time steps
time_t := [seq(step[i], i = 1 .. N)]:

# Display graphs for y1
with(plots):
numerical_plot_y1 := plot(time_t, numerical_array_y1, style = point, symbol = asterisk, color = blue, symbolsize = 20, legend = ["TFIBF"]);
exact_plot_y1 := plot(time_t, exact_array_y1, style = point, symbol = box, color = red, symbolsize = 20, legend = ["EXACT"]);

display({numerical_plot_y1, exact_plot_y1});
Error_plot_y1 := plot(time_t, err, style = line, symbol = box, tickmarks = [piticks, decimalticks], color = navy, labels = [`h=Pi/8`, typeset(`Absolute Errors`)]);
```

I am suspecting that I didnt update the new h properly (I may be wrong, though). Please kindly help modify the code to allow the values of abs(res[i] - exy) to about 10^(-11). Thank you and best regards.

## Can I convert InlinePlot(P3) back to a regular plo...

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 re-size and export a Table as an image like ...

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

## How to speed up Maple...

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...

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

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

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

 (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.

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 ...

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

## Is this a bug or does Maple hate me? ...

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()
 (1)
 > Setup(mathematicalnotation=true):
 > g_[arbitrary]:
 (2)
 > LG :=(g_[~mu,~nu]*Ricci[mu,nu])*sqrt(-%g_[determinant]);
 (3)
 > SG:=Intc(LG,X)
 (4)
 > EQ:=Fundiff(SG,%g_[~delta,~gamma])/sqrt(-%g_[determinant])
 (5)
 > Simplify(subs(%g_=g_,EQ))
 (6)
 >
 >

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

 > restart;
 > with(Physics):
 > Physics:-Version();
 (1)
 > Setup(mathematicalnotation=true):
 > g_[arbitrary]:
 (2)
 > LG :=(g_[~mu,~nu]*Ricci[mu,nu])*sqrt(-%g_[determinant]);
 (3)
 > SG:=Intc(LG,X)
 (4)
 > EQ:=Fundiff(SG,%g_[~delta,~gamma])/sqrt(-%g_[determinant])
 (5)
 > Simplify(subs(%g_=g_,EQ))
 (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.

## Dynamic Systems/System of ODEs error...

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

 (1)

 (2)

 (3)

 (4)

 (5)

 (6)

 (7)

 (8)

 (9)

 (10)

## why do i have a problem?...

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!

## Robustness of plot(eval(something,[])) vs implicit...

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?

## Any ideas about why this numeric integration will ...

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

## How to convert a table of diffs to D...

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];

 > print(A);

 >

## Avoiding the "roots of complex number"...

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

## how to solve system of equation to get answer with...

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?

 >
 >
 (1)

 >
 (2)
 >
 >
 (3)
 >
 (4)
 >
 >
 (5)

 >
 (6)
 >
 (7)