【问题标题】:Mathematica - How do I show of intersections of two functions on plot?Mathematica - 如何在绘图上显示两个函数的交集?
【发布时间】:2020-08-12 19:45:58
【问题描述】:

我已经定义了两个函数:

f[x_] := 40*1.04^x

g[x_] := 150*0.9^x

然后我正在绘制它们:

Plot[{f[x], g[x]}, {x, 0, 20}]

但是如何显示这两个函数的交集呢?

【问题讨论】:

    标签: function plot wolfram-mathematica


    【解决方案1】:
    f[x_] := 40*1.04^x
    g[x_] := 150*0.9^x
    
    sol = Quiet[Solve[f[x] == g[x], x]];
    xpts = x /. sol;
    ypts = f /@ xpts;
    
    Plot[{f[x], g[x]}, {x, 0, 20},
     Epilog -> {PointSize[0.02], Orange,
       Map[Point, Transpose[{xpts, ypts}]]}]
    

    【讨论】:

    • 我真的需要学习如何在 Wolfram 中使用 map 和 replace...但是谢谢!
    猜你喜欢
    • 1970-01-01
    • 2023-03-09
    • 2022-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多