Maple 2023 Questions and Posts

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

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 := ()

I have a complicated tensor expression that is defined wtih all indices down. However if i consider a one-up-one-down configuration it appears to introduce new terms that no longer produce the same result as the all down configuration. Not sure what to make of this. 

IndexQuestion.mw

1.mw.....can anyone hlep to sovle this equation...for omega(t)...
(-limit((1 - omega)^(k + 2), omega = 1, left) + 1)/(k + 2) = C*int((1 - `&sigma;_a`*sin(2*pi*N))^k, N = 0 .. N)...in solution..integral didn't get rid

I keep getting an error: invalid subscript selector on specifically this part of my code:

MuligIndgange := subsop(RemoveList\[i\]=NULL, MuligIndgange).
Whenever I comment out the MuligIndgange := part it works.

I can't for the life of me see why it's happening, and whenever I use this code outside my proc it works aswell.

Any help is appreciated, and if you need more context I'll be happy to give it.

for i to numelems(MuligIndgange) do
     if M1[MuligIndgange[i][1], MuligIndgange[i][2]] =/= 0 then
         RemoveList := [op(RemoveList), i];
      end if;
end do;
for i from numelems(RemoveList) by -1 to 1 do
    MuligIndgange := subsop(RemoveList[i] = NULL, MuligIndgange);
end do;

Simple question (I'm sure) here.  I have one worksheet where the variable does not show up in the ouput of an assignment like this:

whereas I was expecting the output to include the variable being assigned like this in most other worksheets:

I am having some difficulting locating the cause (and therefore the setting) to have the behavior set back to including the variable name in the ouput.  Thanks in advance for your help.

2 3 4 5 6 7 8 Last Page 4 of 30