Saturday, April 2, 2016

Drunk Planets

Hi folkses,

Last weekend whilst stuck in traffic on the way to Sacramento, I was talking (ahem, nerding out) with a friend about data, visualizations, coding, finding our respective niches, doing meaningful work, etc.  At some point, I told him that I began learning Python for the first time when I was but a humble freshman in physics at Purdue, and that the thing I find most exciting about programming is making the computer do the thing I want it to.  Thus, when we learned how to model a ball bouncing on a floor, or a spaceship orbiting the earth, or a skydiver (whom I dubbed "maniac") jumping off of something, it was basically the coolest thing ever for me.

What struck me was that he was very surprised when I said that I don't still mess with coding stuff on the side, instead reserving it for work.  The thought had never crossed my mind, actually!

So, the next day, when I found myself with a few minutes to spare, I dug out my external hard drive, unzipped my "School" folder which has every file I used in nearly 15 years of school assignments from high school through grad school, and found a few of my old Python files from that freshman physics class (Physics 162, to be precise).  I had to install a few things, including the right version of Python and then VPython on top of it, before I could actually run anything, but I did all of that with no problems.  Then I recreated my model of the Earth orbiting the Sun, appending a trail to the Earth so I can see where it went:

Earth1
Sizes greatly exaggerated, otherwise you can't see the Earth, and you can barely see the Sun.


Basic stuff.  BO-RING.

(but I was still glad I got it to work.  squee!)

So then I decided that I would add the Moon and make it orbit the Earth:

EarthMoon
Slightly less exaggerated sizes this time, though I did make the Moon the same size as the Earth so you can actually see them both.  The white trail is the moon.

Still not fun enough for me, because I coded in each of the forces by hand: the force between the Earth and the Sun, between the Earth and the Moon, and between the Sun and the Moon.  I generally try to avoid doing anything "by hand" when it comes to coding, so I decided to make a list of all the planets and then iterate through the list to calculate the net force on each, thus making a slightly more accurate (or slightly less inaccurate) model than just the force between the Sun and each planet.

Here's what happened:

DrunkPlanets
Drunk Planets:  From the outside to the inside, we see Saturn (cyan), Jupiter (green), Mars (red, of course), Earth (blue, naturally) + Moon (white), Venus (yellow), and Mercury (magenta).

You'll notice two things here.

  1. Mercury goes bat-shit crazy very early on.

  2. The Earth + Moon system is in a degenerating orbit around the Sun.  In fact, when the system crosses the path of Mercury, the moon gets stripped off and begins its own orbit around the Sun, independent of the Earth.

Because this is obviously not how our Solar System behaves, we can safely assume that something is incorrect.  There are a few things I could have gotten wrong which would result in this kind of behavior, including masses, orbital distances, and orbital speeds for Mercury and the Earth + Moon system, so I went back to trusty Wikipedia to make sure I had the all the right numbers.

In my original code, instead of just using the actual orbital speed for any of my Solar System bodies, I calculated the speed based on the length of the orbit in years and the distance from the Sun:

equation-142D890DC310230715D

Using the formula made me feel cool (I suppose feeling "cool" is relative) but it was difficult to check and I was impatient, so I just plugged in the average orbital speeds from Wikipedia.  And I feel exactly zero badly about it.  So there!

And here is why I feel zero badly about it:

SoberingUpPlanets

Finally, somewhat normal-looking orbits!  Here's a closer view of the inner Solar System:

SoberingUpPlanets-Zoomed

The Earth + Moon system is still falling into the Sun gradually, but it's a good bit slower now (that's a relief).  And Mercury is super off-center because I used its aphelion distance but its average orbital speed; however, I still count it as a win because at least it's now orbiting instead of going bat-shit crazy.

Obviously, I haven't created a perfect model here.  There is totally room for improvement, and that's alright!  If you found this fascinating, you might check out this other blog post I unearthed in my searching.

And so, dear readers, I think I can safely say that I'll be trying to do more coding exercises in my free (hahahaha...no really, I'm serious) time.

Until next time,
Ms. Disarray

Edit, later that same day:

PS - You can find my code on my Github!

Wednesday, February 24, 2016

"No one can make you feel inferior without your consent." -EleanorRoosevelt

Well, dear readers, here we are.

This blank page is a little intimidating, not gonna lie.

Take a deep breath...ok, there you go...

Hi, my name is Desiree', and it has been 3 years, 3 months, and 14 days since my last real blog post.

I would like to announce that future posts will probably lean more towards the "Random Braindrops" and less towards the "Freelance Astronomer" end of the spectrum (so I should probably change my tagline), because I want to write and honestly I'm a bit out of touch with the Astronomer side of myself at the moment.  We'll see how this goes.

So in trying to figure out what to write about tonight, I was digging through some of my old Evernote notes which I tagged with "musings" because I used to just sit and think a lot about what makes me be me, and how to make myself better.

The first thing I noticed when I began reading is that I really don't do this kind of pondering anymore.

