Skip to main content
1-Visitor
September 29, 2010
Solved

How to restrict domain and avoid 3-D graph errors of division by zero?

  • September 29, 2010
  • 8 replies
  • 6475 views

As an example, plotting the 3D surface Z(x,y):=2/(x^2-y^2). What's the method for restricting the domain to {(x,y)| x =/= y}? Can I plot this without converting from rectangular?

I'm trying to take advatage of Mathcad capabilities, but I can't track this one down.

Best answer by

I think that there are 2 issues causing confusion here:

the first is the discontinuity giving rise to some very large numbers which stop you seeing the finer detail as you move away from it - all that the plot shows are the peaks with values upto 10^???

The second is caused by the way that the points are sampled & I didn't (still don't) understand why some parts of the discontinuity ramped to infinity and other parts appeared to remain finite and relatively small.

Thought about changing "100 on error" to "100* sign(x^2-y^2) on error" which makes the plot more symetrical, though I think is mathematically wrong.

Debatable what the value should be as both x & y tend to 0.

Max() & Min() functions to clip the Z value to something sensible both +ve and -ve

And the plot is now set for the maximum 200 points per axis to show the most detail.

Hope this gives you a few ideas of the possibilities

Andy

8 replies

19-Tanzanite
September 30, 2010

If you are using the Quickplot feature you need to choose the start, end, and # of grids so that none of the calculated points falls on the singularity. In this case you can just change the number of grids for range 2 from 20 to 21.

12-Amethyst
September 30, 2010

Another option is add to the domain of the funciton all points in the plane (x,y) assigning an arbitrarie value when the function isn't continous.

Regards. Alvaro.

1-Visitor
October 1, 2010

I adjusted the variables' Grid #'s to differ (by one), yet it did not resolve the problem for the sample problem. As far as the second suggestion, I didn't understand the meaning behind the syntax. At any rate, the plot seemed to lack usefulness in describing the general behavior of the surface through x,y,z space.

Could someone unpack for me a little how, or whether, Mathcad represents asymptotic planes? And if I have to restrict the domain manually, how I can do that?

In another sample problem (attached) I overcame the division by zero problem in a different rational function only after adjusting start, end, and # grids so that x & y were different in each regard, but again, the plot looks lets than descriptive. Can I visualize these a better way than with QuickPlot?

Thanks for your time spelling it out for a relatively new user.

19-Tanzanite
October 1, 2010

I adjusted the variables' Grid #'s to differ (by one), yet it did not resolve the problem for the sample problem.

You have a singularity when x=y, so you must choose the start, end, and number of grids so that cannot happen. In the plot on the left you have the starting and ending values set the same for x and y, so regardless of the number of grids chosen it's going to fail. For Range 1 change the values to 2, 6, and 21 (as one example - there are an infinite number of possible combinations that will work of course).

As far as the second suggestion, I didn't understand the meaning behind the syntax.

When it encounters an error, i.e. when x=y, the function returns the value 25. I don't know why Alvaro chose that number. Try changing 25 to some very large value, say 10^6, and then in the plot properties turn off the autoscaling for the z-axis and manually set some limits (say -1 and 1 for example)

At any rate, the plot seemed to lack usefulness in describing the general behavior of the surface through x,y,z space.

In what way? It shows the surface in x,y,x space, so I'm not sure what you are expecting.

Could someone unpack for me a little how, or whether, Mathcad represents asymptotic planes?

What do you mean? You want Mathcad to plot the plane automatically when all you give it is the function? It can't do that. You will have to solve for the equation of the plane and then explicitly plot it.

And if I have to restrict the domain manually, how I can do that?

Again, I don't know what you mean. If you set the limits on the Quickplot tab that sets the domain over which the surface is plotted.

but again, the plot looks lets than descriptive. Can I visualize these a better way than with QuickPlot?

In what way does it not show what you are looking for? You can also use the CreateMesh function to plot surfaces, but it will not give you anything fundamentally different to Quickplot (because Quickplot uses the CreateMesh function!). Without a description of what you think the problem is there is no way to tell you how to improve it.