I want to make a 3D plot of two variable i1 and b1. The dependent variable results from a pay-off function
payoff1 := q1*((1 + g1)*b1*10000 - i1*10000) - (1 - q1)*(1 - d)*i1*10000
The problem is that q1 is actually the result from an integral calculation:
q1 := NIntegrate[combo1, {x, 0, 2000000}]
where "combo1" is a function that is defined higher and that is also dependent on i1 and b1.
I want to make this plot:
Plot3D[payoff1, {i1, 0, 20}, {b1, 0, 50}]
So for every value of i1 and b1, it should make the q1-calculation, but what Mathematica does (because I think I have a bug in my code here) is to always take the initial q1 value.
How could I solve this problem?
Thank you!
The entire code can be found here: First some parameters are introduced:
mue = 0.25
mui = 0.25
lambdae = 0.25
lambdai = 0.25
sigmap = 0.05
betae = 0.05
betai = 0.05
gammae = 0.10
gammai = 0.50
d = 0.8
experience1 = 7
experience2 = 6
Some functions are added:
g1 := betae*Exp[-mue*experience1] + betai*Exp[-mui*i1]
g2 := betae*Exp[-mue*experience2] + betai*Exp[-mui*i2]
sd1 := Sqrt[sigmap^2 + (gammae*Exp[-lambdae*experience1])^2 + (gammai*
Exp[-lambdai*i1])^2]*1000000
sd2 := Sqrt[sigmap^2 + (gammae*Exp[-lambdae*experience2])^2 + (gammai*
Exp[-lambdai*i2])^2]*1000000
bid1 := NormalDistribution[1000000*(1 + g1)*(1 + b1/100), sd1]
bid2 := NormalDistribution[1000000*(1 + b2/100) (1 + g2), sd2]
pbid1 := PDF[bid1, x]
pbid2 := PDF[bid2, x]
cbid1 := 1 - CDF[bid1, x]
cbid2 := 1 - CDF[bid2, x]
combo1 := pbid1*cbid2
q1 := NIntegrate[combo1, {x, 0, 2000000}]
combo2 := pbid2*cbid1
q2 := NIntegrate[combo2, {x, 0, 2000000}]
payoff1 := q1*((1 + g1)*b1*10000 - i1*10000) - (1 - q1)*(1 - d)*i1*10000
payoff2 := q2*((1 + g2)*b2*10000 - i2*10000) - (1 - q2)*(1 - d)*i2*10000
And now I want to make the plot for payoff1, given that (example):
i2 = 5
b2 = 10
Plot3D[payoff1, {i1, 0, 20}, {b1, 0, 50}]
If I make a plot for q1, I think I get the right one, but the one of the pay-off does not seem correct/logic.
Afterwards I will need to solve the system of equations (given that now i1,i2,b1 and b2 are unknown) There is also still a problem, but that might be caused by the above stated problem.
eq1 := D[payoff1, i1]
eq2 := D[payoff1, b1]
eq3 := D[payoff2, i2]
eq4 := D[payoff2, b2]
FindRoot[{eq1 == 0, eq2 == 0, eq3 == 0, eq4 == 0} , {{i1, 5}, {i2, 5}, {b1, 5}, {b2, 5}}]
I am very new to the world of Mathematica, so thank you for any help.
Regards,
Dennis
New code:
I implemented the new code now, but than a numerical integration error occurs and there is already a problem by making pbid1 (a normal probability distribution function).
Here is the new code (so, i2 and b2 are given; i1 and b1 are unknown):
The parameters that were introduced are still te same. The functions become:
g1[i1_] := betae*Exp[-mue*experience1] + betai*Exp[-mui*i1]
g2 := betae*Exp[-mue*experience2] + betai*Exp[-mui*i2]
sd1[i1_] := Sqrt[sigmap^2 + (gammae*Exp[-lambdae*experience1])^2 + (gammai*Exp[-lambdai*i1])^2]*1000000
sd2 := Sqrt[sigmap^2 + (gammae*Exp[-lambdae*experience2])^2 + (gammai*Exp[-lambdai*i2])^2]*1000000
bid1[b1_, g1_, sd1_] := NormalDistribution[1000000*(1 + g1[i1])*(1 + b1/100), sd1[i1]]
bid2 := NormalDistribution[1000000*(1 + b2/100) (1 + g2), sd2]
A problem occurs already in this statement:
pbid1[bid1_, x_] := PDF[bid1[b1, g1[i1], sd1[i1]], x]
The probability density function pbid2 causes no problems:
pbid2[x_] := PDF[bid2, x]
The remainder of the code:
cbid1[bid1_, x_] := 1 - CDF[bid1[b1, g1[i1], sd1[i1]], x]
cbid2[x_] := 1 - CDF[bid2, x]
combo1[pbid1_, cbid2_] := pbid1[bid1[b1, g1[i1], sd1[i1]], x]*cbid2[x]
q1[combo1_] := NIntegrate[combo1[pbid1[bid1[b1, g1[i1], sd1[i1]], x], cbid2[x]], {x, 0, 2000000}]
When Evaluating the integral, I get the non-numerical values error.
And finally, for the pay-off, I was thinking of this formula:
payoff1[combo1_, g1_, b1_, i1_] := q1[combo1[pbid1[bid1[b1, g1[i1], sd1[i1]], x], cbid2[x]]]*((1 + g1[i1])*b1*10000 - i1*10000) - (1 - q1[combo1[pbid1[bid1[b1, g1[i1], sd1[i1]], x], cbid2[x]]])*(1 - d)*i1*10000
I have not really a clue where something is going wrong.