## g metric and christoffel...

I want to write a program in differential geometry that get g as a metric matrix then calculate christoffel.

## How do I add an image to a plot?...

with(ImageTools);

ttt0 := textplot([0 + 0.5, (5 + 0) - 0.5, " Star ", color = "blue", font = ["times", "roman", "bold", 40]]):
display(ttt0, U1, axes = none, size = [400, 160]);

This is the error I get:

Error, (in plots:-display) cannot display array with other plots

I can see Maple doesn't allow adding images to plots. But is there a way around that?

I want to be able to virtually have a white box that I can add plots to such as curves, text, and images at certain locations etc? I want to do that with actual Maple code in the worksheet, without having to mouse-clicking Menu, insert, etc.

Thanks

## termination issue...

The loop for HFS _data_2 and SFS_data_2 and the loop for HFS _data_3 and SFS_data_3 do not seem to be terminated. I do not know what it is the issue here. Anyone who can help this?

Negativity_(v12_beta_gamma_mu).mw

## Can this procedure be parallelized? ...

Hello

I wonder if there is a way to parallelize the function listed below.   It deals with a set of sets (dynamical systems).  As far as I can see the problem is with subs and simplify.  In some cases a division by zero shows up (the reason I added try..catch and had to use for).

The procedure should remove the systems with imaginary coefficients and return the valid indices.

Many thanks

Ed

Obs.:  The number of dynamical systems can easily be greater than 10,000.  Any speed improvement is welcome.

Example of one such a dynamical system is

`[(-x*rho*xi[6]*(beta - 1)*sqrt(((rho + beta - 1)*sigma - beta + 1)^2*xi[8]^2/(beta - 1)^2) - xi[8]*(-2*y*sigma*xi[7]*xi[6]^2*(beta - 1)^2 + (sigma*rho + (sigma + 1)*(beta - 1))*x*rho*xi[6] + 2*sigma*z*rho^2*xi[8]))/(2*xi[6]*xi[8]*rho*(beta - 1)), (-(beta - 1)*(-y*sigma*xi[7]*xi[6]^2*(beta - 1)^2 + rho^2*(sigma*z*xi[8] + x^2))*xi[6]*sqrt(((rho + beta - 1)*sigma - beta + 1)^2*xi[8]^2/(beta - 1)^2) - (2*sigma*(beta - 1)^2*(y*xi[7]*(rho + beta - 1)*sigma/2 + x^2*rho + y*(beta - 1)*xi[7]/2)*xi[6]^3 + 2*x*z*rho*sigma*xi[8]*(beta - 1)^2*xi[6]^2 + (-z*xi[8]*(rho + beta - 1)*sigma^2 + ((2*beta^2*z - 3*beta*z + z)*xi[8] + x^2*rho - (beta - 1)*(-2*beta*y*xi[7] + x^2))*sigma + x^2*(beta - 1))*rho^2*xi[6] + 2*x*z*rho^3*sigma*xi[8])*xi[8])/(2*xi[8]*sigma*(beta - 1)*(rho^2 + (beta - 1)^2*xi[6]^2)*xi[6]*xi[7]), (-(-x*sigma*(beta - 1)^2*xi[6]^3 + (beta - 1)^2*(sigma*y*xi[7] + x^2)*xi[6]^2 - rho^2*sigma*x*xi[6] - sigma*z*rho^2*xi[8])*(beta - 1)*rho*sqrt(((rho + beta - 1)*sigma - beta + 1)^2*xi[8]^2/(beta - 1)^2) + xi[8]*(-2*y*sigma^2*xi[7]*(beta - 1)^4*xi[6]^4 + 2*(rho*(rho + beta - 1)*sigma/2 + (beta - 1)*((-beta + 1/2)*rho + y*(beta - 1)*xi[7]))*sigma*(beta - 1)^2*x*xi[6]^3 + (beta - 1)^2*(((-y*xi[7] + 2*z*xi[8])*rho + y*(beta - 1)*xi[7])*sigma^2 + (x^2*rho + (beta - 1)*(-2*beta*y*xi[7] - 2*beta*z*xi[8] + x^2 + y*xi[7]))*sigma - x^2*(beta - 1))*rho*xi[6]^2 + 2*(rho*(rho + beta - 1)*sigma/2 + (beta - 1)*((-beta + 1/2)*rho + y*(beta - 1)*xi[7]))*sigma*x*rho^2*xi[6] + xi[8]*sigma*z*((rho - beta + 1)*sigma - beta + 1)*rho^3))/(2*xi[8]^2*sigma*(beta - 1)*rho*(rho^2 + (beta - 1)^2*xi[6]^2))]`

