Arithmetic Parameterization of General Purpose CFD Code

Size: px
Start display at page:

Download "Arithmetic Parameterization of General Purpose CFD Code"

Transcription

1 Arithmetic Parameterization of General Purpose CFD Code Aleksandar Jemcov 1 Development Department, ANSYS/Fluent Inc., Lebanon, NH, 03766, USA aj@fluent.com ABSTRACT In this paper we describe the use of C++ templates to parameterize CFD code to produce specialized versions of the code at the compile time that is capable of defining different arithmetic types. This parameterization is primarily used to compute automatic derivatives in design optimization. However, it is possible to use the same code parameterization to define various arithmetics that can be used to produce additional useful side effects such as automatic stability characterization of the algorithms, uncertainty propagation, higher order derivative computations and interval arithmetics. Here we describe the implementation of the parameterization and the design of these classes and we show results of the use of different arithmetics in CFD and related fields. 1 INTRODUCTION Modern software architecture in Computational Fluid Dynamics usually involves use of object oriented software design to promote information hiding, strict modularity and code reuse. Given the fact that CFD codes require high computational performance in both serial and parallel runs, the natural choice for the programming language fall onto C++ language. C++ is a weakly object oriented language that is rich with language constructs and can be used to produce high performance numerical software. However, in addition to support for object oriented programming, C++ offers the possibility of generic programming through the use of templates. The ability to freely mix object oriented and metaprogramming styles of code writing can be exploited successfully to create computational code with many purposes. Templating of the CFD code enables parameterization of the software implementation and depending on how this templating is performed, many parameterizations are possible. Use of automatic differentiation libraries in design optimization and sensitivity analysis is well established [1, 2, 3, 4]. Differentiation libraries such as ADIFOR [3] and ADOLC [4] are implemented as language parsers that augment original code in oder to compute derivatives. While this approach to computing derivatives is mostly automatic with minimal changes in source code and very efficient, it is not possible to define any other type of arithmetic other than implemented in the library without reimplementing large portions of the parser. Another approach to computing derivatives consists of the use of the operator overloading mechanism offered in several languages such as FORTRAN90 and C++. This mechanism allows redefinition of the basic arithmetic operations such as +,,, /, etc. Oncethese operations are overloaded, the new definition of the arithmetic operators are used by the compiler whenever a particular type or a key word is encountered. One such implementation of operator overloading is described in [5, 6, 7]. This approach requires changes in the source code that sometimes are not trivial because they may involve a deliberate design of the code, especially in the case of C++ language. However, once this is achieved, the code becomes very flexible and generic. Operator overloading is a necessary precursor to code parameterization by C++ templates. Introduction of C++ templates into a CFD code allows generic programming to be used in its full potential, even beyond the original intention of automatic differentiation of the code. Moreover, carefully overloaded CFD code together with function and class templating introduces the possibility of the use of advanced concepts such as algorithm stability characterization and interval arithmetic in addition to automatic differentiation. The final result of this effort is a generic numerical library that can be used for advanced computations. Examples of these computations include computation of the first and second order derivatives with respect to flow variables, uncertainty propagation, interval arithmetics and stability characterization of the algorithms.

2 2 ARITHMETIC TYPE The basic idea of the exchangeable arithmetics in numerical libraries is based upon the capability of C++ language to declare a new types through the definition of classes [8]. Here we have a specific new type in mind, the one that is capable of replacing the built-in compiler arithmetic with a user defined one. The definition of the class Arithmetic looks like this: class Arithmetic public: //constructor methods Arithmetic(const double x); Arithmetic(const Arithmetic& x); //public methods for operator overloading Arithmetic& operator*=(const Arithmetic& x); Arithmetic& operator+=(const Arithmetic& x); //access methods double value() const; double other() const; void setvalue(const Arithmetic& x); void setother(const Arithmetic& x); private: //data for floating point arithmetic double _value; //additional data for other arithmetic double _other; ; This class definition contains all necessary ingredients required for the definition of the new type in C++ language i.e., it contains the means of creation of the new variable of the Arithmetic type and its destruction (instantiated by the compiler), definition of basic arithmetic operations, access methods and data to store the results of the computations. The intention here is to use this class as a basic building block of the computations that represent the generalization of the built-in types such as float and double. A particular implementation of the concrete Arithmetic type will depend on the type of calculations that are desired. Some examples of differentarithmetic types will be presented in the next several sections. This is achieved by using specific operator overloading that correspond to a particular arithmetic. The ability of the C++ language to define new types that can be used in the same way as abuilt-intypestogetherwiththeoperatoroverloading to define operations on the new types is critical in enabling the different arithmetics. However, Arithmetic types do not replace built-in types in normal operation i.e., when side effects of the new types is not required. In other words, the code must be able to use built-in types whenever it is required without any performance penalties. Therefore, awaytosignaltothecompilerthataspecifictype,be it a built-in or newly defined Arithmetic type, must be devised. This is achieved through the use of C++ templates. C++ templates [8] are very useful in situations when there is a generic code that contains a logical structure that is applicable to many different types. For example, in finite volume methods numeric flux could be computed with the use of the following class: template<typename Arithmetic> class Flux public: //constructor Flux(const Args& args); //desctructor ~Flux(); //public methods for flux computation Arithmetic inviscidflux(arithmetic& wavespeed, const Arithmetic& metriccoeffs, ); Arithmetic viscousflux(const Arithmetic& metriccoeffs, ); private: ; Class Flux together with its methods was parameterized with respect to class Arithmetic and this allows substitution of different arithmetic types: template class Flux<float>; template class Flux<double>; template class Flux<Stability>; DifferentArithmetic types are selected at the compile time and the compiler performs the necessary substitutions and instantiations. Close attention must be paid to implementation of the Arithmetic classes in order to avoid function calls in place of overloaded arithmetic operators and this can be achieved by a deliberate use of inline directive. It is important to keep the implementation of the overloaded operators rela-

