Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 EPSII 59:006 Spring 2004. 2 Real Engineering Problem Solving Analyzing Results of Designs is Paramount Problems are Difficult, Code Writing Exhaustive.

Similar presentations


Presentation on theme: "1 EPSII 59:006 Spring 2004. 2 Real Engineering Problem Solving Analyzing Results of Designs is Paramount Problems are Difficult, Code Writing Exhaustive."— Presentation transcript:

1 1 EPSII 59:006 Spring 2004

2 2 Real Engineering Problem Solving Analyzing Results of Designs is Paramount Problems are Difficult, Code Writing Exhaustive 2-D Model of Oxygen Distribution in a Cell with Consumption at the Mitochondria (Tilakaratne et al., Mathematical Biosciences, 2002)

3 3 Real Engineering Problem Solving  Engineers Need to Concentrate on Solutions without Writing All Code  Can Use a Number of “Packages” Mathematica Maple Matlab IMSL Many Others

4 4 Real Engineering Problem Solving  Care in Using ‘Packaged’ Programming Engineering Savvy Needed to Verify Results Some ‘Packages’ Do Not Explain Methodology (This Can Have Significant Impact on Results) For Important Work, Choose Code that is Engineering Friendly (Not Necessarily User Friendly)  Understanding Code Writing is Paramount for the Best Engineers

5 5 Focus: IMSL C Functions

6 6 IMSL C Functions Provide Sophisticated Code that Is Well Documented Requires Simple C Program Front-end Call IMSL Functions That Are Needed Functions Information on the Algorithm is Well Documented Give Clear Examples that can be Used to Develop Your Code

7 7 IMSL Usage IMSL C libraries are compiled into shared and static libraries  Shared Libraries References to the IMSL subroutines are resolved at run time. Your executable program is significantly smaller because it does not contain the actual code for the IMSL subroutines.  Static Libraries means that the actual IMSL subroutine code is included in your executable The libraries are single- and double-precision To access any IMSL subprograms you must bind your own compiled program with the IMSL Libraries.

8 8 How IMSL Used in Your Code #include main() { int n = 7; int i; float p[7]; float *q; float pi; pi = imsl_f_constant("pi", 0); /* fill p with a pure sine wave */ for (i=0; i<n; i++) p[i] = sin((float)(i+1)*pi/(float)(n+1)); q = imsl_f_fft_sine (n, p, 0); printf (" index\t p\t q\n"); for (i=0; i<n; i++) printf("\t%1d\t%5.2f\t%5.2f\n", i, p[i], q[i]); } Included IMSL Library IMSL functions that are called

9 9 IMSL Math Subprograms (>400) Linear systems Eigensystem analysis Interpolation and approximation Integration and differentiation Differential equations transforms Nonlinear equations Optimization basic matrix/vector operations

10 10 IMSL Math Special Functions Fundamental functions Trigonometric and hyperbolic functions Exponential integrals and related functions Error function and related functions Bessel functions Kelvin functions Bessel functions of fractional order Elliptic integrals Weierstrass elliptic functions Probability distribution functions and inverses Miscellaneous functions

11 11 IMSL STAT Subprograms (>350) Basic statistics Regression Correlation Analysis of variance Categorical and discrete data analysis Nonparametric statistics Tests of goodness of fit and randomness Time series analysis and forecasting Covariance structures and factor analysis Discriminant analysis Cluster analysis Survival analysis, life testing and reliability Multidimensional scaling Density and hazard estimation Line printer graphics Probability distribution functions and inverses Random number generation

12 12 IMSL at Iowa C Numerical Library, HP PA-RISC HP-UX, Shared (32-bit):5.000 C Numerical Library, HP PA-RISC HP-UX, Static (32-bit):5.000 C Numerical Library Online Documentation:5.000 Currently Need to Use PA-RISC machines

13 13 IMSL How to Configure Environment for IMSL Functions Login login-pa.engineering.uiowa.edu To configure your environment, source the setup procedure in a shell:  C shell users, type: L-ecn041% source /usr/ui/class/aux/imsl_setup.csh  Bash shell users, type: bash-2.04$ source /usr/ui/class/aux/imsl_setup.sh  Korn shell users, type: $. /usr/ui/class/aux/imsl_setup.sh

14 14 IMSL How to Access Documentation On HP PA-RISC HP-UX Left Mouse Click Comm App IMSL IMSL Manuals Working on Accessing IMSL Manuals through WebCT

15 15 IMSL Manual Front Interface Links to C Function Libraries

16 16 IMSL How to Compile and Link to IMSL Functions for code prog.c $cc -o prog.exe $CFLAGS prog.c $LINK_CNL (IMSL MAY NOT RUN WITH THE gcc COMPILER)

17 17 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations Here when the correct x 1 and x 2 are found

18 18 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations Check IMSL Manual to See How (and If) IMSL Functions Can Help You Click here, Go to Chapter 7: Nonlinear Equations

19 19 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations

20 20 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations IMSL Offers a Number of Function Options Your Background Knowledge and IMSL Information Help You Make a Decision Let Try

21 21 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations The Information Provided Is At First Overwhelming Overview Contains Pertinent Information of Parameters and the Algorithm Used to Solve Problem Examples Very Useful for Providing Insight to Problem

22 22 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations

23 23 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations

24 24 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations

25 25 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations

26 26 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations

27 27 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations Use the Example to Begin Understanding and To Build Your Problem First, Make Sure the Example Problem You Choose Works!

28 28 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations Example 1. C Code

29 29 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations Example 1. Output The solution to the system is 1 2 0 3 Check solution. These are the values for x 1 and x 2, respectively

30 30 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations Now Our Problem (vics_problem) Review Example 1 Information Recognize Where the Input Function for Their System of Equations Were Placed in the Code

31 31 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations Now our problem (vics_problem) Modify function fcn for our problem as first test : void fcn(int n, float x[], float f[]) { f[0] = 3.0 * x[0] * x[0] + 4.0 * x[1] - 399.0; f[1] = x[0] + 2.0 * x[1] - 167.0; }

32 32 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations Our Problem Output Check solution. These are the values for x 1 and x 2, respectively! The solution to the system is 1 2 5 81

33 33 IMSL Example 1: 2 x 2 System of Non-Linear Algebraic Equations Make sure solution makes sense Can modify code to get correct initial guess (Example 2) Knowledge of numerical methods help better understand algorithms


Download ppt "1 EPSII 59:006 Spring 2004. 2 Real Engineering Problem Solving Analyzing Results of Designs is Paramount Problems are Difficult, Code Writing Exhaustive."

Similar presentations


Ads by Google