Science makes it known,
Engineering makes it work,
Art makes it beautiful.


mathproc.dll Miscellaneous FORTRAN Mathematical Subprograms
(Point Rotation, Triangular Segment Area, Signum, Synthetic Division, Quadratic Roots, Cubic Polynomial Roots)
(Includes Download)
These are nine FORTRAN subprograms whose source code has been
unpublished in FORTRAN (as far as I know), extracted from
mathproc.dll,
and are called by either D procedures in
dnrprocs.dll
or Pascal procedures in
missle02.dll.
Download mathaux.for source code

REAL FUNCTION XROTATECCW (X, Y, ALPHA) RESULT (U)
Rotation counterclockwise about the origin through an angle ALPHA
(many systems consider counterclockwise
rotation to be positive)
Input: X [X coordinate prior to rotation], Y [Y coordinate prior to rotation],
ALPHA [rotation angle, radians]
Returns rotated X coordinate
called by FlghtSrfcArea (...) in Pascal library missle02
(calculate fin/wing/stabilizer 'wetted' surface area)

REAL FUNCTION XROTATECW (X, Y, ALPHA) RESULT (U)
Rotation clockwise about the origin through an angle ALPHA
(many systems consider clockwise rotation to be
negative)
Input: X [X coordinate prior to rotation], Y [Y coordinate prior to rotation],
ALPHA [rotation angle, radians]
Returns rotated X coordinate
called by Gabor2D (...) in D module dnrprocs and
FlghtSrfcArea (...) in Pascal library missle02

REAL FUNCTION YROTATECCW (X, Y, ALPHA) RESULT (V)
Rotation counterclockwise about the origin through an angle ALPHA
Input: X [X coordinate prior to rotation], Y [Y coordinate prior to rotation],
ALPHA [rotation angle, radians]
Returns rotated Y coordinate
called by FlghtSrfcArea (...) in Pascal library missle02

REAL FUNCTION YROTATECW (X, Y, ALPHA) RESULT (V)
Rotation clockwise about the origin through an angle ALPHA
Input: X [X coordinate prior to rotation], Y [Y coordinate prior to rotation],
ALPHA [rotation angle, radians]
Returns rotated Y coordinate
called by Gabor2D (...) in D module dnrprocs and
FlghtSrfcArea (...) in Pascal library missle02

REAL FUNCTION TRIAREA (X1, X2, X3, Y1, Y2, Y3) RESULT (A)
Calculate area of triangular segment from its vertices coordinates;
uses determinant
Input: X1, X2, X3 [vertices' X coordinates], Y1, Y2, Y3
[vertices' Y coordinates]
Returns triangular segment area
called by ellipseSegArea (...) in Pascal library missle02
(calculate elliptical segment area)

INTEGER*2 FUNCTION SIGNUM (R) RESULT (ISGN)
Returns 1 if R<0, 0 if R=0, 1 if R>0
called by SnglRlCubcRt (...) in D module dnrprocs

SUBROUTINE QUADROOT (A, B, C, ROOT1, ROOT2, DISC, IERR)
Quadratic Roots; A*X^{2} + B*X + C = 0
Input: A, B, C
Output: ROOT1, ROOT2, DISC
If roots real, then roots are ROOT1 and ROOT2
If roots imaginary (IERR = 105), then roots are ROOT1 + DISCi and
ROOT2  DISCi  could then use FORTRAN's
CMPLX (ROOT1, DISC)
and CMPLX (ROOT2, DISC) to load an actual
COMPLEX variable.
The larger root is returned in ROOT1.
called by polyRoot (...) in D module dnrprocs

SUBROUTINE SYNDIV (N, C0, C1, ROOT1, IERR)
Synthetic Division  "Synthetically" Divide polynominal coefficient
array C0 by ROOT1 Giving polynominal coefficient array C1
C0(1)*X^{N1} + C0(2)*X^{N2} + ⋯ + C0(N)
Input: N [number of coefficients (power of polynomial + 1)], array C0,
ROOT1 [one known root of polynominal]
Output: array C1
C1(1)*X^{N2} + C1(2)*X^{N3} + ⋯ + C1(N1)
called by polyRoot (...) in D module dnrprocs

SUBROUTINE CUBCROOT (A1, A2, A3, ROOT1, ROOT2, ROOT3, Q, R, IERR)
Cubic Polynomial Roots  X^{3} + A1*X^{2} + A2*X + A3 = 0
(Presumed that X^{3} coefficient is 1)
Input: A1, A2, A3
Output: Q, R (ROOT1, ROOT2, ROOT3 if 3 real roots; if 1 real root and
2 imaginary roots, IERR set to 105)
Q, R used internally if 3 real roots; used externally if 1 real root and
2 imaginary roots.
(if 2 imaginary roots, D procedure SnglRlCubcRt in
D module dnrprocs
can be called to compute the single real root; set coefficient array
elements C0(1)=1, C0(2)=A1,
C0(3)=A2, C0(4)=A3, and call SYNDIV to get the coefficient array C1
for the Quadratic Equation  A=C1(1), B=C1(2), C=C1(3);
QUADROOT (...) can then be called;
this is all done by D module dnrprocs procedure polyRoot (...))
Creating FORTRAN .dll Project:
To create a SilverFrost .dll, create a new project of project type
Fortran DLL.
File
New Project
Project Types:Fortran DLL
Name: enter project name
(this will be the name of the project file,
with file extension
.ftn95p, and to make things simple, the name of the FORTRAN source
file)
Location: browse to the directory where to save file
(can only have one project per directory)
mathaux.for can then be copied and pasted.