3 tively short and avoid using the data that cannot be determined at the compile time. Trait mechanism [8] is used to make sure that the right overloaded functions from the standard library such as sin(x), pow(x,n), min(x,y),etc.areselectedatthecompiletime. 3 AUTOMATIC DIFFERENTIATION The automatic differentiation class is a particular implementation of the generic Arithmetic that enables the computation of the directional derivatives for the sensitivity analysis and design optimization. Derivative computation is achieved by a specific overloading of all arithmetic operators together with the mathematical library. The basic idea of overloading the arithmetic operators is to insert the line of the code at the compile time that is capable of computing the derivative. If we consider a simple example of the multiplication of two numbers directional derivative is defined as z = xy, (1) δz = xδy + yδx (2) The form of Eq. (1) and Eq. (2) suggests that whenever the value of the expression z = xy is computed, it is possible to compute the directional derivative of that expression. In other words, operator overloading should produce the code that is capable of computing the value and the derivative at the same time by changing the meaning of the arithmetic operation + to insert the necessary instruction into the code to perform that operation. The resulting class, called Tangent may be implemented as follows: class Tangent public: //constructor methods Tangent(const double x); Tangent(const Tangent& x); //public methods for operator overloading Tangent& operator*=(const Tangent& x) Tangent& operator+=(const Tangent& x) //access methods double value() const; double deriv() const; void setvalue(const Tangent& x); void setother(const Tangent& x); private: //floating point data double _v; //derivative data double _dv; ; In this case, operator*= must be implemented as a part of the Tangent class and shown here: Tangent& operator*=(const Tangent& x) _dv = _dv*x.value() + _v*x.deriv(); _v *= x.value(); return *this; With the help of the operator*=, itispossibletoimplement operator*: inline Tangent operator*(const Tangent& x, const Tangent& y) return Tangent(x)*=y; Similarly, math library function sin(x) is implemented as follows: inline Tangent sin(const Tangent& x) return Tangent(std::sin(x.value()), x.deriv()*std::cos(x.value())); Careful overloading of all necessary operators and math library functions with templating of the code on Arithmetic type results in a parameterized code capable of computing directional derivative in addition to values of the flow field. Sometimes this approach to computing the directional derivatives is called algorithmic differentiation due to the fact that the whole code is considered to be composed of elemental functions: f = f n f n 1 f 2 f 1 f 0 (3) Consistent application of the chain rule of differentiation leads to the expression δ f = f n,n 1 f n 1,n 2 f 1,0δx (4)

4 8.31e e e e e e e e e e e e e e e e e e e e e e e e e e-01 Contours of Mach Number Figure 1: Mach number contours around NACA0012 at M = 0.7andα = 0 o 5.76e e e e e e e e e e e e e e e e e e e e e e e e e e+01 Contours of User Memory e e e e e e e e e e e e e e e e e e e e e e e e e e+04 Figure 3: Contours of derivative of u-velocity with respect to Mach number at far field boundary around NACA0012 at M = 0.7andα = 0 o Contours of User Memory 0 Figure 2: Contours of derivative of pressure with respect to Mach number at far field boundary around NACA0012 at M = 0.7andα = 0 o The Tangent class allows the propagation of the chain rule of the differentiation in accordance to Eq. (4) throughout the computations regardless of the code complexity. An example of the computation of the directional derivative is demonstrated by computing the derivative of pressure and velocities with respect to Mach number at far field boundary. The airfoil under the consideration is symmetric NACA0012 airfoil in inviscid free stream with Mach number M = 0.7 atzeroangle of attack. Contours of Mach number around airfoil are given in Fig. (1) whereas derivatives of pressure and velocity fields are given in Fig (2), Fig. (3) and Fig. (4). 1.10e e e e e e e e e e e e e e e e e e e e e e e e e e+02 Contours of User Memory 5 Figure 4: Contours of derivative of v-velocity with respect to Mach number at far field boundary around NACA0012 at M = 0.7andα = 0 o

5 It is possible to further generalize Tangent by introducing the computation of the second order derivatives. The resulting class is called Curvature and it is implemented as follows: class Curvature public: //constructor methods Curvature(const double x); Curvature(const Curvature& x); //public methods for operator overloading Curvature& Curvature*=(const Curvature& x) Curvature& operator+=(const Curvature& x) //access methods double value() const; double deriv() const; void setvalue(const Curvature& x); void setother(const Curvature& x); private: //floating point data double _v; //derivative data double _dv; double _sd; ; Here _v stores values of computations, _dv stores first order derivative, and _sd stores the second order derivative. In the case of the Curvature class, the overloaded operator*= has additional instructions in the body of the function: Curvature& operator*=(const Curvature& x) _sd = _sd*x.value() + 2.*_dv*x.deriv() + x.sderiv()*_v; _dv = _dv*x.value() + _v*x.deriv(); _v *= x.value(); return *this; Other operators and math library functions are overloaded in the same manner to produce consistently first and second order derivatives. The use of the Curvature class in computation of the first and second order derivatives is demonstrated for the case of the inviscid flow over the symmetric 7.07e e e e e e e e e e e e e e e e e e e e e e+04 Contours of Static Pressure (pascal) Figure 5: Static pressure contours around NACA0012 at M = 0.7andα = 1 o 1.36e e e e e e e e e e e e e e e e e e e e e e+05 Contours of User Memory 0 Figure 6: First order derivative of pressure with respect to angle of attack contours around NACA0012 at M = 0.7andα = 1 o NACA0012 airfoil with Mach number M = 0.7 andat the angle of attack of α = 1.0 o.herethedifferentiation is performed with the respect to the angle of attack. The pressure field for this case is shown in Fig. (5), the first derivative of the pressure field with respect to angle of attack is shown in Fig. (6) and the second order derivative is shown in Fig. (7). 4 ALGORITHM STABILITY COMPUTATION Another good candidate for defining the new arithmetic is based on the forward error analysis. In forward error analysis the influence of the finite precision arithmetic is examined and the error in the computed

