@@ -112,6 +112,8 @@ function ∂(x)
112112 return isequal (d, 0 ) ? 1 : d
113113end
114114
115+ @syms 𝛷 (x)
116+
115117partial_int_rules = [
116118 # trigonometric functions
117119 @rule 𝛷 (sin (~ x)) => (cos (~ x) + si (~ x), ∂ (~ x))
@@ -128,19 +130,19 @@ partial_int_rules = [
128130 @rule 𝛷 (sech (~ x)) => (atan (sinh (~ x)), ∂ (~ x))
129131 @rule 𝛷 (coth (~ x)) => (log (sinh (~ x)), ∂ (~ x))
130132 # 1/trigonometric functions
131- @rule 𝛷 (1 / sin (~ x)) => (log (csc (~ x) + cot (~ x)), ∂ (~ x))
132- @rule 𝛷 (1 / cos (~ x)) => (log (sec (~ x) + tan (~ x)), ∂ (~ x))
133- @rule 𝛷 (1 / tan (~ x)) => (log (sin (~ x)), ∂ (~ x))
134- @rule 𝛷 (1 / csc (~ x)) => (cos (~ x), ∂ (~ x))
135- @rule 𝛷 (1 / sec (~ x)) => (sin (~ x), ∂ (~ x))
136- @rule 𝛷 (1 / cot (~ x)) => (log (cos (~ x)), ∂ (~ x))
133+ @rule 𝛷 (1 / sin (~ x)) => (log (csc (~ x) + cot (~ x)) + log ( sin ( ~ x)) , ∂ (~ x))
134+ @rule 𝛷 (1 / cos (~ x)) => (log (sec (~ x) + tan (~ x)) + log ( cos ( ~ x)) , ∂ (~ x))
135+ @rule 𝛷 (1 / tan (~ x)) => (log (sin (~ x)) + log ( tan ( ~ x)) , ∂ (~ x))
136+ @rule 𝛷 (1 / csc (~ x)) => (cos (~ x) + log ( csc ( ~ x)) , ∂ (~ x))
137+ @rule 𝛷 (1 / sec (~ x)) => (sin (~ x) + log ( sec ( ~ x)) , ∂ (~ x))
138+ @rule 𝛷 (1 / cot (~ x)) => (log (cos (~ x)) + log ( cot ( ~ x)) , ∂ (~ x))
137139 # 1/hyperbolic functions
138- @rule 𝛷 (1 / sinh (~ x)) => (log (tanh (~ x / 2 )), ∂ (~ x))
139- @rule 𝛷 (1 / cosh (~ x)) => (atan (sinh (~ x)), ∂ (~ x))
140- @rule 𝛷 (1 / tanh (~ x)) => (log (sinh (~ x)), ∂ (~ x))
141- @rule 𝛷 (1 / csch (~ x)) => (cosh (~ x), ∂ (~ x))
142- @rule 𝛷 (1 / sech (~ x)) => (sinh (~ x), ∂ (~ x))
143- @rule 𝛷 (1 / coth (~ x)) => (log (cosh (~ x)), ∂ (~ x))
140+ @rule 𝛷 (1 / sinh (~ x)) => (log (tanh (~ x / 2 )) + log ( sinh ( ~ x)) , ∂ (~ x))
141+ @rule 𝛷 (1 / cosh (~ x)) => (atan (sinh (~ x)) + log ( cosh ( ~ x)) , ∂ (~ x))
142+ @rule 𝛷 (1 / tanh (~ x)) => (log (sinh (~ x)) + log ( tanh ( ~ x)) , ∂ (~ x))
143+ @rule 𝛷 (1 / csch (~ x)) => (cosh (~ x) + log ( csch ( ~ x)) , ∂ (~ x))
144+ @rule 𝛷 (1 / sech (~ x)) => (sinh (~ x) + log ( sech ( ~ x)) , ∂ (~ x))
145+ @rule 𝛷 (1 / coth (~ x)) => (log (cosh (~ x)) + log ( coth ( ~ x)) , ∂ (~ x))
144146 # inverse trigonometric functions
145147 @rule 𝛷 (asin (~ x)) => (~ x * asin (~ x) + sqrt (1 - ~ x * ~ x), ∂ (~ x))
146148 @rule 𝛷 (acos (~ x)) => (~ x * acos (~ x) + sqrt (1 - ~ x * ~ x), ∂ (~ x))
@@ -168,15 +170,15 @@ partial_int_rules = [
168170 @rule 𝛷 (sqrt (~ x)) => (sum (candidate_sqrt (~ x, 0.5 ); init = one (~ x)), ∂ (~ x));
169171 @rule 𝛷 (1 / sqrt (~ x)) => (sum (candidate_sqrt (~ x, - 0.5 ); init = one (~ x)), ∂ (~ x));
170172 # rational functions
171- @rule 𝛷 (1 / ^ (~ x:: is_poly , ~ k)) => (sum (candidate_pow_minus (~ x, - ~ k);
173+ @rule 𝛷 (1 / ^ (~ x:: is_poly , ~ k:: is_pos_int )) => (sum (candidate_pow_minus (~ x, - ~ k);
172174 init = one (~ x)), 1 )
173175 @rule 𝛷 (1 / ~ x:: is_poly ) => (sum (candidate_pow_minus (~ x, - 1 );
174176 init = one (~ x)), 1 )
175177 @rule 𝛷 (^ (~ x, - 1 )) => (log (~ x), ∂ (~ x))
176178 @rule 𝛷 (^ (~ x, ~ k:: is_neg_int )) => (sum (^ (~ x, i) for i in (~ k + 1 ): - 1 ),
177179 ∂ (~ x))
178180 @rule 𝛷 (1 / ~ x) => (log (~ x), ∂ (~ x))
179- @rule 𝛷 (^ (~ x, ~ k)) => (sum (^ (~ x, i+ 1 ) for i= 1 : ~ k+ 1 ), ∂ (~ x))
181+ @rule 𝛷 (^ (~ x, ~ k:: is_pos_int )) => (sum (^ (~ x, i+ 1 ) for i= 1 : ~ k+ 1 ), ∂ (~ x))
180182 @rule 𝛷 (1 ) => (𝑥, 1 )
181183 @rule 𝛷 (~ x) => ((~ x + ^ (~ x, 2 )), ∂ (~ x))]
182184
0 commit comments