>> Rodney Roberts IS & Education Professional Homepage   >> Programming Tutorials And Downloads






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

  1. 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)
  2. 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
  3. 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
  4. 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
  5. 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)
  6. 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
  7. SUBROUTINE QUADROOT (A, B, C, ROOT1, ROOT2, DISC, IERR)
    Quadratic Roots; A*X2 + 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
  8. SUBROUTINE SYNDIV (N, C0, C1, ROOT1, IERR)
    Synthetic Division - "Synthetically" Divide polynominal coefficient array C0 by ROOT1 Giving polynominal coefficient array C1
    C0(1)*XN-1 + C0(2)*XN-2 + ⋯ + C0(N)
    Input: N [number of coefficients (power of polynomial + 1)], array C0, ROOT1 [one known root of polynominal]
    Output: array C1
    C1(1)*XN-2 + C1(2)*XN-3 + ⋯ + C1(N-1)
    called by polyRoot (...) in D module dnrprocs
  9. SUBROUTINE CUBCROOT (A1, A2, A3, ROOT1, ROOT2, ROOT3, Q, R, IERR)
    Cubic Polynomial Roots - X3 + A1*X2 + A2*X + A3 = 0
    (Presumed that X3 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 (...))

  demonstrating dnrprocs polynominal root finding



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.
Plato3 - File, New Project - create Fortran .dll project


Any and all © copyrights, ® ™ trademarks, or other intellectual property (IP) mentioned here are the property of their respective owners.  No infringment is intended.

Feel free to use any of the above in your project (without violating any intellectual property rights); please give credit (same idea as Copyleft).

Page best viewed with Mozilla FireFox 3.6.13 (or higher) and Google Chrome Version 40.0.2214.94 (or higher).

Website is supported on DESKTOP platforms only.

Web hosting provided by:
Cheap Web Hosting. , Award Space Web Hosting , Free Web Hosting , Free Web Hosting. , & GigaRocket Web Hosting


>> Rodney Roberts IS & Education Professional Homepage   >> Programming Tutorials And Downloads