File tree Expand file tree Collapse file tree 4 files changed +12
-12
lines changed 
structural_transformation Expand file tree Collapse file tree 4 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 4242completed_rc_model =  complete (rc_model)
4343@test  isequal (completed_rc_model. resistor. n. i, resistor. n. i)
4444@test  ModelingToolkit. n_expanded_connection_equations (capacitor) ==  2 
45- @test  length (equations (structural_simplify (rc_model, allow_parameter =  false ))) ==  2 
45+ @test  length (equations (structural_simplify (rc_model, allow_parameter =  false ))) ==  1 
4646sys =  structural_simplify (rc_model)
4747@test_throws  ModelingToolkit. RepeatedStructuralSimplificationError structural_simplify (sys)
4848@test  length (equations (sys)) ==  1 
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ rng = StableRNG(22525)
77
88@testset  " Correct ImplicitDiscreteFunction" begin 
99    @variables  x (t) =  1 
10-     @mtkbuild  sys =  ImplicitDiscreteSystem ([x (k) ~  x (k) *  x (k -  1 ) -  3 ], t)
10+     @mtkbuild  sys =  ImplicitDiscreteSystem ([x (k) ~  abs ( x (k) ) *  x (k -  1 ) -  3 ], t)
1111    tspan =  (0 , 10 )
1212
1313    #  u[2] - u_next[1]
Original file line number Diff line number Diff line change @@ -134,8 +134,8 @@ let pss_pendulum = partial_state_selection(pendulum)
134134end 
135135
136136let  sys =  structural_simplify (pendulum2)
137-     @test  length (equations (sys)) ==  5 
138-     @test  length (unknowns (sys)) ==  5 
137+     @test  length (equations (sys)) ==  4 
138+     @test  length (unknowns (sys)) ==  4 
139139
140140    u0 =  [
141141        x =>  sqrt (2 ) /  2 ,
Original file line number Diff line number Diff line change @@ -224,20 +224,20 @@ end
224224            xtt =  default_toterm (unwrap (D (D (x))))
225225            @test  mapping[x] ==  (0  ~  1  -  x^ 2  -  y^ 2 )
226226            @test  mapping[y] ==  (D (y) ~  yt)
227-             @test  mapping[D (y)] ==  (D (yt) ~  - g  +  y  *  λ )
228-             @test  mapping[D (x)] ==  (0  ~  - 2 xt  *  x  -   2 yt  *  y )
229-             @test  mapping[D (D (x))] ==  (xtt  ~  x *  λ)
230-             @test  length (mapping) ==  5 
227+             @test  mapping[D (y)] ==  (D (yt) ~  ( 2 xtt  *  x  +   2 xt ^ 2   +   2 yt ^ 2 )  /  ( - 2 y) )
228+             @test  mapping[D (x)] ==  (xt  ~  - yt  *  y  /  x )
229+             @test  mapping[D (D (x))] ==  (0   ~   - xtt  +  x *  λ)
230+             @test  length (mapping) ==  6 
231231
232232            @testset  " `rename_dummy_derivatives = false`" begin 
233233                mapping =  map_variables_to_equations (sys; rename_dummy_derivatives =  false )
234234
235235                @test  mapping[x] ==  (0  ~  1  -  x^ 2  -  y^ 2 )
236236                @test  mapping[y] ==  (D (y) ~  yt)
237-                 @test  mapping[yt] ==  (D (yt) ~  - g  +  y  *  λ )
238-                 @test  mapping[xt] ==  (0  ~  - 2 xt  *  x  -   2 yt  *  y )
239-                 @test  mapping[xtt] ==  (xtt  ~  x *  λ)
240-                 @test  length (mapping) ==  5 
237+                 @test  mapping[yt] ==  (D (yt) ~  ( 2 xtt  *  x  +   2 xt ^ 2   +   2 yt ^ 2 )  /  ( - 2 y) )
238+                 @test  mapping[xt] ==  (xt  ~  - yt  *  y  /  x )
239+                 @test  mapping[xtt] ==  (0   ~   - xtt  +  x *  λ)
240+                 @test  length (mapping) ==  6 
241241            end 
242242        end 
243243        @testset  " DDEs" begin 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments