0% found this document useful (0 votes)
18 views

Modeling and Optimization of Dynamical Systems by Unconventional Spreadsheet Functions

American Journal of Modeling and Optimization, 2016, Vol. 4, No. 1, 1-12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Modeling and Optimization of Dynamical Systems by Unconventional Spreadsheet Functions

American Journal of Modeling and Optimization, 2016, Vol. 4, No. 1, 1-12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

American Journal of Modeling and Optimization, 2016, Vol. 4, No.

1, 1-12
Available online at http://pubs.sciepub.com/ajmo/4/1/1
© Science and Education Publishing
DOI:10.12691/ajmo-4-1-1

Modeling and Optimization of Dynamical Systems by


Unconventional Spreadsheet Functions
Chahid Kamel Ghaddar*

ExcelWorks LLC, Sharon, MA, USA


*Corresponding author: [email protected]

Abstract The spreadsheet computational engine is exploited via a nonstandard mechanism to support a functional
formulation for constrained optimization of parameterized differential systems by unconventional spreadsheet
functions. The nonstandard mechanism enables encapsulation of numerical algorithms into functions which take
variable formulas as a new type of input argument while retaining purity and recursion properties. This is in contrast
to conventional spreadsheet functions which are restricted to static input types. Several solvers for differential
equations and nonlinear minimization are developed which serve as building blocks for the functional formulation.
The latter makes it possible to express a program for a constrained dynamical minimization problem in as few as
three formula evaluations in Excel as demonstrated by several examples. The solver functions integrate seamlessly
with MS Excel, and propel the spreadsheet beyond traditional applications as a powerful tool for exploring
dynamical optimization problems.
Keywords: dynamical optimization, optimal control, differential equations, spreadsheet, functional paradigm
Cite This Article: Chahid Kamel Ghaddar, “Modeling and Optimization of Dynamical Systems by
Unconventional Spreadsheet Functions.” American Journal of Modeling and Optimization, vol.4, no. 1 (2016): 1-
12.doi:10.12691/ajmo-4-1-1.

2. In another group of cells, the user defines formulas


for the objective function and the left hand side of
1. Introduction each constraint.
3. Via a command dialogue, the solver is executed
The spreadsheet inherent simplicity of defining formulas
which iterates, altering the decision cells values and
and manipulating data, combined with rich intrinsic
recalculating the dependent objective and
mathematical functions, graphing tools, and extensibility,
constraints cell values until such values are found
have contributed to its widespread adoption in engineering
which minimize the objective function value and
and scientific applications [1,2,3]. Models for differential
satisfy the constraints.
equations [4-10], optimization of algebraic and stochastic
Obviously, a command works by transforming its own
systems, and risk analysis [11,12] are well known.
inputs and does not behave as a proper mathematical
However, computational problems in constrained dynamical
function. It lacks the properties of purity, composition and
minimization involving systems of differential equations,
could not support recursion. Differential equations solver
and more generally optimal control problems, have remained
extensions to Excel rely on commands, and operate in a
beyond the utility of the spreadsheet. An example of such
similar fashion to the built in Excel solver, or may utilize
problems is computing optimal parameters for a
the structured spreadsheet layout as a finite difference grid
differential equation system that minimize the sum of
mixing up the input, algorithm and output [4-10]. Furthermore,
square errors for prescribed constraints on its response.
a command cannot to be invoked programmatically as a
The sought parameters may be any controls that influence
re-usable function from other spreadsheet formulas [14].
the response of the system such as coefficients, forcing
Therefore, it is unfeasible to integrate multiple commands
terms, boundary conditions, etc. Solving similar problems
to solve a dynamical minimization problem.
requires seamless integration of multiple solvers for
On the other hand, the second mechanism for extending
constrained minimization and differential equations.
the spreadsheet utility is through the addition of new
The standard design of the spreadsheet makes such an
functions. The spreadsheet design permits only pure
integration of solvers technically impractical. To point out
functions restricted to operating on constant inputs
the reasons, we briefly review the two distinct venues for
[13,14,15]. Some external programs, such as MATLAB
adding functionality to a spreadsheet: Commands and
[16] offer interfaces to Excel to expose a portion of their
Functions [13,14]. A command is the standard mechanism
functionality. This model permits exchange of basic data
for evaluating formulas in the spreadsheet. MS Excel’s
types such as numbers, but cannot be used to expose
built in optimization solver is a good example of a
differential and optimization solvers. Therefore, the
command which works as follows:
standard spreadsheet functions could not either support a
1. The user selects cells to hold initial values for each
constrained minimization of a dynamical system.
decision variable in a model.
2 American Journal of Modeling and Optimization

Certainly, the inherent design limitations of the Table 1 illustrates utilizing (1) to compute the integral
spreadsheet unduly limit its full potential. Given the 1 ln x
spreadsheet intuitive interface for defining formulas, it of ∫ dx = −4 in Excel. The reference to the integrand
0 x
presents a practical platform for supporting native calculus
formula A1 1, the variable of integration X1, and limits are
solvers that could support a functional paradigm for
passed to (1) as regular parameters. Evaluating QUADF
dynamical optimization problems. Accordingly, the author
formula in A2 computes the results without any side
has developed a method which overcomes the spreadsheet
effects. Such a practical integration function has never
limitation and enables the creation of a first class function
existed in a spreadsheet application before.
– function that can take other functions (i.e., formulas and
variables) as arguments while preserving its mathematical Table 1. Computing a formula integral in Excel by the worksheet
properties including purity and recursion. Details of the function (1)
method are provided in [17] and are rather technical in A A
nature. However, the main idea is to capture the definition
1 =LN(X1)/SQRT(X1) 1 #NUM!
of an input formula via the spreadsheet Advanced
Programming Interface (API) and construct a relational 2 =QUADF(A1,X1,0,1) 2 -4
graph representing the formula inter-dependence on nested
More importantly, by preserving function properties
formulas, variable cells, and recursive calls. A graph
including purity and recursion, the first class solvers can
evaluator which exploits the spreadsheet API evaluates the
be utilized as building blocks of a functional paradigm for
value of a formula without modifying any data in the
solving dynamical optimization problems. A simple
spreadsheet.
example of a functional program is illustrated in Table 2
The flowchart logic for developing a first class solver is
in which (1) is employed to compute the volume integral
shown in Figure 1. The benefits gained by enabling a first
3
class solver in the spreadsheet are noteworthy. The 2 3− x 6 − 3 x − 2 y
spreadsheet’s computational engine could be exploited to ∫ ∫ 0 0
2
0 ∫ 1 − xdzdydx =
3. Here each inner
support intrinsic solvers for virtually any system that can QUADF formula serves as the integrand for the next outer
be modelled by formulas and variables [18]. For example, QUADF formula. Evaluating the outer integral in A4
the flow chart of Figure 1 makes possible, for the first computes the triple integral value.
time, the existence of the following intrinsic worksheet
integration function: Table 2. Example of using recursion to compute triple integral in
Excel
= QUADF ( f , x, a, b, [Options ]) (1) A A
b 1 =1-X1 1 1
for computing a formula integral ∫a f ( x )dx using
2 =QUADF(A1,Z1,0,6-3*X1-2*Y1) 2 6
appropriate algorithms [19]. 3 =QUADF(A2,Y1,0,3-3*X1/2) 3 9
4 =QUADF(A3,X1,0,2) 4 3

In Section 2 we present an abstract functional


formulation which permits us to utilize first class
spreadsheet functions to solve constrained dynamical
minimization problems in Excel. The formulation is
motivated by the combination of the benefits of a
functional programming paradigm [20] with the simplicity
of using the spreadsheet application. It enables expressing
the solution steps from an engineering view point, rather
than describe the computational logic in a procedural style,
as is commonly practiced. Given a set of control
parameters, we model and obtain an initial response of the
differential system based on initial values for the control
parameters. In the next step, we state design objectives in
the form of constraint formulas, which penalize the
deviation of the initial response from a desired target
response. Finally, we compute values for the control
parameters to minimize the sum of squared errors in the
set of design constraints. These steps map directly to three
classes of first class functions: solvers for differential
equation systems; criterion functions to enable definition
of dynamical constraints on a system response; and a
functional minimizer for the set of constraints. As shall be
demonstrated in the examples, it is possible to express a

1
The #NUM! error reported by Excel is due to division by X1 which is
Figure 1. Flow chart for unconventional first class spreadsheet function undefined. X1 is chosen as a dummy variable for the formula. Its value,
design assumed zero by Excel, is irrelevant, and the error can be ignored.
American Journal of Modeling and Optimization 3

program for constrained minimization in as few as three 0, if g j ( pd ) ≥ 0 is ture (4)


function evaluations in Excel. δ j ( pd ) = 
The three classes of functions which form the building 1, else
blocks of the functional formulation are presented in the for 𝑗 = 𝑘 + 1, . . , 𝑚, be an indicator weight function which
following section with full description provided in takes on the value one for each active (unsatisfied)
Appendices A-C. Section 3 presents three examples inequality constraint, or zero otherwise.
employing the spreadsheet functions for solving the Accordingly, the optimal design parameters values we
following constrained optimization problems: seek to compute, minimize the following implicit cost
• Computing the required thrust and arrival time for a functional:
travelling train.
k m
• Customizing a second order dynamical system. = C ( pd ) ∑gi ( pd ) + ∑  g j ( pd ) δ j ( pd ) 
2 2
(5)
• Controlling heat transfer across a slab. i= 1 j= k +1
We note that this article primary focus is to introduce
and illustrate the solution framework using pedagogical Based on the flowchart of Figure 1, in conjunction with
examples rather than analyze any specific physical a suitable minimization algorithm such as the Levenberg-
problem. In addition, the article does not review other Marquardt algorithm [21,22], the minimization of the
non-spreadsheet methods, but leave it to the reader to objective (5) can be practically expressed in the
withdraw own conclusion on the merits of the presented spreadsheet by the evaluation of a worksheet functional
approach in comparison to other familiar mathematical minimizer solver of the form:
software. Finally, we recommend reviewing Appendix A
= solve( g ( pd ) , pd ,[m − k ]) (6)
which includes a brief description of basic spreadsheet
concepts for any reader not familiar with the spreadsheet. which takes the vector of constraint formulas, design
variables, and the number of inequality constraints, 𝑚 − 𝑘.
The functional formulation ensures that evaluation of a
2. Functional Formulation for the criterion constraint formula by the solver algorithm
Dynamical Optimization Problem triggers re-evaluation of the underling dynamical system
in order to compute a current value for the constraint at
In the following, we present a functional formulation any given values of the design parameters [17].
for the constrained minimization problem which is based We remark that although the above formulation does
on first class spreadsheet solvers. In what follows, a bold not specify an explicit general cost functional, it is easily
symbol indicates a vector value. Let 𝒖(𝑥, 𝒑𝒅 ) be the amenable to incorporating one. Such a modification would
solution function to a system of differential equations entail: modifying the solver (6) interface to accept an
where 𝑥 is an independent variable and 𝒑𝒅 is a set of additional cost formula, 𝐺(𝒑𝒅 ) , and updating the
design parameters that influence the system response. underlining solver algorithm. Expanding the framework to
𝒖(𝑥, 𝒑𝒅 ) can be interpreted as a solution function returned support an explicit cost functional including continuous
by a higher order solver function [20] for the differential time cost functional for optimal control problems [23] will
equations system. The solution function provides values be addressed in a forthcoming effort.
for the differential system variables 𝒖 = [𝑢1 , 𝑢2 , . . , 𝑢𝑛 ] at The abstract functional formulation (2)-(6) lays the
a specified value for the independent variable , 𝑥, and for a foundation for a practical three-step dynamical
given configuration of the system design parameters, 𝒑𝒅 . optimization process that can be carried out using three
In a spreadsheet context, 𝒖(𝑥, 𝒑𝒅 ) represents an abstract type of pure spreadsheet functions which we described
tabular result value of a differential equation system solver. next.
Let 𝑓𝑖 (𝒖(𝑥, 𝒑𝒅 ), [𝑥], 𝒑𝒅 ) be a criterion functional that
computes a scalar property of interest from the differential 2.1. Differential Equations Solvers
system response, 𝒖(𝑥, 𝒑𝒅 ), for a specified range of the
Two spreadsheet solvers, IVSOLVE() and BVSOLVE()
independent variable, [𝑥] , and specified values for the
suitable for initial and boundary value problems, have
design parameters, 𝒑𝒅 . For example, 𝑓𝑖 may simply
been developed and described in Appendix A. To utilize
extract a single value from 𝒖(𝑥, 𝒑𝒅 ), or may compute a
the solvers, the differential system must be presented as a
complex property by applying a prescribed operation, such
set of first order equations
as integrating a component of 𝒖(𝑥, 𝒑𝒅 ) over a specified
range [𝑥] . Given a target design value, 𝜏𝑖 , for each dui
criterion functional, 𝑓𝑖 , we construct the following ordered
= i ( x, u, pd ) , i 1,.., n
f= (7)
dx
system of 𝑚 constraints:
which are easily modelled in a spreadsheet by the system
= gi ( pd ) 0,= i 1,.., k RHS formulas (𝑓1 , 𝑓2 , . . , 𝑓𝑛 ). These formulas are passed as
(2)
g j ( pd ) ≥ 0, j= k + 1,.., m arguments to the solvers along with the system variables
(𝑥, 𝑢1 , 𝑢2 , . . , 𝑢𝑛 ) , as detailed in Appendix A. The 3rd
where 𝑔𝑖 , 𝑖 = 1, . . , 𝑚 is a suitable penalty functional solver, PDSOLVE(), suitable for initial-boundary value
which may take the simple form: partial differential problems is also presented in Appendix
A, and utilized in Example 3.3.
gi ( pd ) ≡ fi ( u ( x, pd ) , [ x ] , pd ) − τ i , (3) A solver is executed as a regular intrinsic array formula
in an allocated range of the spreadsheet. The solver
Let: computes and displays a formatted result as shown in
4 American Journal of Modeling and Optimization

