A Medley of Potpourri is just what it says; various thoughts, opinions, ruminations, and contemplations on a variety of subjects.
Search This Blog
Friday, December 16, 2011
Some Belated Tricks with Java and Excel VBA
Several years ago, when
I was working for Dr. Jean-Claude Bradley at Drexel University, I posted on a
number of programming projects on the UsefulChem blog site (http://usefulchem.blogspot.com/). I recall a flurry of interest in how I got
Excel VBA programs to call Java programs and how Java could make Excel
spreadsheets. It’s probably a lot easier
now, but here were my tricks below.
First part is how to get VBA to run any software and wait for its
completion:
________________________________________
‘Declarations
Private
Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThread As Long
End
Type
Private
Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Long
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End
Type
Private
Declare Function CreateProcess Lib "Kernel32" Alias
"CreateProcessA" _
(ByVal
lpApplicationName As String, ByVal lpCommandLine As String, _
ByVal
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal
bInheritHandles As Long, ByVal dwCreationFlags As Long, _
lpEnvironment
As Any, ByVal lpCurrentDirectory As String, _
lpStartupInfo
As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
Private
Declare Function CloseHandle Lib "Kernel32" (ByVal hObject As Long)
As Long
Private
Declare Function WaitForSingleObject Lib "Kernel32" _
(ByVal
hHandle As Long, ByVal dwMilliseconds As Long) As Long
‘The actual function.
Private
Function RunWaitApp(lpCommandLine As String, wShowWindow As Integer, bWait As
Boolean, _
Optional lWaitTime
As Long) As Boolean
Dim sinfo As STARTUPINFO
Dim pinfo As PROCESS_INFORMATION
Dim res As Long
Dim lWait As Long
If bWait Then
lWait = lWaitTime
Else
Shell lpCommandLine, wShowWindow
RunWaitApp = True
Exit Function
End If
sinfo.cb = Len(sinfo)
sinfo.wShowWindow = wShowWindow
res = CreateProcess(vbNullString, lpCommandLine,
0, 0, True, &H20, ByVal 0&, vbNullString, sinfo, pinfo)
If res <> 0 Then
Do
res = WaitForSingleObject(pinfo.hProcess,
lWait)
If res <> &H102& Then
Exit Do
End If
DoEvents
Loop While True
CloseHandle pinfo.hProcess
RunWaitApp = True
Else
RunWaitApp = False
End If
End
Function
_______________________________________
A bit windy, I know,
but you need write the module only once, then copy, paste, and call it wherever
needed.
The code to create
Excel spreadsheets from within Java then required a special library import, of
which I could only find one at the time but am sure now there are many others. The full code is:
________________________________________
import
java.io.*;
import
java.util.*;import org.apache.poi.hssf.usermodel.*; // The special import
public class CreateXLS
{
public static void main(String[] args)
{
if (args.length < 1)
{
System.out.println("Usage: java CreateXLS
System.exit(0);
}
try
{String saveDirectory = args[0];
String feedFile = args[1];
System.out.print("Creating XLS files for items from " + feedFile + " ... ");
File dd = new File(saveDirectory);
if (!dd.isDirectory()) dd.mkdir();
String separator = System.getProperty("file.separator");
String newLine = System.getProperty("line.separator");
String tab = "\t";
FileWriter fw;
FileOutputStream os;
HSSFWorkbook wb;
HSSFSheet sheet;
HSSFRow row;
Feed feed = Feed.loadFeed(feedFile);
ArrayList itemList = feed.getItemList();
Item item;
Molecule molecule;
Field suppliers;
ArrayList suppliersList;
for (int i = 0;i < itemList.size();i++)
{
item = (Item) itemList.get(i);
molecule = item.getMolecule();
fw = new FileWriter(saveDirectory + separator + item.toString() + ".txt");
os = new FileOutputStream(saveDirectory + separator + item.toString() + ".xls");
wb = new HSSFWorkbook();
sheet = wb.createSheet();
row = sheet.createRow((short) 0);
row.createCell((short) 0).setCellValue("UC Number:");
row.createCell((short) 1).setCellValue(item.toString());
fw.write("UC Number:" + tab + item + newLine);
row = sheet.createRow((short) 1);
row.createCell((short) 0).setCellValue("SMILES");
row.createCell((short) 1).setCellValue(molecule.getSMILES().getFieldContents());
fw.write("SMILES:" + tab + molecule.getSMILES().getFieldContents() + newLine);
row = sheet.createRow((short) 2);
row.createCell((short) 0).setCellValue("InChI:");
row.createCell((short) 1).setCellValue(molecule.getInChI().getFieldContents());
fw.write("InChI:" + tab + molecule.getInChI().getFieldContents() + newLine);
row = sheet.createRow((short) 3);
row.createCell((short) 0).setCellValue("Image URL:");
row.createCell((short) 1).setCellValue(molecule.getImageURL().getFieldContents());
fw.write("Image URL:" + tab + molecule.getImageURL().getFieldContents() + newLine);
row = sheet.createRow((short) 4);
row.createCell((short) 0).setCellValue("Substructure Search:");
row.createCell((short) 1).setCellValue(molecule.getSubStructureSearch().getFieldContents());
fw.write("Substructure Search:" + tab + molecule.getSubStructureSearch().getFieldContents() + newLine);
row = sheet.createRow((short) 5);
row.createCell((short) 0).setCellValue("Item Page:");
row.createCell((short) 1).setCellValue(molecule.getItemPage().getFieldContents());
fw.write("Item Page:" + tab + molecule.getItemPage().getFieldContents() + newLine);
row = sheet.createRow((short) 6);
row.createCell((short) 0).setCellValue("Canonical MW:");
row.createCell((short) 1).setCellValue(molecule.getCanonicalMW().getFieldContents());
fw.write("Canonical MW:" + tab + molecule.getCanonicalMW().getFieldContents() + newLine);
row = sheet.createRow((short) 7);
row.createCell((short) 0).setCellValue("Natural MW:");
row.createCell((short) 1).setCellValue(molecule.getNaturalMW().getFieldContents());
fw.write("Natural MW:" + tab + molecule.getNaturalMW().getFieldContents() + newLine);
row = sheet.createRow((short) 8);
row.createCell((short) 0).setCellValue("Suppliers:");
fw.write("Suppliers:");
suppliers = molecule.getSuppliers();
suppliersList =
suppliers.getFieldContentsList();
if (suppliersList != null)
{for (int j = 0;j < suppliersList.size();j++)
{
row.createCell((short) 1).setCellValue((String) suppliersList.get(j));
row = sheet.createRow((short) (j + 9));
fw.write(tab + (String) suppliersList.get(j) + newLine);
row.createCell((short) 0).setCellValue("");
}
}
wb.write(os);
os.close();fw.flush();
fw.close();
}
System.out.println("[ok]");
}catch (Exception e)
{
System.out.println("[failed]: " + e.getMessage());
}
}
}
________________________________________
This is all five years
after the fact, and much has changed since then, but hopefully someone will
find it useful.
Thursday, December 15, 2011
Chapter Three -- The Universe as we Don’t See It
I want to take you on a
journey. For me it started quite young,
but when at age twelve or thirteen my parents gave me a six-inch Newtonian
reflector, it began in earnest. I am
told that my largesse was the result of my sister getting (for a while) a pony,
and their was fear I would be envious, but the two events were never connected
in my mind and I never remember a trace of envy or resentment toward my
sister. I was just so darn happy to have
the telescope. .
The
grid represents the “curvature” of spacetime about the massive body of the
planet Earth. Although it gives a good
feeling for what is going on – you can easily picture objects approaching Earth
being drawn in by the curvature of spacetime (the white grid), but the picture
works only because Earth is at the bottom of a deep well and we intuitively
know that objects near a well will be drawn into it. What I am objecting to in this picture as
that it assumes what it is supposed to be explaining. It’s not a bad start but it must not be an
end to the explanation. The reader wants
to know what is really happening.
Even in the rather
light-polluted suburbia USA we lived in the telescope revealed a marvel of
heavenly capital the naked eye never suspected.
We all know there are craters on the moon, but with but 96X
magnification I could see them, bright and clear. And the Galilean satellites of Jupiter. The rings of Saturn. And stars beyond stars, nebulae, galaxies –
by any professional standards it was just a child’s toy, but what it brought
into my backyard most of the greatest philosophers of history could not have
dreamt about.
It took me … out
there. Away from this secluded and
narrow viewpoint of tiny spot on planet Earth where I stood, toward places
hundreds or thousands of years of light speed travel that would have been
needed to actually be there in the flesh (not that I would have survived long,
but I never thought about that). It was
a Asperger’s child’s vision of paradise, to this day probably the best thing my
parents ever did for me. I was not to
become an actual astronomer, but this gift opened that door to me better than
anything else.
I’d like to repeat a
figure from chapter one:
Figure I. (repeated)
Getting away from our
ordinary, Earth-bound existence and planting ourselves somewhere in space –
here, a position millions of miles beyond the sun-Earth system – we see already
how much our perspective on things have changes. For one thing, the cause of the seasons,
which had baffled us before, becomes obvious.
We also see Earth (and the sun) as spherical objects in space, instead
of as flat, infinite surfaces which or may not have boundaries. If the picture were to be fully fleshed out,
we would see other planets too (specifically, the inner world of Mercury and
Venus, and the fourth planet Mars; whether Jupiter and/or Saturn would show
from here is not as clear).
Whether you realize it
or not, I have done something profound to your senses; more precisely, to your
brain’s interpretation of reality. But
all I have really done is change your point of view, as my telescope changed
mine. I call it profound, however,
because the brilliant insights of Albert Einstein, in the beginnings of the
twentieth century, demonstrated that it must be so.
* * *
If you have ever taken
high school physics, or a general college physics course, you may have
discovered that it is, in a very real sense, boring. It’s boring because you’re not learning
anything you hadn’t already intuitively learned by about age two or so. If you don’t believe that, then watch next
time a magic show is performed before a group of toddlers. They are just as dumb-founded and thrilled
seeing the laws of ordinary physics seemingly violated as you or I. And even a small baby can tell when something
is amiss; if you convince it something is in a certain place and then reveal
that it isn’t, their eyes will open wide with surprise, and they may even
become distressed.
“But that’s just common
sense,” you might be tempted to
protest. Yet what is common sense? If it were as easy and as obvious as it
seems, artificial intelligence would be a snap to accomplish, and would have been
years ago.
The fact is, our brains
evolved to perceive and “understand” reality in ways necessary for our
stone-age ancestors and further back, and thus it is unsurprising that we
should possess, even at a very young age, the common-sense concepts we
collectively call reality. Recall what I
said about magicians and how they do what they do; they use those “wired-in”,
common-sense, laws of physics and manipulate our senses and points of view to
cause us to see impossible things. Like
bending a spoon with your fingers, if I may cite a rather common trick by
“psychics” – magicians who pawn themselves off as special people with special
powers.
What you learn in basic
physics course are the details, the precise definitions, and the math behind
the ordinary. And, despite what I said,
it isn’t boring at all; I strongly recommend taking such a course (my mother
did, and got a B, which somehow didn’t convey to her that she could grasp
scientific thinking), perhaps even before reading what’s coming up.
* * *
The lesson of the last
section, I hope, is that although we possess common-sense intuition about
“ordinary” reality – the reality all of us spend all our lives in, a reality
within a narrow range of space and time – at the same time evolution could not
have bestowed us no gifts about reality outside those strict ranges, because
our ancestors never encountered them.
And indeed, it hasn’t. But until
you understand that, it is only natural that you should think the Laws of
Physics, as we somewhat pompously and arrogantly call them, will apply
everywhere, all the time, across all scales of time and place.
That’s why I started
out talking about my childhood telescope, and showing Figure I again. Even this is not too far a deviation from our
hum-drum down on this planet’s lives, but there are some noteworthy
differences. The biggest one may be that
the light from the sun or that reflected from Earth will take several minutes
to reach our new vantagepoint. We
certainly aren’t used to significant (or any) delays between the time something
happens and when we observe it, for light travels – well, it travels faster
than anything known in the universe, a full 186,282 miles per second. That being the case, when a bank of lights at
a stadium are turned on, the stadium is full alit “at once” , though it
actually takes around a fraction of a millisecond or one thousandth of a second
fir this miracle to happen. Since our
brains can’t measure time intervals that short (we’re a tad slow, to tell the
truth), this is instantaneously as far as we are concerned. Indeed, by all common-sense measurements the
speed of light is for all practical purposes infinite.
Yet it is in fact not infinite, as our hovering over
Figure I. shows. That light –
electromagnetic radiation I should call it, including radio, microwaves,
infrared (heat) rays, ultraviolet (black) light, x-rays, and gamma rays –
journeys at a specifically defined speed came out of work on electricity and
magnetism in the 1800’s, already dents our common sense view of things. But what comes next tramples it into unrecognizable
shards.
I have to backtrack some
to explain why. I’ll ask you to close
your eyes (but don’t stop reading!) and imagine the following: someone else and I are on a rail car,
travelling at fifty mph down the track.
We both have baseball mitts (not actually necessary), and one baseball,
and we are playing a game of catch between us.
Some kindly passenger (you, as it turns out) on the train is timing how
fast we throw, and reports us both hurling the ball at 50 miles per hour, or 73
feet per second. You can easily
calculate this because the rail car is 73 feet long and it takes exactly one
second from throw to catch.
Open your eyes
again. That was probably easy to picture
before your mind’s eye, I’m certain; we do things like this all the time, if
never exactly this.
Okay, close ‘em again,
and this time picture yourself on a train platform at a station, watching the
train whizz by at fifty mph (it’s an express, and doesn’t stop there). You can easily look through the car’s windows
and watch the game of throw and catch.
Question: what do you see now?
You are probably
already uncertain as to whether you will see the same thing, but if you haven’t
quite figured out what you do see, I’ll hand you the answer and then explain
it. Using the same clock, you now see
the thrower at the rear of the car throwing, like a top flight major league
pitcher, the ball at 73 + 73 = 146 feet in the one second that ticks off your
clock, or one hundred mph; while the thrower at the front can accomplish a mere
73 – 73 = 0 feet in that second, or zero mph.
The explanation is that
speeds add. The train is travelling
fifty mph forward, and this speed must be added to the rear of car thrower
speed and subtracted from the front of car’s thrower’s velocity. If all the window shades are drawn, however,
the passengers have no way of knowing their speed with respect to the station, because we can’t sense constant speed,
only acceleration (speeding up,
slowing down, or changing direction).
Everything here, keep in your mind, is at constant speeds and
directions. And I’ll wager it doesn’t
gall you too much. You’ve actually
witnessed it first hand many times in your life; you know you can’t really say
an object is travelling at such and such a speed without specifying the
reference point that speed is being measured from. Ever sat in a motionless train and, while
watching another train moving slowly by you, actually sense yourself moving in
the opposite direction? This is
why. Like magic. it confuses your brain
again.
Let’s get back to
light. Nineteenth century physicists
showed that visible light was in fact an electromagnetic wave, or possibly some
kind of particle like a baseball only infinitely tinier, and the speed of that
wave was a well-measured 186,282 mps.
The natural question now? With respect to what point of reference? The answer is either: either none, because all the laws of physics
up to that point demonstrated that there are no privileged or special points of
reference in the universe, that they are all equal; or, despite those laws
(and, to their defense, a law of physics is so only because we humans to our meager
abilities have been able to estimate it well enough to call it a law, so we can
at least bend if not outright break it when needed) their was something called
the universal aether, a fluid having
no density, no color, no resistance to movement through it (viscosity), indeed no observable properties at all, which
permeated all space and actually was stationary in some absolute sense.
A note of personal
preference before I go on here. Lots of
books on relativity have lots of pictures of trains and trolleys and clocks and
other pertinent things – only natural, as this is what got Einstein thinking
about the issues raised here – but I won’t, because if I haven’t presented my
concepts in a simple, straightforward enough manner, then I’ve already failed
in the main aim of this book. I assure
you, it has nothing to do with my incompetence in drawing pictures (OK, well it does some).
I’ve given you the two possibilities
and, if I have been successful, you are probably up a creek paddleless trying
to choose. How can there be no point of
reference for light’s speed; or, alternatively, there is a point, the aether,
that has no physical properties that can be observed and measured? You should be reeling a bit by this point,
because by the late 19’th century almost all scientists were reeling trying to answer
this seemingly impossible conundrum. So
you are in good company.
I’ve suggested that there
are only two solutions to this problem, but, and in fair warning this is where
things get strange (but still logical!), a third solution does present itself. Oh, how I wish I could say I thought of it
myself. No, it took the genius of an
Einstein to see what was so unobvious to the rest us. The third solution is that light is in fact it’s own reference point,
and all other speeds must pay homage to it.
It is light, electromagnetic radiation, to which we must bow to and
follow it’s rules, however absurd they may seem to us.
Again, an aside before
I move on. The speed of light is so
enormous that, compared to it, the differences between the ordinary speeds we
encounter (and the 50,000+ mph of space probes and objects, as fast as they
seem to us, are still way below light’s 670,000,000 mph, by a factor of ten
thousand and more) are so insignificant to render the light speed problem moot. This is why we never notice it in our lives,
or ever imagine it in our minds. It is
certainly not part of our intuitive understanding of physics for it never had
to be in our evolutionary history.
* * *
I apologize here, for I
must lay down some equations for your edification. They are not really complicated, not unless
you’re going to go into full-fledged physics mode, which there is no need to
do. The first equation involves a
quantity that you’ve probably heard of, momentum. It is simply the mass of an object multiplied
by its velocity (speed + direction, remember).
Prior to Einstein, and as still presented in all general physics courses
today it is:
momentum( or p) = mass(or m) × velocity(or v)
p = mv
Equation I.
This is the equation
Newton derived for what, essentially, he called inertia, and so derived the now
famous Law of Conservation of Linear Momentum (quite similar to the one for
Angular Momentum we’ve already encountered).
Newton derived it assuming that all velocities were relative to some
point of reference, even light, although he had little idea what light was or
how/how fast it travelled. Science wasn’t
developed well enough in his day, through no fault of his.
In Einstein’s new
formulation, the equation of momentum must be modified from p = mv
to:
p = gm0v
Equation II.
Where
g
or gamma (mathematics is all symbolized, even X + Y = Z, so don’t let this
throw you), stands for:
Equation III.
The naught (0) on m
indicates rest mass, which we’ll come to in a tick, and c means the speed
of light.
Again, don’t let any of
this get too heavy on you; you should have had all the symbolisms in high
school, or can reference them easily. Anyway,
this factoring in of the square root (what √¯
means) of 1
– (v/c)2 to the momentum equation, which
remember, applies to all objects, takes into account c (speed of light)
being this supreme reference point in the universe we must all be subservient
to. Note something critical here: if v << c,
as is the case with all velocities we normally encounter, then (v/c)2
goes to essentially zero, and g
just as essentially goes to 1, meaning that gamma is just 1/1 or 1 and drops
out of the equation, leaving us with our Newtonian original, except for that
lingering naught on m which we’ve let to explain beyond
calling it the rest mass. Is there such a thing as a different not at rest
mass?
Yes there is, and a
little examination of Equation III. should show why. Imagine we make v
very close to c,
or even make it equal to c. Then (v/c)2
becomes just 1, and as 1 - 1 = 0 the bottom half of g becomes infinite,
meaning that p becomes infinite too!
Even as v gets
closer and closer to c,
p grows rapidly.
It is as though all the energy we are throwing into our object to make
it go faster and faster end up only increasing its mass as the speed of light
is approached. If we could get to c the mass would
be infinite in fact.
The only possible
physical interpretation of this is that energy and mass are somehow equivalent,
and dumping more of the former onto an object means it also has more of the
latter. The math for that is just hairy
enough to excuse us from examining it but the bottom line is the equation we
all know and love: E = m0c2. The naught after m
is, as said, the object’s rest mass; multiplying it by the speed of light
squared gives its equivalent in energy, and since c2
is a very large number you will see (as scientists in the 1930’s were beginning
to see, the results being Hiroshima and Nagasaki), if you can make the conversation
you will release a very large amount of energy indeed.
Other, equally strange
phenomena crop up when we move close to the light speed. Because all observers must find the same
value for the this speed, regardless of their reference points, time and space
become, well, malleable; it can be different with different observers.
Let’s go back to our
baseball throwers in the rail car. The
big difference, instead of throwing baseballs back and forth and each other,
each one now has a laser pointer. As soon as the light from one pointer reaches
the corresponding “catcher”, he in turn flashes his collaborator with his own
pointer.
This experiment, as
described, may sound absurd. The laser
light travels so fast that it takes only 7.422×10-8 seconds, or 74
billionths of a second, for the light to exit the pointer and reach the other
player, still fifty feet away. Very well
then; let’s makes this easier to visualize by making the rail car 186,282 miles
long, so that it now takes our full second for the traverse time. Never mind that this makes the experiment
physically impossible (the rail car would stretch around our world over seven
times!). Experiments can, in many cases
are, done in our minds; as long as we get the math right and imagine things
correctly, this is a perfectly valid approach to the subject. (Such experiments are called gedanken, a German word meaning literally
”done in thought”).
Do you have the picture
in your head, though admittedly it is a bit tougher this time? Good.
Next: imagine yourself, as before, the measurer in the rail car, timing
how long it takes the laser light to get from pointer to receiver, and
back. Naturally you find this number to
be 186,282 mps, just the speed of light.
No surprises there.
Now place yourself on
the station again. You time the laser
pulses again, just as you timed the baseball throw before from the platform. Now, one, crucial, last part of the
experiment to stitch into your mind’s eyes:
the rail car is also travelling 186,282 mps pass the station, in the
same way as it was travelling 50 mph before.
So: what do you expect to see?
With the baseballs, we
obtained the answer that the speeds were either 50 + 50 = 100 mph for the back
of car thrower, or 50 – 50 = 0 mph for the front of car, for now our reference
point is the platform at the train station.
Speeds, velocities more precisely, are additive because they depend on
the point of reference you are measuring them from.
Amazingly,
the result is completely different for the laser pointers and the car
travelling at the speed of light! Recall
my statement that the speed of light is its own reference. This means that its speed is always the same,
regardless of any other point of reference.
The platform observer, pocket watch in hand, finds that the laser
pointers still fire their light beams at each other at c, just as the
car observer does. Indeed, every
observer, wherever he is in space and time, obtains the same values. There is no adding of speeds, at least not
the way it was with baseballs.
If you are trying to
make sense of this, and failing, I can tell you why. You are making the common-sense assumption
that space and time are the same for all viewers. But that is incorrect. It feels
right only because all your experience comes from speeds much below c, and evolution
by natural selection has been geared to that. But our, rather simple, gedanken experiment has shown that both time and space are malleable,
and depend on the observer’s state of motion.
Space and time are not
flat and absolute. Special relativity
shows this beyond a doubt. But if they
are not flat and absolute, then – what are they? It was to take Einstein ten more years to
work that out, and so much of modern cosmology depends on what he discovered. It is time to turn to there, the next
state: the general theory of relativity, published in 1916.
* * *
Einstein was a person
gifted with deep imagination and insight into nature. He knew that if he tried to work out his
ideas about light and space and time not only with static motion but with
accelerated motion as well, he would probably never have succeeded at
either. So he started with static,
meaning straight line, constant speed, motion, and in 1905 arrived at his
special theory. It’s special because it
specifically excludes all motions which involve changes in speed or direction
(collectively known as accelerations), and concentrates purely on static
motion. It was a maneuver which rewarded
him with pure gold. It showed that mass
and energy were equivalent, that the speed of light was the ultimate speed in
the universe, and perhaps most importantly, that time and space were not flat,
abstract constructs, the same for everyone everywhere, but ebbed and flowed
depending on different circumstances. An
enormous triumph, which earned him little notice at the time (he was still
working at the same Swiss patent office well after publication), and which
decidedly did not impress those who bequeathed Nobel Awards (though he did earn
one some years later for a different line of work, which we’ll discuss in the
next chapter).
Getting back to the
theme of this section, special relativity was just that; a special case of
relativity at work. Einstein’s main goal
was a general theory of relativity,
one which included accelerated motion as well as static. It was to take him another ten years to grind
out the final, so-called field
equations for relativity, equations I will not present here, fully confessing I
don’t know enough math to do so.
We don’t need to
understand that math (few do) to get a decent sense of what general relativity
is about. One of the things Einstein
noticed when dealing with accelerated motion was the results were virtually
indistinguishable from being in a gravitational field. Here on Earth, as we would on all mass bodies
in the universe, we feel ourselves being pulled downward by some unknown,
almost magical force, which we call gravity.
And indeed, if the ground beneath our feet were to give way, we would
fall, ever faster and faster, into the resulting abyss, until we were smashed
to our deaths by whatever we finally landed on (if the opening goes deep
enough, however, we will be incinerated by the heat of Earth’s depths and
crushed by the overwhelming pressures first – this all assumes the fall is far
enough, of course).
An aside to describe
accelerated motion. Our falling would
occur under a force of one g
(the gravitational force at Earth’s surface), meaning that we would plunge ever
faster downward, at a rate of 32 feet per second per second, or 32fps2. All this means is that, after the first
second, we are travelling at 32 fps, after the second second 64 fps, after the
third 96fps, and so on. (All this ignores air friction, which counteracts the
acceleration and limits us to 200-300 fps final speed, depending on our
orientation.) Acceleration means a
change in velocity, faster or slower (or in a different direction) over time.
All sorts of phenomena
call cause accelerated motion. Take, as
I believe Einstein did, an elevator. If
you were sealed inside a windowless elevator somewhere out in deep interstellar
space, you would be weightless and float freely all about the car. Now imagine that some unknown being of
prodigious powers attaches a rope to the top of the elevator car, and starts
pulling it upward with a force of one
g
(32fps2, remember). I think
you intuitively sense that you would be slammed onto the floor of the car, and
you would be right – though be careful about intuitions! I ask you a question: now that you are standing on a floor with a
32fps2 acceleration force trying to pull you downward, what is the
difference between this situation and being in an elevator on Earth, at a
stopped floor level? Remember there are
no windows, nothing to tell you what is going on outside the elevator except
this force pulling you down.
If I tell you basically
nothing, you are probably not surprised.
After all, we have all been in elevators, and felt the lurch in our
stomachs, and the temporary lightness or heaviness in our bodies as we moved up
or down in the car (try this at the Empire State Building or another monster
skyscraper with express elevators if you
really want to feel this effect). The
sensation of falling if an elevator plunges down rapidly can be quite
unnerving, rather like being on a roller coaster. I still have dreams about it, once in a
while.
So our super being accelerating
us at 32fps2 “upwards” (there is no such thing as direction in deep
space, remember) feels exactly the same as being on an elevator on Earth,
stopped at a specific floor. The being
could even lurch us “upward” at more or less than one g
if it really wanted to mimic the effects of the ground-based car. The point being, you simply could not tell
the difference.
Here’s where an
Einstein mind works on a different plane than our own. He made the deduction that, the scenario
described above being true, there was no
difference, according to the laws of physics, between them. They are in essence one and the same
phenomena. Like me, I suspect you’ll
have to put this book down at this point and chew on this idea. If there is no difference in the perception
of two or more experiences, than physics tells us they are intimately linked by
some thread; essentially, they are the same thing. This most certainly does violate our
intuitions, which accounts for the warning I gave before.
* * *
But what is the thread
connecting the two? Einstein finally
realized that space and time, and their malleability, had to be brought into
the situation to make that thread. But
another, hopefully short, aside on another needed prerequisite is needed here to
show how. You have probably heard of the
concept called entropy, though you
might (and should be) puzzled as to its exact meaning. We won’t get into that here, except to say
that one meaning is that physical systems are inexorably (actually, probabilistically)
drawn to their lowest energy states. An
example is the falling we’ve been talking about; think about the energy,
derived from its load of jet fuel, it takes to keep an airliner miles above the
ground, or the far greater amount of rocket fuel it takes to put an astronaut
on the moon or a robot about the planet Saturn.
Falling things lose energy, which, according to the laws of entropy, is
exactly what they should and must do, unless something stops them, like the
floor of an elevator car.
The elevator, whether
on Earth or in deep space, is providing energy to keep its occupants out of a
state of free fall, i.e., what they’d
be doing without the forces acting on them, floating about in a zero gravity (g)
field. In both cases we are dealing with
acceleration, even for an elevator stationary on Earth’s surface. What could account for such a curious
conundrum?
Space and time. Spacetime.
Special relativity had indicated that the two were indivisibly
connected, and the fertile mind of the Swiss patent clerk finally become modest
physics professor worked instinctively along these lines. If spacetime were a flexible, or curvable, concept that changed as an
observer’s reference point changed, then maybe it was more that that: if was a real
thing, and not only real but highly variable depending on perhaps many
conditions. One of those conditions, he
realized, was the presence of mass. He
realized that mass objects somehow distorted spacetime, in a way that caused
other objects to be attracted toward them.
Using this insight, he finally solved the problem of the cause of
gravity, which Newton knew better than to destroy his reputation on solving two
hundred years earlier.
To explain how
spacetime operates under general relativity I could reproduce a fairly standard
picture, chances are you’ve seen, which appears to illustrate it:
Figure
IV.
If
instead of falling downwards the gridlines (representing spacetime, remember)
get closer together as they approach Earth, then I believe we have a better
picture of why objects fall toward other objects. Objects cause spacetime to compress, rather
than to indent; a very small compression for objects the size of Earth, larger
for the size of the sun, and quite large for nasty things like neutron stars and
black holes, which compress them into singularities,
a place which we won’t cover here.
Recall
entropy. Objects “prefer” to be at the
most compressed regions of spacetime because they can lose energy that way and
obtain entropy by this particular meaning.
That’s why they’re attracted toward each other, and will either fall
into each other or orbit each other, the latter until loss of energy results in
an eventual (trillions of years and more for the Earth-sun system, so don’t
worry) collision.
If spacetime can curve
in one way, it can – at least in theory – curve many ways – and many of the
solutions to Einstein’s field equations describe the entire universe as being “closed”
(spherically even) or “open”, or “saddle-backed” or plain old flat. New solutions crop up once every few years or
decades, describing how the universe must be or how it will evolve in time, or
what phenomena (like black holes) it might reveal. There is also a “standard” solution, which
itself gets itself upgraded once in a while, as the result of new astronomical
observations (e.g., that the universe is not only expanding but expanding more
and more so, due to something called “dark energy”) and other considerations. .
* * *
I
am going to stop here, because if you have been following me reasonably well,
then I’ve succeeded in what I set out to do in this chapter. I wanted to describe for you a field of
physics which, although it violates all our common-sense notions about how
things behave and why, was within your grasp to at least get a good feel
for. Don’t worry about all the sundry
details I’ve left out (though if this has left you hungering for a deeper
understanding of relativity, all power to you!); I just wanted to give you a
taste for how strange and wonderful reality can be when we drag ourselves away
from our evolutionary-derived intuitions.
Again, if I’ve succeeded, than we are ready to talk about what I’ve been
setting forth to cover, some chemistry and biology that should be within your
understanding as well. This is where we
start on a very new road from the physics of Einstein, to the physics (and
chemistry) of the quantum, a field many great minds have contributed to and to
which, I think, no one can be designated the creator of. On to quantum cats.
Subscribe to:
Posts (Atom)
Operator (computer programming)
From Wikipedia, the free encyclopedia https://en.wikipedia.org/wiki/Operator_(computer_programmin...
-
From Wikipedia, the free encyclopedia Islamic State of Iraq and the Levant الدولة الإسلامية في العراق والشام ( ...
-
From Wikipedia, the free encyclopedia A reproduction of the palm -leaf manuscript in Siddham script ...