Monday, April 1, 2013

UNIT 3 -- Ballistics simulation as a first case study

 xxxxx 

xx

x


Programming for the real world involves the messiness and complexity of real-world situations, and the need to have a user interface that is, er, ah, um . . . actually usable. Further to this, we often face the challenge for people whose main focus of interest is another subject or problem needing to code in a modern language or to work with coders and understand their challenges. Both of these underscore the need for first proficiency programming. For this, a useful well-proved approach is by instructive case study and tutorial-like discussion. Where, projectile motion with air resistance, drag and lift is valuable in itself and serves as a gateway into flight and rocketry. Historically, it was also one of the first applications of digital computing; in the mid-late 1940's, when some allegedly suggested a global market of perhaps five machines! (I.e., roughly, one per major military power.) As well, it is a window through which we can see into the sort of approach that is needed to analyse, model and solve such realistic problems, then document and report results; that is, a paradigm-illustrating key case study. 

Accordingly, as a model example, let us now ponder the path of a supersonic projectile with air resistance, as is contemplated in Unit P (the gateway programming module):

Another classic case [of the carefully developed user interface and undergirding technical details] is the trigger, bolt, shoulder stock and iron or even telescopic sights of a rifle . . . the complexities of ballistics and building a tack-driver rifle are such that this played a key role in developing modern industries. Indeed, just external ballistics is a gateway to aerodynamics, flight control and yes, rocket science

Compare:



 In the case of the classic 0.303 SMLE rifle of WW1 and 2, we can further observe the very carefully curved ramp used to orient the sights to hit the target at ranges from 200 to 2000 yards, with 25-yard fine increments:

British, SMLE Mark III Rifle "Tangent" Rear Sight, with adjustment from < 200 to 2000 yds, in
25-yard marked increments. The muzzle is to the right and the rifle barrel runs under the sight and
the protective wood handguards we can see. Notice, the adjusting slider that "rides" the curved
ramp, and the worm gear for fine adjustments. (On the other side, is a push-button for rapid, rough
range-setting.) Protective ears shield the sighting notch. Early production sights had a L/R
adjusting wheel for the rear sight, to adjust for cross-wind effects. [HT: Handloader Mag., fair use edu. Of course, anything over 800 yards is optimistic and 2000 yards, frankly, is for area targets.]

Here, the curved ramp compensates for the trajectory of the bullet as a projectile facing air resistance and other effects, indeed the rear sight is a simple analogue computer that compensates for the ballistic trajectory. In a vacuum, we can readily show that the trajectory would follow the arc of a parabola, but with air resistance, that is modified by deceleration of the projectile:

A real-world trajectory, with air resistance, cf discussion here. Sight is spelled "site."
(HT WW2 Ballistics notes & an online dictionary. This vid, gives an idea of challenges at 1,000+ yd)

These curves (notice, the ramp on the SMLE sight!) serve us due notice about how fast we get into Mathematical issues. To refresh our memory:


That primes the pump. Now, 


PART 1:
How to begin modelling . . . observations

 We may easily observe a multitude of  trajectories caused by hot lava "bombs" at Sakurajima Volcano, Japan:

Sakurajima erupting Sept 2013, showing high angle ballistic arcs  (and volcanic lightning)
[HT: Volcano Discovery, fair use Education]

We may similarly examine some near-parabolic trajectories, using a water fountain and bowling in Cricket:

 

Now, for a low air resistance case [strictly, a vacuum], the trajectory will be effectively parabolic (as we can see from the water fountain). This is because the horizontal and vertical motions, being perpendicular, are independent. That is, near enough, horizontal speed -- strictly, velocity (speed in a given direction) -- will be steady. Vertical motion, in turn, will be the same as if one threw a ball straight up, then it slows to a stop and falls back down again. In the perfect, no air resistance case, the Math will work out to give a parabolic curve. Here is a demonstration from MIT:




(To get a picture of what is going on, think about a: sitting in a bus moving along a straight road with steady speed [this fixes the horizontal motion vector]. Then, b: toss up a bright green tennis ball and watch it fall back to your lap, as if you were not moving at all. You and the ball are moving with the same horizontal velocity and so, c: to you, you just tossed the ball up and it fell back. But if the bus window was nice and large, d: your friend standing by the road side would see the ball trace out a full parabolic arc. This is, of course, e: a practical demonstration of how perpendicular vectors form a "basis" for vectors in a space, with vector addition/subtraction under the parallelogram law: so, f: vertical and horizontal components of the ball's motion can be isolated -- the bus moves horizontally (x), you toss the ball up and it falls back into your lap (y) -- and separately analysed then put back together. See a first discussions here

[Of course, g: this also opens up a gateway into some pretty deep physics: what is absolute rest? It turns out, even in the classical Galilean-Newtonian framework, we cannot distinguish absolute rest from an inertial -- non-accelerated -- frame of reference for motion and position {IFR}. Einstein exploited and extended it, case 1: in the Special Theory of Relativity, the speed of light in a vacuum has the same value c for any IFR, and the laws of physics take the same, simplest form in such a frame. Where, imposing c is constant is based on the Michelson-Morley ether drift null experimental results. BTW, one famous consequence of case 1 is the energy-rest mass relationship e = m*c^2. For case 2, the General Theory of Relativity: acceleration is indistinguishable from gravity, from which we can spin out whole cosmological models for the universe, and of course masses in space warp the spacetime fabric. As a confirming result, in 1919 Eddington observed that during a solar eclipse the apparent position of a star next to the occluded sun shifted from its standard value, due to warping the spacetime fabric by our sun. In effect, too, a black hole tears a hole in that fabric, and more. In short, we are already next door to deep, deep waters just by pondering a ball tossed up and falling back into our lap in a moving bus.])

 Obviously, no air resistance is the simple, idealised case. The more practically important one would include air resistance, shape effects, speed-of-projectile effects on air resistance, wind, spinning of the projectile, latitude and rotation of the earth, direction relative to the West --> East rotation, temperature and pressure of the air, and more. Indeed, extending this analysis leads into study of rockets and aircraft. So, this is a useful topic for studying how computers can be programmed to simulate or model and predict real world behaviour.

A key step to insight is to notice how drag changes with speed from slow speeds, through the trans- sonic zone [the jump] to supersonic motion, for a G7 projectile, as measured (likely, with Doppler Radar that measures velocity directly, from frequency shift of reflected radio waves, taking radar measurements thousands of times per second . . . a revolution in ballistics studies):

Drag for a streamlined standard projectile, the G7 profile, where Drag Coefficient is a measure of
drag resistance and Mach number is ratio of speed to the local speed of sound, which varies
with temperature, pressure, etc, The supersonic part of the curve can be modelled
and is relevant to motion of bullets used for target shooting (HT: Bison Ballistics)

Indeed, Philip Massaro, in his The Big Book of Ballistics, wrote:

the advent of high-speed Doppler radar units and heavy-duty computing power for backend processing has shown us a very different view of [a projectile's ballistic coefficient, BC] . . . We’ve learned that BC is not a [true] constant, but a variable with some basis in velocity and a host of other impacting factors . . . the actual slipperiness (BC) of the projectile changes at varying velocities throughout its flight profile [ --> as in the graph above]. 

Doppler radar can actually be used [with computing] to solid model the bullet in three dimensions throughout its flight. When we model against the actual flight path, we can see the bullet is not in axial profile with its flight direction. When this occurs, the  bullet is presenting to the wind with an inherent amount of yaw, which increases drag and changes the [detailed] outcome of the BC model. The bullet is spinning in either a right- or left-handed rotation . . .  the rotational force of the spin causes the nose of the bullet to precess or climb into that wind. You end up with a bullet not traveling along its intended axial path, but presenting to the air ahead of it a non-conformal profile and adding an amount of drag again . . . 

Also, though it is rather military-like, we may also look at what such a projectile looks like, a shape that also points to aircraft, boat and rocket shapes, to how modern sail-boats can sail by tacking upwind and even hints at why wings have the teardrop-like cross-section shape they do in order to balance lift and drag:

A G7 standard projectile, shaped for superior supersonic performance. Notice the "boat-tail"
and the nose cone. The latter is based on the arc of a circle at ten radii and makes a distinct
angle with the cylindrical, main body following. Just as does the boat-tail.

 Comparing and extending:

 


 We can see too, that the air resistance graph for the G7 projectile has three parts, [i] a roughly steady subsonic part, [iii] a curving supersonic part and between them, [ii] a trans-sonic transition zone. Normally, a G7 projectile is worked with in the supersonic zone. The trans-sonic part, unsurprisingly, tends to disturb accuracy of aim.

This pattern alone, already means there can be no simple fully accurate algebraic solution; also, we are forced to deal with sets of differential equations . . . which, are equations involving rates of change of variables. For simple example, in Newton's Second law, F = m* a, the acceleration a is the rate at which velocity v changes with time, and v in turn is rate of change of displacement, speed in a given direction. So, we have F = m * x''(t). (I here use dashes instead of the more usual dots-on-top for rates of change relative to time.)

As Bison Ballistics notes:

Instead of analytical solutions we must find numerical solutions. That's a fancy way of saying that we can approximate the results of the analytical solution [to the set of equations] for a specific set of numerical inputs. But in doing so, we introduce some error along the way -- you can think of it as sort of like a rounding error. The full physics of the model are accounted for in the equations, but the solution itself has introduced error.

The way numerical solutions work is that you step along the trajectory, calculating in tiny steps as you go. Each step uses the results of the last step [taking care to avoid building up unacceptable accumulated errors] . . . Since computers are doing all the work, we can effortlessly take a lot of steps and get a very accurate solution.

For example, a common technique is to step through time. That means you might calculate the trajectory for every 0.001 seconds of bullet flight. That might be 1,500 separate calculations along the flight path to 1,000 yards. No sweat for a computer. You can also step along distance -- it's often convenient to step every foot or yard through the trajectory. Either way, very low errors can be achieved.

So, let us now outline, first the negligible air resistance case:

 

PART 2:
Projectiles, the "no air resistance" parabolic arc case:

 


 Here, we first notice how projecting horizontally at a height closely resembles the path of a bowled cricket ball, save that as illustrated it is rather steep.  Which, should be no great surprise.

Next, we may see the value of using vectors to separate vertical and horizontal motion. The horizontal motion is steady where there is negligible air resistance so x is proportional to t. Vertical motion faces uniform downward acceleration at g. Vertical displacement therefore follows a quadratic expression in t, and as x is proportional to t, this means the curved path is a parabola, like y = x^2, an ellipse-like curve. 

As, we saw being nearly the case above with the water fountain. 

(Where, the cos and sin terms are Trigonometric ratios due to the inclination of the trajectory at launch, at angle theta-nought to the horizontal. Let us observe:

 


It becomes clear that as the angle of projection rises to the vertical, the horizontal component reduces and the vertical one increases. This affects the steepness of the parabolic arch, and at 45 degrees, for a level ground, range is maximised. At 90 degrees, the projectile goes straight up and down, and at zero it would go along the ground, or if fired from a cliff edge, would follow the descending part of the parabola.)

We could use these functions and equations to write a program that plots the trajectory as a function y of x or in the end y and x of t. 

As one may imagine, air resistance will tend to retard the motion of the projectile at each point along an actual path, and the actual path will be within this ideal trajectory. As we can see sketched above where what would have been a parabola curves downwards more sharply.

Here is a discussion of early developments up to Euler:


 Let us now turn to:

 

PART 3:
Projectiles with air resistance (Pejsa's model):

Arthur Pejsa [= "Pay-sah"] -- a literal rocket scientist working for Honeywell! -- has developed an algebraic representation for projectile drop with distance, on the reasonable assumption that G7-like bullets are typically projected close to horizontally. It reportedly works well for 1,400 - 4,000 foot per second, supersonic velocities. These are a reasonable range for modern rifles etc, note the speed of sound "at sea level — assuming an air temperature of 59 degrees Fahrenheit (15 degrees Celsius) — is 761.2 mph (1,225 km/h)."  Now, too, 1 mph is 5,280 feet/hr; or as there are 3,600 s/hr, 1.467 ft/s. So, this "representative" value for the speed of sound equals 1,116.427 f/s or 340.288 m/s. Of course, for objects moving at speeds well below the speed of sound, such as a baseball or cricket ball or tennis ball, Newton long since showed that a speed square law can be a good model. We will be looking at the Pejsa supersonic case, and it has been convenient to think in terms of modifications/corrections to a square-of-speed model.

 Bison Ballistics notes:

Dr. Arthur Pejsa's famous Pejsa method is a similarly clever method that allows for the equations of motion to be solved by simplifying them - he approximated the drag with some simple equations and came up with a method that is almost as good as what we use today, but that only requires high school math. That's a great achievement, and his method is far simpler than Siacci's [classic result], but it's still not perfect.

This will be an example of how we can use results developed by trusted subject matter experts as a basis for modelling, simulation, systems etc, that are based on programming in relevant languages. Once we have a good result from a reliable source, there is no need to re-invent the wheel. Of course, sometimes, it is a case of having a framework and needing to turn it into a useful program or even application or "app." This case study can help us on both sides of the fence.

For a starting step, Mark Biegert and his Math Encounters has usefully summarised the first stage of Pejsa's calculation -- and pardon naked differential equations; this is for background reference -- no need to "get the vapours" if differential equation notation is unfamiliar:


Eqn 5 in effect says, vertical acceleration y" is g plus a function times vertical velocity y'.

Where, as it contains rates of change, it is a differential equation. 

F/N: Here, y" is d/dt of (dy/dt), often shown as d^2/dt^2 (y). That is the rate of change of (the rate of change of displacement). Acceleration, in short is the rate of change of velocity, which is the rate of change of displacement. Displacement is distance moved relative to a reference point, in a specified direction, i.e. it is a vector as it has size and direction. Using nonstandard analysis, we can then view dy/dt as in effect the ratio of tiny increments in y, dy to the time required for those increments to happen, dt. Here, dy and dt can be taken as infinitesimals, in effect numbers so small relative to 0, that they are smaller than 1/n for any whole number n we can count to. We can identify such a number using Newton's h. Then. 1/h = H, a transfinite hyperreal larger than any n we can count to. The infinitesimal h then allows us to reduce calculus to an extension of algebra. The extended number line involving infinitesimals and transfinites now becomes:

 

. . . and yes, the transfinites just keep on going.

(This approach, as noted above, allows us to treat Calculus as an extension of Algebra. It is just as valid as the limits approach now usually taught, but is more intuitive; it was put on a rigorous footing by Abraham Robinson in the 1960's. BTW, y" and y' are slight modifications of Newton's dots notation for rates, y' = dy/dt.)

 After some fancy mathematical footwork . . . and yes, these are actually first steps along one of the paths towards rocket science . . . we may deduce y, following Pejsa, giving a solution:


This is then converted to customary units, e.g. horizontal distance R is in yards [x = 3*R, in feet as 1 yard is three feet long], speed is in ft/s and projectile drop D in inches; also using a Taylor Series approximation, with G as a simplification and V_0 as initial velocity, or muzzle velocity. (This requires some practical effort (and statistics) to establish.) As to why Pejsa gives drop in inches and range in yards, he is working with people who think in those terms. In turn, we have to take the expert's result and work with that as it is -- warts and all. 

It is helpful to note that at 100 yards, 1 inch subtends about one minute of arc, and that a 1 moa rifle is a pretty accurate gun; obviously, at 1,000 yards 10 inches is 1 minute of arc. Similarly, at 1,000 m, 1 m subtends a milliradian, a mil of arc. Usually for practical purposes a full circle is taken (NATO standard) as being 6,400 mils, where the old Warsaw Pact and German model rounded to 6,000. 

Next, F_0 is a theoretical distance where the speed of the projectile is 1/e of initial value (by which time the projectile would likely be subsonic! Oopsie!); more usefully, Pejsa expressed this decay in terms of distance to lose 1% of its speed. In his New Exact Small Arms Ballistics (Kenwood Publishing, 2008), appendix,  p. 132, Pejsa deduces for a downrange point, the retard or air drag coefficient, F = F_0 - Nx, a linear decline from F_0 = V_0N/a. Accordingly, he notes, p. 16, that F is "the fractional loss in v per foot of travel," so going to the 1% value that does not go outside the valid range of the model by becoming subsonic, F/100, is " . . . the distance in which a projectile 1% of its remaining speed to drag." Where, yes, here we are looking at exponential decay, similar to rise and fall time of Resistance-Capacitance circuits, but can deduce useful simplifying observations and approximations that are good enough for our "practical" purposes. In essence, when a positive or negative rate of change of some variable x is proportional to its value at any given moment, we have exponential decay [if, -] or growth [if, +]. This is the secret of compound interest etc. 

Similarly, g is acceleration due to gravity [32 ft/s per s], A and n are "parameters," values that allow us to fit the expression to a particular projectile, as the worked example to follow will show.

Notice, we are here reducing the above to a relatively simple algebraic expression that we can simply plug values into and read off D for any given R, i.e. our code will have a calculate sqrt-D then square to get D module. 

One trick is to set the start point at say R_0 corresponding to 0.0001 inch or the like, getting away from the notorious divide by zero error problem:


Where F_m is another simplification, tied to F_0 from the original derivations:

Obviously, as R in yards = 1/3 of x (which is in feet), 

F_m (R) = F_0 - 1/4 (n*3R)

and yes, there is a messy mix of units. 

Sources are going to work in terms that are comfortable for them.

So, we start with a test case:

- muzzle velocity (at 0.0001 in to avoid divide by zero errors), here v_0 = 2,900 ft/s
- Scope/sight height above the centre line of the bore, here S = 1.5 in
- zeroed range (the point where the bullet first intersects the line of the sighting device, i.e. factoring in its elevation angle and curved path . . . as,  the line of the rifle bore is slightly elevated), here the second -- falling -- zero point is Z = 166 yd
- Note, the rising zero is called the "near zero" and the one typically used practically is the falling zero point, often at 100 or 200 yards
- the projectile's ballistic coefficient (and so drag effects relative to a G1-like projectile . . . Pejsa actually used a US 0.50 cal M2 Ball round that is closer to the G7), here BC = 0.5 
- an expression for F_0 [theoretical distance for speed to be 1/e of muzzle speed], thence deduced F_m for given distances downrange [F_0 and F_m are in feet, yes x is in feet . . . F_m or more exactly F_m/100 is a measure of further distance downrange to lose just one percent of current speed], where for this case F_0 = 3,576 ft

- a parameter G, G = 41.697 sqrt ft/s
- downrange distance, D is x in ft and R in yards, R = 1/3 x
- a parameter n for how drag reduces with increased speed in the supersonic zone (as the Mach cone angle narrows), here n = 0.5 

 . . . and then deduce projectile drop for points downrange using a model expressed as a formula. 

Where, the intent is to prime our coding partner ChatGPT with information on this case, ask it to use the Pejsa model, then put up Java code to tabulate bullet height (and drop) for R = 1 yard, 51 yards, 101,  151 . . . 601 yards -- to avoid cases where divide by zero might pop up, as a 50 yard first (rising) zero or a 100 or 200 yard falling zero are common, standard practices. Then, we request a spline interpolation and plot a smooth curve. (In actual practice it did this in a few minutes, but of course, it is our responsibility to do a debug reading, and to understand the situation well enough to prompt properly -- which requires ability to design algorithms and to hand code in Java. Of course, real world coding is now in partnership with an AI Assistant; so we might as well begin that way. As, the simple difference in time, labour and initial effectiveness . . . avoiding silly or careless bugs, is already decisive at the outset. Here, initial results -- including finding an exposition of Pejsa's model on the web, took about three minutes and ChatGPT said it was "fun." We are in the AI economic long wave!)

Of course, if one has a need to use more standard metric units, a conversion module can be engaged to work in Pejsa's "customary US" units and return metric results (or as an option, customary units). 

To get D from its root, simply take the square. 

We can summarise the drop-range result, D vs R, from Pejsa's "The Birth of Practical Ballistics," at the Wayback Machine:


The pivotal result now in hand is "merely" algebraic (a huge simplification!), and apparently is often quite good for practical work.  

A typical practical approach, would be to use the summary result in the main discussion of a proposal, progress report or final report, and place the details in an appendix. Refer to the appendix in the main body and table of contents.

A now familiar plot of C_d vs Mach Number,
showing the "sound barrier" transonic drag peak;
however, this is for an aircraft! (Yes, ballistics
is a gateway to studying flight and rocketry.)

McCoy
-- that's a book at the Wayback Machine -- and others, of course give more complex results. Dr Viv gives a fundamental analysis. Hornady's ballistician, in a video, discusses drag for supersonic projectiles, drawing out that the rise in air resistance as such a round slows down is due to how the angle of the shock wave(s) spreads out as excess of speed over the speed of sound reduces. See video of such shock waves here and a discussion of trans-sonic instability here. Yes, this is a case study on how real world complexities and insightful observations intersect. Notice, also, how the Mach Angle m readily gives Mach Number, M, as sin m = 1/M. Where, the ratio of speed v to local speed of sound c, M = v/c and m is half the angle of the "vee" formed by the shock wave (i.e. the angle one arm of the vee makes to the line of flight). Of course, as a flying round goes subsonic the shock wave vanishes and a different, subsonic drag regime emerges, hence the peak and dropoff to the subsonic drag coefficient. 




That's why Pejsa's approach makes a lot of good sense. 

The ballistician (yes, that is a career path) also draws out insights on the fast projectile air resistance expression, especially drag coefficient C_d. And, as the graph to the right shows, the C_d vs Mach Number pattern also applies to aircraft.

 Here is Mach's original shadow photograph of shock waves, 1888; notice, the turbulent wake:


Then, we can see a bullet slowing down as it goes trans-sonic:

Notice how the Mach cone angle opens up as the bullet slows:
in the trans-sonic case, because fluid flow around a body is accelerated,
we see "whiskers" that mark a point of supersonic flow


 

Where, basic drag and lift equations for subsonic flight are:

Where, the terms for the subsonic V-squared "Newtonian" drag expression are:


The Bell X1 in flight. Notice, the chain of shock
diamonds
in the exhaust, a standing wave pattern
(NB: What looks like an oddly shaped p is actually the lower case Greek "R" rho, a symbol for mass per unit volume, i.e. density. The "capital" Rho, just for fun, looks like our P. BTW, the Greek p is pi, which looks like a table end-on as we know from the math of circles. The reference area depends on context, for a blunt object or bullet it is its cross section area as it cuts through the fluid. For a wing, it is the "plan view" area, as wing lift depends on how much wing area there is. The lift coefficient C_l, of course, is similar to drag coefficient. This makes sense as lift is just the sideways component of the same air resistance force that gives drag as the in line component tending to slow down a body moving through the air. There are theoretical expressions for predicting lift and drag, but simulations and wind tunnel testing are standard procedures. In short, if you are interested, ballistics is the gateway to aerodynamics. For example, the Bell X1 rocket aircraft piloted by Chuck Yaeger that first broke the sound barrier was modelled on the US 0.50 caliber bullet, which was known to go supersonic very successfully.)

 In two short videos, the The Efficient Engineer channel further discusses aerodynamic drag and lift, which bridges to flight. In an MIT open course lecture, Tina Srivastava and Philip Greenspun give a good overview of flight. NASA has translated Krasnov et al on Rocket Aerodynamics, which is at Wayback Machine here. Likewise, NASA has a cluster of simulations on aerodynamics topics here.

A "typical" electromechanical calculator (CR)

Of course, in the real world, major global powers have whole departments that operate research laboratories devoted to the study of ballistics with air resistance. Suffice to say, that one reason for the development of the modern digital computer, was to construct firing tables for artillery. This is one way into the study of flight and rocket science. The well known US agency, NASA grew out of earlier bodies that studied such topics. Indeed, standard airfoil shapes in the 1930's and 40's were often given by NACA type. It is worth noting that "computer" used to be a job title for Mathematicians whose job was to carry out such highly technical and typically tedious calculations by hand, or by hand assisted by electro-mechanical calculating machines. 

(As a note, GEM's father, a Statistician and so a human Computer as well as an Economist trained in the late 1950's, could add three columns mentally to any length, transfer the result and keep going. When he first got electronic calculators, he would automatically cross check the result mentally, right up into his eighties. Gen. Erwin Rommel memorised tables of logs and used these to carry out extremely complex calculations in his head. Multiplication and division become addition and subtraction and raising to powers, multiplication. And, much more. We simply point onward to Mathematica, noting that Wolfram has kindly donated an installation of this app -- with a built in programming language -- to the Raspberry Pi. Given pricing, a Raspberry Pi 400 is therefore in effect an educational donation if one wants to use it as a calculation engine.)

This short survey also gives us a sense of how fast the mathematics of a realistic situation compounds, and why approximations often rule the roost. 

Here is a tabulated result, notice, s := s_val is specifying or defining a value:


This is of course suggestive on how a program to tabulate or plot bullet drop could be written, in Java or another relevant language.

As a first step, we tabulate the results above using a Libre Office Calc spreadsheet, picking the XY scatter plot option, displaying points and lines, with a cubic spline function. The result looks rather parabolic, but of course incorporates the Pejsa air resistance model. The bullet climbs to about 2.5 inches above the muzzle-level [- 1.5 inches] at about 100 yards (the system is "zeroed" for Z := 166 yards), then falls to about 47.7 inches below that level at 500 yards:

Now, let us compare a y = - x^2 parabola to see the considerable effect of air resistance:

 

Air resistance causes the projectile to fall off more
steeply than a parabola, as expected, though the eye
would "miss" the difference. Likewise, motion
through the air can lead to lift, hence how wings work


This exercise is, of course, the digital equivalent of plotting points on a sheet of graph paper then using a set of French Curves (or even a flexi-curve or a wooden spline) to fill in a smooth curve.

 It is enough to show that the tabulated results make good sense, especially when we compare an actual parabola. 

Similarly, one could set up a spreadsheet to automate the calculation, and that would be good enough for many tasks. 

However, our aim is to create a program (which is potentially more powerful and flexible than a spreadsheet . . . and is how a spreadsheet is made), so the above helps us see basic tasks for a program for this case: calculate bullet drop for points downrange, tabulate, plot using something like a cubic spline, displaying on a chart. It might also be helpful to print the table. It may help, to know that Libre Office and its sister Open Office, are coded in Java; likely, the charts plotted using Calc are created with Java graphics packages such as JavaFX and/or JFreeChart.

A first step is to hammer out an expression for D(R), substituting for F(m):

D(R) = {[G/V_0] / [1/R -  1/(1/3 * F_0 - 1/4 * nR)]}^2

So, for the case in view -- and yes, to avoid confusion with "x" for a variable it is common to use the asterisk * for multiplication in computing, 

D(R) = {[41.697/2,900]/ [1/R - 1/(1/3 * 3576 - 1/4 * 0.5 * R)]} ^2

D(R) = { 14.6783*10^-3/[1/R - 1/(1,192 - 0.125 R)]}^2

From this, already we see an upper limit to the model, as the denominator goes to zero at a point where, for this specific, particular case we are looking at:

1/R - 1/(1,192 - 0.125 R) = 0, so we rearrange algebraically

R + 0.125 R = 1,192, thus

R = (1,192/1.125) = 1,059.56 yards

However, also, squaring does not preserve sign as -1 * -1 = +1. To detect sign, we need to use a sign-detecting function and store the result in the form -1 for drop below the line of sight, +1 for rise relative to the baseline, as was tabulated above and plotted. Then [sqrt_D] squared can be multiplied by the sign value to get both size and direction of the projectile drop . . . and yes, real numbers and integers have both size and direction so they are technically speaking vectors. 

All of this need to address direction is because, the line of the bore is below the line of the sights and the round is pitched slightly up on firing then peaks and falls away; slightly is important. Illustrating:

(Notice, here, how the trajectory rises to and beyond a first zero point, then falls through a second one. In the tabulated case, 166 yards is actually the second -- falling -- zero point. Also, observe how the line of the sights is above that of the bore. Of course, as we can see from the SMLE 0.303 ramp sight, once a rifle is zeroed, the sight then uses the known trajectory to calibrate aiming for different ranges. This poses a challenge as the formula has a subtraction in the denominator, which means it can go to zero, creating an infinity. In an algorithm it may be necessary to instead work with 1/[sqrt-D) and to use sign detection to pick up and respond to a zero. 

The Pejsa reduction, in short -- and like many other real world models -- gives us a useful model, "warts and all." Accordingly, we must take steps to ensure that we avoid divide by zero errors and also the zero-range point at the muzzle

The easiest solution, then, is to recognise that a first zero point at 50 yards is common, or sometimes, 100 yards, and a second zero point for the iron sights or the sighting telescope may be 150 or 200 yards. Accordingly, this model is clearly best used to create a tabulation at a list of specific ranges -- with zero-avoiding offsets -- as we just saw, then we use a spline or similar model to interpolate. Why not, 0 + 0.1 yard, 50 + 0.1 yards,100 + 0,1 yards, etc, out to 500 + 0.1 yards or 1,000 + 0.1 yards (or even + 1 yard)?)

Observe, the SMLE sight again (and yes, 2,000 yards is rather optimistic):









ccccc






 

 

 

 

 







 

 

 

ccc









some effort