Figure 2. The result table serves as a discrete proxy for the system by a suitable solver IVSOLVE(),
function 𝒖(𝑥, 𝒑𝒅 ) in (2)-(6) providing a map between the BVSOLVE(), or PDSOLVE().
independent variable 𝑥 and the state variables 𝒖 for II. Define constraints on the initial system response
specified values of the design parameters 𝒑𝒅 . using the criterion functions ARRAYVAL() and
ODEVAL().
III. Solve for the set of constraints for the optimal
design parameters using NLSOLVE().
These steps are demonstrated in the following section
with three examples in Excel.

3. Constrained Optimization Examples


3.1. Travelling Train Problem
In this example we compute the required propulsion
force and the travel time for a frictionless train travelling
Figure 2. Solution layout in Excel for differential systems solvers
between two cities through a straight tunnel. The train
IVSOLVE() and BVSOLVE()
uses a constant propulsion force to accelerate, but relies
solely on the gravitational pull of the Earth, as well as
2.2. Criterion Functions aerodynamic drag, for deceleration. Using the assumptions
A criterion function corresponds to 𝑓𝑖 (𝒖(𝑥, 𝒑𝒅 ), [𝑥], 𝒑𝒅 ) shown in Table 3 and referring to Figure 3, we formulate
in (3), and computes a scalar property from the solution the problem as a constrained optimization problem as
array (see Figure 2) of a differential systems solver for the follows.
purpose of constraining the response. A constraint formula Figure 3 shows the forces acting on the train during its
penalizes the difference between the computed scalar trip from City A to City B along the circular path of the
property value and a target value. In essence, the criterion earth. The motion for the train is governed by the second
function provides the dynamical link that connects the order equation:
differential systems solver with the functional minimizer
mt 
x= Fp − Fd ( x ) + Fg (θ ( x)) (8)
and enables the operation of the functional formulation
(2)-(6). The dynamical links are achieved naturally such with the initial conditions 𝑥(0) = 0, 𝑥̇ (0) = 0 at departure
that evaluation of a constraint formula leads to re-evaluation City A.
of the underling differential solver [17] in order to
compute a current value for the scalar property of interest. Table 3. Assumptions and parameters for problem 3.1
The scalar property may be a direct value extracted Train mass 𝑚𝑡 = 100,000 (kg)
from the solution at a specified point, or an indirect Distance travelled 𝑑 = 1000,000 (m)
computed value utilizing a prescribed calculus operation Earth Radius 𝑅 = 6371,000 (m)
or a user defined formula. To accommodate general Gravitational constant 𝑔 = 10 𝑚/𝑠 2
Drag force 𝐹𝑑 (𝑣) = 0.5 ∗ 𝑣 2 (N)
applications, two criterion functions, ARRAYVAL() and 𝐹𝑝 = constant (N)
Propulsion force
ODEVAL(), have been developed and described in Gravitational force 𝐹𝑔 (𝜃) = 𝑚𝑡 ∗ 𝑔 ∗ cos(𝜃) (N)
Appendix B. ARRAYVAL() applies user-defined formulas
to map a selected data set within the solution array (Figure
2) to a scalar value. On the other hand, ODEVAL()
applies a calculus operation, such as differentiation or
interpolation, to compute a value from the solution array.
We remark that the parameter differences between the
abstract criterion functional and the actual implementations
described in Appendix B are rather a technical exploitation of
the spreadsheet and functional programming properties,
which permit us to assign and recover functions from
variables [17].

2.3. Functional Minimizer Figure 3. Schematic for the forces acting on the travelling train of
problem 3.1
A functional minimizer NLSOLVE(), which
corresponds to (6), is described in Appendix C. It receives Using 𝑑/𝑅 ≪ 1, the angle of rotation, 𝜃, (see Figure 3)
the set of formula constraints, and design parameters can be approximated by the following formula:
variables, and computes optimal values for the latter that  −1  R 
minimize the implicit cost functional (5).  tan  d / 2 − x  , x<d /2
The aforementioned spreadsheet functions enable the   
π
θ ( x ) =
three-step optimization formulation (2)-(6) comprising the
= , x d /2 (9)
following practical steps.
2
I. Using initial values of the design parameters, obtain  −1  R 
an initial response to the parameterized differential  tan  +π, x > d / 2
  d / 2− x
American Journal of Modeling and Optimization 5

On arrival at City B, the train comes to a halt, so the the displacement, 𝑥, at the final but unknown time, 𝑡𝑓 , and
final conditions can be stated as: the travelled distance 𝑑 , while constraint C15 demands
that the interpolated value for the velocity, 𝑣, at the final
( )
x tf = d
(10) time, 𝑡𝑓 , vanishes. As described in Appendix B,
x (t f ) = 0 ODEVAL() uses internally a spline curve fit to perform
the interpolation operation. The first argument for
The final conditions (10) can be viewed as constraints ODEVAL(), J2:J38, (selected from Table 5) defines the
on the differential equation (8) for the train’s motion. The desired range for the interpolation operation, and second
problem is thus reduced to finding optimal values for the argument, x, identifies the variable to interpolate 3.
unknown propulsion force 𝐹𝑝 and the travel time 𝑡𝑓 such
that the two constraints (10) are satisfied. We compute the Table 5. Solution computed by (11) for the system definition given in
answer by a simple functional program in Excel Table 4
spreadsheet corresponding to the three-step optimization J K L J K L
process as shown below. 1 t x V 20 2250 535135 146.4526
2 0 0 0 21 2375 552249.8 127.3546
Step 1 3 125 6115.463 96.66716 22 2500 566971.2 108.1826
We model the differential equation (8) in Excel as a 4 250 23618.42 180.3757 23 2625 579292.2 88.95507
parameterized two first order equations in B2:B3 as shown 5 375 50345.74 243.5815 24 2750 589207.6 69.68509
in Table 4. For convenience, we assign names to raw cells
6 500 83614.12 285.3167 25 2875 596712.8 50.38592
addresses, e.g., ‘x’ for B6, ‘v’ for B7, ‘Fd’ for D2, ‘Th’
for D4 and so on. 7 625 120912.9 308.8178 26 3000 601804.6 31.06775
8 750 160244.8 318.6075 27 3125 604479.3 11.73845
Table 4. Parametrized differential system definition in Excel for 9 875 200165.6 318.7776 28 3250 604737.5 -7.59494
problem 3.1
A B C D 10 1000 239672.8 312.4788 29 3375 602579.9 -26.9254

