­7È+͈C:)=_ÍgSIMP12 CRCSIMP12/TDOC ®SIMP12/TPASºŠINITCMD PASD"ECHO PASfECHO COM|CLST2 PAS¿ MINX PASÌPASS PASÚ FFTRUE PASãMLTEST PASëMM PASú MM SP PASSP  ML PAS! ML .RF PAS0RF BCRC Ver 5.0 CTL-S pauses, CTL-C aborts --> FILE: SIMP12/T.DOC CRC = 38 63 --> FILE: SIMP12/T.PAS CRC = 4E 63 --> FILE: INITCMD .PAS CRC = 76 CE --> FILE: ECHO .PAS CRC = 36 B2 --> FILE: ECHO .COM CRC = C4 CE --> FILE: LST2 .PAS CRC = 66 78 --> FILE: MINX .PAS CRC = 16 85 --> FILE: PASS .PAS CRC = AA CD --> FILE: FFTRUE .PAS CRC = 3A 01 --> FILE: MLTEST .PAS CRC = 7D D1 --> FILE: MM .PAS CRC = 0E D5 --> FILE: MM . CRC = 7C 34 --> FILE: SP .PAS CRC = F2 8E --> FILE: SP . CRC = 2D 34 --> FILE: ML .PAS CRC = B1 73 --> FILE: ML . CRC = 86 D6 --> FILE: RF .PAS CRC = D7 4F --> FILE: RF . CRC = 7F 12 DONE SIMP Version 1.2 TURBO Pascal (tm) May 16, 1984 D. M. Fritz-Rohner Post Office Box 9080 Akron, Ohio 44305 Thió versioî ió deriveä froí thå articlå 'Fittinç Curveó tï � Data§ bù Marcï S® Cacecé anä Williaí P® Cacherió founä iî BYTÅ � Magazine¬ Volumå 9¬ Numbeò 5¬ May¬ 198´ anä froí Versioî 1.± oæ � thå  Pascal/Ú  (tm©  implementation®  Seå Notå ± foò á  lisô  oæ � conversioî effects® Thió versioî ió intendeä tï ruî iî CP/Í (tm© � compatiblå environmentó iî conjunctioî witè TURBÏ Pascaì. Thió versioî furtheò reorganizeó anä extendó thå  referencå � code® Seå alsï SIMP11/Z.DOà froí SIMP11/Z.LBR. Thå structurå oæ SIMÐ 1.± Pascal/Ú ió largelù preserveä witè � additioî  oæ  boundarù conditioî testinç  anä  modularizatioî � ofcommanä linå argumenô processing. Almosô   alì   non-academiã  extremizatioî   problemó   havå � constraintó iî thå forí oæ auxiliarù relationó anä boundarù � conditions®  Linkagå tï á generiã routinå nameä ffTesô ió pro� videä  tï returî booleaî truå iæ thå functioî beinç  extremizeä � ió  feasiblå foò thå specifieä parameteró anä false¬  otherwise® � Iî procedurå SIMPLEØ wherå reflection¬  expansion¬ oò contractioî � arå  applieä iî searchinç foò á betteò extremum¬  thå  testeä � poinô musô alsï bå feasiblå aó reporteä bù ffTest®  Necessarily¬ � thió  featurå requireó thaô thå spacå containeä bù thå  initiaì � SIMPLEØ   bå  feasible®   Seå  Exampleº   Multi-Lineaò  Fiô   foò � illustrativå applicatioî oæ thió feature. TURBÏ Pascaì Versioî 1.° overwriteó parô oæ thå CP/Í commanä � taiì buffeò witè á jumð vector® Onlù thå firsô 3± byteó oæ thå � commanä taiì arå availablå there®  Thió ió generallù enougè  foò � twï fulì sizå filå descriptoró anä separatoró buô allowó nï � growth®  Thå  parseò codeä iî INITCMD.PAÓ parseó thå reduceä CP/Í � TURBÏ commanä tail®  Otheò versionó arå availablå foò TURBÏ thaô � includå expliciô I/Ï redirection¬ ambiguouó filå namå processing¬ � anä  pipeó  usinç  thå CCÐ commanä linå  image®  Lacë  oæ  theså � featureó  ió  noô  necessarilù  á  handicað  iî  numericaì  tooló � environmentó  aó  opposeä tï softwarå tooló  environments®  ECHÏ � illustrates usage of INITCMD routines. TURBÏ ió organizeä iî á waù thaô doeó noô uså separatå � compilatioî anä thereforå doeó noô requirå aî expliciô linker® � Thå routinå SIMP12/T.PAÓ ió structureä tï uså generiã  moduleó � wherå selectioî oæ includeä routineó bindó differenô extremiza� tioî criteriá anä fittinç functionó witè á feasibilitù tesô anä á � commanä linå parseò tï forí á particulaò build® Thå defaultó iî �Šthå distributeä versioî oæ SIMÐ 1.² TURBÏ Pascaì are» leasô � squareó minimization¬ thå referencå articlå Michaelis-Menteî � function¬ aî unconditionaì stuâ returninç truå foò ffTest¬ anä � thå reduceä commanä taiì parser. TURBÏ Pascaì Versioî 2.° ió reporteä tï providå segmentatioî � anä  overlaù facilitieó whicè woulä offeò another¬  perhapó  morå � convenient¬ approacè tï prograí structurå.� USAGE Enteò TURBO¬ calì uð thå (W)orë filå SIMP.PAS¬ enteò (E)diô � anä   enablå   ($I)nclusioî  oæ  thå   appropriatå   extremizeä � function¬  extremizatioî  criterion¬  anä  feasiblilitù  test® � Exiô  edit¬   selecô  (C)om-filå  iî  thå  (O)ptionó  menu¬   anä � (C)ompile® (Q)uiô TURBÏ anä executå thå generateä build® Supposå thaô thå extremizeä functioî ió thå referencå � articlå Michaelis-Menteî function¬ thå extremizatioî criterioî ió � leasô squares¬ anä thå feasibilitù tesô ió alwayó true® Theî thå � selectioî  preamblå  oæ SIMP.PAÓ lookó likå thå  followinç  afteò � edit; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} {--$I b:? parameterized function } {$I b:mm.pas Michaelis-Menten, see ref. } {--$I b:sp.pas simple odd polynomial } {--$I b:ml.pas multi-linear fit } {--$I b:rf.pas 'root finder', see SIMP.DOC } {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} {--$I b:? extremization criterion } {$I b:lst2.pas normalized least squares } {--$I b:minx.pas minimax } {--$I b:pass.pas unity gain } {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} {--$I b:? feasibility test } {$I b:ffTrue.pas always returns true } {--$I b:mlTest.pas fease multi-linear fit } {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} {--$I b:? command parser } {$I b:initcmd.pas CP/M TURBO command tail parse} {--$I b:altcmd.pas CP/M CCP command line parse } {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} The command; Š A>simp mm takeó controì datá froí thå filå MÍ anä executeó outpuô defaulteä � tï thå CP/Í conº device¬ or; A>simp mm lst: with output to the CP/M lst: device, or; A>simp mm mmlst2.dat foò  outpuô tï filå MMLST2.DAÔ oî thå  defaulô  drive®  Consolå � outpuô maù bå madå expliciô with; A>simp mm con: EXAMPLES Foò  thió  distributioî  thå  basiã  modulå  ió  SIMP®  Thå � primitiveó  arå  QUIÔ  anä INITCMÄ whicè  containó  InitArç  anä � GetArg® Thå extremizatioî criteriá arå LST2¬ MINX¬ anä PASS® � Thå extremizeä functionó arå MM¬ SP¬ MÌ anä RÆ witè correspondinç � controì  datá  files®  Thå feasibilitù routineó arå  FFTRUÅ  anä � MLTEST. SIMP.PAÓ containó thå maiî prograí anä thå SIMPLEØ modules® � QUIT.SRà containó á jumð tï CP/M'ó warí booô relaù instruction. Iî additioî tï thå leasô squareó extremizatioî criterion¬ � LST2.PAS¬ thió distributioî includeó á minimaø routine¬ MINX.PAÓ � tï facilitatå searcè foò parameteró thaô producå á fiô sucè thaô � thå maximuí absolutå valuå oæ thå differencå betweeî measureä anä � estimateä valueó ió minimized® Minimaø alsï presentó á usefuì � extremuí criterioî wherå differentiabilitù ió losô anä lineaò � methodó arå generallù noô helpful. Thå extremizatioî criterioî PASS.PAÓ ió intendeä foò appli� cationó wherå aî extremuí ió soughô anä thå extremizatioî cri� terioî itselæ PASSeó thå funtioî valuå withouô referencå tï á � 'fitted§ datá set® Seå Example: 'Rooô Finder§ below. EXAMPLES Thå exampleó provideä witè thió distributioî arå  Michaelis-� Menten¬ simplå polynomial¬ multi-lineaò fit¬ anä 'rooô finder'. Example: Michaelis-Menten The file MM contains the data; 200 - maximum number of iterations 5e-3 - extremum criterion convergence Š 2 - number of parameters 0.2 1.0 1.0 - 'a' initial, step, and convergence 3.0 1.0 1.0 - 'b' " " " " 6 - number of data values 0.172 1.68 - dependent variable, independent 1 0.250 3.33 - " " " 2 0.286 5.00 - ... 0.303 6.67 - ... 0.334 10.0 - 0.384 20.0 - " " " 6 Noticå thaô theså valueó arå arrangeä differentlù anä thå � steð sizeó anä convergencå criteriá arå differenô froí thå refer� encå article. The configuration selected above, namely; {$I b:mm.pas Michaelis-Menten, see ref. } {$I b:lst2.pas normalized least squares } {$I b:ffTrue.pas always returns true } {$I b:altcmd.pas CP/M CCP command line parse } composeó á prograí thaô seekó á besô fiô baseä oî leasô squareó � foò thå referencå function. The command; A>simp mm test putó thå resultó iî filå TEST® Thió filå containó 20± lines¬ thå � lasô oæ whicè is; 200 4.238095E-01 2.451936E+00 5.284773E-03 5.284773E-03 where»  20°  meanó thaô thå convergencå criteriá werå noô satis� fied¬  thå  firsô anä seconä numberó arå thå 'a§ anä 'b§  coeffi� cientó  aô thå verteø witè leasô extremuí valuå giveî  bù  thå � thirä  number¬  anä  thå lasô numbeò ió thå averagå  SIMPLEØ � extremuí foò alì vertices® Thió sayó that¬ oî thå average¬ thå � fiô ió gooä tï abouô 0.00µ foò eacè coordinate. The following configuration; {$I b:mm.pas Michaelis-Menten, see ref. } {$I b:minx.pas normalized least squares } {$I b:ffTrue.pas always returns true } {$I b:altcmd.pas CP/M CCP command line parse } resultó iî á prograí thaô seekó á 'besô fit§ baseä oî á minimaø � criterioî foò thå referencå article'ó functioî MM®  Thå followinç � command; A>simp mm test performs the extremization and puts the results in the file TEST Šon the default drive. The last line of that file is; 200 4.241221E-01 2.470153E+00 6.501847E-03 6.501847E-03 where 200 is the maximum iteration number - meaning that the iteration did not converge - and the first two numbers are the coefficientó aó before¬ anä thå lasô twï numberó arå thå extremuí � functioî  aô thå verteø witè thå besô fiô anä thå averagå  foò � alì vertices¬  respectively® Thå besô fiô showó minimaø erroò � 0.00¶. Selectioî oæ á extremuí functioî demandó somå insighô tï thå � problem® Foò thå referencå probleí iô dependó oî thå varianceó � oæ thå experimenô anä measuremenô processeó iî á lineaò estima� tioî sense® Straighô forwarä computationaì procedureó likå leasô � squareó oò minimaø maù bå equallù wrong. Supposå yoõ havå á choicå betweeî twï similaò representa� tionó anä kno÷ thaô onå haó aî averagå erroò abouô equaì tï thå � other'ó maximuí error® Whicè to choose? Example: Simple Polynomial Thå papeò 'Á Simplå Minimaø Algorithm§ bù Steveî A® Ruzinskù � founä iî Dr®  Dobb'ó Journal¬  Numbeò 93¬  July¬ 198´ illustrateó � thå proposeä algorithí witè á MBASIà (tm© compatiblå prograí thaô � useó á threå terí odä polynomiaì tï approximatå thå SIΠ functioî � oveò thå intervaì ° tï abouô pi/2® Seå FLUF11.DOC. The data file SP contains corresponding information; 100 1.e-4 3 1.0 1.0 1.0 -.167 1.0 1.0 .00833 1.0 1.0 50 3.141076E-02 2.000000E-02 6.279052E-02 4.000000E-02 : : 9.995066E-01 9.800000E-01 1.000000E+00 1.000000E+00 wherå thå coefficientó arå initializeä tï thå approximatå  valueó � for the corresponding Taylor series. Thå  followinç  configuratioî  selectionó  producå  á  leasô � squareó approximation; {$I b:sp.pas simple odd polynomial } {$I b:lst2.pas normalized least squares } {$I b:ffTrue.pas always returns true } {$I b:altcmd.pas CP/M CCP command line parse } Š which, when compiled and executed with the command; A>simp sp test takeó  14¸ secondó tï producå thå filå TESÔ witè onå hundreä  anä � one lines, the last of which is; 100 1.571301E+00 -7.02287E-01 1.380962E-01 5.112938E-03 6.206377E-03 Thå  followinç  includeó forí á configuratioî tï  computå  á � minimaø fiô iî thió problem; {$I b:sp.pas simple odd polynomial } {$I b:minx.pas minimax } {$I b:ffTrue.pas always returns true } {$I b:altcmd.pas CP/M CCP command line parse } Thå command; A>simp sp test executeó iî 12± secondó anä produceó thå datá filå TESÔ witè  thå � lasô line; 100 1.548642E+00 -6.22970E-01 8.073769E-02 8.232326E-03 8.428058E-03 whicè showó á minimaø erroò oæ abouô .008®  Supposå wå uså  thió � estimatå tï restarô SIMP® Whaô happens¿ Thå followinç showó thå � firsô  anä lasô lineó oæ thå resultinç datá filå produceä iî  10· � seconds; 0 1.548642E+00 -6.22970E-01 8.073769E-02 8.232576E-03 7.568654E-01 : : 94 1.570308E+00 -6.41893E-01 7.167449E-02 9.655501E-05 9.721492E-05 whicè  showó  thaô thå specifieä 1.e-´ convergencå tolerancå  waó � achieved®  Thå valueó reporteä foò FLUÆ arå roughly¬  takeî froí � Figurå ± oæ thå article; 1.5706264 -0.64322566 0.07270740 sho÷  reasonablå agreemenô considerinç thaô nï  qualificatioî  oæ � anybody'ó  SIΠ functions¬  floatinç poinô conversionó oò  compu� tationó ió established. SIMP'ó  slo÷ convergencå ió produceä bù thå degreå  oæ  con� tractioî  requireä tï maneuveò iî thå minimaø space'ó  cusð  geo� metry® Restartinç SIMÐ allowó á ne÷ portioî oæ thå extremuí spacå � tï  bå exploreä beforå thå SIMPLEØ figurå contracts®  Therå alsï � comeó  á poinô wheî thå SIMPLEØ ió sï diminisheä thaô thå  finitå � mathematicó  oæ thå machinå representatioî oæ thå extremuí  spacå �Šproducå á degeneratå simpleø wheî somå dimensioî vanisheó oò  thå � finitå numbeò oæ accessiblå pointó arå alì unacceptable. SIMÐ needó anotheò trick® Thå probleí ió ho÷ tï projecô thå � SIMPLEØ  hyperhedroî  intï  á reduceä spacå  witè  itó  geometrù � conformaì tï thå locallù reduceä space. Example: Milti-Linear Fit The data in file ML are; 200 - maximum number of iterations 1.e-4 - extremum criterion convergence 6 - number of parameters 0.00000 0.1 1.0 - breakpoint coordinates, initial 0.00000 0.1 1.0 - steps and convergence criteria 0.30000 0.1 1.0 0.29552 0.1 1.0 0.60000 0.1 1.0 0.56464 0.1 1.0 7 - number of data values 0.00000° 0.° - dependent¬ independenô variableó 1 0.09983³ 0.± - ¢ ¢ ¢ 2 0.198669 0.2 0.295520 0.3 0.389418 0.4 0.479426 0.5 0.564642 0.6 The configuration selected is shown by the following; {$I b:ml.pas multi-linear approximatin } {$I b:minx.pas minimax } {$I b:mlTest.pas multi-linear feasibility test} {$I b:altcmd.pas CP/M CCP command line parse } composeó  á prograí thaô seekó á besô fiô baseä oî minimaø foò á � multi-lineaò  approximatioî foò á SIÎ tablå oî thå intervaì °  tï � abouô pi/6®  Thå approximatioî compriseó twï linå segmentó  witè � initiaì  breakpointó  seô aô thå first¬  middle¬  anä  lasô  datá � points¬  respectively® Thå feasibilitù tesô doeó noô requirå thå � breakpointó  tï  staù iî thå rangeó defineä bù thå  datá  points¬ � onlù  thaô  thå independenô variablå valueó remaiî  iî  ascendinç � order®  Thå  breakpoinô  functioî evaluatioî setó  thå  functioî � valuå  tï thå respectivå endpoinô valuå iæ thå independenô  vari� ablå ió outsidå thå breakpoinô range. Thå command; A>simp ml test executeó  iî 8· secondó anä putó thå resultó iî filå TEST®  Thió � filå compriseó 20± lines¬ thå first and last of which are; Š 0 0.000000E+00 0.000000E+00 3.000000E-01 2.955200E-01 6.000000E-01 5.646400E-01 4.492667E-03 8.078624E-02 : : 200 2.012359E-03 1.677780E-03 2.940030E-01 2.917680E-01 5.972280E-01 5.663182E-01 1.677916E-03 1.678885E-03 Therefore, the breakpoints are roughly; (.0020124,.0016778) (.2940030,.2917680) (.5972280,.5663182) with a minimax fit of about .00168. Example: 'Root Finder' In this example the routine RF.PAS codes a form to illus trate SIMPLEX application to extremization problems without fit conditions, functions that are not differentiable, and have a cusp geometry and multiple extrema. Suppose a second order polynomial with real roots at (x = -1.0) and (x = 2.0); 2 f(x) = (x + 1) * (x - 2) = x - x - 1 Iî  thió  examplå  thå parameteró arå  seô  tï  approximatå � valueó oæ thå rootó anä thå independenô datá valueó arå seô tï � thå polynomiaì coefficients®  Bù definition¬ wheî thå valuå oæ � ø  getó  tï  á rooô thå polynomiaì evaluateó tï  zero®  Iæ  thå � absolutå  valuå oæ thå polynomiaì ió taken¬  theî thå  zerï � crossingó  becomå minima®  Notå thaô theså minimá arå  cuspó � witè discontinuouó firsô derivatives. Further¬  sincå multiplå rootó arå beinç sought¬  thå suí � oæ  thå absolutå valueó oæ thå polynomiaì evaluateä aô eacè  rooô � estimatecaî bå madå thå extremizeä functioî returneä tï  thå � SIMPLEØ procedure through PASS.PAS; m _____ \ ff = \ abs [ (..(x * a + x ) * a + ..) + x ] / 1 i 2 i n /____ i = 1 where; a[1..m] become the roots, x[1..n] become the coefficients, and y[1..n] dummied for consistency Š Thå filå RÆ containó thå data; 100 - number of iterations 1e-5 - extremum convergence criterion 2 - number of 'parameters' 0.0 1.0 1e-5 - initial 'parameter' values, 0.0 1.0 1e-5 - steps, and convergence values 3 - number of 'data points' 0.0 1.0 - data point values 0.0 -1.0 - 0.0 -2.0 - The configuration produced by the include selections; {$I b:rf.pas 'root finder', see SIMP.DOC } {$I b:pass.pas unity gain } {$I b:ffTrue.pas always returns true } {$I b:altcmd.pas CP/M CCP command line parse } and performed with the command; A>simp rf test executes a program that seeks a best fit based on the specified extremuí anä putó thå resultó iî filå TEST® Thå commanä executeó � in 19 seconds and the file contains 80 lines, the last of which is; 79 -1.00000E+00 -1.00000E+00 5.671813E-06 9.414271E-06 where; 79 is the iteration number at which the convergence cri teria were jointly satisfied. Note that this function has extrema at (-1.0,-1.0) and (2.0,2.0) in addition to the 'correct' minimum at (-1.0,2.0). Dependinç  oî initiaì conditions¬  SIMÐ cheerfullù scrambleó intï � thå  nearesô  cusð valleù anä proceedó downhilì  tï  thå  nearesô � extremum. This example illustrates certain features of a class of extremization problems. It is not proposed for finding roots. Its defects also include problems with complex roots, osculating saddle points, and appropriate definition of 'abs' for complex values in addition to multiple extrema and slow convergence. There is no substitute for judgement or experience. Each algorithmic conclusion must be tested for reasonableness. McComb's Only Commandment states: 'Arrange the programming so that intelligence can successfully interfere with the computing.' NOTES 1. Conversion showed the following distinctions; Š i. String declaration syntax slightly different, e.g., var str : string 14 ; { Pascal/Z } var str : string[14] ; { TURBO } ii. Constant folding slightly different, e.g., const mxp1 = mx + 1 ; { Pascal/Z } const mxp1 = 9 ; { TURBO } iii. TURBO more insistent on Pascal scope delimitation, e.g.; if ... then begin ... end ; else begin ... end ; is acceptable to Pascal/Z but is rejected by TURBO unless the semicolon before the else is removed. iv. Association of file names and file variables is slightly different, e.g., reset(fvar,fname) ; { Pascal/Z } assign(fvar,fname) ; { TURBO } reset(fvar) ; v. String building is slightly different; append(sname,' ') ; { Pascal/Z } sname := concat(sname,' ') ; { TURBO } vi. TURBO provides explicit extensions to access environment. To get a high level exit and provoke warm boot, QUIT was programmed as an external procedure for Pascal/Z but was coded with a BIOS procedure call in TURBO. v. File open checks slightly different; eof(...) { Pascal/Z } IOresult { TURBO } 2. An interesting situation arises when comparing TURBO Pascal performance with compile-assemble-link translators like Pascal/Z. Suppose that comparable modular structures have been developed. The development cycle comparison is between TURBO's edit-(save)-compile-(load)-go and Pascal/Z's edit- compile-assemble-link-go. However, the 'correct' runtime comparison is between TURBO's compile and go and Pascal/Z's link, load and go. Š CP/M (tm) Digital Research Pascal/Z (tm) Ithaca Intersystems, (c) Jeff Moskow TURBO (tm) Borland International MBASIC (tm) MicroSoft UNIX (tm) AT&T Information Systems  { Copyright (C) 1984 D.M. Fritz-Rohner } {$I- suppress default I/O error } program main ; { } { Name: SIMPLEX - Apply SIMPLEX algorithm. } { } { Version: 1.2/Turbo (tm) Date: 1984 July 7 } { } { Purpose: Search for parameters to extremize } { specified criterion using specified function. } { } { This program is a generic application module } { intended to be particularized by selection or } { insertion of includes to bind routines for } { specified extremization criteria and specified } { functions. } { } { Author: D.M. Fritz-Rohner } { Post Office Box 9080 } { Akron, Ohio 44305 } { } { Reference: 'Fitting Curves to Data' } { Marco S. Caceci and William P. Cacheris } { BYTE Magazine, Volume 9, Number 5 } { May, 1984, pp. 340-362 } { } const mx = 8 ; { Max number of parameters } mxp1 = 9 ; { Number of SIMPLEX vertices } nx = 64 ; { Maximum number of data } ncxx = 1024 ; { Max number of itertions } CONTRACT = 0.618 ; { Contraction coefficient } REFLECT = -1.0 ; { Reflection coefficient } EXPAND = 1.618 ; { Expansion coefficient } BLANK = ' ' ; MAXLINE = 31 ; MAXSTR = 14 ; MAXARG = 8 ; type vertex = array[1..mx] of real ; vector = array[1..nx] of real ; index = 0..255 ; argstr = string[MAXSTR] ; argvec = array[1..MAXARG] of argstr ; var Narg : integer ; Argv : argvec ; fin : text ; Infile : string[14] ; fout : text ; { Input,output file vars } Outfile : string[14] ; err : text ; { Error file var } m : integer ; { Number of parameters } mi : integer ; mp1 : integer ; { m + 1 } simp : array[1..mxp1] of vertex ; { Vertices } Ssimp : array[1..mxp1] of real ; { Extrema } csimp : vertex ; { Centroid } dsimp : vertex ; { Parameter step sizes } asimp : vertex ; { Avg SIMPLEX vertex values } aSsimp : real ; { Avg SIMPLEX extremum value } cca : vertex ; { Parameter convergence } tsimp : vertex ; { Test vertex } Stsimp : real ; { Extremum value at test vertex } ccS : real ; { Extremum convergence } n : integer ; { Number of data } ni : integer ; ys : vector ; { Dependent data vector } xs : vector ; { Independent data vector } nc : integer ; { Iteration count } ncx : integer ; { Max number of iterations } i,j : index ; ix : index ; inn : index ; { Index to vertex with least } inx : index ; { Index to vertex with greatest } done : boolean ; { Termination flag } a : real ; { Intermediate variable } c : real ; NULL : real ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure quit ; begin bios(0) { warm boot } end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} {--$I b:? parameterized function } {$I b:mm.pas Michaelis-Menten, see ref. } {--$I b:sp.pas simple odd polynomial } {--$I b:ml.pas multi-linear approximation } {--$I b:rf.pas 'root finder', see SIMP.DOC } {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} {--$I b:? extremization criterion } {$I b:lst2.pas normalized least squares } {--$I b:minx.pas minimax } {--$I b:pass.pas unity gain } {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} {--$I b:? feasibility test } {$I b:ffTrue.pas always returns true } {--$I b:mlTest.pas test multi-linear fit } {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} {$I b:initcmd.pas CP/M TURBO command tail parse} {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure HuhEOF ; begin writeln(err,'Premature EOF.') ; quit end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure SimpData ; { } { Reads data from disk file FILENAME. Terminate file } { with EOF immediately after last digit. Data in the } { order; } { } { ncx - maximum number of iterations } { ccS - convergence criterion } { m - number of parameters } { a(1) da(1) cca(1) - initial parameter values, } { a(2) da(2) cca(2) steps sizes, and convergence } { a(3) da(3) cca(3) criteria, } { : : : } { a(m) da(m) cca(m) } { n - number of points } { ys(1) xs(1) - data values } { ys(2) xs(2) } { ys(3) xs(3) } { : : } { ys(n) xs(n) } { } begin read(fin,ncx) ; { Read maximum iteration count } if eof(fin) then HuhEOF ; if ncx < 1 then begin writeln(err,'Unreasonable Maximum Iteration Count: < 1') ; quit end ; if ncx > ncxx then begin writeln(err,'Unexpected Maximum Iteration Count: > ',ncxx:4) ; ncx := ncxx end ; read(fin,ccS) ; { Read convergence criterion } if eof(fin) then HuhEOF ; if ccS <= 0.0 then begin writeln(err,'Unreasonable Convergence Criterion: <= 0.') ; quit end ; read(fin,mi) ; { Read number of parameters } if eof(fin) then HuhEOF ; if mi < 1 then begin writeln(err,'Unreasonable Parameter Order: < 1') ; quit end ; if mi > mx then begin write(err,'Unexpected Parameter Order: m > ',mx:2) ; writeln(err,' : Excess Ignored') ; m := mx ; end else m := mi ; for j := 1 to m do begin { Read initial parameter values } read(fin,simp[1,j],dsimp[j],cca[j]) ; if eof(fin) then HuhEOF ; if dsimp[j] = 0.0 then begin writeln(err,'Unreasonable Parameter Step Size: = 0.0') ; quit end ; if cca[j] <= 0.0 then begin writeln(err,'Unreasonable Convergence Parameter: <= 0.') ; quit end end ; if mi > mx then for j := mx+1 to mi do begin { Gobble excess parameter values } read(fin,NULL,NULL,NULL) ; if eof(fin) then HuhEOF end ; read(fin,ni) ; { Read number of points } if ni > 0 then begin if eof(fin) then HuhEOF ; if ni < m then begin writeln(err,'Unreasonable Data Order: n < m') ; quit end ; if ni > nx then begin write(err,'Unexpected Data Order: n > ',nx:3) ; writeln(err,' : Excess Ignored') ; n := nx ; end else n := ni ; for i := 1 to n do begin { Read initial parameter values } read(fin,ys[i],xs[i]) ; if ((i < n) and eof(fin)) then HuhEOF end ; if ni > nx then for i := nx+1 to ni do begin { Gobble excess data values } read(fin,NULL,NULL) ; if ((i < ni) and eof(fin)) then HuhEOF end end else n := 0 end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure IndExt ; { } { Find indices for vertices with least and greatest } { values of extremum function. } { } begin inn := 1 ; inx := 1 ; for i := 2 to mp1 do if Ssimp[i] < Ssimp[inn] then inn := i else if Ssimp[i] > Ssimp[inx] then inx := i end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure SimpInit ; { } { Initialize SIMPLEX vertices, extremum vector, } { averages, and extrema indices. } { } begin mp1 := m + 1 ; { Compute number of SIMPLEX vertices } Ssimp[1] := SS(simp[1]) ; { Compute extremum value } aSsimp := Ssimp[1] ; for i := 2 to mp1 do begin { Initialize simplex vertices } for j := 1 to m do if j = i - 1 then simp[i,j] := simp[1,j] + dsimp[j] else simp[i,j] := simp[1,j] ; Ssimp[i] := SS(simp[i]) ; { Initialize extremum values } aSsimp := aSsimp + Ssimp[i] end ; aSsimp := aSsimp / mp1 ; { Initialize averages } for j := 1 to m do begin a := 0.0 ; for i := 1 to mp1 do a := a + simp[i,j] ; asimp[j] := a / mp1 end ; IndExt end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure Center ; { } { Compute center of SIMPLEX hyperplane face not con- } { taining vertex with greatest extremum value. } { } begin for j := 1 to m do begin c := 0.0 ; for i := 1 to mp1 do if i <> inx then c := c + simp[i,j] ; csimp[j] := c / m end end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure Offset ; { } { Compute difference vector from centroid to vertex } { with greatest extremum value. } { } begin for j := 1 to m do dsimp[j] := simp[inx,j] - csimp[j] end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure Project ( pc : real ) ; { } { Compute test vertex using centroid, Offset, and pro-} { jection coefficient and compute value of extremum } { function. } { } begin for j := 1 to m do tsimp[j] := csimp[j] + pc * dsimp[j] ; Stsimp := SS(tsimp) end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure Replace ( it : index ) ; { } { Substitute test vertex for specified vertex. } { } begin for j := 1 to m do simp[it,j] := tsimp[j] ; Ssimp[it] := Stsimp end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure SHRINK ; { } { Shrink SIMPLEX with respect to vertex with least } { value of extremum function. } { } begin for j := 1 to m do begin a := simp[inn,j] ; for i := 1 to mp1 do if i <> inn then simp[i,j] := a + CONTRACT * (simp[i,j] - a) end end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure Simplex ; { } { Perform one iteration using SIMPLEX projections to } { explore parameter space seeking extremum. } { } begin IndExt ; { Find indices for least and greatest } Center ; { Compute centroid vector } Offset ; { Compute difference vector } Project (REFLECT) ; { Try reflection } if ffTest(tsimp) and (Stsimp <= Ssimp[inn]) then begin Replace (inn) ; { Accept reflection and .. } Project (EXPAND) ; { Try expansion } if ffTest(tsimp) and (Stsimp <= Ssimp[inn]) then Replace (inn) { Accept expansion } end else begin { Try Replacement } if ffTest(tsimp) and (Stsimp <= Ssimp[inx]) then Replace (inx) { Accept Replacement } else begin Project (CONTRACT) ; { Try contraction } if ffTest(tsimp) and (Stsimp <= Ssimp[inx]) then Replace (inx) else SHRINK { Try shrinkage } end end end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure Results ; begin write(fout,nc:4) ; { Show Results } for j := 1 to m do write(fout,' ',simp[inn,j]:12) ; writeln(fout,' ',Ssimp[inn]:12,' ',aSsimp:12) end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} begin { Main program } nc := 0 ; arginit (Narg,Argv) ; { Parse command line and open files } assign(err,'con:') ; rewrite(err) ; { open error message file } if narg < 1 then begin writeln(err,'Usage: simp Infile [Outfile]') ; quit end ; if getarg(1,Infile,MAXARG) then begin assign(fin,Infile) ; reset(fin) ; { open Infile for input } if IOresult <> 0 then begin writeln(err,'Unable to Open ',Infile,' for Input.') ; quit end end ; if getarg(2,Outfile,MAXARG) then begin assign(fout,Outfile) ; rewrite(fout) ; { open Outfile for output } if IOresult <> 0 then begin writeln(err,'Unable to Open ',Outfile,' for Output.') ; quit end end else begin assign(fout,'con:') ; rewrite(fout) { open console for default output } end ; SimpData ; { Read control and data vectors } SimpInit ; { Initialize SIMPLEX } Results ; { Show initial parameters } repeat { Main loop } Simplex ; { Perform one iteration } done := true ; for j := 1 to m do begin { Use Cauchy parameter convergence test } a := 0.0 ; for i := 1 to mp1 do a := a + simp[i,j] ; a := a / mp1 ; if abs(asimp[j] - a) > cca[j] then done := false ; asimp[j] := a end ; aSsimp := 0.0 ; { Use absolute extremum convergence test } for i := 1 to mp1 do aSsimp := aSsimp + Ssimp[i] ; aSsimp := aSsimp / mp1 ; if abs(aSsimp) > ccS then done := false ; nc := nc + 1 ; { Increment iteration count } Results { Show iteration Results } until (done or (nc = ncx)) ; close(fout) end.  { Copyright (C) 1984 D.M. Fritz-Rohner } procedure ArgInit ( var narg : integer; var argv : argvec ) ; { } { Name: ArgInit - ARGument vector INITialization. } { } { Version: 1.0/TURBO (tm) Date: 1984 May 16 } { } { Purpose: Parse reduced command tail just enough to } { extract argument strings. Note that argument } { counting conforms to Pascal's one origin indexing } { so that argument indices run from 1 to narg. } { } { Notice that command tail length is limited because } { TURBO writes a jump vector over the command buffer } { beginning at offset 20H. Therefore, only 31 bytes } { of the command tail are available in default line } { buffer. See ALTCMD.PAS if the entire command line } { must be parsed. } { } { Author: D.M. Fritz-Rohner } { Post Office Box 9080 } { Akron, Ohio 44305 } { } const MAXLINE = 31 ; type xstrptr = ^xstr ; xstr = record len : char ; tail : array[1..MAXLINE] of char ; end ; var arg : argstr ; { intermediate variable } cptr : xstrptr ; { command tail pointer } icl : integer ; { command tail index } ncl : integer ; { number command chars } begin cptr := ptr(128) ; { command line tail } ncl := ord(cptr^.len) ; if (ncl > MAXLINE) then ncl := MAXLINE ; narg := 0 ; icl := 1 ; while ((icl <= ncl) and (narg < MAXARG)) do begin arg := '' ; { gobble leading blanks } while ((icl <= ncl) and (cptr^.tail[icl] = BLANK)) do icl := icl + 1 ; { extract argument } while ((icl <= ncl) and (cptr^.tail[icl] <> BLANK) and (length(arg) < MAXSTR)) do begin arg := concat(arg,cptr^.tail[icl]) ; icl := icl + 1 end ; { skip argument tail if truncated } while ((icl <= ncl) and (cptr^.tail[icl] <> BLANK)) do icl := icl + 1 ; { update argument vector } if (length(arg) > 0) then begin narg := narg + 1 ; argv[narg] := arg end end end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} function GetArg (n : integer; var s : argstr; maxstr : integer) : boolean ; { } { Name: GetArg - GET and copy command line ARGument. } { } { Version: 1.0/Turbo (tm) Date: 1984 May 16 } { } { Purpose: Copy n-th argument from command line argu- } { ment vector to string s. Note that maxstr is dummy. } { } { Author: D.M. Fritz-Rohner } { Post Office Box 9080 } { Akron, Ohio 44305 } { } { Reference: 'Software Tools in Pascal' } { Brian W. Kernighan and P. J. Plauger } { Addison-Wesley Publishing Company, 1981 } { pp. 350 } { } begin if (n > 0) and (n <= Narg) then begin s := Argv[n] ; GetArg := true end else GetArg := false end ;  { Copyright (C) 1984 D.M. Fritz-Rohner } program main ; { } { Name: ECHO - ECHO command line arguments. } { } { Version: 1.0/TURBO (tm) Date: 1984 May 16 } { } { Purpose: Demonstrate command tail parsing using } { CP/M (tm) line buffer contents. } { } { Author: D.M. Fritz-Rohner } { Post Office Box 9080 } { Akron, Ohio 44305 } { } const BLANK = ' ' ; MAXLINE = 31 ; MAXSTR = 14 ; MAXARG = 8 ; type argstr = string[MAXSTR] ; argvec = array[1..MAXARG] of argstr ; var Narg : integer ; Argv : argvec ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} {$I b:initcmd.pas parse command line } {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure echo ; { } { Name: ECHO - ECHO command line arguments. } { } { Version: 1.0/Turbo (tm) Date: 1984 May 16 } { } { Purpose: Echo command line arguments to output. } { } { Author: D.M. Fritz-Rohner } { Post Office Box 9080 } { Akron, Ohio 44305 } { } { Reference: 'Software Tools in Pascal' } { Brian W. Kernighan and P. J. Plauger } { Addison-Wesley Publishing Company, 1981 } { pp. 45 et seq } { } var i : integer ; arg : argstr ; begin i := 1 ; while (GetArg(i,arg,MAXSTR)) do begin writeln(output,arg) ; i := i + 1 end end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} begin { main program } ArgInit (Narg,Argv) ; { form argument list } echo { display argument list } end. ÃÉÍ«Copyright (C) 1984 BORLAND Inc‚A SDS VDB-8024selectedP=  ~·7È#õå~Íáñ=ÈóÍ% ÉÅÕåÝåýåõo&åͦñýáÝááÑÁÉoåͦÉþ€Ü�Ô©æîÅÕåÝåýåÍ£}Ùå!å!"8áãõÅÕ~#·(åÍáôÑÁñãÉ}´È:$‡‡‡ããããÅÒÁ= ô+èÍÐØ*ÎßõÅÕå!¨ÍZ!¢ÍÐ*ºÔBáÑÁñÉõÅÕå!´éõÅÕå!®àõ:¼·(ÅÕå=2¼!ÈÍZáÑÁñÉõ:¼· ÷ÅÕå<2¼!ÂåõÅÕå!¼ÛõÅÕååð!‹í°Ñ:žO:œ‚ÕÍÑ:ŸO:�ƒÍ!ðÍÐ* ÍBáÑÁñÉ!ð ë!›45(É!.+/ –0ü†õyþ0(ñíÉ d!kÃZ!{ÃZ͈æ͈o&Éô  áÁå:á·(yþ ÕÅÍ |µ(Íþ ÍþÊÅÁÑ*é"ÛÕx2áy·( >Ã28!?"9!É í°!á¸í°áí°>2گà Ã:ÃDÃ]ÃSÃXÃNÃ]ÃDÿ í[Ûþ (ú!eÍ}Í„þA8þQ0Gþ: xÖ@¯!\w# ( þ  ÍyÍVþ. ÍV!h6#ûÉ (þ*(þ.(þ!8þ}(þ*(Í„w#ßÉ>?> w#üÉþaØþ{ÐÖ É|Í’}õÍ›ñæÆ�'Î@'Ãè¯7Ë|À|·}È>ÿÉ"ÍíCß"í6#ûëÑùü "Ïë"ÕÍ�Í©éå*Ï·íB"Ïí[Í·íRëáÚ5í°É*Ïí°"ÏÙÉ^#V#Õ^#V#N#FáÉÝáëO/o&ÿ9ùëí°ÝéÑO/o&ÿ9ùëí°éÝáë!àÿ9ùëÅ(¯üí°Á> �‘(G¯üÝéÝá!àÿ9ù ¯w#üÝéÝáEÍŠ¶wÝéÝáÑ}“8÷�Ãu·íR·íB0 É>‘î·íRëê@ðøÉÕë·íRëáë·íR!È+Éͨ õÍz ð·íR!À+Éͨ õÍz ðÍ<!Ð+Éͨ õÍz ðÍ<!ÈØ+Éͨ ôÍz ïÍ<!ÈØ#Éͨ ôÍz ïÍ<!Ø+Éͨ õÍz ðT]KBë!z·> S>)ë)ë0 = öÉ|ªõÍJëÍJëDM¯go>íjíB0 7?ËË= ðëñðHåÍ\Ë<ËÑëÍÞëËzÈ5Í+È)ýÉÍ+ÈË<ËúÉëz· {þ0G·É¯goÉë|ª|úHºÀ}»ÉÉË|È|/g}/o#É}æo&ÉíKÓí[ÑÅÕxAJSËËËËáëáíJDM!éb"Ñë!6íJ"ÓDMÉ'ͬèͬdͬ ͬ} ¯<íR0û= ÈÆ0ÝwÝ#ÉÝ~Ö$O! Ý#Ý~Í„Ö08)þ 8 !Öþ 8þ0T])Ø)Ø T]Ø)Ø_ØËy·È|‡ÉÝááå}&#9N�8wë!DíB9ùëåí°ëá+Oí¸ë#ùÝé>ÃwÝáͦWáͧ _áå}“8(º8J`9{‚T]=o`9yí¸ë ¯ÃwÍÖ Ð>ÃuÍJ õÍuÍ` íÙ}·Ù>(è; àÙËxÙÂQ Ù}·ÙÈÙÅÕåÙ}· Ù˸TÅËø¯ÙËø}Ù•(0íD=ÙÍC ,= ù(Ùñæ€ Í[ 0%ÍD ·, 7 Í� ?õ(8ÙÍu Ëx ÍO - öÍ; ñ8˸·ÙáÑÁÙÉÙËxÙÂÝ ÍX ÍÝ Ø,-Èxî€GÉÙ}·ÙÊ; }·ÈÙ…ÙÍ ÅÕåÝ9Í; Ù.Ù>Ý#ÝnË0Í[ ÍD = ñÙ-Ù åÝnûËx ÍP ,-(-ñññ·ñÙÁáÙÝá˸°G,-Ì; É}·ÈÙ•Ù?Í åååÝ9Ù.Ù>Í� 8Íu ?Ë= ÝuÝ+Ù-Ù(>ÍO 0ßÍu ·áÍO 8Í� ?áÑÁËx ÍP š, —7•8Æ€8Æ€8oÝãÙåÅxËøÙ¨æ€õËøÝåÝ!ÉáØ¯oGOW_gÉ·ËËËËËÉ·ËËËËËÉ|Ù„Ùg{Ù‹Ù_zÙŠÙWyÙ‰ÙOxÙˆÙGÉ|Ù”Ùg{Ù›Ù_zÙšÙWyÙ™ÙOxÙ˜ÙGÉxÙ¸ÙÀyÙ¹ÙÀzÙºÙÀ{Ù»ÙÀ|Ù¼ÙÉÙxÙ¨ò² xÉËx(ͼ È?É}Ù½ÙÀ·ÈÃ� }Ö�Ú; <þ(ÐÙÅÕåÍ; 7ÍD = ùÙ|Ù¤Ùg{Ù£Ù_zÙ¢ÙWyÙ¡ÙOxÙ ÙGÃD ÙÅÕåÙÍuÙÍÆ ÙÍJ ë}·ÈËx>ÂuÍu}Æ€Ë/Æ€oÖõÙÅÕå; ÍÖ -ÅÕåÍJ }áÑÁÙáÑÁã¼ã0ãñÙÉÙÍW-ÍJ ÙÍW,Ù}þlØÅ˸ͨ Á8 ; Íý Í` Ëx(ÍÖ Ù-Ùͨ õ8ÍJ Ù-Ùͨ 8Ù,ÍJ }þl8;Ùª*ªª!ªÍ` ÝåÝ!Ð >ÍýÝáÍuÍ` Í` ÅÕåÙÍu--Ù-ÍÖ ÙáÑÁÙÍJ ,,ñ,-ÈØxî€GÉgª?+2×n¶*ï8t Ð Ðzˆˆˆˆ~«ªªªª,->ÊuËxÂuÙÍaÙ}.�•õ; ÙÍOÙÍJ ÅÕåÙ,ÍÖ ÙáÑÁ; ÝåÝ!U >ÍýÝá,ÙÍk-ÙÍÖ ñÅÕåo&0%ÍÑÙ,Í` ÙáÑÁÍÖ }þgÚ; É}Š�؉}颋.:}Žã8Žc~I’$I~ÍÌÌÌL«ªªª*ÙÍkÙ·Ëxõ˸; }þˆ0GÅÕå,Í™åË<Ë}áõÍÑ,-(-ÙñáÑÁõÍJ ÝåÝ!Ù >ÍÝáñ0 õÙÍaÙÍ` ñ…o8 ñÈÙÍOþ á>Ãum.`1pF,þåt6|‰„!wS<ÿÃ.zÒ}[•|%¸FXc~üïýu€Ò÷r1}·ÈÝåÙÍOÙ¯Ëx(<˸õͨ 8Ù; ñËÿõÙÏŽé!~JÙͨ 0Í÷OÝ!—>ÙÝÍ<Ùͨ 8 = ìÙ ÝÙÙÍ7ËøÍÖ ÅÕåÍ<Í` ÙÍOÍÖ ÙáÑÁ; ÝåÍ÷ÝáÙÍ7ÍÖ ñ0 õÙÍW-ÍJ ñÝáËOÈËøÉçÏÌTöô¢0 jÁ‘ €µžŠoD€‚,:Í€jÁ‘ �€!¢ÚI}袋.º}Žã8Žc~I’$I’~ÍÌÌÌL«ªªªªÝ!Ó>ÅÕåõÍuÍ` ñÍÙáÑÁÃ` õÙÍ7õÙÅÕåÍ7ÍÖ ÙáÑÁÙÍ` ñ= éÙÍOÃÖ ÝÝnÝfÝ^ÝVÝNÝFÉ!�DLT\ÉI¢Ú!‚!É53ó!�úÉr1÷!€ÒÉÅÕåÙáÑÁÉÍ\!€> Ëx Ë#ËËË-= ðo˸ÉËxÙÍO(Ëø-ÍÖ ·Ë}(ËxËø>�½8(ÍC ,óÍC `iÈÃM!É>’Ãu|µÊ; Ë|ÍJ>�Ë| )=Ë|(úDMboÀ˸Éͦë8þ8ͦÙËxÙ(’0¯þ 8> ÕÍMÑËx(>-ͲË{(aËy(Ͱͦ ò\z·(>.Ͳ (Ͱ ÷ú~ͦ÷Ë{È>EͲ>+Ë|(|íDg>-Ͳ|/Ö 0ûÆ:ÝpÝ# ý~ý#· ý+>0ÝwÝ#Éýå,-  ý60ý#ø¯ÃJÅ˸}ÙÖ€oŸgMÍÄ|þÙ <ýwíDÍ }þ�0Í€ý5Ëø>„•.(ÍC Ë= øý~õ> xæÆ0ýwý#xæGÅÕåË%ÍP Ë%ÍP ëãÑãíZëáãíJDMáË%ÍP = ÈñÁýáÉýåá_~6þ5Øúi+~¨¥Ôh¶¿ÉìÅëx-ÐÍÎÂSÞùx9?ë+¨­ÅøÉ{Η@}·ÈËøÅÕ|ÍC ÍC „gãíZëáãíJDMá0ÍD ,7È}Æo˸ÉÍ ¾ #øyîO!@9ùi&ÝéÍ  ë¶¾ â#÷ÚÍ ¶w#ùëùÝéÍ /¦w#øïÍ ¦w#ùãýáÝá!9ë! E9ýéÝá!!9~·(¯+FÍŠ¦!"9ù!(#Ýé>¯2æýá*ÛͲ¯á"âýå|·>"Ê :æ·( ͆ *â6#wÉÍ÷*â6#6 ë!\$í°É!¶Ååí[Ûþ (úÍ„–( áÁã·É#ëÁÁþ:À~ÉCONTRMKBDLSTAUXUSR>¯2æÍîÍ$*â#~þ ͶÍ$*â:æ·> >w###6ÀÃÖþ þ #6++pÉ>¯2æíSäÍ-Í$Ͷ:Ù·À*â6###ww#w$w#wÖÿ:æ· åÍôá##N#F*ä·íBÈ>�à å¯w#w#í[äs#ráÃó>¯2æÍSÍ$ͶÍ$*â6å ë#Íá-¯Nw#FwÖÿq#p#6€#w#w#wÉÍß*â ë:æ·( ÕÍÑñÅÍÁ<Àxà *â6#ûÉ"â#~+þ 2ËN(>Í’:Ù· *âË^ îËFÈ*âå ëÍá< >ÿ2Ù6É"â~æÈÍŸ*â-¯w#wÕÿw#ÍóÍŸÀ"â~æÈ·ÍÀ ëÍ<À@ýá*ÛͲ¯áýåÍÀåÍ÷áåë!\ í°á åëÍÑ<Ê®!\$í°É>à >¯2æÍÀ*ß|µ>! ë*â \$í°\Í<(Ï!ý€í°:æ· í[1Ã�ÿÕÍ\ÍÑ!€ë·(éf"âÍÂÈ> 2ÙÉ:Ù·ÈñÉÝáÝåå!ÊÍ<áÉÝáÝå"âËF( #~þÀ#6Ãe>Îå!ÊÍ[áÉ"âËNÀ>ë!Ú~þ€8>O6*Û"ÝÍwþ (=þ(&þ("þ(þ :á·(ßÃNþ 8Øyº(Ô~#ÍèÌúx+Í% (½ï6Éå*â#~þáÉÍÂÈÍ[þÈÅÕå*â#~· *Ý~þ(h#"Ýb= Íõþ 8Íèþ ÌáñJ= ÍB== ͯ}8= ͵}/Í­ !*â###å~Æ-_~áþ(4òQ6*âËÖ>™2Ù>*â##wáÑÁÉ:Ù·>Àå*â##~áÉå*â#~þÿ(EÍÌÍ[þ ( þ (þ (þ ÍÖè!]Í[þ (þ (þ (þ(w#(ÍÖãÍÂÌÖ6áÉÝ!]Ý~·Èþ-ÀÝ#É8Ý~·È>7à ëÍ Í[ÃÖÍÖÉ>¯OÅÍkÁͼÈÅåÍÁÑÁÍÎØÌMës #rëÉÍkͼÈÅåÍpÙáÁÍÎØÙÌX ÙáåÍÌÍ[þ ÍÖôÍ[þ (þ( #w(ÍÖêÍÂÌÖáqÉ*â#~þÊáÍ[þ (þÈÍÖñÍ ÍÖþ ÀÃÖ*â##~þÈ6ÉÅÕåÍœáÑÁÉOÍ$*â#~þ(08áÅå·Ê¦=ʦ==Ê©=ʬò+ËÞ###å~Æ-_qá4ð6Í¡È>ðà *æ:è¾È4^qÉ}Ã’ÁÑÅÝ*ÛË|(ÍMëëË|( ÍMÝ6-Ý#ÕÍ�áͦí[ÛÝåá·íRë“8 (G> Í’ùCÈ~Í’#÷ÁÑÙáÑÁÙÅÝ*ÛÕÍôÇÁÑÅͦËC!h Ç!lÀTRUEFALSEͦ!9^#Í(ÑùÕÉá~#·(G~Í’#ùé> Í’> Ã’ "âËF!ÈÍ[¸(þÀ#ÉåÍRë·íRá0Íô*â4À#4É>™Ã åÍR·íR *â4 #4(áÍóÒ>òÜ>¯2çÍ$ë*âËV(/Ë–:ç·(#~+· x· y·ú2ÅÕ!͵ÑÁ( =(þ X:ç·(R*â:ç·(ËÞ###~Æ-Õ_ÑÖ-ÍŒí âX<òN=<ÍŒ*â###æw ÅÕåÍŸáÑÁ Õ*Ñ4 #4x±ÂüëÉ>™>ðà õ:ç·(ëñÉ"âÍŸÈè"*âËÖË^ÈËž*âËVÈË–åÅ0ëÍÁá ëÍ·ÉÁÑíSâÅåÍRÑ·íR8A*â N#F#s#rÍ$ 0}æ)ëíjëS\*â###w* N#Fë·íB ÈÕåÍŸÑár+sÉ>‘à ÕÙáÙ!T]>)ëíjëÙ)Ù0 0= ïÉÍU·íR!À#ÉÍUëÉ*â^#V#ÕN#F#^#VáÉ>">!2çDMÝáÑáÝå"â~æÊóx±(LÅÕÍ*â ë:çOÍÑÁ·(o:çþ" C}=(þ ?ÅÕ*â-N#Fp+qÛÿq#pÑÁ!€ë °*â F+N+++V+^ë·íBÐëq#pÉ>™>ð>à ÁÑíSâÅåÍRÑ·íRÚ*â s#r$ s#rÉ"äíSæëá"â! N#Fë·íB(^x± *â 6#ûí[âÍ<(H*â! íKäq#p##ëíKæÅÕÍí[â!Í· *â! 4 #4Ñ!€ëÁ x± Õ*â$ éÝ*â>ðÃw"òëáã"ô{æü_!í"ëÝ*íÝnÝf}´(HíR0ÝnÝfåÝ"ëÝáã Ý^ÝVÝåMDÝnÝfÝåÝÝuÝtÝqÝpÝåÑ*ës#rÑ*ôs#rÉÝåá"Í*ò ÝåÁ Ú5íKÏíB!Úð>ÿÃuëáã~#fo{æü_ë"ò*íåÝá·íR0RÝnÝfå·íR0ÝáðáÕýáíKòýqýpýuýtÝsÝrÝåáÝNÝFÍÄ( Ý^ÝVÕÝáÝåáÝNÝFÝ^ÝV*ííSíÕÝáÝuÝtíKòÝqÝpë ·íRÀÕýá*Í·íR(ý~Ýwý~Ýwýnýf ÝuÝt¯ÉÝåá"Í6#ûÉÍ *öÉÍ *øÉ!"ö"øÝ*íÝNÝFy°(*ö "ö*ø·íB0íCøÝnÝfåÝáØ*Ïûÿ í[Í·íRØë*ö"ö*ø·íRÐíSøÉí[Ís#rÉ^#VíSÍÉ>¯O"æ¯w2Ùx2è!ê"âá"äá ÍöÍ@*äé>¯2ê"æ!ê"âá"äá"è!\Ͳ¯*è:ê· ÍîÍ!Ù~6·go(Ýåá\íRë*æs#r¯ÿí_2ÔÉëÝáÁáx±( s x±(T]í°ÝéDMÝáÑá·íR0ð ë ëí¸ÝéÑÁÕ-a%ÃÆ}Í„oÉ*é!Ù~6o&ÉÍ |µÈÍ£}þÀÝáÍ%^C User break1:Ù·ÈÝáõÍ% I/OÝáÍ% Run-timeÍ% error Í’Í%, PC=Ýåáí[Õ·íR"×Í�Í% Program aborted*ßé1!ÀܸÿÍ�!Z"ÜͲÃI"ýáá">Üá"@Üýå!€")Ü*)Ün&"%Ü*%Üå!ÑÍ›ËEÊ !"%Ü!ë*@Üs#r!"'Ü*'Üå*%ÜÑ͇å*@Ü^#Vëå!ÑͯÑ}£oËEÊž!Í!+ÜͲ*'Üå*%ÜÑ͇å*)Üå*'Ü+Ñn&å! ÑÍNÑ}£oËEÊ• *'Üå!Ñ"'ÜÃX *'Üå*%ÜÑ͇å*)Üå*'Ü+Ñn&å! ÑÍaÑ}£oå!+ÜÍ Ímå!ÑͯÑ}£oËEÊ!!+ÜÍ *)Üå*'Ü+Ñn&e.åÍ!+ÜͲ*'Üå!Ñ"'ÜÕ *'Üå*%ÜÑ͇å*)Üå*'Ü+Ñn&å! ÑÍaÑ}£oËEÊK!*'Üå!Ñ"'ÜÃ!!+ÜÍ Ímå!ÑÍ›ËEÊ›!*@Ü^#Vëå!Ñë*@Üs#r*>Üå*@Ü^#Vë+å)å)å)ÑÑÑÑå!+ÜÍ ÍÑÃ( Éýáá"Üá" Üá""Üýå*"Üå!ÑÍ›å*"Üå*ºÜÑ͇Ñ}£oËEÊú!!BÜå*"Ü+å)å)å)ÑÑÑÑÍ * ÜͲ!}2$ÜÃ"!}2$Ü*$Ü&É!"Ü*Üå!Üå!åÍŸ!ËEÊH"!ÊÍ[!ÜÍ !ÍqÍ�Íb*Üå!Ñ"Üà "É!ºÜå!BÜåÍçÍ"ÃÅ)å)ÑÑÑÑÍ * ÜͲ!}2$ÜÃÍ!!}2$ { Copyright (C) 1984 D.M. Fritz-Rohner } function SS ( var a: vertex ): real ; { } { Name: SS - normalized least squares extremum. } { } { Version: 1.0/Turbo Date: 1984 May 16 } { } { Purpose: Compute normalized root sum square of } { difference between specified and computed } { dependent variable. } { } { Author: D.M. Fritz-Rohner } { Post Office Box 9080 } { Akron, Ohio 44305 } { } { } { SS extremum function, sum of squares } { a[1..m] parameter vector } { ff(a[1..m],x) parameter defined function } { } var i : index ; s : real ; { intermediate variable } begin if n > 0 then begin s := 0.0 ; for i := 1 to n do s := s + sqr(ys[i] - ff(a,xs[i])) ; SS := sqrt (s / n) end else begin writeln(err,'Unexpected Data Order: n < 1') ; quit end end ;  { Copyright (C) 1984 D.M. Fritz-Rohner } function SS ( var a: vertex ): real ; { } { Name: SS - mini-max extremum function. } { } { Version: 1.0/Turbo (tm) Date: 1984 May 16 } { } { Purpose: Compute maximum of absolute value of } { difference between specified and computed } { independent variable values. } { } { Author: D.M. Fritz-Rohner } { Post Office Box 9080 } { Akron, Ohio 44305 } { } { } { SS extremum function, sum of squares } { a[1..m] parameter vector } { ff(a[1..m],x) parameter defined function } { } var i : index ; s : real ; { intermediate variable } sx : real ; begin if n > 0 then begin sx := abs(ys[1] - ff(a,xs[1])) ; if n > 1 then for i := 2 to n do begin s := abs(ys[i] - ff(a,xs[i])) ; if s > sx then sx := s end ; SS := sx end else begin writeln(err,'Unexpected Data Order: n < 1') ; quit end end ;  { Copyright (C) 1984 D.M. Fritz-Rohner } function SS ( var a: vertex ): real ; { } { Name: SS - Pass without change computed function } { } { Version: 1.0/Turbo Date: 1984 May 16 } { } { Purpose: Support application of SIMPLEX procedure } { to functions where no 'fit' criterion is } { defined } { } { This routine simply passes the value defined by the } { function ff. } { } { Author: D.M. Fritz-Rohner } { Post Office Box 9080 } { Akron, Ohio 44305 } { } begin SS := ff(a,0.0) end ;  { Copyright (C) 1984 D.M. Fritz-Rohner } function ffTest ( var a: vertex ) : boolean ; { } { Name: ffTest - feasibility test } { } { Version: 1.2/TURBO (tm) Date: 1984 July 11 } { } { Purpose: Feasibility test always true. } { } { Author: D.M. Fritz-Rohner } { Post Office Box 9080 } { Akron, Ohio 44305 } { } { ffTest feasibility test result } { a[1..m] parameter vector } { } begin ffTest := true end ;  { Copyright (C) 1984 D.M. Fritz-Rohner } function ffTest ( var a: vertex ) : boolean ; { } { Name: ffTest - feasibility test } { } { Version: 1.2/TURBO (tm) Date: 1984 July 11 } { } { Purpose: Feasibility test for multi-linear fit. } { } { Description: Return true if breakpoint abcissae are } { ordered; } { } { x < x < ... < x } { 1 2 m/2 } { } { Author: D.M. Fritz-Rohner } { Post Office Box 9080 } { Akron, Ohio 44305 } { } { ffTest feasibility test result } { a[1..m] parameter vector, where; } { } { a[1..m] = [x , y , x , y , ... , x , y ] } { 1 1 2 2 m/2 m/2 } { } var i : integer ; begin if m > 3 then begin i := m - 1 ; while (i > 1) and (a[i-2] < a[i]) do i := i - 2 ; ffTest := i = 1 end else begin writeln(err,'Unreasonable Parameter Vector Order') ; quit end end ; function ff ( var a: vertex ; x : real ) : real ; { } { Name: ff - compute fitting function. } { } { Version: 1.0/TURBO (tm) Date: 1984 May 16 } { } { Purpose: Compute 'Michaelis-Menten' function value. } { } { Author: D.M. Fritz-Rohner } { Post Office Box 9080 } { Akron, Ohio 44305 } { } { Reference: 'Fitting Curves to Data' } { Marco S. Caceci and William P. Cacheris } { BYTE Magazine, Volume 9, Number 4 } { May 1984, pp. 340-362 } { } { } { ff dependent variable, estimated } { a[1..m] parameter vector } { x independent variable } { } begin ff := a[1] * x / (x + a[2]) end ; 200 5e-3 2 0.2 1.0 1.0 3.0 1.0 1.0 6 0.172 1.68 0.250 3.33 0.286 5.00 0.303 6.67 0.334 10.0 0.384 20.0 { Copyright (C) 1984 D.M. Fritz-Rohner } function ff ( var a: vertex ; x : real ) : real ; { } { Name: ff - compute fitting function value. } { } { Version: 1.2/TURBO (tm) Date: 1984 July 11 } { } { Purpose: Compute simple odd polynomial value. } { } { ff = x * (a[1] + x2 * (a[2] .. + x2 * a[m]))..) } { } { where: } { } { x2 = x * x } { } { Author: D.M. Fritz-Rohner } { Post Office Box 9080 } { Akron, Ohio 44305 } { } { ff dependent variable, estimated } { a[1..m] parameter vector } { x independent variable } { } var x2 : real ; j : integer ; sum : real ; begin x2 := x * x ; { initialize } sum := 0.0 ; for j := 1 to m do sum := a[m-j+1] + x2 * sum ; ff := x * sum end ; 100 1.e-4 3 1.0 1.0 1.0 -.167 1.0 1.0 .00833 1.0 1.0 50 3.141076E-02 2.000000E-02 6.279052E-02 4.000000E-02 9.410831E-02 6.000000E-02 1.253332E-01 8.000000E-02 1.564345E-01 1.000000E-01 1.873813E-01 1.200000E-01 2.181432E-01 1.400000E-01 2.486899E-01 1.600000E-01 2.789911E-01 1.800000E-01 3.090170E-01 2.000000E-01 3.387379E-01 2.200000E-01 3.681246E-01 2.400000E-01 3.971479E-01 2.600000E-01 4.257793E-01 2.800000E-01 4.539905E-01 3.000000E-01 4.817537E-01 3.200000E-01 5.090414E-01 3.400000E-01 5.358268E-01 3.600000E-01 5.620834E-01 3.800000E-01 5.877853E-01 4.000000E-01 6.129071E-01 4.200000E-01 6.374240E-01 4.400000E-01 6.613119E-01 4.600000E-01 6.845471E-01 4.800000E-01 7.071068E-01 5.000000E-01 7.289686E-01 5.200000E-01 7.501111E-01 5.400000E-01 7.705132E-01 5.600000E-01 7.901550E-01 5.800000E-01 8.090170E-01 6.000000E-01 8.270806E-01 6.200000E-01 8.443279E-01 6.400000E-01 8.607420E-01 6.600000E-01 8.763067E-01 6.800000E-01 8.910065E-01 7.000000E-01 9.048271E-01 7.200000E-01 9.177546E-01 7.400000E-01 9.297765E-01 7.600000E-01 9.408808E-01 7.800000E-01 9.510565E-01 8.000000E-01 9.602937E-01 8.200000E-01 9.685832E-01 8.400000E-01 9.759168E-01 8.600000E-01 9.822873E-01 8.800000E-01 9.876883E-01 9.000000E-01 9.921147E-01 9.200000E-01 9.955620E-01 9.400000E-01 9.980267E-01 9.600000E-01 9.995066E-01 9.800000E-01 1.000000E+00 1.000000E+00  { Copyright (C) 1984 D.M. Fritz-Rohner } function ff ( var a: vertex ; x : real ) : real ; { } { Name: ff - compute fitting function. } { } { Version: 1.2/TURBO (tm) Date: 1984 July 11 } { } { Purpose: Compute multi-linear fit. } { } { Author: D.M. Fritz-Rohner } { Post Office Box 9080 } { Akron, Ohio 44305 } { } { ff dependent variable, estimated } { a[1..m] parameter vector } { x independent variable } { } var i : integer ; x0,y0,x1,y1 : real ; begin if m > 3 then begin i := m - 1 ; while (i > 0) and (x < a[i]) do i := i - 2 ; if i = m - 1 then ff := a[m] else if i < 1 then ff := a[2] else begin x0 := a[i] ; y0 := a[i+1] ; x1 := a[i+2] ; y1 := a[i+3] ; ff := y0 + (y1-y0)*(x-x0)/(x1-x0) end end else begin writeln(err,'Unexpected Parameter Vector Order') ; quit end end ; 200 1e-4 6 0.00000 0.1 1.0 0.00000 0.1 1.0 0.30000 0.1 1.0 0.29552 0.1 1.0 0.60000 0.1 1.0 0.56464 0.1 1.0 7 0.000000 0.0 0.099833 0.1 0.198669 0.2 0.295520 0.3 0.389418 0.4 0.479426 0.5 0.564642 0.6 { Copyright (C) 1984 D.M. Fritz-Rohner } function ff ( var a: vertex ; x : real ) : real ; { } { Name: RF - Root Finder. } { } { Version: 1.1/TURBO (tm) Date: 1984 May 16 } { } { Purpose: Compute absolute value sum for polynomial } { whose root(s) are being sought. Here, the } { roles of some of the program variables are } { exchanged; } { } { ff extremum function } { } { a[1..m] become the roots, } { xs[1..n] become the coefficients, and } { ys[1..n] dummied for consistency } { } { m } { _____ } { \ } { ff = \ abs [ (..(x * a + x ) * a + ..) + x ] } { / 1 i 2 i n } { /____ } { i = 1 } { } { Author: D.M. Fritz-Rohner } { Post Office Box 9080 } { Akron, Ohio 44305 } { } var i,j : integer ; sum : real ; num : real ; begin sum := 0.0 ; for i := 1 to m do begin num := 0.0 ; for j := 1 to n do num := num * a[i] + xs[j] ; { Horner's Rule } sum := sum + abs(num) end ; ff := sum end ; 100 1e-5 2 0.0 1.0 1e-5 0.0 1.0 1e-5 3 0.0 1.0 0.0 -1.0 0.0 -2.0