Subject: get tangent equation, giving curve and a point
From: Aleksas Domarkas
Date: Tue, 1 Jan 2013 20:29:47 +0200
On *Tue Jan 1 09:20:57 CST 2013 *, *Antonio Lapira* antoniolapira at
yahoo.it<maxima%40math.utexas.edu?Subject=Re%3A%20%5BMaxima%5D%20get%20tangent%20equation%2C%20giving%20curve%20and%20a%20point&In-Reply-To=%3C1357053657.27920.YahooMailClassic%40web171206.mail.ir2.yahoo.com%3E>
wrote:
is there a fast way to get for example y=2*x-7 giving y=x^2-2*x-3 and a
point (2,-3)
I know how to calculate but I wanted to know if there was a short way
many thanks
**************************************************************************************************
method 1
(%i1) [x0,y0]:[2,-3];
(%o1) [2,-3]
(%i2) f:x^2-2*x-3$
(%i3) k:at(diff(f,x),x=x0);
(%o3) 2
(%i4) y=y0+k*(x-x0);
(%o4) y=2*(x-2)-3
(%i5) expand(%);
(%o5) y=2*x-7
method 2. We define "get_tangent".
(%i6) get_tangent(f,x0):=block([k,y0], k:at(diff(f,x),x=x0),
y0:at(f,x=x0),
expand(y=y0+k*(x-x0)))$
(%i7) get_tangent(x^2-2*x-3,2);
(%o7) y=2*x-7
(%i8) wxplot2d([x^2-2*x-3,2*x-7], [x,-1,6])$
(%t8) << Graphics >>
best
Aleksas D