Mathematica:两条曲线的切线 [英] Mathematica: Tangent of Two Curves
问题描述
我昨天问了这个问题,但不确定我是否明确说明了我在寻找什么.假设我有两条曲线定义为 f[x_]:=...
和 g[x_]:=...
,如下所示.我想使用 Mathematica 来确定两条曲线的切线的横坐标交点,并分别存储每条曲线的值.也许这确实是一项微不足道的任务,但我确实很感激您的帮助.我是 Mathematica 的中间人,但这是我在其他地方找不到的解决方案.
I asked this question yesterday but not sure if I made clear what I was looking for. Say I have two curves defined as f[x_]:=...
and g[x_]:=...
as shown below. I want to use Mathematica to determine the abscissa intersection of the tangent to both curves and store value for each curve separately. Perhaps this is really a trivial task, but I do appreciate the help. I am an intermediate with Mathematica but this is one I haven't been able to find a solution to elsewhere.
推荐答案
f[x_] := x^2
g[x_] := (x - 2)^2 + 3
sol = Solve[(f[x1] - g[x2])/(x1 - x2) == f'[x1] == g'[x2], {x1, x2}, Reals]
(* ==> {{x1 -> 3/4, x2 -> 11/4}} *)
eqns = FlattenAt[{f[x], g[x], f'[x1] x + g[x2] - f'[x1] x2 /. sol}, 3];
Plot[eqns, {x, -2, 4}, Frame -> True, Axes -> None]
请注意,将有许多函数 f
和 g
以这种方式找不到解决方案.在这种情况下,您将不得不求助于数值问题解决方法.
Please note that there will be many functions f
and g
for which you won't find a solution in this way. In that case you will have to resort to numerical problem solving methods.
这篇关于Mathematica:两条曲线的切线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!