Thompson - Computing for Scientists and Engineers (523188), страница 43
Текст из файла (страница 43)
Insteadof A, Keller used F, which is easily confused with force. In this differential equation the net acceleration is the driving acceleration, A, minus a resistance proportional to the speed at time t. The physiological justifications for this equation werediscussed by Keller and were subsequently debated by various experts.The data on which Keller’s analysis was based are given in Table 7.1 in the column “Men 1972.” Also shown in the table are world records as of 1968 and 1991.The shortest world-record distance now recognized is 100 m, the British system oflengths is no longer used, and the timing is now to 0.01 s, being done electronicallyrather than manually as in 1968.
I have also included the data for women sprinters,since these allow an interesting comparison of speeds and improvements.TABLE 7.1 World-record sprint times (in seconds) for men and women. For the 200-m race thenotation (s) denotes a straight track and (t) denotes a track with a turn. From Guinness Book ofWorld Records (1968, 1991) and Reader’s Digest Almanac (1972). The noninteger distances areconverted from British units.7.2 FIRST-ORDER LINEAR EQUATIONS: WORLD-RECORD SPRINTS227FIGURE 7.1 Distance vs time for world-record sprints.
The line shows the best fit in theKeller model using the 1972 men’s data (solid points). The triangles are the distance in the giventime minus the calculated distance for that time, scaled up by a factor of 10.Figure 7.1 shows the distance-time data for men sprinters in 1972. It may notbe evident that its slope is increasing significantly for about the first 5 seconds. Theaims of our analysis are first to solve the linear differential equation (7.5) for thespeed and the distance covered, to repeat the analysis of Keller’s data, then to analyze some of the other data in Table 7.1. This will be most efficient if we write aprogram to handle the arithmetic involved while we puzzle out the best choice of parameters A andWe will make weighted-least-squares fits of the data, making useof results from Section 6.4.Warming up to the problemWe may use familiarity with athletics, and some mathematics, to build up the solution of (7.5).
In track sprints the runners start from rest, so we must have the initial conditions that at t = 0 the speed v = 0. Therefore, near the start of the race wemay neglect the second term on the right-hand side of (7.5), so that v (t) At atearly times. On the other hand, if the A term in (7.5) were negligible, we wouldobtain the exponential function as the solution, namely v(t) = Ce exp(-t ),where Ce is a constant. Is there a patched-up solution to the world-record sprintproblem that contains both approximations?Exercise 7.4(a) Show by expanding the exponential to its linear term in t that the linear combination of the two linear solutions(7.6)gives v(t) = At for small t provided that Ce = -A.228INTRODUCTION TO DIFFERENTIAL EQUATIONS(b) By substituting in the original sprint differential equation (7.5), verify that(7.7)is a complete solution of the equation that is also consistent with the initial conditions.
nThus, by a combination of insight and algebra we have produced the solution toKeller’s equation for modeling world-record sprints. You may recognize the differential equation (7.5) as an example of a linear first-order equation that can be solvedby the use of integrating factors. For this method of solution, see (for example) thecalculus text of Wylie and Barrett.A simpler method of solution is to notice that (7.5) is also a separable differentialequation, for which (as discussed in Wylie and Barrett) this equation can now be rearranged as the integral over a function of v and an integral over t.Exercise 7.5Convert (7.5) to integral form by writing it as(7.8)then recognizing the left-hand-side integrand as the derivative of a logarithm.Evaluate this logarithm for the given limits of integration, then take the exponential on both sides, show that the solution (7.7) for v (t) is obtained.
nThus we have a second method for solving the sprint differential equation (7.5)For our comparison with data we need an expression for the distance, D, run ina given time T. (Actually, we would prefer the relation in the other direction, butthere is no closed expression for this.) It is also informative to calculate the runner’saverage speed during the race. We have that(7.9)where we have built-in the initial condition that D = 0 if = 0; that is, the runnersmust toe the line.Exercise 7.6(a) Substitute (7.7) for v (t) then carry out the time integration in order to show7.2 FIRST-ORDER LINEAR EQUATIONS: WORLD-RECORD SPRINTS229(7.10)which predicts D for given T.(b) The average speed during the race is just the total distance divided by theelapsed time.
Use (7.10) to show that this average speed, vav (T ), is(7.11)(c) From (7.11) show by expanding the exponential to the third order inthat near the start of the race(7.12)so that the average speed increases nearly linearly with time.(d) Show that for long times, such that T /t >> 1, the exponential term diesaway and a uniform average speed is predicted, having value(7.13)which is just the solution of (7.5) as the left-hand side tends to zero, a steadyspeed that gradually comes to represent the average speed.
nWith all these exercises you are probably getting more of a workout than an athlete, so it is time to apply Keller’s mathematical model to the world-record data. Aprogram is worthwhile for this purpose.Program for analyzing sprint dataFor analyzing the sprint times in Table 7.1 and for predicting average speeds andhow they vary with improvements in athletic performance, some programming effortwill allow the parameter space of A and to be explored thoroughly and efficiently.Before outlining the program structure, examination of the equation for the distance covered, (7.10), is of interest. We notice that A appears only in the combination , which is a common normalization factor for all the data that are analyzedusing a given value of .
In Section 6.4 we show that in a weighted least-squaresfit (not necessarily to straight lines) such a model normalization factor can be obtained directly from comparison between the model with the factor set to unity and thedata. Equation (6.50) is the operative formula that we use to reduce our analysisfrom two parameters to a single parameter This greatly decreases the time it takesto get an optimum fit, at the expense of only a half-dozen lines more code. Thesame arithmetic also produces the minimum value of the weighted objective function(6.53). Contrary to reality, but sufficient for our purposes, we assume that T isprecise.
We use weights that vary as 1/D2, as in Keller’s analysis.230INTRODUCTION TO DIFFERENTIAL EQUATIONSAs suggested by (7.10),is the relevant parameter for analysis, so this is tobe calculated and output by the analysis program. It is also interesting to see the difference between the data and the calculated distances, DR - DC , in Figure 7.1. Theaverage speeds, (7.1l), are not of interest until we have an optimum value, sothese can be readily be programmed on a pocket calculator or on your workstation.The analysis program World Record Sprints has the following structure.The first section provides options for input of sprint data files, for example, those inTable 7.1.
The next part readies matching output files, either to be written over orto be added to. The main work of the program is in the loop to optimize and A,which is controlled by the user. Only has to be input because A is derived automatically as a normalization of the calculated distances, as explained two paragraphsabove.
The output for each value chosen is sent to the console and to the outputfiles for later graphical interpretation. Finally, the definition of the distance formulais provided in function DIST. If you decide that a different single-parameter modelis appropriate, you need only modify DIST. The program listing is as follows.PROGRAM 7.1 Analysis of world-record sprints using the Keller model (7.5).#include <stdio.h>#include <math.h>#define MAX 8main(){/* World Record Sprints */FILE *fin,*fout;FILE *fopen();double DisR[MAX],Time[IGX],DisC[M?JX];double Din,Tin,A,Acalc,tau,Atau;double obj,sum_yData,sum_yProd,sum_yFit,dif,weight;int choice,ND,k;char yn,wa;double DIST();printf("World Record Sprints\n");choice = 1;while ( choice > 0 ){printf("Choose data:\nO: Quit program\nl: Men 1968\n");printf("2: Women 1968\n3: Men 1991\n4: Women 1991\n");printf("5: Men 1972 (Keller)\n");scanf("%i",&choice) ;if ( choice == 0 ){printf("\nEnd World Record Sprints") ; &t(O) ;7.2 FIRST-ORDER LINEAR EQUATIONS: WORLD-RECORD SPRINTSif ( choice < 0 || choice > 5 )printf("!! choice=%i only 1 - 5\n",choice); exit(l);printf("How many distances?\n");scanf("%i",&ND) ;if(ND>MAX)printf("!! # of Distances %i > MAX-l=%i",ND,MAX-1);exit(l);}printf("Prepare input f ile? (y or n) :\n') ;scanf("%s",&yn);if ( yn == 'y' ){printf("Input Distances & Times:\n");switch (choice) /* to ready input files for data */casecasecasecasecase1:2:3:4:5:foutfoutfoutfoutfout=====fopen("MEN68in","w'); break;fopen("WOMEN68in","w"); break;fopen("MEN9lin","w"); break;fopen("WOMEN9lin","w"); break;fopen("MEN72in","w"); break;for ( k = 1; k <= ND; k++ ) /* input Distance & Time */printf("\n%i: ",k);scanf("%lf %lf",&Din,&Tin);DisR[k] = Din; Time [k] = Tin;fprintf(fout, "%lf %lf\n",Din,Tin);fclose(fout); rewind(fout); /* Ready for reuse */} /* end data-preparation loop */printf("\nWrite over output (w) or Add on (a):\n");scanf("%s",&wa);switch (choice) /* to ready input/output files */{case 1: fin = fopen("MEN68in","r");fout = fopen("MEN68out",&wa); break;case 2: fin = fopen("WOMEN68in","r");fout = fopen("WOMEN68out",&wa); break;case 3: fin = fopen("MEN9lin","r");fout = fopen("MEN9lout",&wa); break;case 4: fin = fopen("WOMEN91in","r");231232INTRODUCTION TO DIFFERENTIAL EQUATIONSfout = fopen("WOMEN9lout",&wa); break;case 5: fin = fopen("MEN72in","r");fout = fopen(WEN72out",&wa); break;for ( k = 1; k <= ND; k++ )/* Data input */fscanf(fin, "%lf %lf\n",&Din,&Tin);DisR[k] = Din; Time[k] = Tin;printf("\nLoop to optimize tau & A\n");tau = 1;while ( tau > 0 )printf("\nInput tau: (tau=O to leave loop)\n");scanf("%le",&tau) ;if ( tau > 0 )sum_yData = 0; Sum_yProd = 0; sum_yFit = 0;A = 1; /* for clarity in definition of DIST */for ( k = 1; k <= ND; k++ ) /* loop over data */DisC[k] = DIST(Time,k,A,tau);weight = l/(DisR[k]*DisR[k]);sum_yData = sum_yData + weight*DisR[k]*DisR[k];sum_yProd = sum_yProd + weight*DisR[k]*DisC[k];sum_yFit = sum_yFit + weight*DisC[k]*DisC[k];Acalc = sum_yProd/sum_yFit; /* best-fit */Atau = Acalc*tau;obj = sum_yData - Acalc*Acalc*sum_yFit;printf("tau,A,A*tau,obj: "); /* obj is per data point */printf("%8.21f %8.21f %8.21f %8.41e\n",tau,Acalc,Atau,obj/ND);for (k=l; k<=ND; k++) /* loop for normed calculation */DisC[k] = Acalc*DisC[k];dif = DisR[k]-DisC[k];printf("%i %8.21f %8.21f %8.21f %8.21f\n",k,Time[k],DisR[k],DisC[k],dif);fprintf(fout, "%i %8.21f %8.21f %8.21f %8.21f\n",k,Time[k],DisR[k],DisC[k],dif);} /*end k loop*/} /* end tau>0 loop */} /* end while (tau>0) loop */} /* end choice loop */7.2 FIRST-ORDER LINEAR EQUATIONS: WORLD-RECORD SPRINTS233double DIST(Time,k,A,tau)/* Distance vs Tim formula for world-record sprints */double Time[],A,tau;int k;double length;length = A*tau*(Time[k]-tau*(l-exp(-Time[k]/tau)));return length;As a check on the correctness of your formulas, it is a good idea to try the parameters that Keller used with the men’s 1972 records up to 200m.