1 Differential system Forces formulas 11 1125 278105.9 301.8894 30 3500 598007 -46.2459
12 1250 315027.7 288.4672 31 3625 591022 -65.5454
2 dx/dt =v Fd =0.5*v^2
=(Fp- 13 1375 350145.5 273.1784 32 3750 581623.1 -84.8236
3 dv/dt Fg =m*g*COS(Th)
Fd+Fg)/m 14 1500 383269.8 256.6382 33 3875 569814.6 -104.068
=IF(x<d/2,ATAN(Re/(d/2-
System variables with 15 1625 414271.2 239.2515 34 4000 555605.2 -123.257
4 Th x)),IF(x>d/2,ATAN(Re/(d/2-
initial conditions
x))+PI(),PI()/2)) 16 1750 443058.6 221.296 35 4125 539003.6 -142.369
5 t 0
17 1875 469577.2 202.9315 36 4250 520018.9 -161.382
6 x 0 Constant parameters 18 2000 493781.3 184.2855 37 4375 498664.1 -180.264
7 v 0 g 10 19 2125 515639.8 165.4439 38 4500 474960.7 -198.957
Design parameters
8 Re 6371000
with initial values
Table 6. Constraints formulas on the initial solution of Table 5. The
9 Fp 1000 d 1000000
constraints correspond to the conditions given in (10)
10 Tf 4500 m 100000 C
14 =ODEVAL(J2:J38, x, "INTERP", Tf) - d
The system is simulated with a guess value 𝐹𝑝 = 1000
for a sufficient time of 4500 seconds by evaluating the 15 =ODEVAL(J2:J38, v, "INTERP", Tf)
IVSOLVE() array formula:
Step 3
= IVSOLVE ( B 2 : B3, ( t , x, v ) , {0, 4500}) (11)
Using the functional minimizer NLSOLVE() (C.1), the
in the range J1:L38 2 . The first argument to (11) is a system of constraints C14:C15 is solved with 𝐹𝑝 and 𝑡𝑓 as
reference to the system formulas (see Table 4), the second variables by evaluating the NLSOLVE() formula:
argument is the system variables, and the third argument
specifies the time interval. IVSOLVE() computes and = NLSOLVE ( C14 : C15, ( Fp, Tf ) ) (12)
displays the solution in the range J1:L38 as shown in
Table 5. in the allocated range A16:B18. NLSOLVE() computes
and displays the values for 𝐹𝑝 and 𝑡𝑓 as shown Table 7.
Step 2
Table 7. Optimal parameters computed by (12) satisfying the
Using the criterion function ODEVAL() (B.2), we constraints of Table 6
define in Table 6 two constraint formulas, which A B
correspond to the final conditions (10). Constraint C14 16 Fp 62648.94
penalizes the difference between the interpolated value for
17 Tf 3863.575
2 18 SSERROR 1E-16
The choice of the range location and its allocated number of rows are
arbitrary. By default, the number of rows determines the uniform interval
for the output solution. This behavior can be changed via the options to
3
the solver [24], such as to use a custom step or non-uniform output In general, the second argument may be an arbitrary formula of system
points. variables and parameters [24].
6 American Journal of Modeling and Optimization

Figure 4 plots a simulation of equation (8) using the Table 8. Parametrized differential systeqm definitions in Excel for
problem 3.2
computed values for 𝐹𝑝 and 𝑡𝑓 in Table 7. The plot shows
A B C D
that the final arrival conditions (10) are satisfied.
1 Differential system Design parameters
2 dx/dt =v zeta 0.25
3 dv/dt =-2*zeta*wn*v-wn^2*x wn 1
System variables with initial
4 x0 1
conditions
5 t 0 x_peak -0.2
6 x =x0 t_peak 2.0
7 v 0 e_min 0.1

Table 9. Solution computed by (14) for the system definition given in


Table 8
I J K I J K
1 t x v 22 5 -0.03655 0.293447
2 0 1 0 23 5.25 0.032784 0.259071
Figure 4. Simulation of train motion using optimal parameters of Table 7
3 0.25 0.970168 -0.23257 24 5.5 0.092059 0.213592
nd
3.2. Customizing a 2 Order Dynamical 4 0.5 0.887138 -0.42422 25 5.75 0.138985 0.160974
System 5 0.75 0.762013 -0.56855 26 6 0.172275 0.10513
nd 6 1 0.607055 -0.66269 27 6.25 0.19159 0.049698
In this example, we design the response of the 2 order
dynamical system: 7 1.25 0.434825 -0.70704 28 6.5 0.197429 -0.00212
2 8 1.5 0.25741 -0.70486 29 6.75 0.191048 -0.04772
d x dx
+ 2ζ wn + wn2 x =
0 (13) 9 1.75 0.085824 -0.66173 30 7 0.17425 -0.08518
2 dt
dt
10 2 -0.07064 -0.585 31 7.25 0.149241 -0.11326
in order to control its overshoot, peak time, and energy
11 2.25 -0.20459 -0.48309 32 7.5 0.118448 -0.13142
using the damping coefficient, 𝜁 , the natural frequency,
𝑤𝑛 , and initial condition, 𝑥(0), as design parameters. 12 2.5 -0.31084 -0.36492 33 7.75 0.084347 -0.13977
Table 8 shows the system model in Excel with equation 13 2.75 -0.38643 -0.23931 34 8 0.049333 -0.13896
(13) represented as two first order parametrized equations
14 3 -0.43055 -0.11448 35 8.25 0.015541 -0.13013
in B2:B3 using named variables t, x, v, zeta, and wn,
which are assigned the initial values 0.25 and 1 15 3.25 -0.44434 0.002384 36 8.5 -0.01519 -0.11473
respectively. Note that the design parameters x0, x_peak, 16 3.5 -0.43053 0.105374 37 8.75 -0.04141 -0.09443
t_peak, and e_min will be used in the coming exercises. 17 3.75 -0.39318 0.190104 38 9 -0.06214 -0.071
Starting from the initial conditions 𝑥(0) = 1, 𝑥̇ (0) = 0,
18 4 -0.33723 0.253773 39 9.25 -0.0768 -0.04618
we simulate the system in the interval [0 10] using
IVSOLVE() formula: 19 4.25 -0.26816 0.295115 40 9.5 -0.08525 -0.02157

= IVSOLVE ( B 2 : B3, ( t , x, v ) ,{0,10})


