Hi, here is an animated electron simulation crafted by Mark Baker, who is an active PDL user.
screenshot
It is posted with his consent in the hope of stimulating students to look into math and physics.
#!/usr/bin/perl
use PDL;
use PDL::Graphics::TriD;
use PDL::Math;
# electron simulation by Mark Baker
nokeeptwiddling3d;
for $c(1..199999){
$n = 6.28*$c;
$x = $c*rvals((zeros(9000))*$c);
$cz = 1**$x*$c;
$cy = 1**$x*sin$x*$c;
$cx = 1**$c*rvals($x)*$c;
$w = $cz$cy$cx;
$g = sin($w);
$r = cos($cy+$c+$cz);
$b = cos($w);
$i = ($cz$cx$cy);
$q = $i*$n;
points3d [ $b*sin($q), $r*cos($q), $g*sin$q], [$g,$b,$r];
}
=head1
Mark Baker's text references, and equation explanations:
The book that I used to create the Piddle comes from
Rodger Penrose's book "The Road to Reality"
From pages 562564:
We see the topic on 22.11 Spherical harmonics.
We see that we can get the Cartesian coordinates for the equation
[eq.1]
x = sin [angle] cos [measure of longitude and latitude]
y= sin [angle] sin [measure of longitude and latitude]
z = cos [angle]
this is how I came up with the Spherical harmonic dynamic equation
from the electron piddle ...
[eq.2]
$g = sin($w=$cz$cy$cx);
$r = cos($cy+$c+$cz);
$b = cos($w);
Now this is not the same equation as above , but it does help
us to see the [inner magnetic field] and the [outer electric field
+]
in a Spherical Harmonic Dynamical Geometry , which was my main con
+cern...
Dissecting the equation further we have :
A equation I got from the book "Fundamental Formulas of Physics"
edited by Donald H. Menzel a Director at the Harvard Collage Obser
+vatory
page 7 Volume 1
[eq.3]
[a] sin [2*pi*frequency] [time] + [b] sin [2*pi*frequency] [time] =
+ [c] sin([2*pi*frequency] [time] + [phase])
which is where the transformation below [eq.4] came from me trying
+to put the above [eq.3]
equation in Cartesian coordinates that worked with the equation [e
+q.2] from [eq.1] ...
[eq.4]
$cz = 1**$x*$c;
$cy = 1**$x*sin$x*$c;
$cx = 1**$c*rvals($x)*$c;

So looking at the full piddle we have :
for $c(1..99){ ## here c acts like the [2*pi* frequency] from [eq.
+3]
$n=6.28*$c; ## which is realized here
$x=$c*rvals((zeros(9000))*$c); ## some PDL minipulation
$cz = 1**$x*$c; ## a further transformation [eq.3]
$cy = 1**$x*sin$x*$c;
$cx = 1**$c*rvals($x)*$c;
$g = sin($w=$cz$cy$cx); ## a transformation of [eq.1]
$r = cos($cy+$c+$cz); ## the main Geometry that ties together
$b = cos($w); ## the transformation of [eq.4]
$i=($cz$cx$cy); ## additional Geometry needed
$q=$i*$n;
points3d[ $b*sin($q), $r*cos($q), $g*sin($q)], [$g,$b,$r] } ## furt
+her transformation that makes every thing work
=cut
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
 a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:

For: 

Use: 
 &   & 
 <   < 
 >   > 
 [   [ 
 ]   ] 
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.

