A Space & astronomy forum. SpaceBanter.com

Go Back   Home » SpaceBanter.com forum » Astronomy and Astrophysics » Research
Site Map Home Authors List Search Today's Posts Mark Forums Read Web Partners

Earth to Mars Trajectory



 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old December 1st 08, 10:43 AM posted to sci.astro.research
Jonathan Thornburg[_4_]
external usenet poster
 
Posts: 15
Default Earth to Mars Trajectory

From: "Jonathan Thornburg [remove -animal to reply]"
Subject: Earth to Mars Trajectory
Newsgroups: sci.astro.research
References:


Kent Paul Dolan wrote:
[[about an orbital mechanics simulation]]
unless you are tied to BLAS or
something similar in the way of a numerical software
library, why not a more modern programming language
that would make your software accessible to a larger
audience?

Fortran is dragging a _lot_ of baggage these days.


This does depend rather strongly on where in the scientific-computing
ecosystem you look. For example, in the Cactus toolkit for the parallel
solution of hyperbolic PDEs (http://www.cactuscode.org), newly-written
physics code is something like
50% Fortran 90
30% C
15% C++
5% Fortran 77
[I emphasize that this is "physics" code; the "infrastructure" code for
MPI, parallel I/O, memory management, etc, is mainly C/C++.]

Partly this is historical inertia, but partly it's that Fortran (still)
has much better support than C/C++/Java for certain kinds of numerical
computation. For example, consider the following trivial Fortran 77
subroutine to multiply two n*n matrices:

subroutine matrix_multiply(n, A, B, AB)
integer n
double precision A(n,n), B(n,n), AB(n,n)
integer i,j,k
double precision sum
do 300 j = 1, n
do 200 i = 1, n
sum = 0.0d0
do 100 k = 1, n
sum = sum + A(i,k)*B(k,j)
100 continue
AB(i,j) = sum
200 continue
300 continue
return
end

Until the C99 standard (which isn't yet widely used), you couldn't
write equivalent code in C without significant uglyness (measured in
programmer (in)convenience, (in)efficiency, or both).
[N.b. "equivalent" means n isn't known at compile time,
and the matrices are stored contiguously in memory. We
can ignore row- versus column-major storage.]
C99 has features ("variable length arrays") which let you write this
subroutine in a natural & efficient manner, but alas these are not
described in most C textbooks.

And as for C++, well, it's considerably *worse*: if you want a useful
matrix class, you have to roll your own. And C99 variable length arrays
aren't in the current ANSI/ISO C++ standard.

For these and othe reasons, the vast majority of high-quality numerical
software libraries (eg., the repository at http://www.netlib.org) are
still written in Fortran, most commonly Fortran 77. A classic example
is ODE integration. IMHO the three best general-purpose ODE integration
codes around are
* Shampine & Gordon's ODE/STEP (written in Fortran 66)
* Hindmarsh's ODEPACK/LSODE (written in Fortran 77)
* Brankin, Gladwell, & Shampine's RKSUITE (written in Fortran 77)

Some newer packages now provide C or C++ wrappers or translations
(eg RKSUITE now includes a 3rd-party translation to C++), but the
primary documentation is still usually written using Fortran
terminology, and "advanced features" are often only available through
the Fortran API.

I conclude that at least a reading knowledge of Fortran remains very
useful for doing scientific computation.

Fortunately, interlanguage calling is fairly easy. In particular, it's
easy (albeit usually slightly operating-system--dependent) to call
Fortran subroutines from a {C,C++,Java,Ada,Pascal,Modula-n,PL/1,...}
program. This is what I do in my own research codes (which are almost
entirely C++ or Perl.)

--
-- From: "Jonathan Thornburg [remove -animal to reply]"
Dept of Astronomy, Indiana University, Bloomington, Indiana, USA
"Washing one's hands of the conflict between the powerful and the
powerless means to side with the powerful, not to be neutral."
-- quote by Freire / poster by Oxfam
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Earth to Mars Trajectory Bill[_10_] Astronomy Misc 2 December 4th 08 10:45 PM
Earth to Mars Trajectory Bill[_10_] Research 1 November 30th 08 10:11 AM
calculation of trajectory of astroid collide with the earth with runge kutta. loebasken Astronomy Misc 1 April 2nd 04 02:09 AM
Low Earth orbit to Moon trajectory dynamics Abdul Ahad Technology 5 November 27th 03 03:15 AM
Mars trajectory problems? Bill Clark Space Science Misc 0 July 13th 03 11:25 PM


All times are GMT +1. The time now is 01:21 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 SpaceBanter.com.
The comments are property of their posters.