Dec 222017

Curv fitting and eqn solving prog. | |||
---|---|---|---|

File Name | File Size | Zip Size | Zip Type |

SICURV.BAS | 9600 | 3356 | deflated |

SICURV.COM | 27648 | 20026 | deflated |

SICURV.DOC | 4432 | 2159 | deflated |

TPCREAD.ME | 199 | 165 | deflated |

# Download File SICURV.ZIP Here

## Contents of the SICURV.DOC file

SICURV

SIMULTANEOUS EQUATIONS AND CURVE FITTING

BY CINO HILLIARD

ZBASIC 4.0 VERSION

10/20/87

This program calculates the solution of systems of simultaneous equations

using the long-hand Gaussean elimination method learned in high school.

This procedure is then used as a subroutine to solve systems of equations

necessary to complete the solution of the Least Squares algorithm for curve

fitting.

Solution data is stored in disk files for access by other programs such as

Lotus 1-2-3.

In addition, the program provides for the evaluation, differentiation, and

integration of the Least Squares polynomial for selected values and ranges.

The 54 digit real number accuracy of Zbasic allows for fairly large degree

polynomials to be solved for a set of data pairs. Included in this package

are examples using a 26th degree polynomial to compute the digits of pi and

the area under the Gaussean Distribution using the integration option.

Apparantly because of the 10E63 limit of Zbasic, the 26th degree polynomial

appears to be an upper limit of the program. Still this beats any other

program that I have seen including Borland's Eureka. There is no question

about it. Zbasic is the most powerful basic availabe for the PC. All other

basics I tried (Quick Basic, Turbo Basic, GW-Basic, Basica ) breakdown in

accuracy for degree > 9. Double precision is simply not enough to maintain

the places needed for large powers. If Apple's MAC supports 240 places

it is even more powerful.

EXAMPLE I

---------

Compute pi by finding the area under a selected arc of a circle.

Consider the upper right quadrant of a unit circle OAB with center at O.

Bisect the radius OB at point C and extend upward crossing the circle at P.

By analysis of this figure we have

(1) OC=1/2

(2) Angle AOP=30 deg.

(3) Triangle OPC is a right-triangle

(4) PC = Sqrt(1-(1/2)^2) = Sqrt(3)/2

(5) Area of sector OAP = pi/12

(6) Area of triangle OPC= PC/4 = Sqrt(3)/8

(7) Area under Arc AP = Integral{0,1/2} Sqrt(1-X*X)

where {0,1/2} denotes the bounds of X

(8) Area of sector OAP = Integral Sqrt(1-X*X) - Sqrt(3)/8

(9) Pi = ( Integral{0,1/2} Sqrt(1-X*X) - Sqrt(3)/8 )*12

By the way this process can be repeated, using smaller and smaller arcs

eg., in the case of the arc subtended by a 15 degree angle

Pi = ( Integral{ 0,Sqrt(2-Sqrt(3))/2 } Sqrt(1-X*X) - 1/8 )*24

This is built in to the solution asa default for upper bound <> 1/2

Use SICURV to compute the area under the Arc AP by fitting an appropriate

polynomial through a set of points on the circle passing through the Arc AP.

To do this it is convenient to define the data pairs using the 54 digit

precision of Zbasic.

PROGRAM DATAMAKE.BAS

00010 INPUT"FILE TO SAVE TO ";FIL$

00020 OPEN"O",1,FIL$

00030 F$=CHR$(34)

00040 DEFDBL X,Y

00050 FOR X=0 TO 1 STEP .001

00060 Y=SQR(1-X*X)

00070 PRINT #1,X;",";Y

00080 PRINT X;Y

00090 NEXT X

00100 CLOSE 1

Keep in mind that the function used here is the equation of a circle in

the cartesean coordinate system and that any function can be used to find

the approximating polynomial that fits the selected data. This is useful

to compute derivatives and integrals of complex functions that are not

amenable to analytical solutions.

The example data file included in this package is CIRCLE.

A CURVE FITTING EXAMPLE

----------------------

1. Load and Run SICURV

2. SELECT OPTION 2 FILE CURVE FITTING

3. AT PROMPT INPUT N,P,ST

KEY IN 26,540,20

THIS SAYS SELECT A 26TH DEGREE POLYNOMIAL AND 27 POINTS SELECTING

EVERY 20TH POINT UP TO 540.

5. AT PROMPT FOR FILENAME INPUT CIRCLE

6. FOLLOW PROMPTS AND INSTRUCTIONS

7. WHEN DONE SELECT OPTION 4 OF CURVE FITTING MENU.

8. INPUT 0,.5 AS BOUNDS

9. THE SOLUTION HAS EQUATION (9) ABOVE BUILT IN FOR EFFECT

CHANGE OR REMOVE STARTING AT LINE 2300

10. TO QUIT INPUT M,M

11. SELECT OPTIONS.

HISTORY

-------

I first wrote sicurv on a TRS80 MODEL I using LEVEL I BASIC.

When I got LEVEL II BASIC I wrote my second version.