6 7.04e e e e e e e e e e e e e e e e e e e e e e+06 Contours of User Memory 7 be computed by overloading the appropriate operators similarly to Tangent class. Since the code is considered to be a composition of a large number of elemental functions in accordance to Eq. (3) and the chain rule of differentiation is given by Eq. (4), absolute normwise forward error is given by: ϒ (σ n κ n + σ n 1 σ n κ n + + σ n 1 σ n κ 0 )ε f ( x) (8) where ϒ = f ( x) f ( x). (9) The Stability class is structurally similar to Tangent and Curvature and overloaded operator+= is implemented as follows: Figure 7: Second order derivative of pressure with respect to angle of attack contours around NACA0012 at M = 0.7andα = 1 o E x ~ f ~ f ~ R R ~ f(x) Figure 8: Forward error illustration ~ ~ f(x) result is estimated by computing the relative error [9] f ( x) f ( x) f ( x) σκ r ε. (5) Here ε is machine precision, σ 1isastabilityindicator that is known for binary operators (+,,,/) and κ r is a relative condition number given by the following expression: κ r = x f (x) f (x) (6) Symbol f ( x) represent the perturbed output due to errors in input x and f ( x) represent exact function evaluated at the perturbed input x. The definition of the forward error is illustrated in a Fig. (8). Norm of the Jacobian matrix f (x) is computed in subordinate 1 norm f (x) = sup x 0 f (x)x. (7) x Since the computation of the normwise relative condition number, Eq. (6) involves computation of the Jacobian of the expression, the condition number can Stability& operator+=(const Stability& x) const double xs = x.stab(); if(xs == 0) _stability += numbertrait<double>::eps; else _stability += (numbertrait<double>::eps + xs); _value += x.value(); return *this; As before, implementation of operator+ uses operator+= inline Stability& operator+(const Stability& x, const Stability& y) return Stability(x) += y; Other arithmetic operators are overloaded in a similar way and the resulting Stability class is used in analysis of the stability of algorithms. As an example of the use of the Stability class in the algorithm stability analysis, consider the simple problem of error cancellation. The function f (x i )i = 1,7 defined as f (x i )= 7 i=1 x i (10) with the arguments x 1 = x 2 = 0.5, x 3 = x 4 = 1.0, x 5 = x 6 = 2.0, and x 7 = is analyzed for the stability. This function is evaluated in single precision and due to subtractive cancellation error, the result of the summation is unreliable in floating point arithmetics. Theoretically, the stability of this algorithm

7 is proportional to the number of operations which is in this case S = 6buttheapplicationoftheStability class results in a much higher number, S = E06 thus indicating that the result is unreliable. The simple way of correcting this problem is to switch x 7 and x 1 position in the summation in order to avoid subtractive cancellation error. In this case, the application of Stability class results in stability indicator S = 6. Another example that demonstrates the ability of the Stability class to analyze the stability of the algorithms due to the inherent stiffness in the function is provided by the Rump problem [10]. The Rump problem consists of evaluating the following function: f (x 1,x 2 ) = ( x 2 1 )x6 2 + x 2 1(11x 2 1x x 4 2 2) + 5.5x x 1 2x 2 (11) at the point x 1 = and x 2 = This function can be factored into the following function: f (x 1,x 2 )= x 1 2x 2 2 (12) From the mathematical point of view, Eq. (11) and Eq. (12) are equivalent and they should produce the same result in exact arithmetic. However, in floating point arithmetic evaluation of Eq. (11) yields the result f (x 1,x 2 )= , whereas the evaluation of Eq. (12) yields the correct result f (x 1,x 2 )= Application of the Stability class to this problem shows that the stability of the of the algorithm in Eq. (11) is S = E19 thus indicating that the algorithm is unstable. The Stability class is used to test the implementation of algorithms and it is very valuable in determining the potential problems with the code implementation. It can be applied equally to function evaluations, iterative algorithms and larger pieces of the code. Stability class is a very valuable tool for both code development and error analysis at the run time. 5 INTERVAL ARITHMETIC In interval arithmetic every real number is replaced by an interval so that the value of some variable is contained in the interval defined by the lower and upper interval bounds. The usual notation used in interval arithmetic for an interval is a pair of angled brackets []. Usual arithmetic operations take a very special meaning and addition is defined as follows: [a,b]+[c,d]=[a + c,b + d]. (13) Similarly, other arithmetic operations are defined by the following expressions: [a,b] [c,d]=[a d,b c], (14) [a,b][c,d]=[min(ac,ad,bc,bd), max(ac,ad,bc,bd)], (15) [a, b]/[c, d]=[min(a/c, a/d, b/c, b/d), max(a/c, a/d, b/c, b/d)]. (16) The Interval class is similar in structure to other Arithmetic classes and the implementation of overloaded operators operator+= is shown here: Interval& operator+=(const Interval& x) unsigned short int mode = fpu_get_mode(); fpu_set_mode(mode_up); _sup += x.sup(); fpu_set_mode(mode_down); _inf += x.inf(); fpu_set_mode(mode); checkinfinity(); return *this; inline Interval operator+(const Interval& u, const Interval& v) return Interval(u) += v; The Interval class is very useful in special computations since interval arithmetic adds some special operations such intersection, subset, etc. thatarevery useful in construction of robust iterative algorithms. These additional operations belong to the class of set operations and they are not available in real arithmetic. With their help, a robust iterative Newton method can be constructed that is not sensitive to the initial guess. One implementation of interval Newton method is as follows: int main() Interval x, x_old; x = Interval(2,3); if (criterion(x))

8 do x_old = x; cout << "Enclosure = " << x << " with diameter = " << x.wid() << endl; x = (x.mid() - f(x.mid()) /deriv(x)).intersect(x); while (x!= x_old); else cout << "Criterion not satisfied" << endl; return 0; The Interval class is very useful in treating specific convergence problems in iterative algorithms. Although interval arithmetic has not found broad usage in CFD algorithms, code parameterization through C++ templates enable this possibility at least as a research issue. 6 CONCLUSIONS Code parameterization through C++ templates, classes and operator overloading of a general purpose code was demonstrated. The typical usage of the code parameterization for the computation of the directional derivatives was presented for the case of inviscid compressible flow over the airfoil. Computation of the first and second order derivatives was demonstrated where independent variables were Mach number and the angle of attack. Benefits of the systematic code parameterization include the possibility of replacing the underlying floating point arithmetic with another one that enables stability and interval arithmetics. It is possible to define other arithmetics and some possibilities include reverse differentiation class for adjoint computations and spectral and stochastic arithmetics, to name the few. The main idea that was presented here is that careful code parameterization leads to many possibilities that come at almost no cost once the code parameterization was performed. [1] A. Griewank. Evaluating Derivatives - Principles and Techniques of Algorithmic Differentiation. Frontiers in Applied Mathematics, SIAM, Philadelphia, 2000 [2] A. Griewank. On Automatic Differentiation. Preprint ANL/MCS-P , Mathematics and Computer Science Division, Argonne National Laboratory, 1988 [3] C. H. Bischof and A. Carle. Automatic Differentiation: Obtaining Fast and Reliable derivatives - Fast. ArgonnePreprintMCS-P [4] A. Griewank, D. Juedes and J. Srinivasan. ADOL- C, a Package for the Automatic Differentiation of Algorithms Written in C/C++. Technical Report MCS-P , Mathematics and Computer Science Division, Argonne National Laboratory, 1990 [5] B. Mohammadi and O. Pironneau. Applied Shape Optimal Design for Fluids. Oxford University Press, 2001 [6] A. Jemcov and S. Mathur. Algorithmic Differentiation of General Purpose CFD Code: Implementation and Verification. European Congress on Computational Methods in Applied Sciences and Engineering, ECCOMAS 2004, P. Neittaanmäki, T. Rossi, K. Majava, and O. Pironneau (eds.), I. Lasiecka (assoc. ed.), Jyväskylä, July 2004 [7] A. Jemcov and S. Mathur. Nonlinear Parameter Estimation in Inviscid Compressible Flows in Presence of Uncertainties. 12th Annual Conference of Computational Fluid Dynamics, Ottawa, Canada, May 9-11, 2004 [8] D. Vandevoorde, and N.M. Josuttis. C++ Templates - The Complete Guide. Addison Wesley, 2003 [9] P. Deuflhard. Numerical Analysis in Modern Scientific Computing. TextinAppliedMathematics, Springer, [10] W. Kahan. Mathematics Written in Sand. Technical Report, University of California, Berkeley, USA. REFERENCES

