Re: Programming Languages Decisions - Earthquake Forecasting - August 18, 2008
Posted by mrrabbit on August 19, 2008 at 10:24:44:

Quote:

"I am not going to worry about people who don't."

But you spent an entire 2-3 lines doing exactly that...


Quote:

"I had to go at least originally with Perl and Gnuplot because I am not a professional computer programmer and could actually work with them though it has not been easy."


The following was what I wrote in 30 minutes flat - after taking ONLY ONE programming class in beginning C++ - with no other classes since:


/***************************************************************************
* COPYRIGHT: (C) 1996 << Robert Shackelford >> All Rights Reserved.
* PROJECT: Spoke Calc v.1.0
* FILE: << spoke.cpp spoke.obj spoke.exe >>
* PURPOSE: << Calculates spoke lengths for a proposed wheel assembly >>
* PROGRAMMER: << Robert Francis Shackelford >>
* START DATE: << 10/23/96 >>
* USE POLICY: This program may be compiled and used at no charge. All that
* this author asks is that the source code, object file, and
* executable not be altered in any way. This program may not
* be sold to any party - but costs may be recovered for the
* disk, tape, or CD used to distribute these file.
****************************************************************************/
/***** DESCRIPTION *********************************************************
This program computes the spoke length for a proposed wheel assembly
for use on a bicycle. The formula is given below:

SL = SQRT(A^2 + B^2 + C^2) - 1

A = rSIN(t)
B = R - rCOS(t)
C = hub flange offset
t = (360 * x crossings) / n spokes
R = rim diameter
r = hub diameter hole to hole

Calculations are done for each of the two sides of a wheel. On most
front wheels though, both sides are symetrical therefore only one measurement
is needed.

See manual for data collecting procedures.

*/
/***** INCLUDE *****/

#include "iostream.h"
#include "stdlib.h"
#include "cpplite.h"

/***** FUNCTIONS *****/

float t_parameter(float n, float x)
/* PURPOSE: Computes the angle in degrees to be used in a_parameter and
b_parameter.
RECEIVES: The number of spokes per side (n) and crossings (x).
RETURNS: (t) in degrees.
REMARKS: none
*/
{ float t;
t = (360.00 * x) / n;
return t;
}

/*-------------------------------------------------------------------------*/

float a_parameter(float r, float t)
/* PURPOSE: Computes (A) squared in the above described formula.
RECEIVES: Hub radius (r) and (t) in degrees.
RETURNS: (a)
REMARKS: (t) is converted to radians due to compiler preferences.
*/
{ float t1_rad;
t1_rad = (M_PI * t) / 180.00;
float a;
a = (0.5 * r) * sin(t1_rad);
return a;
}

/*-------------------------------------------------------------------------*/

float b_parameter(float R, float r, float t)
/* PURPOSE: Computes (B) squared in the above described formula.
RECEIVES: Hub radius (r) and (t) in degrees.
RETURNS: (b)
REMARKS: (t) is converted to radians due to compiler preferences.
*/
{ float t2_rad;
t2_rad = (M_PI * t) / 180.00;
float b;
b = (0.5 * R) - ((0.5 * r) * cos(t2_rad));
return b;
}

/*-------------------------------------------------------------------------*/

float sl_parameter(float a_norm, float b_norm, float c)
/* PURPOSE: Computes formula result before square root is taken.
RECEIVES: (A) (a_norm) and (B) (b_norm) and (C) (c).
RETURNS: Result before the square root is taken.
REMARKS: Square root is taken in main with final adjustment for spoke
length.
*/
{ float sl;
sl = (a_norm * a_norm) + (b_norm * b_norm) + (c * c);
return sl;
}

/*-------------------------------------------------------------------------*/

int main()
{ float n;
float x;
float R;
float r;
float c;
cout << "Enter the number of spokes on one side:" "\n";
cin >> n;
cout << "Enter the number of crossings to be used:" "\n";
cin >> x;
cout << "Enter the rim diameter in millimeters:" "\n";
cin >> R;
cout << "Enter the hub diameter in millimeters:" "\n";
cin >> r;
cout << "Enter the offset in millimeters:" "\n";
cin >> c;

float t = t_parameter(n, x);
float a_norm = a_parameter(r, t);
float b_norm = b_parameter(R, r, t);

float sl_norm = sl_parameter(a_norm, b_norm, c);

float sl = sqrt(sl_norm) - 1.00;

cout << "Your spoke length for this side of the wheel is: " << sl;

return EXIT_SUCCESS;
}


