Integration komplexer Zahlen < Mathematica < Mathe-Software < Mathe < Vorhilfe
|
Aufgabe | P[j_] := 1/2 +
[mm] 1/\[Pi] [/mm] NIntegrate[
Re[(Exp[-I y Log[L]] f[j, y])/(I y)], {y, 0, [mm] \[Infinity]}, [/mm]
AccuracyGoal -> 5];
7574.46 E^(
0.212256 - Ln[1.84322]/
2) (1/2 +
NIntegrate[
Re[(Exp[-I y Log[5200]] f$35619[1, y])/(I y)], {y,
0, [mm] \[Infinity]}, [/mm] AccuracyGoal -> [mm] 5]/\[Pi]) [/mm] -
4611.99 (1/2 +
NIntegrate[
Re[(Exp[-I y Log[5200]] f$35619[2, y])/(I y)], {y,
0, [mm] \[Infinity]}, [/mm] AccuracyGoal -> [mm] 5]/\[Pi]) [/mm] |
Hallo,
ich muss im Rahmen einer Implementierung eines Modells am Ende eine Integration des Realteils einer Funktion durchführen. Ich versuche das mithilfe der Funktion NIntegrate[] zu approximieren.
Oben ist der eingegebene Input und unten der Output. Warum kann er mir keine genaue Zahl auswerfen?
Ich habe diese Frage in keinem Forum auf anderen Internetseiten gestellt.
|
|
|
|
Hi,
das Auftauchen von f$35619 deutet darauf hin, dass bei der Definition/Verwendung der Funktion f etwas schief gelaufen ist.
Außerdem taucht bei Dir die Funktion Ln auf. Der Logarithmus zur Basis E ist in Mathematica Log.
Kannst Du die Definition von f nachreichen? Oder soll f unbestimmt bleiben? Dann wäre allerdings NIntegrate fehl am Platz
Gruß,
Peter
|
|
|
|
|
Aufgabe | QuantoCallMod[S0_, L_, ry_, T_, t_, [mm] \[Upsilon]0_] [/mm] :=
[mm] Module[{\[Theta]m, St, s1, s2,
s3, \[Gamma]1, \[Gamma]2, \[Gamma]3, \[Psi], \[Xi], a, b, c, d, q,
w1, w2, w3, \[Gamma]w1, \[Gamma]w2, \[Gamma]w3, \[Xi]w, \[Psi]w,
aw, bw, cw, dw, f, P},
[/mm]
[mm] \[Theta]m [/mm] = [mm] \[Theta] [/mm] - [mm] (\[Rho]vfx \[Sigma]fx \[Delta])/\[Kappa];
[/mm]
St = S0 Exp[(rx - div) (T - t)];
s1 = -(1/2) (((2 [mm] \[Kappa] \[Rho]sv)/ \[Delta]) [/mm] - [mm] \[Rho]sv);
[/mm]
s2 = [mm] (\[Kappa] \[Theta]m \[Rho]sv)/ \[Delta] [/mm] + [mm] \[Rho]sfx \[Sigma]fx [/mm] ;
s3 = [mm] \[Rho]sv/ [/mm] (2 [mm] \[Delta]) [/mm] ;
[mm] \[Gamma]1 [/mm] = Sqrt[2 [mm] \[Delta]^2 [/mm] s1 + [mm] \[Kappa]^2];
[/mm]
[mm] \[Gamma]2 [/mm] = [mm] (1/\[Gamma]1) (\[Kappa] [/mm] - 2 [mm] \[Delta]^2 [/mm] s3);
[mm] \[Gamma]3 [/mm] = [mm] \[Kappa]^2 \[Theta] [/mm] - s2 [mm] \[Delta]^2;
[/mm]
[mm] \[Psi] [/mm] = [mm] Sinh[\[Gamma]1 [/mm] (T - t)] + [mm] \[Gamma]2 Cosh[\[Gamma]1 [/mm] (T - t)];
[mm] \[Xi] [/mm] = [mm] Cosh[\[Gamma]1 [/mm] (T - t)] + [mm] \[Gamma]2 Sinh[\[Gamma]1 [/mm] (T - t)];
a = [mm] (\[Kappa]/\[Delta]^2) [/mm] - [mm] (\[Gamma]1/\[Delta]^2) \[Psi]/\[Xi];
[/mm]
b = [mm] (\[Kappa] \[Theta] \[Gamma]1 [/mm] - [mm] \[Gamma]2 \[Gamma]3 [/mm] + [mm] \[Gamma]3 \
[/mm]
[mm] \[Psi]/(\[Delta]^2 \[Gamma]1 \[Xi])) [/mm] - [mm] (\[Kappa] \[Theta])/\[Delta]^2;
[/mm]
c = -(1/2) [mm] Ln[\[Xi]] [/mm] + [mm] (\[Kappa]/2) [/mm] (T -
t) + [mm] ((\[Kappa]^2 \[Theta]^2 \[Gamma]1^2 [/mm] - [mm] \[Gamma]3^2)/(2 \
[/mm]
[mm] \[Delta]^2 \[Gamma]1^3)) (Sinh[\[Gamma]1 [/mm] (T -
[mm] t)]/\[Xi] [/mm] - [mm] \[Gamma]1 [/mm] (T -
t)) + [mm] (((\[Kappa] \[Theta] \[Gamma]1 [/mm] - [mm] \[Gamma]2 \[Gamma]3) \
[/mm]
[mm] \[Gamma]3)/(\[Delta]^2 \[Gamma]1^3)) (((Cosh[\[Gamma]1 [/mm] (T - t)] -
1) - [mm] 1)/\[Xi]);
[/mm]
d = Exp[(1/2) a [mm] \[Upsilon]0^2 [/mm] + b [mm] \[Upsilon]0 [/mm] + c];
q = St Exp[(rx - div) (T -
t) - [mm] (\[Rho]sv/(2 \[Delta])) (\[Upsilon]0^2 [/mm] + [mm] \[Delta]^2 [/mm] (T -
t))] d;
w1[j_, y_] :=
Piecewise[{{-(1 + I y)/
2 ((1 + I y) (1 - [mm] \[Rho]sv^2) [/mm] -
1 + ((2 [mm] \[Kappa] \[Rho]sv)/\[Delta])), [/mm]
j == 1}, [mm] {y^2/2 (1 - \[Rho]sv^2) + (I y)/
2 (1 - ((2 \[Kappa] \[Rho]sv)/\[Delta])), j == 2}}];
[/mm]
w2[j_, y_] :=
Piecewise[{{(1 +
I y) [mm] (((\[Kappa] \[Theta]m \[Rho]sv)/\[Delta]) [/mm] + [mm] \[Rho]sfx \
[/mm]
[mm] \[Sigma]fx), [/mm] j == 1}, {
I y [mm] (((\[Kappa] \[Theta]m \[Rho]sv)/\[Delta]) [/mm] + [mm] \[Rho]sfx \
[/mm]
[mm] \[Sigma]fx), [/mm] j == 2}}];
w3[j_, y_] :=
Piecewise[{{(1 + I y) [mm] (\[Rho]sv/(2 \[Delta])), [/mm]
j == 1}, {I y [mm] (\[Rho]sv/(2 \[Delta])), [/mm] j == 2}}];
[mm] \[Gamma]w1[j_, [/mm] y_] := Sqrt[ 2 [mm] \[Delta]^2 [/mm] w1[j, y] + [mm] \[Kappa]^2];
[/mm]
[mm] \[Gamma]w2[j_, [/mm] y_] :=
[mm] 1/\[Gamma]w1[j, [/mm] y] [mm] (\[Kappa] [/mm] - 2 [mm] \[Delta]^2 [/mm] w3[j, y]);
[mm] \[Gamma]w3[j_, [/mm] y_] := [mm] \[Kappa]^2 \[Theta] [/mm] - w2[j, y] [mm] \[Delta]^2;
[/mm]
[mm] \[Psi]w[j_, [/mm] y_] :=
[mm] Sinh[\[Gamma]w1[j, [/mm] y] (T - t)] + [mm] \[Gamma]w2[j, [/mm]
y] [mm] Cosh[\[Gamma]w1[j, [/mm] y] (T - t)];
[mm] \[Xi]w[j_, [/mm] y_] :=
[mm] Cosh[\[Gamma]w1[j, [/mm] y] (T - t)] + [mm] \[Gamma]w2[j, [/mm]
y] [mm] Sinh[\[Gamma]w1[j, [/mm] y] (T - t)];
aw[j_, y_] := [mm] (\[Kappa]/\[Delta]^2) [/mm] - [mm] (\[Gamma]w1[j, [/mm]
[mm] y]/\[Delta]^2) \[Psi]w[j, y]/\[Xi]w[j, [/mm] y];
bw[j_, y_] := [mm] (\[Kappa] \[Theta] \[Gamma]w1[j, [/mm] y] - [mm] \[Gamma]w2[j, [/mm]
y] [mm] \[Gamma]w3[j, [/mm] y] + [mm] \[Gamma]w3[j, [/mm] y] [mm] \[Psi]w[j, [/mm]
[mm] y])/(\[Delta]^2 \[Gamma]w1[j, [/mm] y] [mm] \[Xi]w[j, [/mm]
y]) - [mm] (\[Kappa] \[Theta])/\[Delta]^2;
[/mm]
cw[j_, y_] := -(1/2) [mm] Ln[\[Xi]w[j, [/mm] y]] + [mm] (\[Kappa]/2) [/mm] (T -
t) + [mm] ((\[Kappa]^2 \[Theta]^2 \[Gamma]w1[j, y]^2 [/mm] - [mm] \[Gamma]w3[j,
[/mm]
[mm] y]^2)/(2 \[Delta]^2 \[Gamma]w1[j, y]^3)) (Sinh[\[Gamma]w1[
[/mm]
j, y] (T - [mm] t)]/\[Xi]w[j, [/mm] y] - [mm] \[Gamma]w1[j, [/mm]
y] (T - t)) + [mm] (((\[Kappa] \[Theta] \[Gamma]w1[j, [/mm]
y] - [mm] \[Gamma]w2[j, [/mm] y] [mm] \[Gamma]w3[j, [/mm] y]) [mm] \[Gamma]w3[j, [/mm]
[mm] y])/(\[Delta]^2 \[Gamma]w1[j, [/mm]
[mm] y]^3)) (((Cosh[\[Gamma]w1 [/mm] (T - t)] - 1) - [mm] 1)/\[Xi]w[j, [/mm] y]);
dw[j_, y_] :=
Exp[(1/2) aw[j, y] [mm] \[Upsilon]0^2 [/mm] + bw[j, y] [mm] \[Upsilon]0 [/mm] + cw[j, y]];
f[j_, y_] :=
Piecewise[{{(Exp[(1 + I y) ((rx - div) (T - t) + Ln[St]) - (1 +
I y) [mm] ((\[Rho]sv)/
[/mm]
2 [mm] \[Delta]) (\[Upsilon]0^2 [/mm] + [mm] \[Delta]^2 [/mm] (T - t))]/
q) dw[j, y],
j == 1}, {Exp[((rx - div) (T - t) + Ln[St]) I y -
I y [mm] ((\[Rho]sv)/
[/mm]
2 [mm] \[Delta]) (\[Upsilon]0^2 [/mm] + [mm] \[Delta]^2 [/mm] (T - t))] dw[j,
y], j == 2}}];
P[j_] :=
1/2 + [mm] 1/\[Pi] [/mm] NIntegrate[
Re[(Exp[-I y Ln[L]] f[j, y])/(I y)], {y, 0, [mm] \[Infinity]}, [/mm]
AccuracyGoal -> 5];
q Exp[-ry (T - t)] P[1] - L Exp[-ry (T - t)] P[2 |
also mein betreuer meinte, dass das problem evtl. am NIntegrate hängt. Ich solle versuchen das mithilfe des gauss-laguerre verfahren zu lösen, weiß aber noch nicht wie ich das implementiert kriege.
|
|
|
|
|
Status: |
(Mitteilung) Reaktion unnötig | Datum: | 09:20 Fr 29.03.2013 | Autor: | matux |
$MATUXTEXT(ueberfaellige_frage)
|
|
|
|