Numerical Simulations of Fluid-Structure Interaction Problems using MpCCI

Numerical Simulations of Fluid-Structure Interaction Problems using MpCCI Numerical Simulations of Fluid-Structure Interaction Problems using MpCCI François Thirifay and Philippe Geuzaine CENAERO, Avenue Jean Mermoz 30, B-6041 Gosselies, Belgium Abstract. This paper reports

More information

Object oriented implementation of a second-order optimization method

Object oriented implementation of a second-order optimization method Obect oriented implementation of a second-order optimization method L. F. D. Bras & A.F.M.Azevedo Civil Engineering Department, Faculty of Engineering, University of Porto, Portugal. Abstract A structural

More information

Reals 1. Floating-point numbers and their properties. Pitfalls of numeric computation. Horner's method. Bisection. Newton's method.

Reals 1. Floating-point numbers and their properties. Pitfalls of numeric computation. Horner's method. Bisection. Newton's method. Reals 1 13 Reals Floating-point numbers and their properties. Pitfalls of numeric computation. Horner's method. Bisection. Newton's method. 13.1 Floating-point numbers Real numbers, those declared to be

More information

Computational Methods. Sources of Errors

Computational Methods. Sources of Errors Computational Methods Sources of Errors Manfred Huber 2011 1 Numerical Analysis / Scientific Computing Many problems in Science and Engineering can not be solved analytically on a computer Numeric solutions

More information

2.1.1 Fixed-Point (or Integer) Arithmetic

2.1.1 Fixed-Point (or Integer) Arithmetic x = approximation to true value x error = x x, relative error = x x. x 2.1.1 Fixed-Point (or Integer) Arithmetic A base 2 (base 10) fixed-point number has a fixed number of binary (decimal) places. 1.

More information

Optimization with Gradient and Hessian Information Calculated Using Hyper-Dual Numbers

Optimization with Gradient and Hessian Information Calculated Using Hyper-Dual Numbers Optimization with Gradient and Hessian Information Calculated Using Hyper-Dual Numbers Jeffrey A. Fike and Juan J. Alonso Department of Aeronautics and Astronautics, Stanford University, Stanford, CA 94305,

More information

Cpt S 122 Data Structures. Templates

Cpt S 122 Data Structures. Templates Cpt S 122 Data Structures Templates Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Topics Introduction Function Template Function-template and function-template

More information

LECTURE 0: Introduction and Background

LECTURE 0: Introduction and Background 1 LECTURE 0: Introduction and Background September 10, 2012 1 Computational science The role of computational science has become increasingly significant during the last few decades. It has become the

More information

C++ (Non for C Programmer) (BT307) 40 Hours

C++ (Non for C Programmer) (BT307) 40 Hours C++ (Non for C Programmer) (BT307) 40 Hours Overview C++ is undoubtedly one of the most widely used programming language for implementing object-oriented systems. The C++ language is based on the popular

More information

Lecture Objectives. Structured Programming & an Introduction to Error. Review the basic good habits of programming

Lecture Objectives. Structured Programming & an Introduction to Error. Review the basic good habits of programming Structured Programming & an Introduction to Error Lecture Objectives Review the basic good habits of programming To understand basic concepts of error and error estimation as it applies to Numerical Methods

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

Cpt S 122 Data Structures. Introduction to C++ Part II

Cpt S 122 Data Structures. Introduction to C++ Part II Cpt S 122 Data Structures Introduction to C++ Part II Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Topics Objectives Defining class with a member function

More information

CS 376b Computer Vision

CS 376b Computer Vision CS 376b Computer Vision 09 / 25 / 2014 Instructor: Michael Eckmann Today s Topics Questions? / Comments? Enhancing images / masks Cross correlation Convolution C++ Cross-correlation Cross-correlation involves

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

AM205: lecture 2. 1 These have been shifted to MD 323 for the rest of the semester.

AM205: lecture 2. 1 These have been shifted to MD 323 for the rest of the semester. AM205: lecture 2 Luna and Gary will hold a Python tutorial on Wednesday in 60 Oxford Street, Room 330 Assignment 1 will be posted this week Chris will hold office hours on Thursday (1:30pm 3:30pm, Pierce

More information

Solution of 2D Euler Equations and Application to Airfoil Design

Solution of 2D Euler Equations and Application to Airfoil Design WDS'6 Proceedings of Contributed Papers, Part I, 47 52, 26. ISBN 8-86732-84-3 MATFYZPRESS Solution of 2D Euler Equations and Application to Airfoil Design J. Šimák Charles University, Faculty of Mathematics

More information

8. Functions (II) Control Structures: Arguments passed by value and by reference int x=5, y=3, z; z = addition ( x, y );

8. Functions (II) Control Structures: Arguments passed by value and by reference int x=5, y=3, z; z = addition ( x, y ); - 50 - Control Structures: 8. Functions (II) Arguments passed by value and by reference. Until now, in all the functions we have seen, the arguments passed to the functions have been passed by value. This

More information

Introduction to Computational Mathematics

Introduction to Computational Mathematics Introduction to Computational Mathematics Introduction Computational Mathematics: Concerned with the design, analysis, and implementation of algorithms for the numerical solution of problems that have

More information

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; }

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; } Ex: The difference between Compiler and Interpreter The interpreter actually carries out the computations specified in the source program. In other words, the output of a compiler is a program, whereas

More information

ambrosys The Taylor series method for ordinary differential equations Karsten Ahnert 1,2 Mario Mulansky 2 December, 8, 2011