coefmodel

`{beta = 8/3, rho = 28, sigma = 10}`

and phi and coe equal to

`[[], [], []]`

```cleanSystems := proc(sys::list,phi::list,coe::list,coefmodel::{list,set})
description "This function applies coefficient values to a system and remove it if the coef is somehow imaginary":
local i,aaa:=table(),bbb:=table(),ccc:=table(),ind:=table():
for i from 1 to nops(sys) do
try
aaa[i]:=simplify(subs(coefmodel,sys[i])):
if has(aaa[i],I) then
aaa[i]:=NULL:
bbb[i]:=NULL:
ccc[i]:=NULL:
ind[i]:=NULL:
else
bbb[i]:=simplify(subs(coefmodel,phi[i])):
ccc[i]:=simplify(subs(coefmodel,coe[i])):
ind[i]:=i:
end if:
catch:
aaa[i]:=NULL:
bbb[i]:=NULL:
ccc[i]:=NULL:
ind[i]:=NULL:
end try:
end do:
aaa:=convert(aaa,list):print(nops(aaa)):
bbb:=convert(bbb,list):print(nops(bbb)):
ccc:=convert(ccc,list):print(nops(ccc)):
ind:=convert(ind,list):print(nops(ind)):
return(aaa,bbb,ccc,ind):
end proc:
```

## How to add arrows to a phase portrait?...

Hi. I'm having a problem with the command phase portrait on maple when i'm trying to make a phase portrait of my autonomous differential equations. The problem is i can't get arrows on my phase portrait to see how the system behave with different intial value conditions, so my questions is how can i add arrows to the phase portrait? See below for a image of my code

## How do I get a unction with if else expression in ...

Hello

I'm a Master student and for my thesis I need to get the following function in Maple with the if then commando (or onother one that will get the same result):

But I didn't find the solution yet.

Can anyone help me out?

## animate rotating object in interval...

Hi everyone

