Is there any easy way to have an animated bar chart (one where the heights of the bars change with time)? I currently have the following code:
α := 1/2
β := 1/2
γ := 0
δ := 0
ϵ := 0
ζ := 0
η := 1/2
θ := 1/2
w := 2 Pi
DSolve[{a'[t] == (-2 I*w/3) a[t], b'[t] + c'[t] + e'[t] == 0,
d'[t] + f'[t] + g'[t] == 0, b'[t] - c'[t] == (I*w/3) (b[t] - c[t]),
f'[t] - g'[t] == (I*w/3) (f[t] - g[t]),
b'[t] + c'[t] - 2 e'[t] == (I*w/3) (b[t] + c[t] - 2 e[t]),
2 d'[t] - f'[t] - g'[t] == (I*w/3) (2 d[t] - f[t] - g[t]),
h'[t] == (-2 I*w/3) h[t], a[0] == α, b[0] == β,
c[0] == γ, d[0] == δ, e[0] == ϵ,
f[0] == ζ, g[0] == η, h[0] == θ}, {a[t], b[t],
c[t], d[t], e[t], f[t], g[t], h[t]}, t]
Animate[Show[
BarChart[{{Re[a[t]] /. %, Im[a[t]] /. %}, {Re[b[t]] /. %,
Im[b[t]] /. %}, {Re[c[t]] /. %, Im[c[t]] /. %}, {Re[d[t]] /. %,
Im[d[t]] /. %}, {Re[e[t]] /. %, Im[e[t]] /. %}, {Re[f[t]] /. %,
Im[f[t]] /. %}, {Re[g[t]] /. %, Im[g[t]] /. %}, {Re[h[t]] /. %,
Im[h[t]] /. %}}], BoxRatios -> Automatic], {t, 0, 30},
AnimationRate -> 1, AnimationRunning -> False, RefreshRate -> 30]
I have 8 differential equations being solved, and the real and imaginary parts of each solution is being plotted, so there are 8x2 bars. Understandably, though, this gives me the error 'BarChart is not a type of graphics'. Any help would be greatly appreciated, and thanks in advance ;)
Show
is unnecessarily used. I'm wondering if these posts all originate from the same classroom and are due to (incorrect) teacher instruction. $\endgroup$Animate
localizing the variablet
, while the output fromDSolve
has a differentt
in mind. I'm quite sure, a duplicate question (or rather one that points specifically to localization) should be here somewhere. $\endgroup$