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 562-564:
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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.