Is it possible to solve a system of integral equations in Mathematica? More specifically, I would like to obtain numerical solutions for $\mu$ and $\sigma$ from the following system:

f[x_] := (Sqrt[2*Pi]*σ*x*(1 - x))^(-1)*Exp[-0.5*σ^(-2)*(Log[x/(1 - x)] - μ)^2]
g[μ_, σ_] := Integrate[x*f[x], {x, 0, 1}]
h[μ_, σ_] := Integrate[x^2*f[x],{x, 0, 1}]
Solve[{g[μ, σ] == 0.3, h[μ, σ] == 0.1}, {μ, σ}]

The last line of code is a naive attempt to solve the system that does not run.

Help would be greatly appreciated!

  • $\begingroup$ Note that Mathematica uses Log[] for the natural logarithm. $\endgroup$
    – Feyre
    Jul 5 '16 at 9:22
  • $\begingroup$ Oops! Have corrected it now. $\endgroup$
    – Miguel
    Jul 5 '16 at 9:29
f[x_, μ_, σ_] := 
  (Sqrt[2*Pi]*σ*x*(1 - x))^(-1)*Exp[-0.5*σ^(-2)*(Log[x/(1 - x)] - μ)^2]
g[μ_?NumericQ, σ_?NumericQ] := NIntegrate[x*f[x, μ, σ], {x, 0, 1}]
h[μ_?NumericQ, σ_?NumericQ] := NIntegrate[x^2*f[x, μ, σ], {x, 0, 1}]

FindRoot[{g[μ, σ] == 0.3, h[μ, σ] == 0.1}, {{μ, 1}, {σ, 1}}]
(*{μ -> -0.894192, σ -> 0.495778}*)
  • $\begingroup$ Thanks! This works! I assume I don't need to worry about the initial convergence warnings by NIntegrate? $\endgroup$
    – Miguel
    Jul 5 '16 at 9:46
  • $\begingroup$ @Miguel No, it is caused by symbolic expansion. If you feel this is annoying, first execute Clear[f,g,h] and then run my updated code, there should not be errors anymore. PS: that ?NumericQ prevents the equation from symbolic expansion, so NIntegrate won't complain. $\endgroup$
    – vapor
    Jul 5 '16 at 9:51
  • $\begingroup$ Thanks - that does get rid of the initial warnings. And changing the starting point for $\mu$ to 0 in your code gets rid of the remaining convergence warnings. Thanks again! $\endgroup$
    – Miguel
    Jul 5 '16 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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