数学建模社区-数学中国
标题:
定积分定义动画演示
[打印本页]
作者:
402
时间:
2014-11-20 15:01
标题:
定积分定义动画演示
Clear[f, x, a, b];
* X( o8 Y# R& e. x0 I3 J- x2 j" O
f[x_]: = x^2; a = 0; b = 1.5; m = 0;
$ l B9 r5 a, ?
g1 = Plot[f[x], {x, a, b}, PlotStyle -> {RGBColor[1, 0, 0]},
+ {: v3 G9 E0 G) q: q; M
DisplayFunction -> Identity];
- i. `0 ?& k$ D5 F; u
For[j = 3, j <= 50, j += 2, m = j; tt1 = {}; tt2 = {};
: H4 r" _& r9 n% M0 C2 J
For[i = 0, i < m, i++, x1 = a + i*(b - a)/m; x2 = x1 + (b - a)/m;
' u: v( D7 k, n t- M
tt1 = Append[tt1,
( s) f( e5 M' d. |0 f b h
Graphics[{RGBColor[0, 0, 1], Rectangle[{x1, 0}, {x2, f[x2]}]}]];
6 L* L1 ~9 ~& J
tt2 = Append[tt2,
& [& S6 l' `# k. M. f
Graphics[{RGBColor[0, 0, 1], Rectangle[{x1, f[x1]}, {x2, 0}]}]]];
, H$ u: _1 O y Y+ n+ T5 {# d
Show[tt1, tt2, g1, DisplayFunction -> $DisplayFunction,
7 E6 k7 G) \; J5 o* t1 w
PlotLabel -> m'' intervals'']]
$ s3 m. e3 z- Z! K; u
: ^" s/ p" w, n/ O
定积分的动画演示,运行没有结果,请各位大虾看看错在哪里?
" B' f4 B. Z+ M& S4 q5 }9 [' t7 l9 \
" i4 U3 j- a8 m7 g
f[x_] := x^2 + 1; a = 0; b = 2; m = 0;
% D! Q [ i) Q' h/ {- [( Y
g = Plot[f[x], {x, a, b}, PlotStyle -> Red,
3 i* o) \9 ~* c- p
DisplayFunction -> Identity]
+ v9 J2 |9 d A' [# f
For[n = 0, n < 100, n = n + 4; t1 = {}; t2 = {};
}1 g/ ]: m& Z6 l5 w
For[i = 0, i < n, i++, x1 = a + (b - a) i/n; x2 = x1 + (b - a)/n;
. T( A6 S) m: S4 I; ?4 C# A
t1 = Append[t1,
* _3 A0 d- J) ^/ _$ w
Graphics[{Blue, Rectangle[{x1, f[x1]}, {x2, f[x2]}]}]];
: A t' |: g }
t2 = Append[t2, Graphics[{Green, Rectangle[{x1, f[x1]}, {x2, 0}]}]]];
`1 I3 ^' o+ U2 Q8 p. T7 f
Show[t1, t2, g, DisplayFunction -> $DisplayFunction,
: H/ `; V# D% c& m
PlotLabel -> n "intervals"]]
( O1 o1 E$ }: C; A" A
( C+ Y6 ?1 I+ A3 c( B
/ C! q9 V/ q3 z& ?5 r2 o
0 e1 D ~! B! r6 {
作者:
变动的永恒
时间:
2014-11-20 21:20
太高端,不懂,帮顶
' u- b9 ?! Z# K: z: z9 S
作者:
402
时间:
2014-12-1 19:54
已经解决。谢谢小木虫的大虾。
& i+ z$ W4 Q$ T) _$ O
f[x_] := x^2 + 1; a = 0; b = 2; m = 0;
5 y, j! Y$ H( Q- W) Q
g = Plot[f[x], {x, a, b}, PlotStyle -> Red];
# }' Z7 H/ ~3 I3 E
Animate[t1 = {}; t2 = {};
! z( J |3 h6 x
For[i = 0, i < n, i++, x1 = a + (b - a) i/n; x2 = x1 + (b - a)/n;
9 _; M8 R4 N7 X
t1 = Append[t1,
/ D. s" `6 m7 y8 F' U# G$ Y7 V. X
Graphics[{Blue, Rectangle[{x1, f[x1]}, {x2, f[x2]}]}]];
/ _& O! s( q( U$ Y$ O
t2 = Append[t2, Graphics[{Green, Rectangle[{x1, f[x1]}, {x2, 0}]}]]];
# r2 {2 Q R5 H, W% r8 ^# d' H
Show[t1, t2, g, PlotLabel -> n "intervals"], {n, 4, 100, 4},
* T' O, L& S0 q7 f6 L4 Z; |
AnimationRunning -> False]
& ]6 M. D) z7 h7 c* v1 @
作者:
宏心
时间:
2014-12-8 09:31
牛。牛牛。
3 g" p" \/ k! w8 A3 _9 m3 |
作者:
z43742516
时间:
2015-10-25 09:54
收藏起来慢慢看
$ M# g- s: J9 |7 o7 o7 u H5 x
作者:
z43742516
时间:
2015-10-25 09:54
收藏起来慢慢看
) `2 @# v$ H0 f3 S) W3 w3 [8 {
作者:
meiya
时间:
2017-3-20 00:45
好牛,厉害
3 i% _, y0 u5 N/ r7 F% P
欢迎光临 数学建模社区-数学中国 (http://www.madio.net/)
Powered by Discuz! X2.5