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

## This warning message is incomprehensible to me....

Fig := proc(t)
local xD, yD, D, C, Ii, Points, tex,sol;
global A, B, b, Omega1, EL1, EL2;
xD := Omega1[1] + aa*cos(t);
yD := bb*sin(t);
D := [xD, yD];
C := [xD + b, yD];
sol:=solve({EQ(A,D),EQ(C,B)},{x,y});
Ii:=[subs(sol,x),subs(sol,y)]:
Points := pointplot([A[], B[], C[], C[], D[], E[], Omega1[]], symbol = solidcircle, color = [red], symbolsize = 6);
tex := textplot([[A[], "A"], [B[], "B"], [C[], "C"], [D[], "D"], [E[], "E"], [Omega1[], "&Omega;1"]], align = ["above", "right"]);
display([polygonplot([A, B, C, D], color = blue, filled = true, transparency = 0.9), Points, tex, EL1, EL2,plot([D,Ii]),plot([Ii,C])], axes = normal, scaling = constrained); end proc:
Fig((3*Pi)/4):
display([seq(Fig((2*Pi*i)/40), i = 1 .. 80)], insequence = true);
Warning, data could not be converted to float Matrix
Warning, data could not be converted to float Matrix
Warning, data could not be converted to float Matrix
Warning, data could not be converted to float Matrix
Warning, data could not be converted to float Matrix
Warning, data could not be converted to float Matrix
Warning, data could not be converted to float Matrix
Warning, data could not be converted to float Matrix
I am sorry; How to manage with such a message. Thank you very much.

## Animation of a trapeze...

restart;
with(plots):
_local(D):

EQ := proc(M, N) local eq; eq := (y - M[2])/(x - M[1]) = (N[2] - M[2])/(N[1] - M[1]); end proc;
EQ := proc (M, N) local eq; eq := (y-M[2])/(x-M[1]) =

(N[2]-M[2])/(N[1]-M[1]) end proc

On considère un trapèze dans lequel une base est fixe l'autre base a une longueur constante et la somme des 2 autres côtés est constaante.
Trouver :
1-. le lieu des sommets mobiles.
A := [xA, 0]:
B := [xA + a, 0]:
D := [xD, yD]:
C := [xD + b, yD]:
EQ(B, C);
E := [xA + a - b, 0]:
Omega1 := (A + E)/2;
Application numérique :
Lieux des sommets C et D

xA := -5:
a := 13:#a>=b
b := 7:
c := -3:
xD := -6:
xC := xD + c:

A:
B:
C:
D:
Ll:=11:aa:= Ll/2:
cc := (a - b)/2:
bb := sqrt(aa^2 - cc^2):
el1 := (x - Omega1[1])^2/aa^2 + y^2/bb^2 = 1:
sol := solve(subs(x = xD, (x - Omega1[1])^2/aa^2 + y^2/bb^2 = 1), y):
yD := sol[1]:
el2 := (x - Omega1[1] - b)^2/aa^2 + y^2/bb^2 = 1:
EL1 := implicitplot(el1, x = -9 .. 4, y = -6 .. 6, color = blue):
EL2 := implicitplot(el2, x = -9 .. 12, y = -6 .. 12, color = blue):
Trap := polygonplot([A, B, C, D], color = blue, filled = true, transparency = 0.9):
Points := pointplot([A[], B[], C[], C[], D[], E[], Omega1[]], symbol = solidcircle, color = [red], symbolsize = 6):
tex := textplot([[A[], "A"], [B[], "B"], [C[], "C"], [D[], "D"], [E[], "E"], [Omega1[], "&Omega;1"]], align = ["above", "right"]):
display([Trap, EL1, EL2, tex, Points], axes = normal, scaling = constrained):
Fig := proc(xD)
local yD, D, C,Points,tex;
global A, B, b, Omega, xA, xB, EL1, EL2;
solve(subs(x = xD, (x - Omega1[1])^2/aa^2 + y^2/bb^2 = 1), y);
yD := %[1]; D:= [xD, yD]; C := [xD + b, yD];
Points := pointplot([A[], B[], C[], C[], D[], E[], Omega1[]], symbol = solidcircle, color = [red], symbolsize = 6):
tex := textplot([[A[], "A"], [B[], "B"], [C[], "C"], [D[], "D"], [E[], "E"], [Omega1[], "&Omega;1"]], align = ["above", "right"]):
display([polygonplot([A, B, C, D], color = blue, filled = true, transparency = 0.9), Points,tex,EL1, EL2], axes = normal, scaling = constrained);
end proc:

Fig(2):Fig(-4):
Fig([seq(-6 + 3*i/10), i = 1.20], insequence = true);
Error, (in Engine:-Dispatch) badly formed input to solve: not fully algebraic
;I don't understand this error message. Thank you gfor your help.

## animate flight path of ball including rotation...

Hi everyone

I have a problem regarding the animation of a flying ball.

I get the coordinates and rotation in rad/s out of differential equations. Now I want to show the movement of the ball including the rotation in an animation.

With just the coordinates it works just fine, but when I try do add the rotation the error message "number of elements in lust must be a multiple of 2" appears

I added my file, hope it helps.

how_rot.mw

## multipliying nonconformable matrices should give a...

I made an error by trying to multiply two nonconformable matrices. I think, I should receive an error message. But in this example this did not occur.

Strange.mw

 >

Matrices nonconformable, Maple should give error message:

 >

 >

 >

 >

 >

 >

 >

 >

hereafter results are correct: Matrices

nonconformable, therefore error messages appear.

 >

Error, (in LinearAlgebra:-Multiply) first matrix column dimension (16) <> second matrix row dimension (4)

 >

Error, (in LinearAlgebra:-Multiply) first matrix column dimension (16) <> second matrix row dimension (4)

## animate points which are connected with a line in ...

Hi everyone

I have a problem with an animation that I dont know how to solve.

Let's say I have three sets of coordinates. (one static and two moving dependet on time)

1:= [x1;z1]

2:= [x2(t);z2(t)]

3:= [x3(t);z3(t)]

Now I want out of these 3 points two lines that are connected  with each other like this:

line 1:= 1 and 2

line 2:= 2 and 3

These lines should move over time in the 2d space. The only point that doesnt move is point 1. In the animation there should only be the 2 lines visible for each frame. (not a trace or something like this)

does anyone have an idea how I solve this?

## initial condition error...

Hi everyone

I solve several differential equations using dsolve. Now I want to change one initial condition a little bit:

before:

new:

When solving the new system I am getting the error message: Error, (in dsolve/numeric/process_input) unknown piecewise(0 < 16-(xn(t)^2+(zn(t)-16)^2)^(1/2), 16-(xn(t)^2+(zn(t)-16)^2)^(1/2), 0) present in ODE system is not a specified dependent variable or evaluatable procedure

I am guessing this has to do with a function in an initial condition.

Has anyone an idea how to solve this problem?

I added the maple file for the whole overview.

## calculation of Major Axis and Minor Axis of an ell...

How to improve this program ? Thank you.

restart;
Equation de la conique
eqcon := (45 - 27*cos(alpha))*x^2 - 54*sin(alpha)*x*y + (45 + 27*cos(alpha))*y^2 - 8;
Delta := (-54*sin(alpha))^2 - 4*(45 - 27*cos(alpha))*(45 + 27*cos(alpha));
expand(%);
simplify(%);
Discriminant : Δ<0 ce qui correxpond à une ellipse
Eq := simplify(expand(subs(x = cos(alpha/2)*X - sin(alpha/2)*Y, y = sin(alpha/2)*X + cos(alpha/2)*Y, eqcon)));
kx := coeff(Eq, X, 2);
ky := coeff(Eq, Y, 2);
k := -tcoeff(Eq);

EQ := X^2/(sqrt(1/kx^2)*k) + Y^2/(sqrt(1/ky^2)*k) = 1;
Calcul du grand et du petit axe
a := 1/sqrt(coeff(lhs(EQ), X, 2));
b := 1/sqrt(coeff(lhs(EQ), Y, 2));
print(X^2/('a^2') + Y^2/('b^2') = 1);

## How to compute the restricted-edge-connectivity of...

！Edits: I have found  a existing polynomial algorithm, but I still have difficulty implementing it. 2022/10/26

The edge connectivity of a connected graph G  is the minimum number of edges whose deletion from the graph G disconnects G. Below we are concerned with a particular kind of edge-cut.

• For a connected graph G=(V ,E), an edge set S ⊂ E is a restricted-edge-cut, if G−S is disconnected and every connected component of  G−S has at least 2 vertices.

Clearly, a restricted-edge-cut is an edge cut with a special requirement.

• The restricted-edge-connectivity of G, denoted by κres(G), is defined as the cardinality of a minimum restricted-edge-cut.

For example, a graph g is as follows.

Clearly, its edge-connectivity is 1 since (0,3) or (0,4) is a edge cut of g. But we can find that  if we remove the edge (0,3), then "3" is a isolated vertex. Similarly, "4" is a isolated vertex if we remove  (0,4). It is not difficult to find g has exactly the two cut-edges (0,3) and (0,4).