ambrosys The Taylor series method for ordinary differential equations Karsten Ahnert 1,2 Mario Mulansky 2 December, 8, 2011 1 The Taylor series method for ordinary differential equations Karsten Ahnert 1,2 Mario Mulansky 2 1 Ambrosys GmbH, Potsdam 2 Institut für Physik und Astronomie, Universität Potsdam December, 8, 2011 ambrosys

More information

CSE 374 Programming Concepts & Tools. Hal Perkins Fall 2015 Lecture 19 Introduction to C++

CSE 374 Programming Concepts & Tools. Hal Perkins Fall 2015 Lecture 19 Introduction to C++ CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 19 Introduction to C++ C++ C++ is an enormous language: All of C Classes and objects (kind of like Java, some crucial differences) Many

More information

Absolute C++ Walter Savitch

Absolute C++ Walter Savitch Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents

More information

Reproducibility in Stochastic Simulation

Reproducibility in Stochastic Simulation Reproducibility in Stochastic Simulation Prof. Michael Mascagni Department of Computer Science Department of Mathematics Department of Scientific Computing Graduate Program in Molecular Biophysics Florida

More information

Efficiency of second-order differentiation schemes by algorithmic differentiation: Case Study

Efficiency of second-order differentiation schemes by algorithmic differentiation: Case Study Efficiency of second-order differentiation schemes by algorithmic differentiation: Case Study Thorsten Lajewski Supervisor: Johannes Lotz STCE, RWTH Aachen May 6, 2013 1 Introduction In numerical calculations

More information

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; }

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; } Ex: The difference between Compiler and Interpreter The interpreter actually carries out the computations specified in the source program. In other words, the output of a compiler is a program, whereas

More information

Floating-point numbers. Phys 420/580 Lecture 6

Floating-point numbers. Phys 420/580 Lecture 6 Floating-point numbers Phys 420/580 Lecture 6 Random walk CA Activate a single cell at site i = 0 For all subsequent times steps, let the active site wander to i := i ± 1 with equal probability Random

More information

5 Assignment 3 [Assignment ID:cpp_arithmetic]

5 Assignment 3 [Assignment ID:cpp_arithmetic] SENG 475 & ECE 596C, Summer 2019 5-1 5 Assignment 3 [Assignment ID:cpp_arithmetic] 5.1 Preamble (Please Read Carefully) Before starting work on this assignment, it is critically important that you carefully

More information

Numerical Computing: An Introduction

Numerical Computing: An Introduction Numerical Computing: An Introduction Gyula Horváth Horvath@inf.u-szeged.hu Tom Verhoeff T.Verhoeff@TUE.NL University of Szeged Hungary Eindhoven University of Technology The Netherlands Numerical Computing

More information

Truncation Errors. Applied Numerical Methods with MATLAB for Engineers and Scientists, 2nd ed., Steven C. Chapra, McGraw Hill, 2008, Ch. 4.

Truncation Errors. Applied Numerical Methods with MATLAB for Engineers and Scientists, 2nd ed., Steven C. Chapra, McGraw Hill, 2008, Ch. 4. Chapter 4: Roundoff and Truncation Errors Applied Numerical Methods with MATLAB for Engineers and Scientists, 2nd ed., Steven C. Chapra, McGraw Hill, 2008, Ch. 4. 1 Outline Errors Accuracy and Precision

More information

Programming Languages Third Edition. Chapter 9 Control I Expressions and Statements

Programming Languages Third Edition. Chapter 9 Control I Expressions and Statements Programming Languages Third Edition Chapter 9 Control I Expressions and Statements Objectives Understand expressions Understand conditional statements and guards Understand loops and variation on WHILE

More information

CS321 Introduction To Numerical Methods

CS321 Introduction To Numerical Methods CS3 Introduction To Numerical Methods Fuhua (Frank) Cheng Department of Computer Science University of Kentucky Lexington KY 456-46 - - Table of Contents Errors and Number Representations 3 Error Types

More information

EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics and Computer Science

EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics and Computer Science EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics and Computer Science Written examination Homologation C++ and Computer Organization (2DMW00) Part I: C++ - on Tuesday, November 1st 2016, 9:00h-12:00h.

More information

SYSTEMS OF NONLINEAR EQUATIONS

SYSTEMS OF NONLINEAR EQUATIONS SYSTEMS OF NONLINEAR EQUATIONS Widely used in the mathematical modeling of real world phenomena. We introduce some numerical methods for their solution. For better intuition, we examine systems of two

More information

Expression Templates (Todd Veldhuizen)

Expression Templates (Todd Veldhuizen) 1 of 8 23-12-2004 12:01 You may also be interested in: Source code for the dvec example in this paper: dexpr.h dvec.h dvec.cpp Template Metaprograms C++ Templates as Partial Evaluation [PS] [HTML] [bibtex]

More information

Software Development with C++ Templates

Software Development with C++ Templates Software Development with C++ Templates Lab Submission 1 Exercises should be solved in groups of two. However, with approval from the lecturer, exercises may also be solved alone or in groups of three.

More information

An Optimization Method Based On B-spline Shape Functions & the Knot Insertion Algorithm

An Optimization Method Based On B-spline Shape Functions & the Knot Insertion Algorithm An Optimization Method Based On B-spline Shape Functions & the Knot Insertion Algorithm P.A. Sherar, C.P. Thompson, B. Xu, B. Zhong Abstract A new method is presented to deal with shape optimization problems.

More information

1. Describe History of C++? 2. What is Dev. C++? 3. Why Use Dev. C++ instead of C++ DOS IDE?

1. Describe History of C++? 2. What is Dev. C++? 3. Why Use Dev. C++ instead of C++ DOS IDE? 1. Describe History of C++? The C++ programming language has a history going back to 1979, when Bjarne Stroustrup was doing work for his Ph.D. thesis. One of the languages Stroustrup had the opportunity

More information

Computer Arithmetic. 1. Floating-point representation of numbers (scientific notation) has four components, for example, 3.

Computer Arithmetic. 1. Floating-point representation of numbers (scientific notation) has four components, for example, 3. ECS231 Handout Computer Arithmetic I: Floating-point numbers and representations 1. Floating-point representation of numbers (scientific notation) has four components, for example, 3.1416 10 1 sign significandbase

More information

Numerical validation using the CADNA library practical work

Numerical validation using the CADNA library practical work Numerical validation using the CADNA library practical work F. Jézéquel, J.-L. Lamotte LIP6 Laboratory, P. and M. Curie University, Paris, France Fabienne.Jezequel@lip6.fr, Jean-Luc.Lamotte@lip6.fr February

More information

