0
|
3144 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
GROUPS:

# Why does my RegionFunction restriction not work with a boundary y=x-c?

Posted 10 years ago
 I have desperately tried for hours to understand what I did wrong with this short and pretty basic code: c=1 Plot3D[{(c^2*Pi)/(x^2*Pi)}, {x, 1, 3}, {y, 0, c}, RegionFunction -> Function[{x, y, z}, 0 <= y <= x - c]] The graph I get is this one: Looking at the z axis, it becomes quite obvious that this doesn't make any sense. If c=1, then the value of z should be z=1 for x=1. The strange thing is that the Plot works totally fine if I a) delete the Region restriction or b) remove the power of 2 from x, then it's just a nicely behaving plane: I have no idea what's going on. Does anybody know how I can implement the restriction I want without messing up the graph? And what's the reason for this strange behaviour? Thanks in advance!
2 Replies
Sort By:
Posted 10 years ago
 In plotting functions Mathematica makes a determination of how much of the function to show according to some algorithm that determines where the interesting parts of the function are. To override this use the PlotRange option. In your case this will show the full graph: Plot3D[{(c^2*Pi)/(x^2*Pi)}, {x, 1, 3}, {y, 0, c}, RegionFunction -> Function[{x, y, z}, 0 <= y <= x - c], PlotRange -> All] 
Posted 10 years ago
 Thank you so much! I had the function plotted with several others via Show[], and I thought that since these other ones have a bigger range, my function would adjust to that range - obviously it does that before being put into the Show-Box, I didn't think of that. Now it works!