20 4.5 -0.19152 0.314355 41 9.75 -0.08772 0.001409
(14)
21 4.75 -0.11269 0.312972 42 10 -0.08478 0.021604
in the allocated range I1:K41. IVSOLVE() computes the
solution shown in Table 9, which is plotted in Figure 5. 3.2.1. Exercise 1
The plot shows that the system response for the initial In the first exercise, we redesign the response such that
parameters is underdamped with an absolute overshoot the system has an absolute overshoot of 0.2 at a peak time
greater than 0.4 at approximately a peak time of 3.3. of 2.0. We define two constraints shown in Table 10 on
the response of Table 9. Constraint C1 penalizes the
difference between the minimum value of the
displacement and the target overshoot, x_peak, while
constraint C2 demands that the velocity vanishes at the
peak time 4.

Table 10. Constraints formulas for problem 3.2.1


C
1 =ARRAYVAL(J2:J41, “MIN”) – x_peak
2 =ARRAYVAL(K10)

4
Figure 5. Plot of system response computed in Table 9 using the C2 makes use of the readily available velocity in Table 9, however, we
could impose an equivalent constraint on the displacement derivative
parameters values given in Table 8
directly using ODEVAL() (B.2) as follows
‘=ODEVAL(I1:I41,x,”DERIV”,2.0)’.
American Journal of Modeling and Optimization 7

The system of constraints C1:C2 is solved with 𝑤𝑛 and 3.2.2. Exercise 2


𝜁 as variables by evaluating the functional minimizer In this exercise we constrain the absolute overshoot,
NLSOLVE() formula: and the minimal available energy at the unknown peak
= NLSOLVE ( ( C1, C 2 ) , ( zeta, wn ) time, 𝑡𝑝 , then compute the damping coefficient, 𝜁 , the
) (15)
natural frequency, 𝑤𝑛 , and the attained peak time, 𝑡𝑝 . At
in allocated range D1:E3. NLSOLVE() computes the the overshoot, the velocity is zero and the total energy is
results shown Table 11. Figure 6 shows the modified defined by:
system response using the values for 𝑤𝑛 and 𝜁 of Table 11.
e = wn * x 2 (17)
Table 11. Optimal parameters computed by (15) satisfying
constraints of Table 10 The constraints are stated as follows:

1 zeta
D E
0.451081913
( )
x t p − x _ peak =
0

2 wn 1.659599536 ( )
v tp = 0 (18)
3 SSERROR 2.20497E-26
( )
e t p − e _ min ≥ 0

where𝑥_𝑝𝑒𝑎𝑘 and 𝑒_𝑚𝑖𝑛 values are specified in Table 8.


Table 13 shows the equivalent Excel constraints defined
on the initial solution of Table 9 by aid of the criterion
function ODEVAL() which uses interpolation to compute
the values at the variable t_peak.

Table 13. Constraints formulas for problem 3.2- Exercise 2


C
4 =ODEVAL(I2:I41, x, ”INTERP”, t_peak) – x_peak
5 =ODEVAL(I2:I41, v, ”INTERP”, t_peak)
6 =wn*ODEVAL(I2:I41, x, ”INTERP”, t_peak)^2 – e_min

The system of constraints C4:C6 is solved by


Figure 6. Modified system response using optimal parameters of Table 11 NLSOLVE() formula:
For illustration, we solve the same system of constraints = NLSOLVE ( ( C 4, C 6 ) , ( zeta, wn, t _ peak ) , 1) (19)
in Table 10, but with initial displacement, x0, and 𝑤𝑛 as
design variables. Here we simply need to replace zeta with in the allocated range F1:G3 shown in Table 14. Note that
x0, and evaluate the new NLSOLVE() formula: we pass one in the third argument to indicate the last
constraint is an inequality constraint. Figure 8 shows the
= NLSOLVE ( ( C1, C 2 ) , ( x0, wn ) ) (16) modified system response using the computed values for 𝜁
and 𝑤𝑛 which shows the peak time occurs near 1.4.
The results are shown in Table 12 and plotted in Figure
7. As expected, the solution satisfies the constraints, but Table 14. Optimal parameters computed by (19) satisfying the
retains the underdamped behavior of the system. constraints of Table 13
F G
Table 12. Optimal parameters computed by (16) satisfying 1 zeta 0.455927572
constraints of Table 10
2 wn 2.5
D E
3 t_peak 1.412086279
1 x0 0.450161581 4 SSERROR 1.08134E-11
2 wn 1.622267731
3 SSERROR 1.08134E-11

Figure 8. Modified system response using parameters of Table 14

3.3. Heat Transfer Problem


Figure 7. Modified system response using parameters of Table 12 In this example, we demonstrate how to setup a simple
functional program to control a heat transfer problem. We
8 American Journal of Modeling and Optimization

consider a slab that is initially at zero temperature with an PDSOLVE() populates the range with the requested
insulated right side. At time = 0, the left side is brought to transient format solution shown in Table 16 and plotted in
100 degrees. We are interested in controlling the right side Figure 9A. Alternatively, in the default snapshot format
temperature reached after one second. The problem is for the output array, the order of time and space are
described by the parabolic heat equation: exchanged in the table. The latter format simplifies
plotting the temperature spatial profile at different times as
∂u ∂ 2u
=k (20) shown in Figure 9B.
∂t ∂x 2
with initial condition 𝑢(𝑥, 0) = 0 , left boundary
condition 𝑢(0, 𝑡) = 100, and right boundary condition
𝜕𝑢(𝑥, 𝑡)/𝜕 𝑥 = 0 at 𝑥 = 1. The problem’s spatial domain
is 𝑥 ∈ [0 1] and the time interval is 𝑡 ∈ [0 1]. Table 15
shows the model definition in Excel for the solver
PDSOLVE() (A.7). Here we use the cells T1, X1, U1, U2,
and U3 to represent system variables 𝑡, 𝑥, 𝑢, 𝑢𝑥 , 𝑢𝑥𝑥
respectively. We also assign the names u, ux, and uxx for
U1, U2 and U3. The system RHS formula is defined in A1,
the left boundary condition in B1, and the right boundary
condition in C1, the conductivity 𝑘 in K1 and the initial
condition for 𝑢 in U1.

Table 15. PDE System definition in Excel for problem 3.3 Figure 9A.Transient plot of the system response computed in Table 16 at
A B C K U different spatial points
1 =k*uxx =u-100 =ux 1 =IF(X1=0,100,0)

To solve the system, we use the spreadsheet solver,


PDSOLVE() (A.7) by evaluating the array formula:
 A1, (T 1, X 1, U 1: U 3) , B1, C1, {0, 0.5,1} , 
= PDSOLVE   (21)
 {0, 
 1} ,, {"FORMAT ", "TCOL1"} 