G Programming Languages Spring 2010 Lecture 6. Robert Grimm, New York University

G Programming Languages Spring 2010 Lecture 6. Robert Grimm, New York University G22.2110-001 Programming Languages Spring 2010 Lecture 6 Robert Grimm, New York University 1 Review Last week Function Languages Lambda Calculus SCHEME review 2 Outline Promises, promises, promises Types,

More information

Types and Type Inference

Types and Type Inference CS 242 2012 Types and Type Inference Notes modified from John Mitchell and Kathleen Fisher Reading: Concepts in Programming Languages, Revised Chapter 6 - handout on Web!! Outline General discussion of

More information

(Refer Slide Time: 02:59)

(Refer Slide Time: 02:59) Numerical Methods and Programming P. B. Sunil Kumar Department of Physics Indian Institute of Technology, Madras Lecture - 7 Error propagation and stability Last class we discussed about the representation

More information

Chapter 3: Operators, Expressions and Type Conversion

Chapter 3: Operators, Expressions and Type Conversion 101 Chapter 3 Operators, Expressions and Type Conversion Chapter 3: Operators, Expressions and Type Conversion Objectives To use basic arithmetic operators. To use increment and decrement operators. To

More information

UNIT- 3 Introduction to C++

UNIT- 3 Introduction to C++ UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage

More information

10. Functions (Part 2)

10. Functions (Part 2) 10.1 Overloaded functions 10. Functions (Part 2) In C++, two different functions can have the same name if their parameters are different; either because they have a different number of parameters, or

More information

Module 1 Lecture Notes 2. Optimization Problem and Model Formulation

Module 1 Lecture Notes 2. Optimization Problem and Model Formulation Optimization Methods: Introduction and Basic concepts 1 Module 1 Lecture Notes 2 Optimization Problem and Model Formulation Introduction In the previous lecture we studied the evolution of optimization

More information

Semi-automatic transition from simulation to one-shot optimization with equality constraints

Semi-automatic transition from simulation to one-shot optimization with equality constraints Semi-automatic transition from simulation to one-shot optimization with equality constraints Lisa Kusch, Tim Albring, Andrea Walther, Nicolas Gauger Chair for Scientific Computing, TU Kaiserslautern, www.scicomp.uni-kl.de

More information

Programming, numerics and optimization

Programming, numerics and optimization Programming, numerics and optimization Lecture A-4: Object-oriented programming Łukasz Jankowski ljank@ippt.pan.pl Institute of Fundamental Technological Research Room 4.32, Phone +22.8261281 ext. 428

More information

Floating-Point Arithmetic

Floating-Point Arithmetic Floating-Point Arithmetic 1 Numerical Analysis a definition sources of error 2 Floating-Point Numbers floating-point representation of a real number machine precision 3 Floating-Point Arithmetic adding

More information

Driven Cavity Example

Driven Cavity Example BMAppendixI.qxd 11/14/12 6:55 PM Page I-1 I CFD Driven Cavity Example I.1 Problem One of the classic benchmarks in CFD is the driven cavity problem. Consider steady, incompressible, viscous flow in a square

More information

Scientific Computing: An Introductory Survey

Scientific Computing: An Introductory Survey Scientific Computing: An Introductory Survey Chapter 1 Scientific Computing Prof. Michael T. Heath Department of Computer Science University of Illinois at Urbana-Champaign Copyright c 2002. Reproduction

More information

Airfoil shape optimization using adjoint method and automatic differentiation. Praveen. C

Airfoil shape optimization using adjoint method and automatic differentiation. Praveen. C 'th Annual AeSI CFD Symposium, -2 August 2009, Bangalore Airfoil shape optimization using adjoint method and automatic differentiation Praveen. C TIFR Center for Applicable Mathematics Post Bag No. 6503,

More information

Operator overloading

Operator overloading 1 Introduction 2 The copy constructor 3 Operator Overloading 4 Eg 1: Adding two vectors 5 The -> operator 6 The this pointer 7 Overloading = 8 Unary operators 9 Overloading for the matrix class 10 The

More information

IBS Software Services Technical Interview Questions. Q1. What is the difference between declaration and definition?

IBS Software Services Technical Interview Questions. Q1. What is the difference between declaration and definition? IBS Software Services Technical Interview Questions Q1. What is the difference between declaration and definition? The declaration tells the compiler that at some later point we plan to present the definition

More information

Contents. Hilary Term. Summary of Numerical Analysis for this term. Sources of error in numerical calculation. Solving Problems

Contents. Hilary Term. Summary of Numerical Analysis for this term. Sources of error in numerical calculation. Solving Problems Contents Hilary Term 1 Root Finding 4 11 Bracketing and Bisection 5 111 Finding the root numerically 5 112 Pseudo BRACKET code 7 113 Drawbacks 8 114 Tips for success with Bracketing & Bisection 9 115 Virtues

More information

A brief introduction to C++

A brief introduction to C++ A brief introduction to C++ Rupert Nash r.nash@epcc.ed.ac.uk 13 June 2018 1 References Bjarne Stroustrup, Programming: Principles and Practice Using C++ (2nd Ed.). Assumes very little but it s long Bjarne

More information

C++ Programming Fundamentals

C++ Programming Fundamentals C++ Programming Fundamentals 269 Elvis C. Foster Lecture 11: Templates One of the contemporary sophistries of C++ programming is defining and manipulating templates. This lecture focuses on this topic.

More information

Lecture 8. Xiaoguang Wang. February 13th, 2014 STAT 598W. (STAT 598W) Lecture 8 1 / 47

Lecture 8. Xiaoguang Wang. February 13th, 2014 STAT 598W. (STAT 598W) Lecture 8 1 / 47 Lecture 8 Xiaoguang Wang STAT 598W February 13th, 2014 (STAT 598W) Lecture 8 1 / 47 Outline 1 Introduction: C++ 2 Containers 3 Classes (STAT 598W) Lecture 8 2 / 47 Outline 1 Introduction: C++ 2 Containers

More information

Cpt S 122 Data Structures. Course Review Midterm Exam # 2

Cpt S 122 Data Structures. Course Review Midterm Exam # 2 Cpt S 122 Data Structures Course Review Midterm Exam # 2 Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Midterm Exam 2 When: Monday (11/05) 12:10 pm -1pm

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 3 Thomas Wies New York University Review Last week Names and Bindings Lifetimes and Allocation Garbage Collection Scope Outline Control Flow Sequencing

More information

Computational Methods. H.J. Bulten, Spring

