1
$\begingroup$

I have the following expression. I realize Mathematica has a little bit of trouble with Abs[] as it assumes variables to be complex and etc., but I am trying to compute an integral and it just keeps running without any output...

The expression is

Abs[-((20 Log[2])/Log[10]) + (
  20 Log[2/Abs[
     1 + (0. + 0.262217 I) f - 
      0.0343788 f^2 - (0. + 0.00278569 I) f^3 + 
      0.000139504 f^4 + (0. + 3.49311*10^-6 I) f^5]])/Log[10]]

And the integral to evaluate is

Integrate[ErrorButt, {f, 0, 1}, Assumptions -> f \[Element] Reals]

Any guess?

$\endgroup$
1
  • $\begingroup$ I'd just go with NIntegrate for this. $\endgroup$ Commented Jan 28, 2023 at 18:45

1 Answer 1

5
$\begingroup$
Clear["Global`*"]

Use ComplexExpand

expr = Assuming[Element[f, Reals],
  Abs[-((20 Log[2])/
          Log[10]) + (20 Log[
           2/Abs[1 + (0. + 0.262217 I) f - 
              0.0343788 f^2 - (0. + 0.00278569 I) f^3 + 
              0.000139504 f^4 + (0. + 3.49311*10^-6 I) f^5]])/Log[10]] // 
     Rationalize[#, 0] & // ComplexExpand // Simplify]

(1/Log[10])10 Log[(1 - (85947 f^2)/2500000 + (8719 f^4)/62500000)^2 + ((
     262217 f)/1000000 - (278569 f^3)/100000000 + (171923 f^5)/49217745791)^2]

The exact integral is

int = Integrate[expr, {f, 0, 1}]

(* (1/Log[10])10 (-10 + 
   Log[605596718724483025606799576062383049649/
     605596625186874553920250000000000000000] - 
   98435491582 RootSum[
     605596625186874553920250000000000000000 + 
       93921375003607187692937652250000 #1^2 - 
       399705884555840943078443405000 #1^4 + 
       8596710556978237869461280425 #1^6 - 46737404025411666287075776 #1^8 + 
       7389379482250000000000000000 #1^10 &, (-30761091119375000000000000000 \
Log[1 - #1] - 3816565488490199500000 Log[1 - #1] #1^2 + 
         12181761216365932500 Log[1 - #1] #1^4 - 
         174666889326537175 Log[1 - #1] #1^6 + 
         474802363195168 Log[
           1 - #1] #1^8)/(93921375003607187692937652250000 #1 - 
         799411769111681886156886810000 #1^3 + 
         25790131670934713608383841275 #1^5 - 
         186949616101646665148303104 #1^7 + 
         36946897411250000000000000000 #1^9) &] + 
   98435491582 RootSum[
     605596625186874553920250000000000000000 + 
       93921375003607187692937652250000 #1^2 - 
       399705884555840943078443405000 #1^4 + 
       8596710556978237869461280425 #1^6 - 46737404025411666287075776 #1^8 + 
       7389379482250000000000000000 #1^10 &, (-30761091119375000000000000000 \
Log[-#1] - 3816565488490199500000 Log[-#1] #1^2 + 
         12181761216365932500 Log[-#1] #1^4 - 
         174666889326537175 Log[-#1] #1^6 + 
         474802363195168 Log[-#1] #1^8)/(93921375003607187692937652250000 #1 \
- 799411769111681886156886810000 #1^3 + 25790131670934713608383841275 #1^5 - 
         186949616101646665148303104 #1^7 + 
         36946897411250000000000000000 #1^9) &]) *)

Its approximate numeric value is

int // N[#, 20] & // Chop[#, 10^-20] & // N

(* 2.23955*10^-7 *)

Comparing with numeric integration

int == NIntegrate[expr, {f, 0, 1}, WorkingPrecision -> 20]

(* True *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.