Chapter 2 Practice Exercises, p183

# 81.
x = symbols('x')
y = Function('y')(x)
eq = x**2 + 2*y**2 - 9
f = sqrt((9 - x**2)/2)
dydx = diff(eq, x)
root = solve(dydx, diff(y, x, 1))
# dy/dx = -x/2*y
# the slope of tangent line at (1, 2)
m_t = Rational(-1, 2*2)
print m_t
y1 = m_t*(x - 1) + 2
# the slope of normal line at (1,2)
y2 = (-1/m_t)*(x - 1) + 2
eq, f, dydx, root, y1, y2

yl = 4
p = plot(f, -f, y1, y2, (x, -4, 4), ylim=(-yl, yl), title="x**2 + 2*y**2 = 9", show=False)
p[2].line_color = 'green'
p[3].line_color = 'purple'
p.show()

### Like this:

Like Loading...

*Related*

## About janpenguin

Email: janpenguin [at] riseup [dot] net
Every content on the blog is made by Free and Open Source Software in GNU/Linux.