Home

# An ALPHA version of FortranCalculus compiler.

FC-Compiler is a ALPHA version of FortranCalculus. The FortranCalculus (FC) language is for math modeling, simulation, optimization, and parameter tweaking. FortranCalculus is based on Automatic Differentiation (AD) and Operator Overloading that simplify computer code to an absolute minimum; i.e., a mathematical model, constraints, and the objective (function) definition. Minimizing the amount of code allows the user to concentrate on the science or engineering problem at hand and not on the (numerical) process requirements to achieve an optimum solution.

### Anyone seeking an Online math tutor?

 I specialize in solving Differential Equations (DEs) or systems. DEs may be explicit or implicit. There is an App, ODEcalc, on my website that is free and may be of help solving an ODE for you. Phil Brubaker tutors Differential Equations and other App usage or modification of my Apps OnLine via Zoom from Roseburg, OR. He has a Bachelor degree in Math with a Minor in Electrical Engineering. Tutoring fee is \$10/h. Contact Phil now!

## History:

• PROSE, in 1974, was the first available Calculus-level language. It was used by Time-sharing users until mid-1980s, on CDC computers.
• FortranCalculus first appeared in late 1980s, running on a PC.
• In 1990s, Windows appeared and stopped work on FC for a while. Cloud computing re-started efforts to get a Calculus-level compiler up and working. It is still being worked on. So in the mean time this Alpha version is being made available.

## Power of FortranCalculus and PROSE:

• Find statement - tweak parameters
• Find a, b, c, ooo
• Nesting of Find statements
• Find a, b ooo
• Find c, d, e ooo
• Find f ooo

## A good example of Nesting is our Match n Freq (tm) App.

• See our textbook for example problems. The Oil Refinery (ch. 8) shows a nesting problem that involves number of (refinery) sites (level 1), number of distillation units (level 2), and (level 3 ... not shown) number of processors types. This problem would require tweaking of thousands of variables in one run!!!

Some Apps were developed to show the power of FortranCalculus in solving math problems. They are:

1. CurvFit (tm): Fits data to Algebraic and Trigonometery equations;
2. Robot4 (tm): finds Optimal route from A to B; and,
3. Match n Freq (tm): solves La Place transform, H(s), and Trigonometery equations.

Try one or more of these applications to get an understanding of the FortranCalculus Compiler power that is available. Some Apps have a source code file for viewing; see how short the coding can be.

## Some Optimization Demo problems Solved and included with FC Compiler are,

 3 Stage Rocket Design Optimization A Stiff Differential Equation AC Motor Design to Maximize Efficiency Analysis using Monte Carlo Bang Bang Control, moving head across disc platter Boundary Value Problem of a Stiff ODE Cantilever beam Chemical kinetics parameter estimation Contour Graph of Rosenbrock's function Ecological equilibrium Implicit Differential Equations Know decay time, need right parameters to get there! Lorentz ODE: 3rd order ODE Lorentzian Series model for isolated pulse Matched Filter design for disc drive Maximum likelihood estimation Minimize Airport Noise Minimize integral w/limits Missile pursuit Multiple extrema Nearest Point on a Contour Neutral ... Neurons ODE-xCos 2nd order ODE Optimal design & control Orbit Motion Painleve Transcendent ODE Pilot Ejection Simulation Pumping System - Implicit Nonlinear Radial tire design Shell projectile Tolerance using Root-sum-square of partials (not Monte Carlo) Transfer Function, H(s), A1! Wing design optimization Matched Filter design

Next, I will attempt to guide you through the various routines in order to create a 'picture' for you to understand what's going on. First, the code required and then a sample of output summary.

1. Introduce the Find statement that is used to tweak variables until ones objective(s) are met. The variables may have bounds and constraints that restrick where the selected solver may search for an Optimal solution.

! Find statement is key to tweak variables AND obtain an Optimal ! (i.e., Maximum / Minimum) solutions. FIND y0, ydot0; ! variable list of those to tweak! in bvp; by Ajax; ! Ajax is the solver for this problem TO MINIMIZE errSum ! objective Minimize errSum variable!

2. Introduce the Integration Process.

