Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why do you code in Fortran?

Status
Not open for further replies.

Ploper001

Technical User
Oct 5, 2006
286
GB
Hi guys,

I wanted to find out why some of you use Fortran. I ask this because of a recent coding experience I've had. I have a six-week Computational Modelling project to do for my Physics degree (second year), and everyone's doing it in Fortran because that's what we were taught in the first year. However, I taught myself VB.NET 2003 in my last year of school (and used it for my Computing A-Level project) and now code in VB.NET 2005/2008.

When I found out that Fortran 95's random number generator was medeocre at best after writing the main part of my program I decided that I'd try it in VB.NET. Once I was done and I tested it, not only was the random system infinitely better but it was about twice as fast as Fortran was at performing the calculations - despite having to update the Progress Bar too!

This shocked me as I assumed that the reason we were being taught Fortran 95 was that it was fast and so could be used to do complicated and long simulations. But now I see this is not the case. Maybe we were only taught it because that's all our lecturers know?

Anyway, because of this my entire project is now in VB.NET and it's great (no more using the console to run the program and then import the data into a pretty awful graphing program - my program creates an Excel 2007 spreadsheet and creates a graph automatically in seconds), and I doubt I'll use Fortran again unless I have to. So, I'm curious, ignoring the fact that some people might be using it because they must use Fortran for their work....why do you use Fortran?


Thanks :)
 
Because you can't use VB.net on Linux, Unix, VMWare, and any other operating system that is not Windows 2000 or above. It won't run on low spec machines either. You can't use VB.net 2003 on Vista.

The big problem with VB is that it has lots of different dialects (VBScript, VBA, VB6, VB.net). VB being twice the speed of Fortran is surprising. When I run it, VB/C# is one quarter the speed of Fortran. You have to build it as native to get any speed out of it and it wants a myriad of libraries to be installed before it will even work. Try building a VB.net program and running it on Win95 - even hello world doesn't work.

VB is OK for Microsofty stuff and talking to other MS packages like Excel but how well can it handle array processing, interfacing to other languages, multi-dimensional arrays, data formatting, mathematical functions (like sinh, tanh, j0, j1 etc). You'll find that you have to write libraries for almost everything. None of it is readily available because that is not what VB people do.

Not everyone is a drag and drop person who relies on wizards to get the bulk of the work done. Without the DnD capability and the Wizards, would you be able to code in VB? Some can, majority can't. If intellisense fails, they're completely stuck. If they were asked to code the entire project just using notepad, they wouldn't be able to do it.

Some people just cannot get on with certain languages/packages. They get a mental block. I have difficulty using APL, Prolog, Snobol3, Dreamweaver and MFC. Sometimes it is familiarity, sometimes it is suitability for the purpose. For what you were doing, maybe VB was the correct tool.

Can't comment about your RNG - did you seed it?
 
Random number generators are all too often thrown into a compiler as an afterthought. There are a number of algorithms that work better (and are more random) than the ones that originally came with the compiler. Do a bit of research (start with Knuth's Seminumerical Algorithms, but there are other books out there) and you can create a subprogram that will work better than the ones that came with VB or the Fortran compiler you're using.

Incidentally, you didn't mention which Fortran compiler and OS you're using for your project--that often matters.



Pat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top