Computational Methods. H.J. Bulten, Spring Computational Methods H.J. Bulten, Spring 2017 www.nikhef.nl/~henkjan 1 Lecture 1 H.J. Bulten henkjan@nikhef.nl website: www.nikhef.nl/~henkjan, click on Computational Methods Aim course: practical understanding

More information

COIMBATORE EDUCATIONAL DISTRICT

COIMBATORE EDUCATIONAL DISTRICT COIMBATORE EDUCATIONAL DISTRICT REVISION EXAMINATION JANUARY 2015 STD-12 COMPUTER SCIENCE ANSEWR KEY PART-I Choose the Correct Answer QNo Answer QNo Answer 1 B Absolute Cell Addressing 39 C Void 2 D

More information

Chapter 3 Numerical Methods

Chapter 3 Numerical Methods Chapter 3 Numerical Methods Part 1 3.1 Linearization and Optimization of Functions of Vectors 1 Problem Notation 2 Outline 3.1.1 Linearization 3.1.2 Optimization of Objective Functions 3.1.3 Constrained

More information

Verification and Validation of Turbulent Flow around a Clark-Y Airfoil

Verification and Validation of Turbulent Flow around a Clark-Y Airfoil Verification and Validation of Turbulent Flow around a Clark-Y Airfoil 1. Purpose 58:160 Intermediate Mechanics of Fluids CFD LAB 2 By Tao Xing and Fred Stern IIHR-Hydroscience & Engineering The University

More information

Week 5: Geometry and Applications

Week 5: Geometry and Applications Week 5: Geometry and Applications Introduction Now that we have some tools from differentiation, we can study geometry, motion, and few other issues associated with functions of several variables. Much

More information

2 nd Week Lecture Notes

2 nd Week Lecture Notes 2 nd Week Lecture Notes Scope of variables All the variables that we intend to use in a program must have been declared with its type specifier in an earlier point in the code, like we did in the previous

More information

Development of a Consistent Discrete Adjoint Solver for the SU 2 Framework

Development of a Consistent Discrete Adjoint Solver for the SU 2 Framework Development of a Consistent Discrete Adjoint Solver for the SU 2 Framework Tim Albring, Max Sagebaum, Nicolas Gauger Chair for Scientific Computing TU Kaiserslautern 16th Euro-AD Workshop, Jena December

More information

Estimation d arrondis, analyse de stabilité des grands codes de calcul numérique

Estimation d arrondis, analyse de stabilité des grands codes de calcul numérique Estimation d arrondis, analyse de stabilité des grands codes de calcul numérique Jean-Marie Chesneaux, Fabienne Jézéquel, Jean-Luc Lamotte, Jean Vignes Laboratoire d Informatique de Paris 6, P. and M.

More information

Your first C++ program

Your first C++ program Your first C++ program #include using namespace std; int main () cout

More information

A Distributed Application Server for Automatic Differentiation

A Distributed Application Server for Automatic Differentiation A Distributed Application Server for Automatic Differentiation Boyana Norris and Paul D. Hovland Mathematics and Computer Science Division Argonne National Laboratory 9700 S. Cass Avenue, Argonne, IL 60439-4844

More information

Fortran 90 Two Commonly Used Statements

Fortran 90 Two Commonly Used Statements Fortran 90 Two Commonly Used Statements 1. DO Loops (Compiled primarily from Hahn [1994]) Lab 6B BSYSE 512 Research and Teaching Methods The DO loop (or its equivalent) is one of the most powerful statements

More information

C++ Programming: From Problem Analysis to Program Design, Third Edition

C++ Programming: From Problem Analysis to Program Design, Third Edition C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine

More information

ARTICLE IN PRESS. Topology and its Applications ( )

ARTICLE IN PRESS. Topology and its Applications ( ) S0166-8641(05)0018-7/FLA AID:2822 Vol. ( ) [DTD5] P.1 (1-13) TOPOL:m1a v 1.42 Prn:11/08/2005; 10:03 top2822 by:rita p. 1 Topology and its Applications ( ) www.elsevier.com/locate/topol The topological

More information

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p. Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p. 9 Self-Test Exercises p. 11 History Note p. 12 Programming and

More information

Lecture VIII. Global Approximation Methods: I

Lecture VIII. Global Approximation Methods: I Lecture VIII Global Approximation Methods: I Gianluca Violante New York University Quantitative Macroeconomics G. Violante, Global Methods p. 1 /29 Global function approximation Global methods: function

More information

Object-Oriented Design (OOD) and C++

Object-Oriented Design (OOD) and C++ Chapter 2 Object-Oriented Design (OOD) and C++ At a Glance Instructor s Manual Table of Contents Chapter Overview Chapter Objectives Instructor Notes Quick Quizzes Discussion Questions Projects to Assign

More information

CSC1322 Object-Oriented Programming Concepts

CSC1322 Object-Oriented Programming Concepts CSC1322 Object-Oriented Programming Concepts Instructor: Yukong Zhang February 18, 2016 Fundamental Concepts: The following is a summary of the fundamental concepts of object-oriented programming in C++.

More information

Review Questions 26 CHAPTER 1. SCIENTIFIC COMPUTING

Review Questions 26 CHAPTER 1. SCIENTIFIC COMPUTING 26 CHAPTER 1. SCIENTIFIC COMPUTING amples. The IEEE floating-point standard can be found in [131]. A useful tutorial on floating-point arithmetic and the IEEE standard is [97]. Although it is no substitute

More information

New Mexico Tech Hyd 510

New Mexico Tech Hyd 510 Numerics Motivation Modeling process (JLW) To construct a model we assemble and synthesize data and other information to formulate a conceptual model of the situation. The model is conditioned on the science

More information

CS201 Some Important Definitions

CS201 Some Important Definitions CS201 Some Important Definitions For Viva Preparation 1. What is a program? A program is a precise sequence of steps to solve a particular problem. 2. What is a class? We write a C++ program using data

More information

2 Computation with Floating-Point Numbers

2 Computation with Floating-Point Numbers 2 Computation with Floating-Point Numbers 2.1 Floating-Point Representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However, real numbers

More information

Multiple-Precision Arithmetic Library exflib (C++) FUJIWARA Hiroshi

Multiple-Precision Arithmetic Library exflib (C++) FUJIWARA Hiroshi 1 Multiple-Precision Arithmetic Library exflib (C++) FUJIWARA Hiroshi fujiwara@acs.i.kyoto-u.ac.jp Aug. 01 2006 exflib Exflib (extended precision floating-point arithmetic library) is a simple software

More information

