I'm trying to solve two nonlinear algebra equations for two unknown parameters, U and Tf. Since some terms in these equations contain integration, and the integration also contains U and Tf. The main problem I have encountered is that Mathematica function NIntegrate cannot get numerical results, even in FindRoot.
My code is as following:
(*Define functions*)
DI1[x_] :=
E^((Sqrt[K^2 + 2 K U^2 + 4 CC K U^2 + U^4] (-R - x))/(
2 U) + ((K - U^2) (R + x) - 2 U Log[R + x])/(2 U))
HypergeometricU[(
K Sqrt[K^2 + 2 K U^2 + 4 CC K U^2 + U^4] +
U^2 Sqrt[K^2 + 2 K U^2 + 4 CC K U^2 + U^4])/(
K^2 + 2 K U^2 + 4 CC K U^2 + U^4), 0, (
Sqrt[K^2 + 2 K U^2 + 4 CC K U^2 + U^4] (R + x))/U]
DI2[x_] :=
E^((Sqrt[K^2 + 2 K U^2 + 4 CC K U^2 + U^4] (-R - x))/(
2 U) + ((K - U^2) (R + x) - 2 U Log[R + x])/(2 U))
LaguerreL[-(K Sqrt[K^2 + 2 K U^2 + 4 CC K U^2 + U^4] +
U^2 Sqrt[K^2 + 2 K U^2 + 4 CC K U^2 + U^4])/(K^2 + 2 K U^2 +
4 CC K U^2 + U^4), -1, (
Sqrt[K^2 + 2 K U^2 + 4 CC K U^2 + U^4] (R + x))/U]
I1[x_] := NIntegrate[DI1[s], {s, x, ∞}]
I2[x_] := NIntegrate[DI2[s], {s, 0, x}]
(*Define these parameters for simplicity*)
a = Sqrt[K^2 + 2 K U^2 + 4 CC K U^2 + U^4]
C1 := (K Q (K + U^2) Gamma[(K + U^2)/a])/(a U)
C2 := (K Q (K + U^2) Gamma[(K + U^2)/a] DI1[0])/(a U DI2[0]) - (
K Tf (2 I1[0] - DI1[0]))/(U (I1[0] - DI1[0]) DI2[0])
C3 := (K Q (K + U^2) Gamma[(K + U^2)/a] I1[0])/(a U) - (Tf I1[0] )/(
I1[0] - DI1[0] )
(*Define equations*)
equ1[U_, Tf_] := -C1*(-U/K DI1'[0] + DI1[0]) +
C2*(-U/K DI2'[0] + DI2[0]) - (-Tf DI1[0])/(I1[0] - U/K DI1[0]) ==
1/Le Exp[-U*Le*R]/R^2 1/
Integrate[s^-2 Exp[-U*Le*s], {s, R, ∞}]
equ2[U_, Tf_] :=
1/Le Exp[-U*Le*R]/R^2 1/
Integrate[
s^-2 Exp[-U*Le*s], {s,
R, ∞}] == (σ + (1 - σ) Tf)^2 Exp[
Z/2 (Tf - 1)/(σ + (1 - σ) Tf)]
(*FInd roots of equ1 and equ2*)
Block[{K = 1, CC = 2, Q = 1, σ = 0.15, Z = 10, Le = 1, R = 1,
Tf = 0.8}, FindRoot[equ1[U, Tf], {U, 1}]]
(Edit)
I think the main problem is the definition of I1[x_] := NIntegrate[DI1[s], {s, x, ∞}]. While FindRoot function is running, NIntegrate encounters non-numerical results. But if I change the definition from NIntegrate to Integrate, this integration cannot be calculated out.
{}button above the edit window. The edit window help button?is also useful for learning how to format your questions and answers. You may also find this this meta Q&A helpful – Michael E2 Aug 11 '15 at 03:29