Based on the definition of the restricted-edge-cuts, neither {(0,3)} nor  {(0,4)} are restricted-edge-cuts A minimum restricted-edge-cut is {(0,1),(0,2)} since every connected component of G-{(0,1),(0,2)} has  (at least) 2 vertices.

So  κres(g) is 2.  My problem is:

Given a graph G, how to calculate the restricted-edge-connectivity of  G?  Moreover, how to find a minimum restricted-edge-cut?

A specific graph that I want to test is as follows. (it has 16 vertices and 56 edges.) I would like to calculate its restricted-edge-connectivity and find a minimum restricted-edge-cut.

```g:=ConvertGraph("O~tIID@wL~j`PbOqgLJ@p");
vertexcolor="Black",edgethickness=2])
```

`EdgeConnectivity(g) `

6

One option I came up with is to find all 6-edge subsets first. Test if they satisfy  the restricted condition (one by one). Then continue to increase to 7 or more. But this violent calculation may get stuck in the first step. That is, test all the minimum edge cut sets (Note that we will consider 32468436 edge-subsets!) I was referring to the efficiency aspect.

```with(Iterator):
C:=Combination(58,6):
K:=Edges(g):
#sub:=seq( K[[seq(c[]+1)]], c=C); # do not run this code since it has 32468436 members.```

Any language is acceptable.( C or C++, Python. )

PS: Some time ago, I also asked a related question (but with some differences) on mathematica stack （Find all the minimum edge cuts of a graph）. Although Bob Hanlon  gave a reply, the actual result is not good.

Edits: The following literature gives a polynomial algorithm for computing the restricted-edge-connectivity of a given  graph. The heart of it is to computing the least cardinality of some  edge-pairs's edge separator. I'm stuck here.

• Esfahanian A H, Hakimi S L. On computing a conditional edge-connectivity of a graph[J]. Information processing letters, 1988, 27(4): 195-199.

How to implement this algorithm is my current concern.

## Error, (in Optimization:-NLPSolve) could not store...

i have a problem in an optimzation problem. in the problem using NLPSolve to find the minimum, i have an integration which i use the Int command to be solved in the optimization process, but this error occures: Error, (in Optimization:-NLPSolve) could not store Int(..) in a floating-point rtable

 > restart:with(LinearAlgebra):
 > N:=3:
 > m:=Vector([ 1 , log(x+b3) , b2/(x+b3) ]):
 > A:=m.m^+:
 > for i to N do m||i:=eval(A,[x=x||i]); od:
 > MM:=( LinearAlgebra:-Trace(MatrixInverse(M)) ):
 > IF1:=evalf(Int(MM,[b2=1..2,b3=1..2],method = _d01ajc,epsilon=0.001)):
 > s:= Optimization:-NLPSolve(IF1,w1=0..1,w2=0..1,x1=1..10,x2=1..10,x3=1..10,variables=[w1,w2,x1,x2,x3],initialpoint={w1=0.6,w2=.1,x1=8,x2=7,x3=5},maximize=false,method=modifiednewton)
 >

## evalv max/min of function...

Hi everyone

I am trying to get the maximum value (angle) for a function, which is a solution from a ODE. I tried evalf(max.. which I already thaught wouldnt work.

After that I installed the package "DirectSearch", again with no success.

Does anybody know what I am doing wrong or how I am going to get the maximum. I added the maple file with the direct seach attempt.

## why fsolve doesn't work...

Hi

I'd like to know that why in the attachment "fsolve" does not work?

How can I evaluate the value of "A" in my file?

 > restart:
 > N := 60: L := 10: a := 2*10^(-12):
 > eqn:=ns=1-((((N/A)+((A*L)^(L/(1-L))))^((1-L)/L))/(A*L))*(2+(a*exp((((N/A)+((A*L)^(L/(1-L)))))^(1/L)))/((A*L*(((N/A)+((A*L)^(L/(1-L))))^((L-1)/L)))+((a*exp((((N/A)+((A*L)^(L/(1-L)))))^(1/L)))))):
 > seq(fsolve(eqn,A),ns=[0.9603,0.9647,0.9691]):
 >

## How to plot 2d flight path over time in 3d (x,z,t)...

Hi everyone

I would like to plot something in 3d. I have to functions both depending on the time. (x(t), z(t))

I can plot in 2d: (t, x(t)) or (t,z(t)) or (x(t), z(t))

Now I want to show the flight path (x(t), z(t)) over time t. So I thought a 3d plot would be suitable for this.

The problem is that I dont know how to plot this. With plot3d I am only able to plot some planes. What I want to plot is the flight path in the 3d room with the axis x(t),z(t) and t.

Does anybody know how to do this?