Group Abstract Group Abstract

Message Boards Message Boards

0
|
6.4K Views
|
6 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How do I perform this Plot3D?

Posted 10 years ago
POSTED BY: Q Huang
6 Replies
Posted 10 years ago

Huang,

You're right on that point. The plot should come out OK in spite of the error in the integration. My comment was too hasty. René

POSTED BY: Rene Samson
Posted 10 years ago

Hi Huang,

Also, in the definition of c, you call Log as Log() rather than Log[ ]. A good way to begin troubleshooting is to evaluate jointf1 with 4 numerical arguments, which is what Plot3D will do. It must return a number.

Best, David

POSTED BY: David Keith

Hi Rene,

Thank you for your help. It was indeed a mistake.

But what I was trying to plot is a function that is well defined. I suspect that the definition of jointd1 should not affect the Plot3D of jointf1, or it is not? Thanks.

Huang

POSTED BY: Q Huang
Posted 10 years ago

Huang,

I had a very cursory look at your code. It seems to me that where things go wrong is in the statement where you define jointd1: you integrate over jointf1 which you write here as a function of 2 variables, while three lines up it's defined as a function of 4 variables. I think this is where your code goes wrong.

René

POSTED BY: Rene Samson
abarS := (-2 thB + 
     2 thB^2 xi + \[Sqrt]((2 thB - 2 thB^2 xi)^2 - 
        4 (-thB + thB^2 xi) (2 - 2 thB - xi - 2 thB xi + 3 thB^2 xi + 
           2 thB xi^2 - 2 thB^2 xi^2 + 2 thB Log[thB] - 
           4 thB xi Log[thB] - 2 thB^2 xi Log[thB] + 
           2 thB xi^2 Log[thB] + 4 thB^2 xi^2 Log[thB] - 
           2 thB^2 xi^3 Log[thB] + 2 thB Log[1 - xi] - 
           4 thB xi Log[1 - xi] - 2 thB^2 xi Log[1 - xi] + 
           2 thB xi^2 Log[1 - xi] + 4 thB^2 xi^2 Log[1 - xi] - 
           2 thB^2 xi^3 Log[1 - xi] - 2 thB Log[1 - thB xi] + 
           4 thB xi Log[1 - thB xi] + 2 thB^2 xi Log[1 - thB xi] - 
           2 thB xi^2 Log[1 - thB xi] - 
           4 thB^2 xi^2 Log[1 - thB xi] + 
           2 thB^2 xi^3 Log[1 - thB xi])))/(2 (2 - 2 thB - xi - 
       2 thB xi + 3 thB^2 xi + 2 thB xi^2 - 2 thB^2 xi^2 + 
       2 thB Log[thB] - 4 thB xi Log[thB] - 2 thB^2 xi Log[thB] + 
       2 thB xi^2 Log[thB] + 4 thB^2 xi^2 Log[thB] - 
       2 thB^2 xi^3 Log[thB] + 2 thB Log[1 - xi] - 
       4 thB xi Log[1 - xi] - 2 thB^2 xi Log[1 - xi] + 
       2 thB xi^2 Log[1 - xi] + 4 thB^2 xi^2 Log[1 - xi] - 
       2 thB^2 xi^3 Log[1 - xi] - 2 thB Log[1 - thB xi] + 
       4 thB xi Log[1 - thB xi] + 2 thB^2 xi Log[1 - thB xi] - 
       2 thB xi^2 Log[1 - thB xi] - 4 thB^2 xi^2 Log[1 - thB xi] + 
       2 thB^2 xi^3 Log[1 - thB xi]));

xbar := abarS*xi*(1 - thB)/(1 - xi*thB);
c := 1/(abarS*xi*(1 - thB) + xi*thB - 
     abarS*thB*xi*(1 - xi)*Log (thB*(1 - xi)/(1 - xi*thB)));
f1[x_, thB_, xi_] := 
 Piecewise[{{c*(1 - abarS*thB*xi*(1 - xi)/(abarS*xi - x)), 
    0 <= x <= xbar}, {xbar <= x <= 1, c*xi*thB}}, 0]
jointf1[x1_, x2_, thB_, xi_] := 
  Piecewise[{{1 >= x1 > x2, 2*f1[x1, thB, xi]*f1[x2, thB, xi]}}, 0];
jointd1[a1_, a2_] := 
  Integrate[jointf1[x1, x2], {x2, 0, a2}, {x1, 0, a1}, 
   Assumptions -> 
    0 < thB < 1 && 0 < xi < 1 && 0 < xbar < 1 && 0 < abarS < 1];
Plot3D[jointf1[x1, x2, 0.5, 0.91], {x1, 0, 1}, {x2, 0, 1}]

Thank you for your reply.

Let me explain: abarS, xbar and c are expressions of thB and xi. And jointf1 is defined as a function of four variables.

But when I try to plot the jointf1 with thB=0.5, xi=0.91, the code gives empty plot. Is there a problem in my code?

Thanks again!

POSTED BY: Q Huang
Posted 10 years ago

Your statement looks OK to me. Except you say in the text you want to plot p(x,y,5,4]) -- incorrect syntax and different symbol -- than your code, which is f[x,y,5,4] and looks correct. Maybe you could post your code in a code block?

POSTED BY: David Keith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard