摘要
(* Source code written in Mathematica 6.0, by Steve Byrnes, 2011. I release this code into the public domain. *)
ClearAll["Global`*"]
SetOptions[Plot, Frame -> True, FrameTicks -> None, Axes -> False, PlotRange -> {{-8, 8}, All}];
SetOptions[ListPlot, Frame -> True, FrameTicks -> None, Axes -> False,
Filling -> Axis, PlotStyle -> None, PlotRange -> {{-8, 8}, All}];
f[x_] := Exp[-(4/3)*\[Pi] x^2];
g[x_] := Exp[-(3/4)*\[Pi] x^2];
repeatedf[x_, p_] := Sum[f[x + n*p], {n, -10, 10}];
repeatedg[x_, p_] := Sum[g[x + n*p], {n, -10, 10}];
plotf = Plot[f[x], {x, -10, 10}, PlotStyle -> Darker[Blue]];
plotg = Plot[g[x], {x, -10, 10}, PlotStyle -> Darker[Red]];
plotrepeatedf = Plot[repeatedf[x, 5], {x, -10, 10}, PlotStyle -> Darker[Blue]];
discreteg = Table[{x, g[x]}, {x, -10, 10, 1/5}];
plotdiscreteg = ListPlot[discreteg, FillingStyle -> Darker[Red]];
discretef = Table[{x, f[x]}, {x, -10, 10, 1/3}];
plotdiscretef = ListPlot[discretef, FillingStyle -> Darker[Blue]];
plotrepeatedg = Plot[repeatedg[x, 3], {x, -10, 10}, PlotStyle -> Darker[Red]];
discreterepeatedf = Table[{x, repeatedf[x, 11/4]}, {x, -12, 12, 1/4}];
plotdiscreterepeatedf = ListPlot[discreterepeatedf, FillingStyle -> Darker[Blue]];
discreterepeatedg = Table[{x, repeatedg[x, 4]}, {x, -12, 12, 4/11}];
plotdiscreterepeatedg = ListPlot[discreterepeatedg, FillingStyle -> Darker[Red]];
finalimg = Show[GraphicsGrid[{{plotf, plotrepeatedf, plotdiscretef, plotdiscreterepeatedf},
{plotg, plotdiscreteg, plotrepeatedg, plotdiscreterepeatedg}}], ImageSize -> 800]
SetDirectory["C:\\Users\\Steve\\Desktop"];
Export["test.gif", finalimg]
许可协议
我,本作品著作权人,特此采用以下许可协议发表本作品:
|
本作品采用知识共享CC0 1.0 通用公有领域贡献许可协议授权。
|
采用本宣告发表本作品的人,已在法律允许的范围内,通过在全世界放弃其对本作品拥有的著作权法规定的所有权利(包括所有相关权利),将本作品贡献至公有领域。您可以复制、修改、传播和表演本作品,将其用于商业目的,无需要求授权。
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse
|