這裏是你的代碼,完整性,隨着劇情的參數稍加修改放大到感興趣的區域:
Clear[d,h,T,f,r,a];
T = 170 Degree;
f[s_, d_] = Normal[Series[Tan[T - (d*s)], {s, 0, 4}]];
r[h_, d_] = Simplify[Integrate[f[s, d], {s, 0, h}]];
a[h_] = Table[r[h, d], {d, 1, 4, .5}];
plot = Plot[a[h], {h, 0, 4}, PlotRange -> {{0, 0.8}, {0, -0.5}},
AspectRatio -> 1, Frame -> {False, True, True, False},
FrameStyle -> Directive[FontSize -> 10],
PlotStyle -> {Thickness[0.004]}]
下面是代碼來獲取解決方案(H-座標):
In[42]:= solutions = Map[Reduce[{D[#, h] == -1, h >= 0}, h] &, a[h]]
Out[42]= {h == 0.623422, h == 0.415615, h == 0.311711, h == 0.249369,
h == 0.207807, h == 0.178121, h == 0.155856}
現在產生的情節:
points = ListPlot[MapIndexed[{#1, a[#1][[[email protected]#2]]} &, solutions[[All, 2]]],
PlotStyle -> Directive[PointSize[0.015], Red],
PlotRange -> {{0, 0.8}, {0, -0.5}}, AspectRatio -> 1,
Frame -> {False, True, True, False},
FrameStyle -> Directive[FontSize -> 10]]
最後,結合圖:
Show[{plot, points}]

編輯:
響應在發現點切割地塊的要求 - 在這裏是一種方法:
plot =
With[{sols = solutions[[All, 2]]},
Plot[Evaluate[a[h]*UnitStep[sols - h]], {h, 0, 4},
PlotRange -> {{0, 0.8}, {0, -0.5}}, AspectRatio -> 1,
Frame -> {False, True, True, False},
FrameStyle -> Directive[FontSize -> 10],
PlotStyle -> {Thickness[0.004]}]]
,這應該在解決方案後執行已被發現。
@Leonid R的定義[]和a []與** = **完成的,而不是**:= **。這可以嗎?結果不同.. – 2011-01-26 18:22:11
@belisarius:在這種情況下,Set是做IMO的正確的事情,因爲我們想在定義的時候做簡化,而不是在運行時。除了讓事情變慢之外,在這裏使用SetDelayed需要我們在l.hs.s上使用_?NumericQ之類的東西。爲參數,以避免錯誤消息。我們必須確保在運行代碼之前d和h沒有被全局定義。我將添加一個Clear語句或Block,將在一分鐘內更新我的帖子。 – 2011-01-26 18:34:04