@@ -54,6 +54,7 @@ def test_planar_cc():
5454 substitutions [xi_d_syms [idx ]] = 1
5555
5656 forbidden_syms = set (substitutions .keys ())
57+ bending_syms = [xi_syms [3 * i ] for i in range (num_segments )]
5758
5859 def remove_rows_cols (mat : sp .Matrix , remove_idxs ):
5960 mat_mutable = sp .Matrix (mat )
@@ -107,6 +108,39 @@ def simplify_and_reduce(expr: sp.Expr) -> sp.Expr:
107108 print (f"{ exp_key } =\n { simplified_item } " )
108109 assert forbidden_syms .isdisjoint (simplified_item .free_symbols )
109110
111+ def limit_bending_strain (expr : sp .Expr ) -> sp .Expr :
112+ limited_expr = expr
113+ for bending_sym in bending_syms :
114+ limited_expr = sp .limit (limited_expr , bending_sym , 0 )
115+ return sp .simplify (limited_expr )
116+
117+ def assert_no_bending_syms (expr : sp .Expr ):
118+ assert set (bending_syms ).isdisjoint (getattr (expr , "free_symbols" , set ()))
119+
120+ limited_exps = {}
121+ for exp_key , exp_val in simplified_exps .items ():
122+ if isinstance (exp_val , list ):
123+ limited_list = []
124+ for idx , exp_item in enumerate (exp_val ):
125+ limited_item = (
126+ exp_item .applyfunc (limit_bending_strain )
127+ if isinstance (exp_item , sp .MatrixBase )
128+ else limit_bending_strain (exp_item )
129+ )
130+ limited_list .append (limited_item )
131+ print (f"{ exp_key } _limit[{ idx } ] =\n { limited_item } " )
132+ assert_no_bending_syms (limited_item )
133+ limited_exps [exp_key ] = limited_list
134+ else :
135+ limited_item = (
136+ exp_val .applyfunc (limit_bending_strain )
137+ if isinstance (exp_val , sp .MatrixBase )
138+ else limit_bending_strain (exp_val )
139+ )
140+ limited_exps [exp_key ] = limited_item
141+ print (f"{ exp_key } _limit =\n { limited_item } " )
142+ assert_no_bending_syms (limited_item )
143+
110144def test_planar_cs ():
111145 sym_exp_filepath = (
112146 Path (jsrm .__file__ ).parent / "symbolic_expressions" / "planar_pcs_ns-1.dill"
0 commit comments