! Integration procedure involves two commands: ! INITIATE (for 'setup') and INTEGRATE (for doing the work). INITIATE isis; for ODEknown; ! isis is the integration solver. equations y2dot/ydot, ydot/y; ! states how variables are related of x; step dx; to xfinal ooo integrate ODEknown; by isis

3. This is the complete code necessary to solve this problem, but hope it gives you an idea what is going on. Variables to tweak (e.g. y0) MUST always be on the rightside of an equal sign; so the solver can change a value when it wants too. Follow y0 variable throughout the code for seeing what is required. Plus, see y0 and other tweaked variables in output section.

global all problem xCos dimension xdata(6), ydata(6), error(6) data xdata/ .5, 1., 1.5, 2., 2.5, 3./ data ydata/ .439, .540, .106, -.832, -2.00, -2.97/ npoints = 6 write(6,*) ' ' write(6,*) ' searching for parameters to minimize |error|' write(6,*) ' ' x = xdata(1): dx = .01: xfinal = 3 ! initialize var.s y2dot0 = 1: ydot0 = 1: y0 = 1 Find y0, ydot0; in bvp; by AJAX( cntl1); ~ to match errsum write(6, *) ' i x y error' write(6, *) ' - ----- ----- -----' do 20 i = 1, npoints write(6, 11) i, xdata(i), ydata(i) + error(i), error(i) 20 continue 11 format(2x, i2, 3(2x,g11.4)) ! @aplot('od-plt') ! see Example Plot code below end model bvp ! boundary value problem initiate isis; for ODEknown; ~ equations y2dot/ydot, ydot/y; ~ of x; step dx; to xfinal y = y0: ydot = ydot0: x = xdata(1) error(1) = y - ydata( 1): errsum = error(1)**2 do 20 i = 2, npoints xfinal = xdata( i) integrate ODEknown; by isis error(i) = y - ydata( i) errsum = errsum + error(i)**2 20 continue end model ODEknown ! known solution y2dot = (2 * x * ydot - (x**2 + 2) * y) / x**2 ! sol'n: y = x cos( x) g = eq * 10000 end controller cntl1( AJAX) remax = 60 end

4. The following block shows code for an XYplots, if desired.