Comparisons of Compressible and Incompressible Solvers: Flat Plate Boundary Layer and NACA airfoils

Comparisons of Compressible and Incompressible Solvers: Flat Plate Boundary Layer and NACA airfoils Comparisons of Compressible and Incompressible Solvers: Flat Plate Boundary Layer and NACA airfoils Moritz Kompenhans 1, Esteban Ferrer 2, Gonzalo Rubio, Eusebio Valero E.T.S.I.A. (School of Aeronautics)

More information

CSE 142 Su 04 Computer Programming 1 - Java. Objects

CSE 142 Su 04 Computer Programming 1 - Java. Objects Objects Objects have state and behavior. State is maintained in instance variables which live as long as the object does. Behavior is implemented in methods, which can be called by other objects to request

More information

Constrained and Unconstrained Optimization

Constrained and Unconstrained Optimization Constrained and Unconstrained Optimization Carlos Hurtado Department of Economics University of Illinois at Urbana-Champaign hrtdmrt2@illinois.edu Oct 10th, 2017 C. Hurtado (UIUC - Economics) Numerical

More information

Abstract Data Types (ADT) and C++ Classes

Abstract Data Types (ADT) and C++ Classes Abstract Data Types (ADT) and C++ Classes 1-15-2013 Abstract Data Types (ADT) & UML C++ Class definition & implementation constructors, accessors & modifiers overloading operators friend functions HW#1

More information

Three dimensional meshless point generation technique for complex geometry

Three dimensional meshless point generation technique for complex geometry Three dimensional meshless point generation technique for complex geometry *Jae-Sang Rhee 1), Jinyoung Huh 2), Kyu Hong Kim 3), Suk Young Jung 4) 1),2) Department of Mechanical & Aerospace Engineering,

More information

Multi-Mesh CFD. Chris Roy Chip Jackson (1 st year PhD student) Aerospace and Ocean Engineering Department Virginia Tech

Multi-Mesh CFD. Chris Roy Chip Jackson (1 st year PhD student) Aerospace and Ocean Engineering Department Virginia Tech Multi-Mesh CFD Chris Roy Chip Jackson (1 st year PhD student) Aerospace and Ocean Engineering Department Virginia Tech cjroy@vt.edu May 21, 2014 CCAS Program Review, Columbus, OH 1 Motivation Automated

More information

Sparsity Detection in Matlab

Sparsity Detection in Matlab Sparsity Detection in Matlab 11th European Workshop on Automatic Differentiation Cranfield University, Shrivenham 9th December 2010 Shaun Forth 1 and Anand Chaturvedi 2 1 Applied Mathematics & Scientific

More information

LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:

LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are: LESSON 1 FUNDAMENTALS OF C The purpose of this lesson is to explain the fundamental elements of the C programming language. C like other languages has all alphabet and rules for putting together words

More information

Abstract Interpretation of Floating-Point. Computations. Interaction, CEA-LIST/X/CNRS. February 20, Presentation at the University of Verona

Abstract Interpretation of Floating-Point. Computations. Interaction, CEA-LIST/X/CNRS. February 20, Presentation at the University of Verona 1 Laboratory for ModElling and Analysis of Systems in Interaction, Laboratory for ModElling and Analysis of Systems in Interaction, Presentation at the University of Verona February 20, 2007 2 Outline

More information

Some questions of consensus building using co-association

Some questions of consensus building using co-association Some questions of consensus building using co-association VITALIY TAYANOV Polish-Japanese High School of Computer Technics Aleja Legionow, 4190, Bytom POLAND vtayanov@yahoo.com Abstract: In this paper

More information

Multiple Choice Style Informatics

Multiple Choice Style Informatics Multiple Choice Style Informatics Jordan Tabov, Emil Kelevedzhiev & Borislav Lazarov I. Introduction. Jordan Tabov was an IMO participant and has been a team leader of the Bulgarian IMO team. He graduated

More information

An interesting related problem is Buffon s Needle which was first proposed in the mid-1700 s.

An interesting related problem is Buffon s Needle which was first proposed in the mid-1700 s. Using Monte Carlo to Estimate π using Buffon s Needle Problem An interesting related problem is Buffon s Needle which was first proposed in the mid-1700 s. Here s the problem (in a simplified form). Suppose

More information

Introduction to C++ Systems Programming

Introduction to C++ Systems Programming Introduction to C++ Systems Programming Introduction to C++ Syntax differences between C and C++ A Simple C++ Example C++ Input/Output C++ Libraries C++ Header Files Another Simple C++ Example Inline Functions

More information

Review: C++ Basic Concepts. Dr. Yingwu Zhu

Review: C++ Basic Concepts. Dr. Yingwu Zhu Review: C++ Basic Concepts Dr. Yingwu Zhu Outline C++ class declaration Constructor Overloading functions Overloading operators Destructor Redundant declaration A Real-World Example Question #1: How to

More information

Faculty of Mechanical and Manufacturing Engineering, University Tun Hussein Onn Malaysia (UTHM), Parit Raja, Batu Pahat, Johor, Malaysia

Faculty of Mechanical and Manufacturing Engineering, University Tun Hussein Onn Malaysia (UTHM), Parit Raja, Batu Pahat, Johor, Malaysia Applied Mechanics and Materials Vol. 393 (2013) pp 305-310 (2013) Trans Tech Publications, Switzerland doi:10.4028/www.scientific.net/amm.393.305 The Implementation of Cell-Centred Finite Volume Method

More information

Introduction to Automatic Differentiation

Introduction to Automatic Differentiation Introduction to Automatic Differentiation PLEIAD Seminar, Universidad de Chile 27 Nov. 2009 Santiago de Chile Outline of the talk Automatic Differentiation (AD) Definition by example Forward and reverse

More information

Development of quadruple precision arithmetic toolbox QuPAT on Scilab

Development of quadruple precision arithmetic toolbox QuPAT on Scilab Development of quadruple precision arithmetic toolbox QuPAT on Scilab Tsubasa Saito 1, Emiko Ishiwata 2, and Hidehiko Hasegawa 3 1 Graduate School of Science, Tokyo University of Science, Japan 2 Tokyo

More information

Wednesday 18 May 2016 Morning

Wednesday 18 May 2016 Morning Oxford Cambridge and RSA Wednesday 18 May 016 Morning AS GCE MATHEMATICS (MEI) 4751/01 Introduction to Advanced Mathematics (C1) QUESTION PAPER * 6 8 8 5 4 5 4 4 * Candidates answer on the Printed Answer

More information