Now here is the funny thing - I don't touch PERL with a 10 foot pole...and lots of other fellow IT workers have admitted to me that PERL is a tad harder - BUT use it because PERL is a VERY POWERFUL SCRIPTING ORIENTED language and is a primary reason why it is use so much. I use PERL scripts - just don't write 'em.

So I'm scratching my head here...


Quote:

"And most of the researchers with whom I have been in contact also have Windows machines."


Most of the researchers I've met via SJSU, a few from Stanford, a few from Berkely - SJSU as a student - and the others at a job where they had been encouraged to work in private industry - used a variety of hardware and software platforms.

Sure their variety of hardware and software platforms - Mac, PC, Sun, HP, IBM, Silicon Graphics, had nifty little utilities they prefered and a local copy of an IDE, BUT most if not all used their machine as an interface to...

- Unix Servers (Sun, IBM, Tatung)
- Cray Multi-Proc Systems
- VMS
- Parallel Processing Clusters
- Mach Kernel Based Servers

...and it was there via the network that they did the vast majority of their science related programming.


Might I suggest that you got the wrong impression - and therefore it would be even more erroneous to go the .exe route that would limit or tie each .exe. to a specific platform - as opposed to distributing source?

It kinda like a school district allowing Mac-oriented religous zealots run rough shod over everyone else declaring a district to be Mac only - only to have a non-religous Mac user make two points:

1. The real world is a multi-platform world.
2. Banning other bans their user's skills and availability as a resource.


So...

Question...care to show us the source you have so far?

=8-)


Follow Ups:
     ● Re: Programming Languages Decisions - Earthquake Forecasting - August 18, 2008 - EQF  11:28:22 - 8/19/2008  (74260)  (2)
        ● Re: Programming Languages Decisions - Earthquake Forecasting - August 18, 2008 - Skywise  14:25:56 - 8/19/2008  (74264)  (1)
           ● Re: Programming Languages Decisions - Earthquake Forecasting - August 18, 2008 - EQF  08:34:43 - 8/25/2008  (74271)  (1)
              ● Re: Programming Languages Decisions - Earthquake Forecasting - August 18, 2008 - Skywise  18:58:41 - 8/25/2008  (74272)  (1)
                 ● Re: Programming Languages Decisions - Earthquake Forecasting - August 18, 2008 - Roger Hunter  19:22:13 - 8/25/2008  (74273)  (1)
                    ● Re: Programming Languages Decisions - Earthquake Forecasting - August 18, 2008 - Skywise  21:57:30 - 8/26/2008  (74277)  (1)
                       ● Re: Programming Languages Decisions - Earthquake Forecasting - August 18, 2008 - EQF  09:26:57 - 8/27/2008  (74278)  (1)
                          ● Re: Programming Languages Decisions - Earthquake Forecasting - August 18, 2008 - Skywise  21:22:21 - 8/27/2008  (74280)  (2)
                             ● Re: Programming Languages Decisions - Earthquake Forecasting - August 18, 2008 - EQF  17:37:55 - 9/3/2008  (74323)  (1)
                                ● Re: Programming Languages Decisions - Earthquake Forecasting - August 18, 2008 - Skywise  22:03:10 - 9/3/2008  (74324)  (0)
                             ● Re: Programming Languages Decisions - Earthquake Forecasting - August 18, 2008 - mrrabbit  21:58:00 - 8/27/2008  (74281)  (1)
                                ● Re: Programming Languages Decisions - Earthquake Forecasting - August 18, 2008 - EQF  17:24:03 - 9/3/2008  (74322)  (1)
                                   ● Re: Programming Languages Decisions - Earthquake Forecasting - August 18, 2008 - mrrabbit  22:42:52 - 9/4/2008  (74327)  (0)
        ● Re: Programming Languages Decisions - Earthquake Forecasting - August 18, 2008 - mrrabbit  12:52:27 - 8/19/2008  (74262)  (1)
           ● Re: Programming Languages Decisions - Earthquake Forecasting - August 18, 2008 - EQF  14:04:14 - 8/19/2008  (74263)  (0)