ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 29 Jan 2016 07:13:47 -0600problem to draw plane equation 4x + 5y - 2z = 18https://ask.sagemath.org/question/32368/problem-to-draw-plane-equation-4x-5y-2z-18/I try to illustrate the result of a problem which consist of finding the intersect point between a line and a plane. Solution is supposed to be point P(-4,8,3). Line and point seems to be displayed correctly but not the plane which correspond to the equation: 4x + 5y -2z = 18. I tried several options without success. Could anyone pinpoint the error in my code?
t, x, y, z = var('t x y z')
f(t) = 2 + 3*t
g(t) = -4*t
h(t) = 5 + t
line = parametric_plot3d((f(t), g(t), h(t)), (t, -3, 3), color="blue")
plan = implicit_plot3d(4*x + 5*y -2*z - 18, (y,-10,10),(z,-10,10),(x,-10,10), color="blue", opacity=0.5)
X = arrow3d((0, 0, 0), (1,0,0), color="black")
Y = arrow3d((0, 0, 0), (0,1,0), color="black")
Z = arrow3d((0, 0, 0), (0,0,1), color="black")
P = point((-4,8,3), size=5, color="red")
X + Y + Z + P + line + planThu, 28 Jan 2016 18:28:05 -0600https://ask.sagemath.org/question/32368/problem-to-draw-plane-equation-4x-5y-2z-18/Answer by ndomes for <p>I try to illustrate the result of a problem which consist of finding the intersect point between a line and a plane. Solution is supposed to be point P(-4,8,3). Line and point seems to be displayed correctly but not the plane which correspond to the equation: 4x + 5y -2z = 18. I tried several options without success. Could anyone pinpoint the error in my code?</p>
<pre><code>t, x, y, z = var('t x y z')
f(t) = 2 + 3*t
g(t) = -4*t
h(t) = 5 + t
line = parametric_plot3d((f(t), g(t), h(t)), (t, -3, 3), color="blue")
plan = implicit_plot3d(4*x + 5*y -2*z - 18, (y,-10,10),(z,-10,10),(x,-10,10), color="blue", opacity=0.5)
X = arrow3d((0, 0, 0), (1,0,0), color="black")
Y = arrow3d((0, 0, 0), (0,1,0), color="black")
Z = arrow3d((0, 0, 0), (0,0,1), color="black")
P = point((-4,8,3), size=5, color="red")
X + Y + Z + P + line + plan
</code></pre>
https://ask.sagemath.org/question/32368/problem-to-draw-plane-equation-4x-5y-2z-18/?answer=32374#post-id-32374You changed the x, y, z order in the implicit_plot statement.
With
plan = implicit_plot3d(4*x + 5*y -2*z - 18, (x,-10,10),(y,-10,10),(z,-10,10), color="blue", opacity=0.5)
you will get the expected plot.
I suppose your y - z - x order causes a swap of axes.
Fri, 29 Jan 2016 05:18:03 -0600https://ask.sagemath.org/question/32368/problem-to-draw-plane-equation-4x-5y-2z-18/?answer=32374#post-id-32374Comment by yann for <p>You changed the x, y, z order in the implicit_plot statement.</p>
<p>With</p>
<pre><code> plan = implicit_plot3d(4*x + 5*y -2*z - 18, (x,-10,10),(y,-10,10),(z,-10,10), color="blue", opacity=0.5)
</code></pre>
<p>you will get the expected plot.
I suppose your y - z - x order causes a swap of axes.</p>
https://ask.sagemath.org/question/32368/problem-to-draw-plane-equation-4x-5y-2z-18/?comment=32375#post-id-32375Thank you so much ndomes. You nailed it!Fri, 29 Jan 2016 07:13:47 -0600https://ask.sagemath.org/question/32368/problem-to-draw-plane-equation-4x-5y-2z-18/?comment=32375#post-id-32375