Main.Equations History

Hide minor edits - Show changes to markup

December 04, 2008, at 08:02 AM by 158.35.225.227 -
Deleted lines 21-23:
-Unary minus-(x-y) = 0
-Unary minus-(x-y) = 0
-Unary minus-(x-y) = 0
October 30, 2008, at 09:46 AM by 158.35.225.230 -
Added line 69:
Added line 71:
October 30, 2008, at 09:17 AM by 158.35.225.230 -
Changed lines 70-72 from:
     (y+2/x)^(x*z) * (log(tanh(sqrt(y-x+x^2))+3))^2 = 2+sinh(y)+acos(x+y)+asin(x/y)
to:
     (y+2/x)^(x*z) * &
     (log(tanh(sqrt(y-x+x^2))+3))^2 &
     = 2+sinh(y)+acos(x+y)+asin(x/y)
October 30, 2008, at 09:16 AM by 158.35.225.230 -
Changed line 11 from:

There are currently 26 operands for parameters or variables. They are listed below with a short description of each and a simple example involving variable x and y. For equations may be in the form of equalities (=) or inequalities (>,<). For inequalities, the equation may be bounded between lower and upper limits that are also functions of variables.

to:

The available operands are listed below with a short description of each and a simple example involving variable x and y. For equations may be in the form of equalities (=) or inequalities (>,<). For inequalities, the equation may be bounded between lower and upper limits that are also functions of variables.

October 30, 2008, at 09:14 AM by 158.35.225.230 -
Changed line 15 from:
!,#,%Comment! equation #1 (:html:)<br>(:htmlend:) 0 = x[1] + x[2] ! comment
to:
!,#,%Comment% equation #1 (:html:)<br>(:htmlend:) 0 = x[1] + x[2] ! eqn1
October 30, 2008, at 09:13 AM by 158.35.225.230 -
Changed line 15 from:
!,#,%Comment! equation #1 (:html:)<br>(:htmlend:) 0 = x[1] + x[2] ! comment
to:
!,#,%Comment! equation #1 (:html:)<br>(:htmlend:) 0 = x[1] + x[2] ! comment
October 30, 2008, at 09:12 AM by 158.35.225.230 -
Changed line 15 from:
!,#,%Comment! comment
to:
!,#,%Comment! equation #1 (:html:)<br>(:htmlend:) 0 = x[1] + x[2] ! comment
October 30, 2008, at 09:11 AM by 158.35.225.230 -
Deleted line 15:
=Equalityx=y
October 30, 2008, at 09:10 AM by 158.35.225.230 -
Changed line 13 from:
to:
Changed lines 15-17 from:
=Line Continuation0 = x[1] & (:html:)<br>(:htmlend:) + x[2]
to:
!,#,%Comment! comment
=Equalityx=y
&Line Continuation0 = x[1] & (:html:)<br>(:htmlend:) + x[2]
October 30, 2008, at 09:09 AM by 158.35.225.230 -
Changed line 15 from:
=Line Continuation0 = x[1] & \n + x[2]
to:
=Line Continuation0 = x[1] & (:html:)<br>(:htmlend:) + x[2]
October 30, 2008, at 09:08 AM by 158.35.225.230 -
Changed line 13 from:
to:
Added line 15:
=Line Continuation0 = x[1] & \n + x[2]
October 28, 2008, at 03:16 PM by 158.35.225.230 -
Added lines 43-44:
erf()Error functionerf(x*y)=0
erfc()Complementary error functionerfc(x*y)=0
September 25, 2008, at 01:34 PM by 158.35.225.230 -
Changed lines 11-12 from:

There are currently 21 operands for parameters or variables. They are listed below with a short description of each and a simple example involving variable x and y.

to:

There are currently 26 operands for parameters or variables. They are listed below with a short description of each and a simple example involving variable x and y. For equations may be in the form of equalities (=) or inequalities (>,<). For inequalities, the equation may be bounded between lower and upper limits that are also functions of variables.

Added lines 15-19:
=Equalityx=y
<Less thanx<y
<=Less than or equalx<=y
>Greater thanx>y
>=Greater than or equalx>=y
Added lines 21-23:
-Unary minus-(x-y) = 0
-Unary minus-(x-y) = 0
-Unary minus-(x-y) = 0
Changed lines 47-48 from:

A couple differential and algebraic equations are shown below. The steady-state solution is p=2, x=-1.0445, y=0.1238, and z=-1.0445. For steady-state solutions the differential variables ($x) are set to zero. Variables x, y, and z were not given initial values. In the absence of an initial condition, variables are set to a default value of 1.0.

