402 发表于 2014-11-20 15:01

定积分定义动画演示

Clear;
f: = x^2; a = 0; b = 1.5; m = 0;
g1 = Plot, {x, a, b}, PlotStyle -> {RGBColor},
   DisplayFunction -> Identity];
For[j = 3, j <= 50, j += 2, m = j; tt1 = {}; tt2 = {};
For[i = 0, i < m, i++, x1 = a + i*(b - a)/m; x2 = x1 + (b - a)/m;
  tt1 = Append[tt1,
    Graphics[{RGBColor, Rectangle[{x1, 0}, {x2, f}]}]];
  tt2 = Append[tt2,
    Graphics[{RGBColor, Rectangle[{x1, f}, {x2, 0}]}]]];
Show[tt1, tt2, g1, DisplayFunction -> $DisplayFunction,
  PlotLabel -> m'' intervals'']]

定积分的动画演示,运行没有结果,请各位大虾看看错在哪里?

f := x^2 + 1; a = 0; b = 2; m = 0;
g = Plot, {x, a, b}, PlotStyle -> Red,
  DisplayFunction -> Identity]
For[n = 0, n < 100, n = n + 4; t1 = {}; t2 = {};
For[i = 0, i < n, i++, x1 = a + (b - a) i/n; x2 = x1 + (b - a)/n;
  t1 = Append[t1,
    Graphics[{Blue, Rectangle[{x1, f}, {x2, f}]}]];
  t2 = Append}, {x2, 0}]}]]];
Show[t1, t2, g, DisplayFunction -> $DisplayFunction,
  PlotLabel -> n "intervals"]]



变动的永恒 发表于 2014-11-20 21:20

太高端,不懂,帮顶

402 发表于 2014-12-1 19:54

已经解决。谢谢小木虫的大虾。
f := x^2 + 1; a = 0; b = 2; m = 0;
g = Plot, {x, a, b}, PlotStyle -> Red];
Animate[t1 = {}; t2 = {};
For[i = 0, i < n, i++, x1 = a + (b - a) i/n; x2 = x1 + (b - a)/n;
  t1 = Append[t1,
    Graphics[{Blue, Rectangle[{x1, f}, {x2, f}]}]];
  t2 = Append}, {x2, 0}]}]]];
Show, {n, 4, 100, 4},
AnimationRunning -> False]

宏心 发表于 2014-12-8 09:31

牛。牛牛。

z43742516 发表于 2015-10-25 09:54

收藏起来慢慢看

z43742516 发表于 2015-10-25 09:54

收藏起来慢慢看

meiya 发表于 2017-3-20 00:45

好牛,厉害
页: [1]
查看完整版本: 定积分定义动画演示