in allocated range A5:D21, passing in the system formula,
variables and boundary conditions defined in Table 15.
The 5th argument {0, 0.5, 1} instructs the solver to report
spatial output points at 0, 0.5, and 1 only, whereas
temporal output points for the specified interval {0, 1} in
the 6th argument will be reported uniformly according to
the available rows in the allocated range. We also request
Figure 9B. Snapshot plot shows the temperature spatial profile at
in the optional 8th argument a transient format for the different times
output [24].
Table 16 shows that the right side reaches a temperature
Table 16. Solution computed by (21) for the system definition given of approximately 89.2 after one second (value of cell H23
in Table 15 at T1=1, X1=1). In this example, we will demand that the
E F G H right side reaches a target temperature of 75 degrees after
1 X1 0 0.5 1 one second, and then compute the required left boundary
2 T1 u u u
condition that will produce the target temperature. To vary
3 0 100 0 0
4 0.05 100 11.38488 0.313100897 the left boundary condition value, we introduce a design
5 0.1 100 26.43517 5.069308645 variable P1 with an initial value of 100, and parametrize
6 0.15 100 36.7479 13.57766027 the initial condition and left boundary condition formulas,
7 0.2 100 44.68197 22.76939125 as shown in Table 17.
8 0.25 100 51.29839 31.45587281
9 0.3 100 57.01478 39.32101487 Table 17. Parametrized PDE system definition in Excel for problem
10 0.35 100 62.0256 46.33272712 3.3
11 0.4 100 66.43943 52.55248913 A B C K P U
12 0.45 100 70.33672 58.05646724
1 =k*uxx =u-P1 =ux 1 1000 =IF(X1=0,P1,0)
13 0.5 100 73.78095 62.92253049
14 0.55 100 76.82433 67.22546077
Based on the initial response of Table 16, we define the
15 0.6 100 79.51285 71.03140753
16 0.65 100 81.88989 74.39453117
simple constraint C2 in Table 18, which penalizes the
17 0.7 100 83.99159 77.36648292 difference between the actual temperature at the right side
18 0.75 100 85.85031 79.99204101 (cell H23 of Table 16) and the target value of 75. Note
19 0.8 100 87.49342 82.3128696 that although we are extracting one element from the
20 0.85 100 88.94526 84.36516013 solution array, we must do that by means of the criterion
21 0.9 100 90.22807 86.18001317 function ARRAYVAL() according to the functional
22 0.95 100 91.36183 87.78445318 formulation (2)-(6). Next, we run NLSOLVE() formula:
23 1 100 92.36414 89.20245472
American Journal of Modeling and Optimization 9

= NLSOLVE ( C 2, P1) (22) Excel supports two types of formulas: simple formulas
and array formulas. A simple formula is assigned to one
with P1 as the variable. NLSOLVE() computes an optimal cell and evaluates to a single value, e.g., ’=SUM(A1:B4)’.
value of 84.0786 for P1, as shown in Table 18. Although Alternatively, an array formula is assigned to a range of
not shown, re-simulating the system (20) with the cells and evaluates to an array of values, e.g.,
computed value for P1 shows that the constraint C2 is ‘=MINVERSE(A1:C3)’ which computes the inverse of
satisfied. the 3 by 3 matrix A1:C3.

Table 18. Constraint and solver formulas for problem 3.3. The A.2 Differential Systems Solvers
optimal value computed by the solver is shown to the right
C C A.2.1 Initial Value Spreadsheet Solver: IVSOLVE()
2 =ARRAYVAL(H23) - 75
= IVSOLVE ( rhs, vars , interval , m, [ options ] ) (A.1)
3 =NLSOLVE(C2,P1)  84.07859699
The spreadsheet solver IVSOLVE (A.1) computes the
solution to an initial value ordinary differential-algebraic
4. Conclusion system represented in the ordered form:
dui
i ( t , u, y ) , i 1,..., n
The spreadsheet computing engine is exploited via a = f=
nonconventional approach to develop a novel set of dt (A.2)
=0 g=j ( t , u, y ) , j 1,..., m
solvers which support a functional paradigm for
dynamical optimization. Design of the solvers was made
possible by overcoming inherent limitations that restricted with initial conditions 𝑢𝑖 (0) = 𝑎𝑖 , 𝑦𝑗 (0) = 𝑏𝑗 , and over
spreadsheet functions to operating on static inputs only, the Interval 𝑡 ∈ [0 𝑇].
while retaining essential properties of purity and recursion. References to the system RHS formulas
The solvers are assembled in an add-in software library (𝑓1 , 𝑓2 , . . , 𝑓𝑛 , 𝑔1 , 𝑔2 , . . 𝑔𝑚 ) are supplied in the first
[24], which integrates seamlessly with MS Excel. Three parameter rhs and the system variables
examples were presented to demonstrate the merits of the (𝑡, 𝑢1 , 𝑢2 , . . , 𝑢𝑛 , 𝑦1 , 𝑦2 , . . 𝑦𝑚 ) are seeded with initial values
solvers, which expand the spreadsheet utility into a new and supplied via the 2nd parameter vars. The integration
direction. Future effort will consider extending the interval is defined in the third parameter, interval, and the
capability of this framework to solve general optimal number of algebraic constraints, if nonzero, is supplied in
control problems. 4th parameter m. IVSOLVE() implements several
Although we do not provide benchmark performance integration schemes [25,26], suitable for stiff and smooth
data in this paper, we comment that all the preceding problems. Algorithm control parameters and an optional
examples compute on the order of a second or less, on a system analytic Jacobian can be supplied via the
typical computer with an Intel core i5 processor. The [options][24].
performance is directly linked to the true performance of IVSOLVE() is executed as an array formula in a pre-
the spreadsheet engine due to direct interface to the allocated range of cells. It evaluates to an ordered tabular
spreadsheet engine API [17]. array of values for the system variables with the layout
shown in Figure 2. By default IVSOLVE() reports the
output at uniform intervals according to the allocated
Appendix A number of rows for the output array. Custom output
formats can be achieved via the optional parameters [24].
A.1 Basic Spreadsheet Concepts
A.2.2 Boundary Value Spreadsheet Solver:
A spreadsheet is composed of a large structured grid.
BVSOLVE()
Each cell in the grid is referenced by its column label and
row number (e.g., A1), and represents a global memory  rhs, vars, bpts, bcs, 
= BVSOLVE   (A.3)
 interval , m, [ options ] 
