I have a problem with a calculation. I was not able to find a corresponding answer. I try to find a numerical calculation of a integral equation with parameters. In general I understand how to solve a simple problem if there isn't a integral. For example:
yy[a_, b_] := x^2 - a + b
gg[a_, b_] := x /. FindRoot[yy[a, b] == 0, {x, 1}]
gg[3, 1]
1.41421
It works with warning in more complicated examples:
Veffd2i[m_, T_] :=
4 - ((2 E^(-((m + Sqrt[4 + M^2])/
T)) )/((1 + E^(-((m + Sqrt[M^2 + 4])/T))) T \[Sqrt](4 + M)^2))
Veffd2i2[m_, T_] := M /. FindRoot[Veffd2i[m, T] == 0, {M, 0}]
Veffd2i2[1, -2]
The line search decreased the step size to within tolerance specified \ by AccuracyGoal and PrecisionGoal but was unable to find a sufficient \ decrease in the merit function. You may need more than \ MachinePrecision digits of working precision to meet these tolerances.
24992.6
But if I want to add a integration in my example, I face with the next one:
Veffd2i[m_?NumberQ, T_?NumberQ] :=
4 + Integrate[-((
2 E^(-((m + Sqrt[4 + (l + M)^2])/T))
l^2)/((1 + E^(-((m + Sqrt[(l + M)^2 + 4])/T))) T Sqrt[
4 + (l + M)^2])), {l, -100, 100}]
Veffd2i2[m_?NumberQ, T_?NumberQ] :=
M /. FindRoot[Veffd2i[m, T] == 0, {M, 0}]
Veffd2i2[1, -2]
And, Mathematica doesn't want to calculate more simple integral:
yyy[a_?NumberQ,b_?NumberQ]:=Integrate[E^(-E^(a+U^2+x)),{x,-1,0}]+b
ggg[a_?NumberQ, b_?NumberQ] := U /. FindRoot[yyy[a, b] == 0, {U, 0.1}]
ggg[1, -2]
FindRoot::nlnum: The function value {Undefined} is not a list of numbers with dimensions {1} at {U} = {0.1}. ReplaceAll::reps: {FindRoot[yyy[1,-2]==0,{U,0.1}]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing.
And I'd like to ask about is it possible to automatize process? That is if I will want to calculate thousand point: Veffd2i2[0,0], Veffd2i2[0,1], Veffd2i2[1, 0], ... rather than one point.

IntegratewithNIntegratein your code produces results you want/like? – Anton Antonov Jan 15 '17 at 14:29landM? Are they syntaxic errors ? – Valacar Jan 15 '17 at 14:41yyy, useIntegrate[E^(-E^(a + U^2 + x)), {x, -1, 0}, Assumptions -> {a, U} \[Element] Reals], or perhapsIntegrate[E^(-E^(a + U^2 + x)), {x, -1, 0}, GenerateConditions -> False]; also, to save time, use=instead of:=. – Michael E2 Jan 15 '17 at 16:30Veffd2i[m_?NumberQ, T_?NumberQ, M_?NumberQ] :=...(when usingNIntegrateas Anton recommended) eliminates theNIntegrateerrors one otherwise gets. – Michael E2 Jan 15 '17 at 16:36=instead of:=" the calculated time? And do you know why if I writeAssumptions -> {a, U}in last example, Mathematica tells that it is "Unknown option Assumptions in NIntegrate..."? – illuminato Jan 17 '17 at 09:29Set/=andSetDelayed/:=is that=evaluated the RHS (yourIntegrate, for instance) once and for all time when the definition is made; whereas:=will evaluate the RHS every time the function is invoked (see link). So with:=you reevaluate the integral every time, which is a time-consuming operation. Since the general integral can be found, it will be faster to do it only once.... – Michael E2 Jan 17 '17 at 11:59NIntegratedoes not have an optionAssumptions(butIntegratedoes). In general, numerical functions will not have anAssumptionsoption because such problems are numerically explicit/definite. Symbolic functions sometimes have the optionAssumptionsfor giving assumptions about symbolic parameters. – Michael E2 Jan 17 '17 at 12:04