deep-thought
Deep Thought: The name of the supercomputer in Douglas Adams' wonderful book Hitchhiker's Guide to the Galaxy. (Image courtesy of youtube.com)

The next thing I noticed was nostalgia - no, a longing - for those great times of deep thought.  I meandered through my own mind's little garden of pretty things:  my religious views (or lack thereof), quantum mechanics and how it manifests itself on the macroscopic world (seriously, that shit is really crazy), the size and scale of the Universe, evolution on every scale I could imagine, and on and on...and on.

The difference between that and present day?  Now, nearly all of my thinking/pondering time is spent exclusively on worrying about my relationships.  Don't get me wrong, it wasn't all nebulae and primates and wavefunctions back in the day.  I spent some time on worrying then, too: about my boyfriend (or lack thereof), my past romantic relationships, my familial relationships, my future career; now I worry about the past, present, and future state of my relationships with my family, my fiance, my coworkers...It's incredibly unhealthy!  I should add, though, that I have happily gotten past many of those dark thoughts about loves lost, and my friends have never been a major source of worry.  Nevertheless, I dearly miss those deep introspections about the nature of the Universe or the process of evolution, and the freedom and beauty I felt with muses such as these.

"How did this happen??" and "How can I fix this??" are the two questions at the front of my mind.  I suppose the first can probably be answered with, "I entered the Real World."

And that, dear readers, ignites a fire of indignation that I caved to The Man, that my creativity was sucked away just like so many other grown-ups.

That makes me want to go ponder the answer to question 2:  "How can I fix this??"

And I need to do it stat.

Saturday, November 10, 2012

Thinking outside the lines

Hello my dear readers - all five of you.  :)

I recently started a new job in exciting, eclectic San Francisco, which included me moving from lovely, sensible little Greater Sacramento into a studio apartment with tons of character in the most adorable little suburb of SF ever.  Seriously.

It's pretty safe to say that I finally finished unpacking today, about a month after my 8th move in 5 years.  Commenting on one of my many complaints-about-moving Facebook statuses, a dear friend told me I should just stop unpacking.  As much as I would like to take this advice and make my life a lot easier, I genuinely hate living surrounded by boxes.  I need to feel like I belong in my home, even if I'm only going to be there for 2.5 months, as was the case with my previous place.  I similarly hate living out of a suitcase, which is why for more than a 2-night stay in a hotel, I will unpack my suitcase into the dresser drawers and the closet.  But that's neither here nor there.

This time, I even *gasp* hung my tools on the pegboard!

Anyway, I finally broke down and bought another bookshelf on which to put my books (since my original bookshelf is now pantry space) and also put up my pegboard on which I hang all of my pretty accessories.  Yes, I have a pegboard!

My philosophy happens to be that I am a blank canvas which I get to adorn differently every day, so I love to have cool accessories, such as jewelry, head bands, hats, scarves, etc.  You could probably call it a hobby.

So my home is all but settled again, and with it, my soul.  I am loving my new job, my new town, my new coworkers, my whole new style of life.

I could be upset that I'm not doing what I set out to do when I started college as a physics major with high hopes to be an astrophysicist one day.  This actually used to be my biggest fear, that I wouldn't wind up doing what I'd set out to do.  My mind and heart have had a challenge dealing with this:  I'm currently in a situation which used to be a huge fear, and somehow I'm completely alright with it.

"A closed mind is a wonderful thing to lose," reads my very favorite bumper sticker.  I would have to say that this is the biggest, most important lesson I have learned in my 30 years on this little blue dot of a planet.

I learned it when I left the Christian religion.  I learned it when I went to Europe and was told by the tour guide to not put expectations on my trip, to just enjoy whatever happens, because nothing is ever exactly as you expect it to be.  I learned it in physics when I learned about major scientific discoveries that turned people's worlds upside down.

Most recently, I've learned it as I've transitioned from grad school to the working world:  It's a big world out there, with plenty of satisfying, interesting work for someone trained in the sciences.  Of course, as one enters college as a physics major, that's all anyone ever says, "You can do anything with a degree in physics!"  Well, I would like to say that you really can.  Physics taught me how to think, how to learn, how to approach a problem and think of creative ways to solve it.  These very skills have been indispensable to me this last month as I started work in a completely new field to me: website analytics.  When asked what I do, I like to say that my job is where marketing meets science - we use the scientific method to determine how to better market our product.

So, what does this have to do with astronomy?  Absolutely nothing.  And that is okay with me.  I'm still keeping astronomy as a hobby, and I would like to continue blogging about cool spacey things, but the tech industry is what will enable me to bring home the bacon.

Life can be so much happier when you let yourself think outside the box, color outside the lines, unpack those boxes even if you're just going to pack them back up in a few months, take the little scenic detour on the road to your dream.  Try doing something practical if you've had your head in the stars for years, or try doing something imaginative and impractical if you've had your nose to the grindstone for years.

You never know what you might discover about yourself.