to:

A couple differential and algebraic equations are shown below. For steady-state solutions the differential variables ($x) are set to zero. Variables x, y, and z were not given initial values. In the absence of an initial condition, variables are set to a default value of 1.0.

Changed line 51 from:
 ! Example model that demonstrates a few equations
to:
 ! Example with three equality equations
Added lines 69-92:
  The steady-state solution is:
   p=2
   x=-1.0445
   y=0.1238
   z=-1.0445.  

(:cellnr:)

 ! Example with an inequality
 Model example
   Variables
     x
     y
     z
   End Variables

   Equations
     x = 0.5 * y
     0 = z + 2*x
     x < y < z
   End Equations
 End Model
September 25, 2008, at 12:21 PM by 158.35.225.230 -
Changed lines 41-62 from:

(:table class='markup horiz' align='left':) (:cellnr class='markup1':)

! Example model that demonstrates a few equations
Model example
  Parameters
    p = 2
  End Parameters

  Variables
    x
    y
    z
  End Variables

  Equations
    exp(x*p)=y
    z = p*$x + x
    (y+2/x)^(x*z) * (log(tanh(sqrt(y-x+x^2))+3))^2 = 2+sinh(y)+acos(x+y)+asin(x/y)
  End Equations
End Model
to:

(:table border=1 width=50% align=left bgcolor=#EEEEEE cellspacing=0:) (:cellnr:)

 ! Example model that demonstrates a few equations
 Model example
   Parameters
     p = 2
   End Parameters

   Variables
     x
     y
     z
   End Variables

   Equations
     exp(x*p)=y
     z = p*$x + x
     (y+2/x)^(x*z) * (log(tanh(sqrt(y-x+x^2))+3))^2 = 2+sinh(y)+acos(x+y)+asin(x/y)
   End Equations
 End Model
September 25, 2008, at 10:08 AM by 158.35.225.230 -
Changed lines 9-10 from:

Equation operands

to:

Operations

Changed line 37 from:

Equation Example

to:

Example

September 25, 2008, at 09:52 AM by 158.35.225.230 -
Changed line 13 from:
to:
September 25, 2008, at 09:52 AM by 158.35.225.230 -
Changed line 13 from:
to:
September 25, 2008, at 09:51 AM by 158.35.225.230 -
Changed line 13 from:
to:
September 25, 2008, at 09:47 AM by 158.35.225.230 -
Changed line 14 from:
OperandDescriptionExample
to:
OperandDescriptionExample
September 25, 2008, at 09:42 AM by 158.35.225.230 -
Changed line 39 from:

A couple differential and algebraic equations are shown below. The steady-state solution is p=2, x=-1.0445, y=0.1238, and z=-1.0445. For steady-state solutions the differential variables ($x) are set to zero.

to:

A couple differential and algebraic equations are shown below. The steady-state solution is p=2, x=-1.0445, y=0.1238, and z=-1.0445. For steady-state solutions the differential variables ($x) are set to zero. Variables x, y, and z were not given initial values. In the absence of an initial condition, variables are set to a default value of 1.0.

September 25, 2008, at 09:40 AM by 158.35.225.230 -
Added lines 39-40:

A couple differential and algebraic equations are shown below. The steady-state solution is p=2, x=-1.0445, y=0.1238, and z=-1.0445. For steady-state solutions the differential variables ($x) are set to zero.

Deleted lines 44-48:

Steady state solution

p = 2

x = -1.0445

y = 0.12380

z = -1.0445

September 25, 2008, at 09:37 AM by 158.35.225.230 -
Changed line 47 from:

z = -1.0445E+00

to:

z = -1.0445

September 25, 2008, at 09:37 AM by 158.35.225.230 -
Changed lines 42-47 from:

[@! Example model that demonstrates equation declarations

to:

[@! Example model that demonstrates a few equations

Steady state solution

p = 2

x = -1.0445

y = 0.12380

z = -1.0445E+00

September 25, 2008, at 09:32 AM by 158.35.225.230 -
Changed lines 7-8 from:

Open-equation format is allowed for differential and algebraic equations. Open-equation means that the equation can be expressed in the least restrictive form. Other software packages require differential equations to be posed in the semi-explicit form: dx/dt = f(x). This is not required with APMonitor modelling language.

to:

Open-equation format is allowed for differential and algebraic equations. Open-equation means that the equation can be expressed in the least restrictive form. Other software packages require differential equations to be posed in the semi-explicit form: dx/dt = f(x). This is not required with APMonitor modelling language. All equations are automatically transformed into residual form.

Changed lines 35-38 from:
$Differential$x = -x + y
to:
$Differential$x = -x + y

Equation Example

Changed line 45 from:
    p = 1
to:
    p = 2
Changed lines 54-104 from:
 Equations
  ! The program tranforms all equations from the 'original form' to
  !   the 'residual form'.  Sparse first derivatives
  !   of the residual are reported with respect to the variable values.
  x = y           ! Original form
  x-y = 0         ! Residual form

  ! Below are examples of some of the types of variable operations that
  !   are possible.  There is currently a limit of 100 unique variables per equation.
  -(x-y) = 0      ! Unary minus
  x+y=0           ! Addition   
  x-y=0           ! Subtraction   
  x*y=0           ! Multiplication   
  x/y=0           ! Division   
  x^y=0           ! Power   
  abs(x*y)=0      ! Absolute value   
  exp(x*y)=0      ! Exponentiation   
  log10(x*y)=0    ! Log10 
  log(x*y)=0      ! Log (natural log)   
  sqrt(x*y)=0     ! Square Root  
  sinh(x*y)=0     ! Hyperbolic Sine  
  cosh(x*y)=0     ! Hyperbolic Cosine  
  tanh(x*y)=0     ! Hyperbolic Tanget  
  sin(x*y)=0      ! Sine   
  cos(x*y)=0      ! Cosine   
  tan(x*y)=0      ! Tangent   
  asin(x*y)=0     ! Arc-sine  
  acos(x*y)=0     ! Arc-cos  
  atan(x*y)=0     ! Arc-tangent  

  ! Example of a more complex equation.  There are 3 unique variables (x,y,z) and 1 residual.
  ! Exact first derivatives are reported for:
  !   d(res)/dx, d(res)/dy, d(res)/dz
  ! where:
  !   res = (y+2/x)^(x*z) * (log(tanh(sqrt(y-x+x^2))+3))^2 - (2+sinh(y)+acos(x+y)+asin(x/y))
  (y+2/x)^(x*z) * (log(tanh(sqrt(y-x+x^2))+3))^2 = 2+sinh(y)+acos(x+y)+asin(x/y)

  ! Differential equation with $ indicating a differential with respect to time
  ! Sparsity pattern is augmented by n columns where n is the number of variables
  ! If x is the first variable and there are 3 variables then $x would be variable 4
  ! x=1
  ! y=2
  ! z=3
  ! $x=4
  ! $y=5
  ! $z=6
  $x = -x + y

  ! Characters are not case specific
  $Z = -x + z*Y
 End Equations
to:
  Equations
    exp(x*p)=y
    z = p*$x + x
    (y+2/x)^(x*z) * (log(tanh(sqrt(y-x+x^2))+3))^2 = 2+sinh(y)+acos(x+y)+asin(x/y)
  End Equations
September 25, 2008, at 09:24 AM by 158.35.225.230 -
Added line 35:
$Differential$x = -x + y
September 25, 2008, at 09:24 AM by 158.35.225.230 -
Changed lines 14-34 from:
#DescriptionExample
1Unary minus-(x-y) = 0
2Additionx+y = 0
3Subtractionx-y=0
4Multiplicationx*y=0
5Divisionx/y=0
6Powerx^y=0
7Absolute valueabs(x*y)=0
8Exponentiationexp(x*y)=0
9Base-10 Loglog10(x*y)=0
10Natural Loglog(x*y)=0
11Square Rootsqrt(x*y)=0
12Hyperbolic Sinesinh(x*y)=0
13Hyperbolic Cosinecosh(x*y)=0
14Hyperbolic Tangettanh(x*y)=0
15Sinesin(x*y)=0
16Cosinecos(x*y)=0
17Tangenttan(x*y)=0
18Arc-sineasin(x*y)=0
19Arc-cosacos(x*y)=0
20Arc-tangentatan(x*y)=0
to:
OperandDescriptionExample
-Unary minus-(x-y) = 0
+Additionx+y = 0
-Subtractionx-y=0
*Multiplicationx*y=0
/Divisionx/y=0
^Powerx^y=0
abs()Absolute valueabs(x*y)=0
exp()Exponentiationexp(x*y)=0
log10Base-10 Loglog10(x*y)=0
logNatural Loglog(x*y)=0
sqrt()Square Rootsqrt(x*y)=0
sinh()Hyperbolic Sinesinh(x*y)=0
cosh()Hyperbolic Cosinecosh(x*y)=0
tanh()Hyperbolic Tangettanh(x*y)=0
sin()Sinesin(x*y)=0
cos()Cosinecos(x*y)=0
tan()Tangenttan(x*y)=0
asin()Arc-sineasin(x*y)=0
acos()Arc-cosacos(x*y)=0
atan()Arc-tangentatan(x*y)=0
September 25, 2008, at 09:21 AM by 158.35.225.230 -
Changed line 14 from:
DescriptionExample
to:
#DescriptionExample
September 25, 2008, at 09:20 AM by 158.35.225.230 -
Changed line 13 from:
to:
Changed lines 15-34 from:
Unary minus-(x-y) = 0
Additionx+y = 0
Subtractionx-y=0
Multiplicationx*y=0
Divisionx/y=0
Powerx^y=0
Absolute valueabs(x*y)=0
Exponentiationexp(x*y)=0
Log10log10(x*y)=0
Log (natural log)log(x*y)=0
Square Rootsqrt(x*y)=0
Hyperbolic Sinesinh(x*y)=0
Hyperbolic Cosinecosh(x*y)=0
Hyperbolic Tangettanh(x*y)=0
Sinesin(x*y)=0
Cosinecos(x*y)=0
Tangenttan(x*y)=0
Arc-sineasin(x*y)=0
Arc-cosacos(x*y)=0
Arc-tangentatan(x*y)=0
to:
1Unary minus-(x-y) = 0
2Additionx+y = 0
3Subtractionx-y=0
4Multiplicationx*y=0
5Divisionx/y=0
6Powerx^y=0
7Absolute valueabs(x*y)=0
8Exponentiationexp(x*y)=0
9Base-10 Loglog10(x*y)=0
10Natural Loglog(x*y)=0
11Square Rootsqrt(x*y)=0
12Hyperbolic Sinesinh(x*y)=0
13Hyperbolic Cosinecosh(x*y)=0
14Hyperbolic Tangettanh(x*y)=0
15Sinesin(x*y)=0
16Cosinecos(x*y)=0
17Tangenttan(x*y)=0
18Arc-sineasin(x*y)=0
19Arc-cosacos(x*y)=0
20Arc-tangentatan(x*y)=0
September 25, 2008, at 09:17 AM by 158.35.225.230 -
Changed lines 11-12 from:

There are currently 21 operands for parameters or variables. They are listed below with a short description of each and a simple example involving variable x and optionally y.

to:

There are currently 21 operands for parameters or variables. They are listed below with a short description of each and a simple example involving variable x and y.

Changed line 14 from:
Description!Example
to:
DescriptionExample
September 25, 2008, at 09:16 AM by 158.35.225.230 -
Changed lines 14-34 from:
DescriptionExample
Unary minus-(x-y) = 0
Additionx+y = 0
Subtractionx-y=0
Multiplicationx*y=0
Divisionx/y=0
Powerx^y=0
Absolute valueabs(x*y)=0
Exponentiationexp(x*y)=0
Log10log10(x*y)=0
Log (natural log)log(x*y)=0
Square Rootsqrt(x*y)=0
Hyperbolic Sinesinh(x*y)=0
Hyperbolic Cosinecosh(x*y)=0
Hyperbolic Tangettanh(x*y)=0
Sinesin(x*y)=0
Cosinecos(x*y)=0
Tangenttan(x*y)=0
Arc-sineasin(x*y)=0
Arc-cosacos(x*y)=0
Arc-tangentatan(x*y)=0
to:
Description!Example
Unary minus-(x-y) = 0
Additionx+y = 0
Subtractionx-y=0
Multiplicationx*y=0
Divisionx/y=0
Powerx^y=0
Absolute valueabs(x*y)=0
Exponentiationexp(x*y)=0
Log10log10(x*y)=0
Log (natural log)log(x*y)=0
Square Rootsqrt(x*y)=0
Hyperbolic Sinesinh(x*y)=0
Hyperbolic Cosinecosh(x*y)=0
Hyperbolic Tangettanh(x*y)=0
Sinesin(x*y)=0
Cosinecos(x*y)=0
Tangenttan(x*y)=0
Arc-sineasin(x*y)=0
Arc-cosacos(x*y)=0
Arc-tangentatan(x*y)=0
September 25, 2008, at 09:15 AM by 158.35.225.230 -
Changed lines 3-4 from:

Parameters are fixed values that represent model inputs, fixed constants, or any other value that does not change. Parameters are not modified by the solver as it searches for a solution. As such, parameters do not contribute to the number of degrees of freedom (DOF).

to:

Equations consist of a collection of parameters and variables that are related by operands (+,-,*,/,exp(),d()/dt, etc.). The equations define the relationship between variables.

Added lines 7-36:

Open-equation format is allowed for differential and algebraic equations. Open-equation means that the equation can be expressed in the least restrictive form. Other software packages require differential equations to be posed in the semi-explicit form: dx/dt = f(x). This is not required with APMonitor modelling language.

Equation operands

There are currently 21 operands for parameters or variables. They are listed below with a short description of each and a simple example involving variable x and optionally y.

DescriptionExample
Unary minus-(x-y) = 0
Additionx+y = 0
Subtractionx-y=0
Multiplicationx*y=0
Divisionx/y=0
Powerx^y=0
Absolute valueabs(x*y)=0
Exponentiationexp(x*y)=0
Log10log10(x*y)=0
Log (natural log)log(x*y)=0
Square Rootsqrt(x*y)=0
Hyperbolic Sinesinh(x*y)=0
Hyperbolic Cosinecosh(x*y)=0
Hyperbolic Tangettanh(x*y)=0
Sinesin(x*y)=0
Cosinecos(x*y)=0
Tangenttan(x*y)=0
Arc-sineasin(x*y)=0
Arc-cosacos(x*y)=0
Arc-tangentatan(x*y)=0
Changed lines 42-46 from:
 Variables
  x = 0.2
  y = 0.5
  z = 1.5
 End Variables
to:
  Parameters
    p = 1
  End Parameters

  Variables
    x
    y
    z
  End Variables
September 25, 2008, at 08:58 AM by 158.35.225.230 -
Added lines 1-71:

Equations

Parameters are fixed values that represent model inputs, fixed constants, or any other value that does not change. Parameters are not modified by the solver as it searches for a solution. As such, parameters do not contribute to the number of degrees of freedom (DOF).

Equations are declared in the Equations ... End Equations section of the model file. The equations may be defined in one section or in multiple declarations throughout the model. Equations are parsed sequentially, from top to bottom. However, implicit equations are solved simultaneously so the order of the equations does not change the solution.

(:table class='markup horiz' align='left':) (:cellnr class='markup1':)

! Example model that demonstrates equation declarations
Model example
 Variables
  x = 0.2
  y = 0.5
  z = 1.5
 End Variables

 Equations
  ! The program tranforms all equations from the 'original form' to
  !   the 'residual form'.  Sparse first derivatives
  !   of the residual are reported with respect to the variable values.
  x = y           ! Original form
  x-y = 0         ! Residual form

  ! Below are examples of some of the types of variable operations that
  !   are possible.  There is currently a limit of 100 unique variables per equation.
  -(x-y) = 0      ! Unary minus
  x+y=0           ! Addition   
  x-y=0           ! Subtraction   
  x*y=0           ! Multiplication   
  x/y=0           ! Division   
  x^y=0           ! Power   
  abs(x*y)=0      ! Absolute value   
  exp(x*y)=0      ! Exponentiation   
  log10(x*y)=0    ! Log10 
  log(x*y)=0      ! Log (natural log)   
  sqrt(x*y)=0     ! Square Root  
  sinh(x*y)=0     ! Hyperbolic Sine  
  cosh(x*y)=0     ! Hyperbolic Cosine  
  tanh(x*y)=0     ! Hyperbolic Tanget  
  sin(x*y)=0      ! Sine   
  cos(x*y)=0      ! Cosine   
  tan(x*y)=0      ! Tangent   
  asin(x*y)=0     ! Arc-sine  
  acos(x*y)=0     ! Arc-cos  
  atan(x*y)=0     ! Arc-tangent  

  ! Example of a more complex equation.  There are 3 unique variables (x,y,z) and 1 residual.
  ! Exact first derivatives are reported for:
  !   d(res)/dx, d(res)/dy, d(res)/dz
  ! where:
  !   res = (y+2/x)^(x*z) * (log(tanh(sqrt(y-x+x^2))+3))^2 - (2+sinh(y)+acos(x+y)+asin(x/y))
  (y+2/x)^(x*z) * (log(tanh(sqrt(y-x+x^2))+3))^2 = 2+sinh(y)+acos(x+y)+asin(x/y)

  ! Differential equation with $ indicating a differential with respect to time
  ! Sparsity pattern is augmented by n columns where n is the number of variables
  ! If x is the first variable and there are 3 variables then $x would be variable 4
  ! x=1
  ! y=2
  ! z=3
  ! $x=4
  ! $y=5
  ! $z=6
  $x = -x + y

  ! Characters are not case specific
  $Z = -x + z*Y
 End Equations
End Model

(:tableend:)