We don't bite newbies here... much PerlMonks

### Comment on

 Need Help??
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];

}

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]

\$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

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to PDL 3d TriD animation of the electron by zentara

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

• Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
• Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
• Read Where should I post X? if you're not absolutely sure you're posting in the right place.
• 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
• You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
 For: Use: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?

Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (11)
As of 2018-03-22 11:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
When I think of a mole I think of:

Results (273 votes). Check out past polls.

Notices?