placeholder. A range of cells can be referenced as a
rectangular array, e.g., A1:B3 or a union of disjoint arrays
and cells, e.g., (X1, A1:A3). A cell may store a constant The spreadsheet function BVSOLVE() (A.3) computes
value or a formula defined using basic spreadsheet syntax, the solution to a multi-point boundary-value first order
e.g., ‘= SQRT(X1^2 + Y1*Y1)’. The spreadsheet engine differential-algebraic systems represented in the order
insures orderly evaluation of all dependent formulas upon defined in (A.2), with boundary conditions expressed in
a change in the value of any cell. A general function can the form 0 = 𝑏𝑐𝑖 (𝒖, 𝑥) at 𝑥 = 𝑝𝑖 for 𝑖 = 1, … , 𝑛 in the
thus be identified by a root formula and a list of variable domain 𝑥 ∈ [0 𝐿].
cells. Nested dependency allows arbitrarily complex BVSOLVE() shares similar parameters with
functions to be constructed. To motivate the possibilities, IVSOLVE(), except for the boundary points and
consider the formula ‘=SUM(X1:Z1)’ assigned to A1, the associated conditions formulas, which are supplied via
pair (A1, Y1) identifies the function 𝑓(𝑦) = 𝑋1 + 𝑦 + 𝑍, bpts and bcs, respectively. BVSOLVE() implements the
where X1 and Z1 are treated as constant values. In another COLDAE collocation algorithm [27,28], and evaluates to
example, consider the formula ‘=1+COS(B1)’ assigned to the same results layout shown in Figure 2. Optional
A1, and the formula ‘=SQRT(ABS(X1))’ assigned to B1, analytical system and boundary conditions Jacobians as
the pair (A1,X1) identifies the function 𝑓(𝑥) = 1 + well as algorithm control parameters can be supplied via
cos(�|𝑥|). [𝑜𝑝𝑡𝑖𝑜𝑛𝑠] [24].
10 American Journal of Modeling and Optimization

To demonstrate BVSOLVE(), we solve the 4th order Table 20. partial listing of results computed by (A.6) for the system
equation: definition given in Table 19
H I J K L
1 − 6 x 2 z ''' − 6 xz ''
=z '''' , 1≤ x ≤ 2 4 X1 W1 V1 U1 Z1
x3 5 1 -0.5 1.552E-30 0.017132 0
z (1) = 0, z '' (1) = 0, (A.4) 6 1.05 -0.3301 -0.020516 0.016584 0.0008472

z ( 2 ) = 0, z ( 2 ) = 0
'' -- -- -- -- -- --
24 1.95 0.065617 -0.003203 -0.01121 0.0005634
which models a uniformly loaded beam of variable
stiffness simply supported at both ends [29]: 25 2 0.0625 1.735E-18 -0.01129 -1.084E-19
Using standard substitution, we convert (A.4) into a
system of 1st order equations. Letting 𝑢 = 𝑧′, 𝑣 = 𝑢′ = A.2.3 Initial Boundary Value Problem Spreadsheet
𝑧 ′′ , 𝑤 = 𝑣 ′ = 𝑧′′′, we have: Solver: PDSOLVE()

dw 1 − 6 x 2 w − 6 xv = PDSOLVE ( rhs, vars, lbc, rbc, L, T , [ options ])) (A.7)


=
dx x3 The spreadsheet function PDSOLVE() (A.7) computes
dv the solution to an initial boundary-value differential
=w
dx (A.5) system represented in the ordered form:
du
=v ∂ui
dx = i ( t , x, u, u x , u xx ) , i 1,..., n
f= (A.8)
∂t
dz
=u with initial conditions expressed in the form 0 = 𝑢𝑖 (𝑥, 0),
dx
and left and right boundary conditions expressed in the
with equivalent boundary conditions: 𝑧(1) = 0, 𝑣(1) = form 0 = 𝑏𝑐𝑖 (𝒖, 𝒖𝒙 ) at 𝑥 = 0 and 𝐿, in the time interval:
0, 𝑧(2) = 0, 𝑣(2) = 0 . The complete system model in 𝑡 ∈ �0 𝑇� and spatial domain: 𝑥 ∈ �0 𝐿�.
Excel is shown in Table 19. Next we evaluate the array References to the system RHS formulas are supplied in
formula: the 1st parameter rhs, and the system variables
 A2 : A5, ( X 1, W 1, V 1, U 1, Z1) ,  (𝑡, 𝑥, 𝒖, 𝒖𝒙 , 𝒖𝒙𝒙 ) supplied via the 2nd parameter vars, with
= BVSOLVE   (A.6) 𝒖 seeded with initial value formulas. Left and right
 C 2 : C 5, D 2 : D5, {1, 2}
  boundary condition formulas are specified via lbc and rbc.
Spatial and temporal domains are defined via the 5th and
in the allocated range H4:L25, and obtain the solution 6th parameters L and T. Optional System Jacobians and
shown partially in Table 20 and plotted in Figure 10. algorithm controls can be supplied via [𝑜𝑝𝑡𝑖𝑜𝑛𝑠] [24].
PDSOLVE() implements the method of lines [30].
Table 19. Differential system (A.5) definition in Excel for input to
BVSOLVE() Spatial discretization is carried out on a uniform mesh
using a standard collocation method [27]. The resulting
A C D
implicit ODE system is integrated by any of the schemes
Boundary Boundary RADAU5, BDF, or ADAMS with adaptive step control
1 System RHS formulas
points conditions
=(1-6*X1^2*W1- [25,26]. The output result can be presented in one of two
2 1 =Z1 formats: a snapshot of the system variables’ spatial
6*X1*V1)/X1^3
3 =W1 1 =V1 distribution at desired temporal values, or a transient view
of the system variables at specified spatial points. The
4 =V1 2 =Z1 snapshot format is demonstrated in Figure 11 for a system
5 =U1 2 =V1 with two equations, where the system variables are
reported in repeated column blocks for each pair of the
output time and space values. The transient view layout is
identical except that the roles of time and space are
interchanged.

Figure 11.Snapshot solution layout in Excel for partial differential


Figure 10. Plot for results of Table 20 for boundary value problem (A.4) equation solver PDSOLVE(). The display of 1st and 2nd derivative
variables is optional
American Journal of Modeling and Optimization 11

Appendix B of a criterion function, evaluation of the constraints


