Introduction to GSL CS 3414 From GNU Scientific Library Reference Manual at http://sources.redhat.com/gsl/ref/gsl-ref_toc.html http://www.gnu.org/software/gsl/manual/html_node/

Slides:



Advertisements
Similar presentations
Introduction to C++ An object-oriented language Unit - 01.
Advertisements

Introduction to C Programming
Intro into real world numerical libraries/packages.
Lecture 5 Newton-Raphson Method
Polynomial Approximation PSCI 702 October 05, 2005.
Programming Languages and Paradigms The C Programming Language.
CSE 330: Numerical Methods
Introduction to Programming Lesson 1. Objectives Skills/ConceptsMTA Exam Objectives Understanding Computer Programming Understand computer storage and.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
Wednesday, 10/9/02, Slide #1 CS 106 Intro to CS 1 Wednesday, 10/9/02  QUESTIONS ??  Today:  Discuss HW #02  Discuss test question types  Review 
 2007 Pearson Education, Inc. All rights reserved C Functions.
CS 497C – Introduction to UNIX Lecture 3: Inside UNIX Chin-Chih Chang
Guide To UNIX Using Linux Third Edition
COMP1170 Midterm Preparation (March 17 th 2009) Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education.
MathMore Lorenzo Moneta, Andràs Zsenei ROOT Workshop 30/9/2005.
Fundamentals of Python: From First Programs Through Data Structures
 Introduction Introduction  Types of Function Types of Function  Library function Library function  User defined function User defined function 
MATH 685/ CSI 700/ OR 682 Lecture Notes Lecture 8. Nonlinear equations.
Fundamentals of Python: First Programs
Wavelet Transforms CENG 5931 GNU RADIO INSTRUCTOR: Dr GEORGE COLLINS.
Numerical Methods Applications of Loops: The power of MATLAB Mathematics + Coding 1.
Introduction to GSL CS 3414 From GNU Scientific Library Reference Manual at
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. C How To Program - 4th edition Deitels Class 05 University.
Chapter 06 (Part I) Functions and an Introduction to Recursion.
Chapter 1 Introduction to Computers and C++ Programming Goals: To introduce the fundamental hardware and software components of a computer system To introduce.
Computer Science Department Data Structure & Algorithms Lecture 8 Recursion.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Programming in C++ Language ( ) Lecture 5: Functions-Part1 Dr. Lubna Badri.
Numerical Methods for Engineering MECN 3500
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
Lecture 5 - Single Variable Problems CVEN 302 June 12, 2002.
Numerical Methods Solution of Equation.
Chapter 10: Classes and Data Abstraction. Objectives In this chapter, you will: Learn about classes Learn about private, protected, and public members.
12/22/ Thread Model for Realizing Concurrency B. Ramamurthy.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming Introduction to simple functions.
Chapter 6 Questions Quick Quiz
SOLVING NONLINEAR EQUATIONS. SECANT METHOD MATH-415 Numerical Analysis 1.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
Repetition Statements (Loops). 2 Introduction to Loops We all know that much of the work a computer does is repeated many times. When a program repeats.
Chapter 10: Classes and Data Abstraction. Classes Object-oriented design (OOD): a problem solving methodology Objects: components of a solution Class:
MathMore Lorenzo Moneta, Andràs Zsenei ROOT Meeting 19/8/2005.
1 CSE1301 Computer Programming: Where are we now in the CSE1301 syllabus?
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
Introduction to Programming Lesson 1. Algorithms Algorithm refers to a method for solving problems. Common techniques for representing an algorithms:
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
 Pearson Education, Inc. All rights reserved Methods: A Deeper Look.
BIL 104E Introduction to Scientific and Engineering Computing Lecture 4.
Chapter 15 - C++ As A "Better C"
The Machine Model Memory
Root Finding Methods Fish 559; Lecture 15 a.
APPENDIX a WRITING SUBROUTINES IN C
Introduction to C++ Systems Programming.
Programming Languages and Paradigms
Programming Paradigms
C Basics.
Programmazione I a.a. 2017/2018.
Functions.
Chapter 5 - Functions Outline 5.1 Introduction
Realizing Concurrency using Posix Threads (pthreads)
Realizing Concurrency using the thread model
COP 3502.
Introduction C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell.
SOLUTION OF NONLINEAR EQUATIONS
Realizing Concurrency using Posix Threads (pthreads)
Realizing Concurrency using the thread model
Presented By: Darlene Banta
Based on slides created by Bjarne Stroustrup & Tony Gaddis
Introduction to Programming
Functions Imran Rashid CTO at ManiWeber Technologies.
SPL – PS1 Introduction to C++.
Presentation transcript:

Introduction to GSL CS 3414 From GNU Scientific Library Reference Manual at http://sources.redhat.com/gsl/ref/gsl-ref_toc.html http://www.gnu.org/software/gsl/manual/html_node/

What is GSL? The GNU Scientific Library GNU is a recursive acronym for "GNU's Not Unix!”, a project started in 1983 by Richard Stallman GNU is an operating system (HURD kernel) and an extensive collection of computer software GSL is a numerical library for C and C++ programmers GSL is free software distributed under the terms of the GNU General Public License The combination of GNU software and the Linux kernel is commonly known as Linux 

Functionality GSL provides a well-defined C language Applications Programming Interface (API) for common numerical functions, such as: Random Numbers Least-Squares Fitting Fast Fourier Transforms Root-Finding Minimization Etc. http://www.gnu.org/software/gsl/manual/html_node/ GSL is thread-safe (the library can be used in multi-threaded programs)

Compiling and Linking The library header files are installed in their own “gsl” directory. You should write include statements with a “gsl/” directory prefix like: #include <gsl/gsl_math.h> Compile: gcc -c example.c Link: gcc example.o -lgsl -lgslcblas -lm

One dimensional Root-Finding The header file `gsl_roots.h' contains prototypes for the root finding functions and related declarations. The library provides low level components for a variety of iterative solvers and convergence tests. These can be combined by the user to achieve the desired solution, with full access to the intermediate steps of the iteration.

Root Finding Algorithms Two classes of algorithms root bracketing algorithms begin with a bounded region known to contain a root uses only function evaluations (not derivatives) guaranteed to converge root polishing algorithms improve an initial guess to the root require both the function and its derivative to be supplied by the user converge only if started “close enough” to a root

Framework The user provides a high-level driver for the algorithms. The library provides the individual functions necessary for each of the steps. There are three main phases of the iteration. The steps are, initialize solver state, s, for algorithm T update s using the iteration T test s for convergence, and repeat iteration if necessary The state for solver is held in a gsl_root_fsolver struct (a declaration for a grouped list of variables in C) or in gsl_root_fdfsolver struct.

Initializing the Solver gsl_root_fsolver * gsl_root_fsolver_alloc (const gsl_root_fsolver_type * T ) This function returns a pointer to a newly allocated instance of a solver of type T void gsl_root_fsolver_free (gsl_root_fsolver * s) This function frees all the memory associated with the solver s.

Providing the function to solve Data Type: gsl_function This data type defines a general function with parameters. double (* function) (double x, void * params) this function should return the value f(x,params) for argument x and parameters params void * params a pointer to the parameters of the function

Iteration int gsl_root_fsolver_iterate (gsl_root_fsolver * s) perform a single iteration of the solver to update its state s double gsl_root_fsolver_root (const gsl_root_fsolver * s) The solver maintains a current best estimate of the root at all times.

Search Stopping Parameters A root finding procedure should stop when one of the following conditions is true: A root has been found to within the user-specified precision. A user-specified maximum number of iterations has been reached. An error has occurred.

Precision Test int gsl_root_test_interval (double x_lower, double x_upper, double epsabs, double epsrel) |a - b| < epsabs + epsrel min(|a|,|b|)

Root Bracketing Algorithms bisection algorithm - gsl_root_fsolver_bisection false position algorithm - gsl_root_fsolver_falsepos Brent-Dekker method - gsl_root_fsolver_brent

Root Finding Algorithms using Derivatives Newton's Method - gsl_root_fdfsolver_newton secant method (a simplified version of Newton's method which does not require the computation of the derivative on every step) - gsl_root_fdfsolver_secant Steffenson Method - gsl_root_fdfsolver_steffenson

Resource Read GNU Scientific Library Reference Manual at http://sources.redhat.com/gsl/ref/gsl-ref_toc.html