I have a question regarding an animation. The maple file is attached at the bottom. (parts of it are from tomleslie 12910

I have two spheres which move and rotate over time. Now I would like to show one ball at a certain time and the other one at a certain time and not both over the whole animation.

For example:

x1 should only be shown and visible from time -1 to 0

x2  should only be shown and visible from time 0 to 1

Because I want to show a kind of transition from x1 to x2 at the time 0 i cannot just start one animation at -1 and the other at 0 because then they would run at the sime time which is not the goal.

has anyone an idea?

how_transition.mw

## properties of the ellipse...

restart
EQ := proc(M, N) RETURN((y - M[2])/(x - M[1]) = (N[2] - M[2])/(N[1] - M[1])); end proc:
with(plots):
with(geometry):
_EnvHorizontalName := 'x':   _
EnvVerticalName := 'y':
a := 7;  b := 5;
c:=sqrt(a^2-b^2);
t:= (3* Pi)/(4):
ellipse(el,x^2/a^2 + y^2/b^2 - 1 ):
point(M1, a*cos(t),b*sin(t)):
point(F1,-c,0):point(F2,c,0):
line( L1,[F1,M4]):
point(M1, a*cos(t),b*sin(t)):
EQ([a*cos(t),b*sin(t)],[-c,0]);
solve(`%`,y);m:=coeff(`%`,x);
line(L3,y=m*(x-c));
op(solve({x^2/a^2 + y^2/b^2 - 1 =0, y=m*(x-c)},{x,y},explicit)[2])[1]:xM2:=rhs(`%`):
op(solve({x^2/a^2 + y^2/b^2 - 1 =0, y=m*(x-c)},{x,y},explicit)[2])[2]:yM2:=rhs(`%`):
point(M2,xM2,yM2);
line( tang1,x*xM2/a^2 + y*yM2/b^2 = 1);
intersection(C1,L1,tang1);
line(L4,[F1,M2]);  C1:=[ HorizontalCoord(C1), VerticalCoord(C1)];
F1:=[-c,0];M2:= [ HorizontalCoord(M2), VerticalCoord(M2)];
display( [ textplot( [[ -c, 0, "F1"],[ c,0, "F2"] ,
[ HorizontalCoord(M1), VerticalCoord(M1), "M1"],
[ HorizontalCoord(M2), VerticalCoord(M2), "M2"],
[ HorizontalCoord(C1), VerticalCoord(C1), "C1"] ],'align'={"above",'right'},                       [polygonplot([C1,F1,M2], color=blue,filled=true,transparency=0.9)]);
draw( [ el(color=red),M1(color=black,symbol=solidcircle, symbolsize=16),
M2(color=black,symbol=solidcircle, symbolsize=16),
L1( color=black),L3(color=green),L4(color=green),
tang1(color=red),
F1(color=blue, symbol=solidcircle, symbolsize=16),
F2(color=red, symbol=solidcircle, symbolsize=16),
C1(color=black, symbol=solidcircle, symbolsize=16),                     ],                                    axes=none ) ] );
Error, missing operator or `;` Many errors Icant corrected.  Thank you.

## Make my Own Code and Call to other file and Get Re...

Hello;

Hope you are fine. I need to learn how can I call my code in the other file of maple, define new value for A and can get results. For this purpose, I just take an simple example as

questionmaple.mw

 >
 (1)

## Expanding Derivatives in Equations...

Hi Everyone,

ich have a question, that is probably rather trivial. I am currently doing some calculations with the differential geometry package. (I know the Physics package was recommended, however, the DG package seems more appropriate for my purposes after having a look through the Physics help page)

My goal is to substitute a functional expression into equations derived in curvilinear (spherical and helical) coordinates. my problem now is that maple won't expand the differentials of the expressions I have substituted.

I hope the answer isn't too trivial. Although I assume it will be :)

 >
 >
 >
 >
 (1)

Defining the Metric Tensor and Calculating the Connection Coefficients

 >
 (1.1)
 >
 (1.2)
 >
 >
 (1.3)

Defining the PDF as a Tensor (Metric) Density

 >
 (2.1)
 >
 (2.2)
 >

Convective Operator

 >
 >
 >
 (3.1)
 >

In particular, the last line should simplify quite a bit when expanding derivatives.

## Animation of an ellipse...

Problema with textplot

restart:with(plots):
with(geometry):
_EnvHorizontalName := 'x':
_EnvVerticalName := 'y':
a := 7:
b := 3:
ellipse(p, x^2/a^2 + y^2/b^2 - 1, [x, y]):
Fig := proc(t)
local M, l1,L1,L2,  q, m, c , tex;
global a, b, p;
point(M, a*cos(t), b*sin(t));
if   VerticalCoord(M)=0
then line(l1, x=HorizontalCoord(M));
else m:=eval[recurse]( rhs
( isolate
( diff
( eval
( Equation(p),
y=y(x)
),
x
),
diff(y(x),x)
)
),
[ y(x)=y,
x=HorizontalCoord(M),
y=VerticalCoord(M)
]
);
c:=VerticalCoord(M)-m*HorizontalCoord(M);
line(l1, y=m*x+c);
fi;
reflection(q, p, l1);
line(L1, [point(P1, evalf~(coordinates(foci(q)[1]))),
point(P2, evalf~(coordinates(foci(q)[2])))]):
line(L2, [point(P3, evalf~(coordinates(foci(p)[1]))),
point(P4, evalf~(coordinates(foci(p)[2])))]):
segment(P1P3,[P1,P3]): circle(cir1,[P3,2*a]):
segment(P2P4,[P2,P4]):
circle(cir1,[P3,2*a]): circle(cir2,[P4,2*a]):
textplot([[P2[], "F1"], [P4[], "F2"]], font = [times, 10], align = {below, left}):
draw( [ p(color = blue),P1P3(color=magenta,linestyle=3),
q(color = blue),P2P4(color=magenta,linestyle=3),
l1(color = black),L1(color = black),cir1(color=magenta,linestyle=3),
cir2(color=magenta,linestyle=3),
M(color = blue, symbol = solidcircle, symbolsize = 16),
P1(color = red, symbol = solidcircle, symbolsize = 16),
P2(color = red, symbol = solidcircle, symbolsize = 16),
P3(color = red, symbol = solidcircle, symbolsize = 16),
P4(color = red, symbol = solidcircle, symbolsize = 16)
],
axes = none,
scaling = constrained);
end proc:
#
# Change nFig to type float
#
nFig := 180.0:
#
# Make sure loop index is a float, and change end point
# on loop to nFig-1.0
#
Figs := seq(Fig(2*Pi*i/nFig), i = 0.0 .. nFig-1.0):
plots:-display(Figs, insequence = true);
Error, (in plots:-textplot) improper op or subscript selector
Error, (in plots:-display) expecting plot structure but received: Figs

## Discrete Fourier transform(DFT) of Array giving er...

Hi Everyone,

I want to do some fourier analysis on a numeric ODE solution but first I wanted to understand all the commands and make sure it worked with a simple example. I created a Array of data which I attempted to take the DFT of but I got an error and I cannot seem to figure out why, I looked through the help pages and it looks like inputs use an Array of data but for some reason mine wont work.

Worksheet attached, any help greatly appreciated.

DFT_Test.mw

## Looking for focal points of an ellipse...

```_local(D);
f := (x, y) -> 3*x^2 - 3*y*x + 6*y^2 - 6*x + 7*y - 9;
coeffs(f(x, y));
A, B, C, D, E, F := %;
theta := 1/2*arctan(B/(A - C));
solve({-2*A*xc - B*yc = D, -B*xc - 2*C*yc = E});
assign(%);
x := xcan*cos(theta) - ycan*sin(theta) + xc;
y := xcan*sin(theta) + ycan*cos(theta) + yc;
Eq := simplify(expand(f(x, y)));
xcan^2/simplify(sqrt(-tcoeff(Eq)/coeff(Eq, xcan^2)))^`2` + ycan^2/simplify(sqrt(-tcoeff(Eq)/coeff(Eq, ycan^2)))^`2` = 1;
a := sqrt(-tcoeff(Eq)/coeff(Eq, xcan^2));
b := sqrt(-tcoeff(Eq)/coeff(Eq, ycan^2));
c := sqrt(a^2 - b^2);
F1 := [xc + c*cos(theta), yc + c*sin(theta)];
evalf(%);
F1 := [xc - c*cos(theta), yc - c*sin(theta)];
evalf(%);
Points := pointplot([F1[], F2[]], symbol = solidcircle, color = [red], symbolsize = 6);
xcan := plot(yc + tan(theta)*('x' - xc), 'x' = -2 .. 3.5, color = black);
ycan := plot(yc - ('x' - xc)/tan(theta), 'x' = 0.1 .. 1.5, color = black);
Ellipse := plots[implicitplot](f('x', 'y'), 'x' = -2 .. 3.5, 'y' = -2 .. 1.5, color = red, thickness = 2, gridrefine = 5);
labels := plots[textplot]([[0.4, 1.3, "ycan"], [3.2, 0.75, "xcan"]], font = [TIMES, ROMAN, 14]);
plots[display](xcan, ycan, Points, Ellipse, labels, scaling = constrained);
```

I do not why I get this message:

Error, (in plots:-display) expecting plot structure but received: pointplot([17/21-(2/21)*(1407/(-(3/2)*2^(1/2)+9/2)-1407/((3/2)*2^(1/2)+9/2))^(1/2)*cos((1/8)*Pi), -8/21-(2/21)*(1407/(-(3/2)*2^(1/2)+9/2)-1407/((3/2)*2^(1/2)+9/2))^(1/2)*sin((1/8)*Pi), F2[]], symbol = solidcircle, color = [red], symbolsize = 6) NULL;

## Syrup Spice Toolbox - Netlists with arbitary volta...

Good day,

I am looking for some guidance with the Syrup toolbox

I have a netlist that was generated with the Altium designer Spice simulator (XSpice based), I was able to import it into LTSpice and verrify the results.

I want to move it into maple to make use of the modellica code generation.

I then began modifying the netlist in order to meet the netlist syntax of Syrup. One of the most prominant change I needed to make was the arbitrary input nodes for my Voltage dependant Voltage sources.

Therefore, for any line that implies arbitrary sources such as:

```E_U8_E1 U8_N208620 LO
+ VALUE { IF(V(U8_N208706, 0) > 0.5, 5, -5) }```

was changed to:

```V1    16   17 1vdc

E_U8_E1 U8_N208620 LO 16 17
+ VALUE { IF(V(U8_N208706, 0) > 0.5, 5, -5) }```

This, of course, is a non ideal workaround which brings me to question 1,

Is there a way to define a arbitrary source with the Spice parser in Syrup?

Once these changes were made, it seems the Solve function in Syrup can parse the netlist without issue, however when it gets to the Solve portion it throws the following error:

```Solve("file://C:/Users/msavoy/Documents/Spice_cct/inverter_newfet_nonot.cir", 'tran');
Solve: Analyzing SPICE deck "The Apple" (ignoring this line)
Error, (in Syrup:-Solve) invalid input: rcopy uses a 1st argument, A (of type anything), which is missing
```

Attached is a copy of the netlist, inverter_newfet_nonot.txtI am honestly at a lost as to what could be throwing the rcopy error

Furthermore, I wanted to test out the Modellica code generation in Syurp, it appears that it does not like having subcircuits, as running the test:

```V 1 0 1
L1 1 2 L
C1 2 0 C
L2 2 3 L
C2 3 0 C
L3 3 4 L
C3 4 0 C
Vshort 4 5 0
Rt 5 0 1
.SUBCKT TEST A B C Y
V1 14 15 1
EINT YINT 0 14 15
+ VALUE {IF(V(A) > 0.5 && V(B) > 0.5 && V(C) > 0.5, 1, 0)}
RINT YINT Y 1
CINT Y 0 1n
.ENDS TEST
.end```

provides the error of:

```test_c := ToModelica("file://C:/Users/msavoy/Documents/Spice_cct/test_cct_RCL.txt", 'probes' = ["Rt.v"], 'parameters' = {C = 2, L = 1});
Error, (in Syrup:-ToModelica) invalid input: nodeToModelica expects its 1st argument, node, to be of type nonnegint, but received Y
```

Is it possible to define a sub circuit in a netlist that is to be converted to Modellica, or do all subcircuits need to be defined in their own file?

Thank you

## Create Homogeneous Transformation Matrix through C...

Hello,

I am trying to create a Homogeneous transformation matrix, where I am given the point 'p' through which a unit rotation axis 'x' passes and the point/vector on which this Homogenous transformation acts is rotated by 'theta'.

I used the Rodrigues formula (the one in the blue-green box) to define the rotation matrix;

```unit_axis_cross_mat := unapply(<<0 | -x[3] | x[2]>, <x[3] | 0 | -x[1]>, <-x[2] | x[1] | 0>>, x::Vector);
rot_mat := unapply(LinearAlgebra[IdentityMatrix](3) + unit_axis_cross_mat(<x[1], x[2], x[3]>)*sin(theta) + MatrixPower(unit_axis_cross_mat(<x[1], x[2], x[3]>), 2)*(1 - cos(theta)), x::Vector, theta)```

I then tried to concatenate them to generate the matrix function

, where the exponential term represents the rotation matrix (defined above) as such:

`trans_mat_ang := unapply(ArrayTools[Concatenate](1, ArrayTools[Concatenate](2, rot_mat(<x[1], x[2], x[3]>, theta), (LinearAlgebra[IdentityMatrix](3) - rot_mat(<x[1], x[2], x[3]>, theta)) . <p[1], p[2], p[3]>), <0 | 0 | 0 | 1>), x::Vector, theta, p::Vector)`

But I end up getting the error

"Error, (in ArrayTools:-Concatenate) number of columns must match"

To diagnose it, I try to evaluate the 1st Concatenation:

`trans_mat := unapply(<ArrayTools[Concatenate](2, rot_mat(<x[1], x[2], x[3]>, theta), (LinearAlgebra[IdentityMatrix](3) - rot_mat(<x[1], x[2], x[3]>, theta)) . <p[1], p[2], p[3]>)>, x::Vector, p::Vector, theta);`

which runs successfully, but when I try to evaluate it:

`trans_mat(<1, 0, 0>, <1, 0, 0>, 0)`

, I get a symbolic expression .

Although the expression is correct algabrically, I expected a full evaluation for the numerical inputs.

I am attaching my Homogeneous_Transformation.mw for your ease of diagnosis.

Is this the cause of the error of "Number of Columns must match"?

Any help towards this would be appreciated.

Regards

 3 4 5 6 7 8 9 Last Page 5 of 34
﻿