数学建模社区-数学中国
标题:
定积分定义动画演示
[打印本页]
作者:
402
时间:
2014-11-20 15:01
标题:
定积分定义动画演示
Clear[f, x, a, b];
: \# r. ~, B: T7 s9 W+ |5 a
f[x_]: = x^2; a = 0; b = 1.5; m = 0;
0 @" J( W1 i3 P0 i; e# Z, K
g1 = Plot[f[x], {x, a, b}, PlotStyle -> {RGBColor[1, 0, 0]},
2 t, e) e5 Y: V( p7 ~8 l: G
DisplayFunction -> Identity];
! @8 M7 L9 u& g; n8 Q2 f! N
For[j = 3, j <= 50, j += 2, m = j; tt1 = {}; tt2 = {};
! n7 _; i( W( X. q! b, u$ ]! x
For[i = 0, i < m, i++, x1 = a + i*(b - a)/m; x2 = x1 + (b - a)/m;
0 ]+ {0 M# {5 ^7 a( s0 e8 W
tt1 = Append[tt1,
0 A3 z/ k2 k4 h% {
Graphics[{RGBColor[0, 0, 1], Rectangle[{x1, 0}, {x2, f[x2]}]}]];
) {# q1 `& r5 c
tt2 = Append[tt2,
) T' O3 m- k8 A
Graphics[{RGBColor[0, 0, 1], Rectangle[{x1, f[x1]}, {x2, 0}]}]]];
* n* K! @) k; A0 {/ Q8 P( G* q
Show[tt1, tt2, g1, DisplayFunction -> $DisplayFunction,
$ R; {! n; t4 ~
PlotLabel -> m'' intervals'']]
, H' }& I9 D: i! m k6 c0 ?
V/ n, e& ^5 p7 T# ^
定积分的动画演示,运行没有结果,请各位大虾看看错在哪里?
- h2 V# u1 Y! f5 U& v
5 c) w5 q: Z3 B; A, @7 g
f[x_] := x^2 + 1; a = 0; b = 2; m = 0;
4 m7 h. X' B( {
g = Plot[f[x], {x, a, b}, PlotStyle -> Red,
" D8 a; J, V3 P+ M
DisplayFunction -> Identity]
5 ^0 F% C( L' O
For[n = 0, n < 100, n = n + 4; t1 = {}; t2 = {};
9 F @8 K: c; S* Z2 K& z3 T- p
For[i = 0, i < n, i++, x1 = a + (b - a) i/n; x2 = x1 + (b - a)/n;
4 U, N- a+ w/ a5 S! v" l; T5 I
t1 = Append[t1,
; h) F. p/ }; U5 _
Graphics[{Blue, Rectangle[{x1, f[x1]}, {x2, f[x2]}]}]];
, c6 H: h8 ?6 s" a. {- q
t2 = Append[t2, Graphics[{Green, Rectangle[{x1, f[x1]}, {x2, 0}]}]]];
1 B ]( J) `% w9 D j n
Show[t1, t2, g, DisplayFunction -> $DisplayFunction,
+ [. y, w6 O k2 t6 k2 W
PlotLabel -> n "intervals"]]
' E+ U5 A5 D2 V" x3 J( s0 u
5 ]- |1 y* e/ v
( r7 J! K5 M+ U. X; a4 P
% j8 ~6 }1 P( q" D, d* ^
作者:
变动的永恒
时间:
2014-11-20 21:20
太高端,不懂,帮顶
# h/ g0 j- b; n
作者:
402
时间:
2014-12-1 19:54
已经解决。谢谢小木虫的大虾。
; Y0 \7 w N" ?& p* c# G: W
f[x_] := x^2 + 1; a = 0; b = 2; m = 0;
# d% L2 Z6 k) a, t i }/ ^
g = Plot[f[x], {x, a, b}, PlotStyle -> Red];
4 c8 G( z+ X0 @* g! L* A7 x
Animate[t1 = {}; t2 = {};
# y/ ` H+ V% [7 D0 W
For[i = 0, i < n, i++, x1 = a + (b - a) i/n; x2 = x1 + (b - a)/n;
# b2 v) d" M8 d9 z! a2 D1 w/ B
t1 = Append[t1,
. z% l6 E, A# D
Graphics[{Blue, Rectangle[{x1, f[x1]}, {x2, f[x2]}]}]];
5 H6 _+ }) t$ l8 T+ R2 o: P
t2 = Append[t2, Graphics[{Green, Rectangle[{x1, f[x1]}, {x2, 0}]}]]];
' v0 {: Q7 Q6 |; x4 S- l- k) e
Show[t1, t2, g, PlotLabel -> n "intervals"], {n, 4, 100, 4},
/ \& z9 ~' Z0 F" w
AnimationRunning -> False]
]' w2 U! ^; o* d* n' O/ l
作者:
宏心
时间:
2014-12-8 09:31
牛。牛牛。
2 Y+ L) ]7 e9 w. o2 j
作者:
z43742516
时间:
2015-10-25 09:54
收藏起来慢慢看
0 |7 d0 C {' l3 p* w$ I
作者:
z43742516
时间:
2015-10-25 09:54
收藏起来慢慢看
8 D+ I5 H$ U( e; Y* D+ j' b
作者:
meiya
时间:
2017-3-20 00:45
好牛,厉害
* d( B* k3 F' F# u% \( z
欢迎光临 数学建模社区-数学中国 (http://www.madio.net/)
Powered by Discuz! X2.5