Modelica_LinearSystems2.Math

Additional functions for Modelica.Math

Information

Extends from Modelica.Icons.Library (Icon for library).

Package Content

NameDescription
Modelica_LinearSystems2.Math.Complex Complex Record defining a Complex number
Modelica_LinearSystems2.Math.Polynomial Polynomial Record defining the data for a polynomial
Modelica_LinearSystems2.Math.Matrices Matrices Additional functions for Modelica.Math
Modelica_LinearSystems2.Math.Vectors Vectors Functions operating on vectors

Modelica_LinearSystems2.Math.Complex Modelica_LinearSystems2.Math.Complex

Record defining a Complex number

Information


This record defines a complex number consisting of a real and an imaginary part. Additionally, various utility functions are provided in the record to operate on instances of this record. Example (note: "j" in the comments is defined as j=sqrt(-1)):

   import Modelica.Utilities.Streams;
   import Modelica_LinearSystems2.Math.Complex;
   Complex c1=Complex(re=2, im=3) "= 2 + 3j";
   Complex c2=Complex(3,4) "= 3 + 4j";
 algorithm
   c3 := Complex.'+'(c1, c2) "= c1 + c2";
   Streams.print("c3 = " + Complex.'String'(c3));
   Streams.print("c3 = " + Complex.'String'(c3,"i"));
   // This gives the following print-out:
   c3 = 5 + 7j
   c3 = 5 + 7i

The utility functions are written in such a way that it is convenient to work with them, once operator overloading is provided in Modelica and Modelica tools. Example:

   // Assume operator overloading is available (this is not yet the case):
   Complex j  = Complex.j();
   Complex c4 = -2 + 5*j;
   // A Modelica tool will transform the statement of c4 into
   Complex c4 = Complex.'+'( Complex.(-2,0), Complex.'*'(Complex(5,0),j)));

The utility functions are implemented so that they can be easily inlined by a tool. In such a case, the above statement will not lead to any overhead.

Extends from Modelica.Icons.Record (Icon for a record).

Parameters

NameDescription
reReal part of complex number
imImaginary part of complex number

Modelica_LinearSystems2.Math.Polynomial Modelica_LinearSystems2.Math.Polynomial

Record defining the data for a polynomial

Information


This record defines a polynomial, e.g., y = 2*x^2 + 3*x + 1. The general form is:

   y = c[1]*x^n + c[2]*x^(n-1) + ... + c[n]*x + c[n+1];

In the record, the coefficients c[i] are stored. Usually, the record is not directly accessed. Instead, a polynomial is generated with the functions provided in the record such as Polynomial.base(..), Polynomial.fitting(..). Several functions are provided that operate on polynomials.

Extends from Modelica.Icons.Record (Icon for a record).

Parameters

NameDescription
c[:]Polynomial coefficients (c[1]*x^n + ... c[n]*x + c[n+1])

HTML-documentation generated by Dymola Tue Sep 08 18:52:57 2009.