# Solving an Integral equation

I would like to solve the equation $$\frac{2}{p}\int_0^1((1-u)^{1-p}+u^{1-p})^{\frac{1}{p}}\text{d}u=42$$ for p numerically.

I tried

NSolve[2/p*Integrate[(u^(1 - p) + (1 - u)^(1 - p))^(1/p), {u, 0, 1}] == 42, p]


and

FindRoot[2/p*Integrate[(u^(1 - p) + (1 - u)^(1 - p))^(1/p), {u, 0, 1}] == 42, {p, 0.08}]


and

h[p_?NumericQ] := 2/p*NIntegrate[((1 - u)^(1 - p) + u^(1 - p))^(1/p), {u, 0, 1}]
FindRoot[h[p] == 42, {p, 0, 1}]


(I know the answer is approximately 0.0804670), however I still would like to know how it is computed.

In both cases, I received errors:

NSolve::nsmet: This system cannot be solved with the methods available to NSolve


and

GCD::exact: "Argument 0.92 in GCD[0,0.92] is not an exact number.
FactorSquareFree::lrgexp: Exponent is out of bounds for function FactorSquareFree.
GCD::exact: "Argument 0.9195355178111501 in GCD[0,0.919536] is not an exact number.


How do I solve this equation? Preferably with as little Integral evaluations, because they are horribly slow.

EDIT nevermind, sorry. There was a typo in the third try. Thank you for your time >_<

-
add comment

## 1 Answer

Integrate evaluations are slow, but NIntegrate are reasonably quick. You'll need to define a function f that is valid only for numeric arguments.

f[p_?NumericQ] := 2/p*NIntegrate[(u^(1 - p) + (1 - u)^(1 - p))^(1/p), {u, 0, 1}];
FindRoot[f[p] == 42, {p, 0.08}]

(* Out: {p -> 0.0804672} *)

-
Oh I tried something similar aswell... I got a bunch of Infinite Expression errors however? I will add that to the OP –  CBenni Dec 24 '12 at 13:36
I found my typo in the third try (I thought that would not work, because it instantly threw dozens of errors at me) How do I improve the precision? AccuracyGoal and PrecisionGoal do not change the output? –  CBenni Dec 24 '12 at 13:40
add comment