Question: How can I evaluate procedure J2?


Why does the execution of procedure J2 in the attached file fire an error?
it looked to me as if I had built it the same way as J1.
 

restart:

# Basically I want do do something like that,

J1 := proc()
  local z:
  z := proc(u) fsolve(sqrt(x)=u, x) end proc:
  evalf(Int(''z''(u), u=0..1))
end proc:

J1();
  

.3333333333

(1)

# but when z is more complex finction of two arguments.
#
# Unfortunately a direct transposition of what worked above no longer works.

J2 := proc()
  local z:
   z := proc(q1, q2)
     exp(
       2*(
         fsolve(1/2+(1/2)*erf((1/2)*x*sqrt(2)) = q1, x)
         *
         fsolve(1/2+(1/2)*erf((1/2)*x*sqrt(2)) = q2, x)
       )
       -
       fsolve(1/2+(1/2)*erf((1/2)*x*sqrt(2)) = sqrt(q1), x)^2
       -
       fsolve(1/2+(1/2)*erf((1/2)*x*sqrt(2)) = sqrt(q2), x)^2
    )
  end proc:
  evalf(Int(''z''(q1, q2), q1=0..1, q2=0..1))
end proc:

J2();

Error, (in evalf/int) q1 is in the equation, and is not solved for

 

 

 

Download integration_issue.mw

Can you help me fix this issue?

Thanks in advance

Please Wait...