help visualizing discontinous function
- To: mathgroup at smc.vnet.net
- Subject: [mg42477] help visualizing discontinous function
- From: "Michael Alfaro" <malfaro at ucdavis.edu>
- Date: Thu, 10 Jul 2003 03:37:00 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
I am trying to visualize contours for the function uKT across ranges specified for
three variables, x,y, and z. I am only interested in real values for uKT and I know
that uKT does not evaluate to real for some combinations of variables for this
length. When I use ContourPlot3D, I get error messages of the flavor below:
CompiledFunction::cfn: Numerical error encountered at instruction 52; \
proceeding with uncompiled evaluation.
General::stop: Further output of CompiledFunction::cfn will be suppressed \
during this calculation.
ContourPlot3D::gval: Function value -0.249596-0.350995 \[ImaginaryI] at grid \
point x = 0.23`, y = 0.34`, z = 0.32` is not a real number.
And I notice that the shape of the plotted contours is strongly influenced by the
number of points that I select to plot. What does Contour3DPlot do when it
encounters nonreal values of uKT? I would like to do three things
1) plot, as completely possible the contour uKT = 1.0 for the ranges specified (in the
pasted example below) for x, y, and z
2) calculate the relative surface areas for contours in this space (say uKT = 1.0 and
uKT = 0.6)
3) for a specific contour (uKT = 1.0) find the maximum and minimum slope for x,y,
and z. In other words, find the point on the contour where changes a small change
in any dimension (or spread out over x,y,and z) has the largest and smallest effect
on uKT.
I am attaching uKT below
Any help would be much appreciated.
Thanks!
Michael
(as plain text)
In[46]:=
Clear[uDiagonal, uAngYZ, uAngW, uAngX, uAngY, uAngZ, y, x]
uDiagonal[input_, fixed_, angleA_] :=
Sqrt[input^2 + fixed^2 - 2*input*fixed*
Cos[angleA*(Pi/180)]];
uAngYZ[fixed_, input_, coupler_, output_, angleA_] :=
ArcCos[(coupler^2 + output^2 - uDiagonal[input, fixed, angleA]^2)/(2*coupler*
output)]*
(180/Pi);
uAngW[fixed_, input_, coupler_, output_, angleA_] :=
ArcCos[(uDiagonal[input, fixed, angleA]^2 + fixed^2 - input^2)/
(2*
uDiagonal[input, fixed, angleA]*fixed)]*(180/Pi);
uAngX[fixed_, input_, coupler_,
output_, angleA_] :=
ArcCos[(coupler^2 + uDiagonal[input, fixed, angleA]^2 -
output^2)/
(2*coupler*uDiagonal[input, fixed, angleA])]*(180/Pi);
uAngY[f_, i_,
c_, o_, A_] := 90 - uAngW[f, i, c, o, A] - uAngX[f, i, c, o, A];
uAngZ[f_, i_, c_, o_, A_]
:= uAngYZ[f, i, c, o, A] - uAngY[f, i, c, o, A];
uKT[f_, i_, c_, o_, A_] := (uAngZ[f, i, c, o,
A + 30] - uAngZ[f, i, c, o, A])/30
<< "Graphics`ContourPlot3D`"
ContourPlot3D[uKT[1, x, y, z, 30], {x, 0.23, 0.68}, {y, 0.34, 0.92}, {z, 0.32, 0.73},
Contours -> {0.8, 1., 1.2}, Lighting -> False, Axes -> True,
ContourStyle ->
{{RGBColor[0, 1, 0]}, {RGBColor[1, 0, 0]}, {RGBColor[0, 0, 1]}},
BoxRatios -> {1,
1, 1}, ViewPoint -> {-2.633, -1.328, 1.659}, PlotPoints -> 4,
AxesLabel -> {input,
coupler, output}];
(as mathematica standard input)
\!\(Clear[uDiagonal, uAngYZ, uAngW, uAngX, uAngY, uAngZ, y, x]\n
uDiagonal[input_, fixed_,
angleA_] := \@\(input\^2 + fixed\^2 - 2\ input\ fixed\
Cos[\(angleA\ \
\[Pi]\)\/180]\); \n
uAngYZ[fixed_, input_, coupler_, output_,
angleA_] := \(ArcCos[\(coupler\^2 + output\^2 - uDiagonal[input, fixed, \
angleA]\^2\
)\/\(2\ coupler\ output\)]\ 180\)\/\[Pi]; \n
uAngW[fixed_, input_, coupler_, output_,
angleA_] := \(ArcCos[\(uDiagonal[input, fixed, angleA]\^2 + fixed\^2 - \
input\^2\)\/\
(2\ uDiagonal[input, fixed, angleA]\ fixed\)]\ 180\)\/\[Pi]; \n
uAngX[fixed_, input_,
coupler_, output_,
angleA_] := \(ArcCos[\(coupler\^2 + uDiagonal[input, fixed,
angleA]\^2 \
- output\^2\)\/\(2\ coupler\ uDiagonal[input, fixed, angleA]\)]\ \
180\)\/\
[Pi]; \n
uAngY[f_, i_, c_, o_, A_] :=
90 - uAngW[f, i, c, o, A] - uAngX[f, i, c, o, A]; \
n
uAngZ[f_, i_, c_, o_, A_] :=
uAngYZ[f, i, c, o, A] - uAngY[f, i, c, o, A]; \n
uKT[f_, i_, c_, o_, A_] :=
1\/30\ \((uAngZ[f, i, c, o, A + 30] - uAngZ[f, i, c, o, A])\)\n
<< "\<Graphics`ContourPlot3D`\>"\n
ContourPlot3D[
uKT[1, x, y, z, 30], {x,
0.23, 0.68}, {y, 0.34, 0.92}, {z, 0.32, 0.73},
Contours -> {0.8, 1. , 1.2}, Lighting ->
False, Axes -> True,
ContourStyle -> {{RGBColor[0, 1, 0]}, {RGBColor[1, 0, 0]},
{RGBColor[0,
0, 1]}}, BoxRatios -> {1, 1, 1},
ViewPoint -> {\(-2.633\), \(-
1.328\), 1.659}, PlotPoints -> 4,
AxesLabel -> {input, coupler, output}]; \)