automatically triggers re-evaluation of underling system to
compute a current value for the constraint [17].
B.1. Criterion Spreadsheet Function:
ARRAYVAL()
= ARRAYVAL ( DATA, GlobalOper , [ LocalOper ]) (B.1)
References
[1] Larsen, R. W., “Engineering with Excel,” Pearson PrenticeHall
The spreadsheet function ARRAYVAL() (B.1) 2009, New Jersey.
computes a scalar property for a set of data, DATA, [2] Bourq, David M., “Excel scientific and engineering cookbook,”
selected from a system solution array, by applying user O’Reilly, 2006.
supplied formulas specifying local and global operations [3] Laughbaum, Edward D., Seidel, Ken, “Business math Excel
on DATA. The optional local operation transforms applications,” Prentice Hall ; 2008.
[4] E. J. Billo, Excel for Scientists and Engineers, WILEY-
elements of DATA (e.g., an absolute value operation), and INTERSCIENCE, 2007.
the global operation maps the entire data set to a scalar [5] Ali El-Hajj, Sami Karaki, Mohammed Al-HusseiniKarim Y.
(e.g., a maximum value operation). Common global Kabalan, “Spreadsheet Solution of Systems of Nonlinear
operations such as computing maximum or minimum can Differential Equations”, Spreadsheets in Education, Vol 1, Issue 3.
be defined directly as “MAX” or “MIN”. [6] M. B. Cutlip and M. Shacham, Problem Solving in Chemical and
Biochemical Engineering with POLYMATH, Excel and
MATLAB,Prentice Hall, 2008.
B.2. Criterion Spreadsheet Function: [7] Chung-Yau Lam and F. H. Alan Koh, “A Partial Differential
ODEVAL() Equation Solver for the Classroom,” Int. J. Engng Ed.Vol. 22, No.
4, pp. 868-875, 2006.
 range, operand ,  [8] Hagler, Marion, “Spreadsheet Solution of Partial Differential
= ODEVAL   (B.2) Equations,” IEEE Transactions on Education, Volume:E-30
 operation, [ parameters ]  Issue:3.
[9] Olsthoorn TN (1998) Groundwater modelling: calibration and the
The spreadsheet function ODEVAL() (B.2) computes a use of spreadsheets. Delft University Press, Delft, ISBN 90-407-
scalar property from an ODE system solution array by 1702-8, CIP, about 300 pp.
[10] Karahan H. (2007). Unconditional stable explicit finite difference
applying a calculus integration, differentiation, or technique for the advection-diffusion equation using spreadsheets.
interpolation operation. The operand for the calculus Adv.EngSoftw 38(2):80-86.
operation is a system variable or a formula of system [11] Palisade Corporation, “Evolver. The Genetic Algorithm Super
variables. The operation, which is specified using any of Solver for Microsoft Excel.”, Palisade Corporation (2001).
https://www.palisade.com/evolver/.
the labels: “INTEG”, “DERIV” or “INTERP”, is applied
[12] Cliff Ragsdale, “Spreadsheet Modeling & Decision Analysis: A
over a selected range for the system’s independent Practical Introduction to Management Science, 6th Edition”.
variable. ODEVAL() perform the requested operation by College Bookstore, 2011.
the aid of a cubic spline curve fit to the data [31]. [13] S. Dalton, Financial Applications using Excel Add-in
Additional required data, such as a differentiation or Development in C/C++ , The Wiley Finance Series, 2007.
interpolation point, are defined in [parameters] [24]. [14] Excel Commands, Functions, and States, MSDN publication,
https://msdn.microsoft.com/en-
us/library/bb687832(v=office.15).aspx.
[15] Description of limitations of custom functions in Excel.
Appendix C https://support.microsoft.com/en-us/kb/170787.
[16] The MathworksInc, MATLAB Builder EX,
http://www.mathworks.com/products/matlabxl/.
C.1. Functional Minimizer Spreadsheet [17] C. Ghaddar, “Method, Apparatus, and Computer Program Product
Solver: NLSOLVE() for Optimizing Parameterized Models Using Functional Paradigm
of Spreadsheet Software,” USA Patent No. 9286286.
= NLSOLVE ( lhs, vars, [ineq ] , [ options ]) (C.1) [18] C. Ghaddar, Unconventional Calculus Spreadsheet Functions,
ICMS 2016: 18th International Conference on Mathematics and
The spreadsheet function NLSOLVE() (C.1) computes Statistics. Boston.
a least square minimum error solution toan algebraic [19] R. Piessens, E. de Doncker-Kapenga, C.W. Ueberhuber, and D.K.
Kahaner, QUADPACK A subroutine package for automatic
system of 𝑘 equations and 𝑚 − 𝑘 inequalities, with integration, Springer Verlag, 1983.
variables 𝒙 = [𝑥1 , 𝑥2 , . . , 𝑥𝑛 ], ordered in the form: [20] Wikipedia. Functional Programming.
https://en.wikipedia.org/wiki/Functional_programming
( x ) 0,=i 1,..., k
f i=
(C.2)
[21] K. Levenberg, A Method for the Solution of Certain Non-Linear
fi ( x ) ≥ 0, i =
k + 1,.., m Problems in Least Squares, Quarterly of Applied Mathematics
vol2, 164-168, 1944.
[22] D. Marquardt , An Algorithm for Least-Squares Estimation of
References to the system LHS formulas [𝒇𝒊 ] are Nonlinear Parameters,SIAM Journal on Applied Mathematics
supplied via lhs, and the system variables via vars. The vol11 (2), 431-441, 1963.
number of inequality constraints, is defined in [ineq]. [23] V. Arnăutu and P. Neittaanmäki, “Optimal Control from Theory to
System analytic Jacobian and algorithmic parameters may Computer Programs” Springer. 2003.
be supplied via the [options] [24]. [24] C. Ghaddar, ExceLab Reference Manual,
www.excel-works.com
NLSOLVE() employs the Levenberg-Marquardt [25] E Hairer and G Wanner, Solving Ordinary Differential Equations
algorithm [21,22] to find optimal values for the system II: Stiff and Differential-Algebraic Problems, Springer Series in
variables 𝒙 by minimizing an implicit objective function Computational Mathematics, 1996.
representing the sum of squares of the equations and [26] Alan C. Hindmarsh, ODEPACK, A Systematized Collection of
ODE Solvers, in Scientific Computing, R. S. Stepleman et al.
active inequalities. When an equation or inequality of (Eds.), North-Holland, Amsterdam, 1983, pp. 55-64.
system (C.2) is a dynamical constraint defined by means
12 American Journal of Modeling and Optimization

[27] U. M. Ascher, R. M. Mattheij and R. D. Russell, Numerical [30] Schiesser W.E (1991).The Numerical Method of Lines, San Diego,
Solution of Boundary Value Problems for Ordinary Differential CA: Academic Press, 1991.
Equations, SIAM, 1995. [31] Gao, Zhang and Cao in the article: “Differentiation and numerical
[28] U. Ascher and R. Spiteri, Collocation software for boundary value Integral of the Cubic Spline Interpolation”, in the Journal of
differential-algebraic equations, SIAM Journal on Scientific Computers, Vol. 6, No 10, 2011.
Computing. 1994, 15,938-952.
[29] GAWAIN, T.H., AND BALL, R.E. Improved finite difference
formulas for boundary value problems. Int. J. Numer. Meth. Eng.
12 (1978), 1151-1160.

You might also like