As my hardware and software changed I rewrote Sicurv.

This version was written on a PC-LIMITED 286.

SPECIAL THANKS

--------------

FRANK R.NEAL COLUMBUS OHIO 75206,1402

FOR THE MENU ROUTINE.

SIMULTANEOUS EQUATIONS AND CURVE FITTING

BY CINO HILLIARD

ZBASIC 4.0 VERSION

10/20/87

This program calculates the solution of systems of simultaneous equations

using the long-hand Gaussean elimination method learned in high school.

This procedure is then used as a subroutine to solve systems of equations

necessary to complete the solution of the Least Squares algorithm for curve

fitting.

Solution data is stored in disk files for access by other programs such as

Lotus 1-2-3.

In addition, the program provides for the evaluation, differentiation, and

integration of the Least Squares polynomial for selected values and ranges.

The 54 digit real number accuracy of Zbasic allows for fairly large degree

polynomials to be solved for a set of data pairs. Included in this package

are examples using a 26th degree polynomial to compute the digits of pi and

the area under the Gaussean Distribution using the integration option.

Apparantly because of the 10E63 limit of Zbasic, the 26th degree polynomial

appears to be an upper limit of the program. Still this beats any other

program that I have seen including Borland's Eureka. There is no question

about it. Zbasic is the most powerful basic availabe for the PC. All other

basics I tried (Quick Basic, Turbo Basic, GW-Basic, Basica ) breakdown in

accuracy for degree > 9. Double precision is simply not enough to maintain

the places needed for large powers. If Apple's MAC supports 240 places

it is even more powerful.

EXAMPLE I

---------

Compute pi by finding the area under a selected arc of a circle.

Consider the upper right quadrant of a unit circle OAB with center at O.

Bisect the radius OB at point C and extend upward crossing the circle at P.

By analysis of this figure we have

(1) OC=1/2

(2) Angle AOP=30 deg.

(3) Triangle OPC is a right-triangle

(4) PC = Sqrt(1-(1/2)^2) = Sqrt(3)/2

(5) Area of sector OAP = pi/12

(6) Area of triangle OPC= PC/4 = Sqrt(3)/8

(7) Area under Arc AP = Integral{0,1/2} Sqrt(1-X*X)

where {0,1/2} denotes the bounds of X

(8) Area of sector OAP = Integral Sqrt(1-X*X) - Sqrt(3)/8

(9) Pi = ( Integral{0,1/2} Sqrt(1-X*X) - Sqrt(3)/8 )*12

By the way this process can be repeated, using smaller and smaller arcs

eg., in the case of the arc subtended by a 15 degree angle

Pi = ( Integral{ 0,Sqrt(2-Sqrt(3))/2 } Sqrt(1-X*X) - 1/8 )*24

This is built in to the solution asa default for upper bound <> 1/2

Use SICURV to compute the area under the Arc AP by fitting an appropriate

polynomial through a set of points on the circle passing through the Arc AP.

To do this it is convenient to define the data pairs using the 54 digit

precision of Zbasic.

PROGRAM DATAMAKE.BAS

00010 INPUT"FILE TO SAVE TO ";FIL$

00020 OPEN"O",1,FIL$

00030 F$=CHR$(34)

00040 DEFDBL X,Y

00050 FOR X=0 TO 1 STEP .001

00060 Y=SQR(1-X*X)

00070 PRINT #1,X;",";Y

00080 PRINT X;Y

00090 NEXT X

00100 CLOSE 1

Keep in mind that the function used here is the equation of a circle in

the cartesean coordinate system and that any function can be used to find

the approximating polynomial that fits the selected data. This is useful

to compute derivatives and integrals of complex functions that are not

amenable to analytical solutions.

The example data file included in this package is CIRCLE.

A CURVE FITTING EXAMPLE

----------------------

1. Load and Run SICURV

2. SELECT OPTION 2 FILE CURVE FITTING

3. AT PROMPT INPUT N,P,ST

KEY IN 26,540,20

THIS SAYS SELECT A 26TH DEGREE POLYNOMIAL AND 27 POINTS SELECTING

EVERY 20TH POINT UP TO 540.

5. AT PROMPT FOR FILENAME INPUT CIRCLE

6. FOLLOW PROMPTS AND INSTRUCTIONS

7. WHEN DONE SELECT OPTION 4 OF CURVE FITTING MENU.

8. INPUT 0,.5 AS BOUNDS

9. THE SOLUTION HAS EQUATION (9) ABOVE BUILT IN FOR EFFECT

CHANGE OR REMOVE STARTING AT LINE 2300

10. TO QUIT INPUT M,M

11. SELECT OPTIONS.

HISTORY

-------

I first wrote sicurv on a TRS80 MODEL I using LEVEL I BASIC.

When I got LEVEL II BASIC I wrote my second version.

As my hardware and software changed I rewrote Sicurv.

This version was written on a PC-LIMITED 286.

SPECIAL THANKS

--------------

FRANK R.NEAL COLUMBUS OHIO 75206,1402

FOR THE MENU ROUTINE.

December 22, 2017
Add comments