@@ -36,10 +36,44 @@ test("voltage in current probe - 1", async () => {
3636 const [ textResult , _mathml , complex_response , _numericResult , numericText ] = await build_and_solve_mna ( 3 , [ "Y0" ] , components , values , pyodide , "sympy" ) ;
3737 expect ( textResult ) . toEqual ( "C0*L0*s**2/(C0*L0*R0*s**2 + L0*s + R0)" ) ;
3838 // expect(_mathml).toEqual(null);
39- expect ( complex_response ) . toEqual ( "C0*L0* s**2/sqrt(C0**2*L0**2*R0**2* s**4 - 2*C0*L0*R0**2* s**2 + L0**2*s**2 + R0**2 )" ) ;
39+ expect ( complex_response ) . toEqual ( "1.0e-24* s**2/sqrt(1.0e-40* s**4 - 1.0e-20* s**2 + 1 )" ) ;
4040 expect ( numericText ) . toEqual ( "1.0e-20*s^2/(1.0e-16*s^2 + 1.0e-6*s + 10000)" ) ;
4141} ) ;
4242
43+ test ( "voltage in current probe (algebrite) - 1" , async ( ) => {
44+ const components = {
45+ Y0 : {
46+ ports : [ 0 , 1 ] ,
47+ type : "iprobe" ,
48+ } ,
49+ vin : {
50+ ports : [ 0 ] ,
51+ type : "vin" ,
52+ } ,
53+ L0 : {
54+ ports : [ 0 , 2 ] ,
55+ type : "inductor" ,
56+ } ,
57+ R0 : {
58+ ports : [ 1 , 2 ] ,
59+ type : "resistor" ,
60+ } ,
61+ C0 : {
62+ ports : [ 2 , null ] ,
63+ type : "capacitor" ,
64+ } ,
65+ } ;
66+ const values = {
67+ L0 : 0.000001 ,
68+ R0 : 10000 ,
69+ C0 : 1.0000000000000002e-14 ,
70+ } ;
71+ const [ textResult , _mathml , complex_response ] = await build_and_solve_mna ( 3 , [ "Y0" ] , components , values , null , "algebrite" ) ;
72+ expect ( textResult ) . toEqual ( "C0*L0*s^2/(R0+C0*L0*R0*s^2+L0*s)" ) ;
73+ // expect(_mathml).toEqual(null);
74+ expect ( complex_response ) . toEqual ( "abs(C0)*abs(s)/((1-2*C0*R0^2/L0+C0^2*R0^2*s^2+R0^2/(L0^2*s^2))^(1/2))" ) ;
75+ } ) ;
76+
4377test ( "voltage in current probe - 2" , async ( ) => {
4478 const components = {
4579 R0 : {
@@ -71,7 +105,7 @@ test("voltage in current probe - 2", async () => {
71105 const [ textResult , _mathml , complex_response , _numericResult , numericText ] = await build_and_solve_mna ( 3 , [ "Y0" ] , components , values , pyodide , "sympy" ) ;
72106 expect ( textResult ) . toEqual ( "C0*L0*s**2/(C0*L0*R0*s**2 + L0*s + R0)" ) ;
73107 // expect(_mathml).toEqual(null);
74- expect ( complex_response ) . toEqual ( "C0*L0* s**2/sqrt(C0**2*L0**2*R0**2* s**4 - 2*C0*L0*R0**2* s**2 + L0**2*s**2 + R0**2 )" ) ;
108+ expect ( complex_response ) . toEqual ( "1.0e-24* s**2/sqrt(1.0e-40* s**4 - 1.0e-20* s**2 + 1 )" ) ;
75109 expect ( numericText ) . toEqual ( "1.0e-20*s^2/(1.0e-16*s^2 + 1.0e-6*s + 10000)" ) ;
76110} ) ;
77111
@@ -106,7 +140,7 @@ test("current in current probe - 2", async () => {
106140 const [ textResult , _mathml , complex_response , _numericResult , numericText ] = await build_and_solve_mna ( 3 , [ "Y0" ] , components , values , pyodide , "sympy" ) ;
107141 expect ( textResult ) . toEqual ( "L0*s/(L0*s + R0)" ) ;
108142 // expect(_mathml).toEqual(null);
109- expect ( complex_response ) . toEqual ( "L0 *s/sqrt(L0**2* s**2 + R0**2 )" ) ;
143+ expect ( complex_response ) . toEqual ( "1.0e-10 *s/sqrt(1.0e-20* s**2 + 1 )" ) ;
110144 expect ( numericText ) . toEqual ( "1.0e-6*s/(1.0e-6*s + 10000)" ) ;
111145} ) ;
112146
@@ -136,7 +170,7 @@ test("current in current probe VCIS - 3", async () => {
136170 const [ textResult , _mathml , complex_response , _numericResult , numericText ] = await build_and_solve_mna ( 2 , [ "Y0" ] , components , values , pyodide , "sympy" ) ;
137171 expect ( textResult ) . toEqual ( "G0*R0/(G0*R0 + 1)" ) ;
138172 // expect(_mathml).toEqual(null);
139- expect ( complex_response ) . toEqual ( "G0*R0/(G0*R0 + 1) " ) ;
173+ expect ( complex_response ) . toEqual ( "0.999000999000999 " ) ;
140174 expect ( numericText ) . toEqual ( "0.999000999000999" ) ;
141175} ) ;
142176
@@ -176,6 +210,6 @@ test("voltage in voltage probe VCVS", async () => {
176210 const [ textResult , _mathml , complex_response , _numericResult , numericText ] = await build_and_solve_mna ( 3 , [ "X0" ] , components , values , pyodide , "sympy" ) ;
177211 expect ( textResult ) . toEqual ( "A0*R0*(C0*L0*s**2 + 1)/(C0*L0*R0*s**2 + L0*s + R0)" ) ;
178212 // expect(_mathml).toEqual(null);
179- expect ( complex_response ) . toEqual ( "Abs(A0*C0*L0*R0* s**2 - A0*R0)/ sqrt(C0**2*L0**2*R0**2* s**4 - 2*C0*L0*R0**2* s**2 + L0**2*s**2 + R0**2 )" ) ; //FIXME - this seems to be a sympy bug
213+ expect ( complex_response ) . toEqual ( "Abs(1.0e-13* s**2 - 100000000)/(1000000* sqrt(1.0e-42* s**4 - 1.999999999e-21* s**2 + 1) )" ) ; //FIXME - this seems to be a sympy bug
180214 expect ( numericText ) . toEqual ( "(1.0e-13*s^2 + 100000000)/(1.0e-15*s^2 + 1.0e-9*s + 1000000)" ) ;
181215} ) ;
0 commit comments