contourplot3d again
- To: mathgroup at smc.vnet.net
- Subject: [mg43538] contourplot3d again
- From: Jessica Lynch <jwlynch at ucdavis.edu>
- Date: Fri, 19 Sep 2003 03:42:02 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hello all,
I wrote yesterday asking for help with plotting this function. (I
would like to plot smooth contours of uKT but they end up jagged using
contourplot3d--original message is at the very bottom of this post).
I am posting the function that I am trying to plot as suggested by some
on the group.
Thanks for any help!
Michael
("raw" format, input format follows)
\!\(<< Graphics`Contourplot3D`\[IndentingNewLine]
Clear[uDiagonal, uAngYZ, uAngW, uAngX, uAngY, uAngZ,
y, x]\[IndentingNewLine]
\(uDiagonal[input_, fixed_, angleA_] := ¡î\((\((input\^2 + fixed\^2)\)
- \
\((2*input*
fixed\ *Cos[angleA\ *\ \((Pi/180)\)\ ])\))\);\)\[IndentingNewLine]\
\[IndentingNewLine]\[IndentingNewLine]
\(uAngYZ[fixed_, \ input_,
coupler_, \ output_, \ angleA_] := \ ArcCos[\((coupler\^2 + \
output\^2 - \((uDiagonal[input, fixed, \
angleA])\)\^2)\)/\((2*coupler*output)\)]\
*\((180/Pi)\);\)\[IndentingNewLine]
\(uAngW[fixed_, \ input_, coupler_, \ output_, \ angleA_]\ := \ \
ArcCos[\(\((uDiagonal[input, fixed, angleA])\)\^2 +
fixed\^2 - \ input\^2\)\/\(2*uDiagonal[input, fixed,
angleA]*fixed\)]*\((
180/Pi)\);\)\[IndentingNewLine]
\(uAngX[fixed_, \
input_, coupler_, \ output_, \ angleA_]\ := \
ArcCos[\(coupler\^2 +
uDiagonal[input, fixed, angleA]\^2 - \ \
output\^2\)\/\(2*coupler*uDiagonal[input, fixed,
angleA]\)]*\((180/Pi)\);\)\[IndentingNewLine]
\(uAngY[f_, i_, c_, o_, A_]\ := \ 90\ - \ uAngW[f, i, c, o, A]\ - \
uAngX[f, i, c, o, A];\)\[IndentingNewLine]
\(uAngZ\ [f_, i_, c_, o_, A_] := uAngYZ[f, i, c, o, A]\ - uAngY[f,
i, c, o, A];\)\[IndentingNewLine]
uKT[f_, i_, c_,
o_, A_]\ := \ \((uAngZ\ [f, i, c, o, \((\((A + 30)\))\)]\ - \
uAngZ\ [f, i, c, o, \((\((
A)\)\ )\)]\ )\)/30\[IndentingNewLine]\[IndentingNewLine]
uNASKT[f_, i_, c_, o_, A_]\ := \ \((uAngY\ [f, i, c, o, \((\((A +
30)\))\)]\ - \ uAngY\ [f, i, c, o, \((\((
A)\)\ )\)]\ )\)/
30\[IndentingNewLine]\[IndentingNewLine]\[IndentingNewLine]\
\[IndentingNewLine]\[IndentingNewLine]\[IndentingNewLine]\[IndentingNewL
ine]\
\[IndentingNewLine]
\(f = ContourPlot3D[uKT[1, x, y, z, 30], {x, .19, .70}, {y, .29,
1.10}, \
{z, .28, .74}, Contours -> {0.8}, \ Lighting ->
False, Axes -> True, ContourStyle -> {{
RGBColor[0, 1, 0]}}, \ BoxRatios -> {1, 1,
1}, ViewPoint -> {\(-2.633\), \ \(-1.328\), \ 1.659}, \
PlotPoints -> 7, AxesLabel\ -> {\ input, \
coupler, output}];\)\)
(input format)
<< "Graphics`Contourplot3D`"
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
uNASKT[f_, i_, c_, o_,
A_] := (uAngY[f, i, c, o, A + 30] - uAngY[f, i, c, o, A])/30
f = ContourPlot3D[
uKT[1, x, y, z, 30], {x, 0.19, 0.7}, {y, 0.29, 1.1}, {z, 0.28,
0.74},
Contours -> {0.8}, Lighting -> False, Axes -> True,
ContourStyle -> {{RGBColor[0, 1, 0]}}, BoxRatios -> {1, 1, 1},
ViewPoint -> {-2.633, -1.328, 1.659}, PlotPoints -> 7,
AxesLabel -> {input, coupler, output}];
[original message]
> Hi,
>
> I am trying to plot a contour that is a function of 3 variables, x, y,
> and z. I am plotting the function over a biologically interesting
> range of values using ContourPlot3d. The problem is that the function
> does not give real values over some parts of the space near an edge.
> When I try to plot, mathematica
> shows these lines in blue
> 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."
>
> and
>
> ContourPlot3D::"gval": "Function value \!\(\(\(-0.6727485829490804`\)\)
> - \
> \(\(0.22711205859697875`\\ \[ImaginaryI]\)\)\) at grid point x =
> \!\(0.19`\), \
> y = \!\(0.29`\), z = \!\(0.28`\) is not a real number."
>
> The plot that mathematica produces looks good except for one edge which
> is jagged! As I tell mathematica to plot more points, the size of the
> jags diminishes. However I am reaching the practical limit of plot
> points (25) in terms of time and screen resolution and that edge is
> still not smooth like I expect that it really is (after plotting points
> from a numerical simulation).
>
> I would like to get a smooth plot somehow for this function. Is there
> anything else I can try? I am new to mathematica. Is there anyway to
> say, in the function for example, that only real numbers are valid? Or
> will any of the ContourPlot3D options like min/max recursion or
> singularity help?
>
> Thanks for any assistance!
>
> Michael
>