C =============== Example code for writing XYplots =============== ! Following stmt. MUST be in bottom of main routine @aplot('od-plt') ! any 6 char.s or less for 'od-plt' end procedure aplot( plot77) character*(*) plot77 @graph( plot77, '2dgraph') @window( plot77,100,500,50,400,xmin,xmax,ymin,ymax, 0,0,0,1,1.5) xstep = (xmax - xmin)/8 @xaxis( plot77, xmin, xmax, xstep, 0, 1, 1) ystep = (ymax - ymin)/6 @yaxis( plot77, ymin, ymax, ystep, 0, 1, 1) @xclabel( plot77, 6, 'X-axis', 11) @yelabel( plot77, 7, 'Y-axis ', 11) @setup( plot77, 'pp', 0, 0, ichar('*'), 14) ! profile points (yellow *'s) @setup( plot77, 'cr', 0, 10, -2, 0) ! profile curve (light green) C Available colors include ... C @setup( plot77, 'cr', 0, 1,-2,0) ! profile curve (blue) C @setup( plot77, 'cr', 0, 2,-2,0) ! profile curve (green) C @setup( plot77, 'cr', 0, 3,-2,0) ! profile curve (cyan) C @setup( plot77, 'cr', 0, 4,-2,0) ! profile curve (red) C @setup( plot77, 'cr', 0, 5,-2,0) ! profile curve (magenta) C @setup( plot77, 'cr', 0, 6,-2,0) ! profile curve (orange) C @setup( plot77, 'cr', 0, 7,-2,0) ! profile curve (white) C @setup( plot77, 'cr', 0, 9,-2,0) ! profile curve (light blue) C @setup( plot77, 'cr', 0, 10,-2,0) ! profile curve (light green) C @setup( plot77, 'cr', 0, 12,-2,0) ! profile curve (light red) C 2nd 'label' parameter is length of 3rd parm.; e.g., 14 is 2nd param. below @label( plot77, 14, 'Plot title ...', 13, 150, 420, 0) do 10 j=1, npoints @point( plot77, 'pp', x(j), y(j)) @curve( plot77, 'cr', x(j), y(j)) 10 continue @show( plot77) end

5. The following block shows a sample of output from the AJAX solver. The first column lists the variables being tweaked. The next column, INITIAL, shows initial values for variables that gets things rolling. The next columns are the values for that iteration. This problem required 60 iterations to solve for an optimal solution. Solution time was less than 8 seconds on a 5-year old PC.

--- AJAX SUMMARY, INVOKED AT X8COS[16] FOR MODEL BVP ---- CONVERGENCE CONDITION AFTER 60 ITERATIONS UNKNOWNS NOT CONVERGED CONSTRAINTS UNSATISFIED MAXIMUM ITERATIONS PERFORMED SPECIFIED CRITERIA UNSATISFIED LOOP NUMBER ......... [INITIAL] 1 2 UNKNOWNS Y0 1.000000E+00 8.161676E-01 7.211046E-01 YDOT0 1.000000E+00 1.069793E+00 1.104053E+00 OBJECTIVE ||G|| @MIN ||X|| 5.760534E+01 1.394653E+01 3.849952E+00 ooo LOOP NUMBER ......... [INITIAL] 59 60 UNKNOWNS Y0 1.000000E+00 4.978819E-01 4.936162E-01 YDOT0 1.000000E+00 7.678495E-01 7.673392E-01 OBJECTIVE ||G|| @MIN ||X|| 5.760534E+01 7.865099E-02 7.412294E-02 ! always decreasing ^^^ ? ---END OF LOOP SUMMARY

Are you ready to give it a try? First step is to download our free Calculus (Level) Compiler (i.e., FC-Compiler), install it, and run some Demo (example) files. Next, copy another (Demo) file and save it under another name in your 'user' folder. Edit this file with your equations and (math) models, then save it. Next, try executing it and see how it goes. Enjoy!

Last Updated: Jan. 1, 2024
First Published: Dec. 4, 2014
Requirements:Windows
Publisher: Optimal Designs Enterprise

 Description (Click to download) Price FC-Compiler: ALPHA version of FortranCalculus compiler. Free .
 All prices in US Dollars

(Here is a 'picture' of time-savings from FortranCalculus usage.)

```    Basic, Fortran, MACSYMA, etc.  vs.   FortranCalculus
```

```
Source Code:         Large             Small
Cost:                High              Low
Delay:               Long              Short```

<a href=""><img style="float:left; width:100px" src="https://goal-driven.net/image/readrit-pic2.png"/> <strong>FortranCalculus Compiler</strong> </a>: Solves Algebraic Equations through Ordinary Differential Equations.

Go to top

## Problem-Solving Applications include:

 CurvFit: a curve fitting program with Lorentzian, Sine, Exponential and Power series are available models to match your data. Match-n-Freq: a Matched Filter program used to filter signals and slim pulses.

## Industry Problem-Solving Descriptions include:

 Business Strategies & War Gaming: Buy, Sell, Hold options may be tested for an entire company, individual plant(s), or whole product lines. Imagine an increase in control settings from a 1 or 2 digits (i.e., a guess value) to an 8+ digit accuracy resulting from a Calculus programming calculation! Pulse Slimming to minimize InterSymbol Interference: via Arbitrary Equalization with Simple LC Structures to reduce errors. Voice Coil Motor: basically an electromagnetic transducer in which a coil placed in a magnetic pole gap experiences a force proportional to the current passing through the coil. Electrical Filter Design: find the transfer function's poles & zeros; H(s) = Yout(s) / Yin(s). Digitized Signal from Magnetic Recording: Magnetic recording of transitions written onto a computer disc drive may produce an isolated pulse as shown. AC Motor Design: a simulation program for A.C. motor design that was reapplied as a constrained optimization problem with 12 unknown parameters and 7 constraints. PharmacoKinetics: an open-two- compartment model with first order absorption into elimination from central compartment is presented here.

 Calculus (level) Problem-Solving for Engineers & Scientists