File tree Expand file tree Collapse file tree 1 file changed +9
-18
lines changed Expand file tree Collapse file tree 1 file changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -127,38 +127,29 @@ def leadterm(e: S, x: S) -> list[S]:
127
127
"""
128
128
Returns the leading term a*x**b as a list [a, b].
129
129
"""
130
- term1 : S = sin (x )/ x
131
- term2 : S = S (2 )* sin (x )/ x
132
- term3 : S = sin (S (2 )* x )/ x
133
- term4 : S = sin (x )** S (2 )/ x
134
- term5 : S = sin (x )/ x ** S (2 )
135
- term6 : S = sin (x )** S (2 )/ x ** S (2 )
136
- term7 : S = sin (sin (sin (x )))/ sin (x )
137
- term8 : S = S (2 )* log (x + S (1 ))/ x
138
- term9 : S = sin ((log (x + S (1 ))/ x )* x )/ x
139
130
140
131
l1 : list [S ] = [S (1 ), S (0 )]
141
132
l2 : list [S ] = [S (2 ), S (0 )]
142
133
l3 : list [S ] = [S (1 ), S (1 )]
143
134
l4 : list [S ] = [S (1 ), S (- 1 )]
144
135
145
- if e == term1 :
136
+ if e == sin ( x ) / x :
146
137
return l1
147
- elif e == term2 :
138
+ elif e == S ( 2 ) * sin ( x ) / x :
148
139
return l2
149
- elif e == term3 :
140
+ elif e == sin ( S ( 2 ) * x ) / x :
150
141
return l2
151
- elif e == term4 :
142
+ elif e == sin ( x ) ** S ( 2 ) / x :
152
143
return l3
153
- elif e == term5 :
144
+ elif e == sin ( x ) / x ** S ( 2 ) :
154
145
return l4
155
- elif e == term6 :
146
+ elif e == sin ( x ) ** S ( 2 ) / x ** S ( 2 ) :
156
147
return l1
157
- elif e == term7 :
148
+ elif e == sin ( sin ( sin ( x ))) / sin ( x ) :
158
149
return l1
159
- elif e == term8 :
150
+ elif e == S ( 2 ) * log ( x + S ( 1 )) / x :
160
151
return l2
161
- elif e == term9 :
152
+ elif e == sin (( log ( x + S ( 1 )) / x ) * x ) / x :
162
153
return l1
163
154
raise NotImplementedError (f"Can't calculate the leadterm of { e } ." )
164
155
You can’t perform that action at this time.
0 commit comments