数学建模社区-数学中国
标题:
定积分定义动画演示
[打印本页]
作者:
402
时间:
2014-11-20 15:01
标题:
定积分定义动画演示
Clear[f, x, a, b];
d2 N7 s, h6 }0 B9 W& g, b m
f[x_]: = x^2; a = 0; b = 1.5; m = 0;
% a; N& z" }% D& q
g1 = Plot[f[x], {x, a, b}, PlotStyle -> {RGBColor[1, 0, 0]},
0 J/ L/ }& h" f' d
DisplayFunction -> Identity];
' R' c" m7 w& F% [! ]
For[j = 3, j <= 50, j += 2, m = j; tt1 = {}; tt2 = {};
4 V8 ~: x9 o9 s0 s3 R% g
For[i = 0, i < m, i++, x1 = a + i*(b - a)/m; x2 = x1 + (b - a)/m;
. ]( b% @, l: j
tt1 = Append[tt1,
$ o( Z+ Q' B( Z- O/ q3 y1 a$ E
Graphics[{RGBColor[0, 0, 1], Rectangle[{x1, 0}, {x2, f[x2]}]}]];
$ {: D4 i3 f( g+ |/ @4 ~' n
tt2 = Append[tt2,
4 l1 }* W) T' V( C# A9 Q
Graphics[{RGBColor[0, 0, 1], Rectangle[{x1, f[x1]}, {x2, 0}]}]]];
) b& N4 Z) g. E: G2 [
Show[tt1, tt2, g1, DisplayFunction -> $DisplayFunction,
/ ^( B4 ]* |3 @7 h
PlotLabel -> m'' intervals'']]
. |2 ^6 l# v& t& P% a* V$ P
- Y. s: E5 s |. k, x
定积分的动画演示,运行没有结果,请各位大虾看看错在哪里?
- q6 U# i7 E/ w5 x1 D9 `% a+ B
( f) W, N5 N3 i8 U4 |) D K& ?
f[x_] := x^2 + 1; a = 0; b = 2; m = 0;
: X, G* x- l, V; S5 R6 _9 ~5 _
g = Plot[f[x], {x, a, b}, PlotStyle -> Red,
# z% W% y( \4 b! s
DisplayFunction -> Identity]
" @% O% I/ {4 [5 J
For[n = 0, n < 100, n = n + 4; t1 = {}; t2 = {};
9 ?, f+ K" Y+ ?/ t; `2 [4 T. w
For[i = 0, i < n, i++, x1 = a + (b - a) i/n; x2 = x1 + (b - a)/n;
4 x- I* O% ?( U7 Y
t1 = Append[t1,
% U) A# }4 X$ Y, n% r0 _3 \
Graphics[{Blue, Rectangle[{x1, f[x1]}, {x2, f[x2]}]}]];
# o& T8 @) N! W' E
t2 = Append[t2, Graphics[{Green, Rectangle[{x1, f[x1]}, {x2, 0}]}]]];
i6 ?6 g T. b* Z( U2 R$ y
Show[t1, t2, g, DisplayFunction -> $DisplayFunction,
% c8 Q; O9 a" E$ u- j# a5 v: ]
PlotLabel -> n "intervals"]]
' b3 I' {9 q* ~( m( d* s: ^
# i5 C }4 L# d! P, m6 o6 o ^
7 Y+ |9 H' ]- v+ V3 B# V" j
% v6 Y% H4 N" K+ ]: \0 f
作者:
变动的永恒
时间:
2014-11-20 21:20
太高端,不懂,帮顶
3 i# b' \9 a: R; q1 ^/ `
作者:
402
时间:
2014-12-1 19:54
已经解决。谢谢小木虫的大虾。
) c4 V [7 Z" g3 U
f[x_] := x^2 + 1; a = 0; b = 2; m = 0;
& k* P$ g* v6 \9 Z0 `+ m4 `4 f
g = Plot[f[x], {x, a, b}, PlotStyle -> Red];
2 F, _0 f6 s2 y2 |
Animate[t1 = {}; t2 = {};
2 C, C% v) h, n6 e7 s1 ~ m
For[i = 0, i < n, i++, x1 = a + (b - a) i/n; x2 = x1 + (b - a)/n;
/ J- e' M3 ^% [6 T
t1 = Append[t1,
# |/ t2 l) B2 ~
Graphics[{Blue, Rectangle[{x1, f[x1]}, {x2, f[x2]}]}]];
: k: r. C B5 p! b! q/ @1 c3 I+ z
t2 = Append[t2, Graphics[{Green, Rectangle[{x1, f[x1]}, {x2, 0}]}]]];
4 k( w7 D9 P. E, ^
Show[t1, t2, g, PlotLabel -> n "intervals"], {n, 4, 100, 4},
1 h6 K# T0 U/ U. \9 e9 ]. E
AnimationRunning -> False]
# o+ W; F: s# N7 D
作者:
宏心
时间:
2014-12-8 09:31
牛。牛牛。
( N- ]0 I$ `$ R! @; s7 i- e
作者:
z43742516
时间:
2015-10-25 09:54
收藏起来慢慢看
/ K, Z4 {) e" J2 Z7 S
作者:
z43742516
时间:
2015-10-25 09:54
收藏起来慢慢看
, z# O& q; S) H+ l' g9 _ T7 W
作者:
meiya
时间:
2017-3-20 00:45
好牛,厉害
1 o) p. ^& T. x5 u: j
欢迎光临 数学建模社区-数学中国 (http://www.madio.net/)
Powered by Discuz! X2.5