1 / 68

SYCS 165 SCIENTIFIC COMPUTING FOR ENGINEERS

SYCS 165 SCIENTIFIC COMPUTING FOR ENGINEERS. Ronald J. Leach. From the Catalog. Introduces programming and use of digital computers. Programming includes general problem-solving and the systematic development of algorithms

mvaughan
Télécharger la présentation

SYCS 165 SCIENTIFIC COMPUTING FOR ENGINEERS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SYCS 165 SCIENTIFIC COMPUTING FOR ENGINEERS Ronald J. Leach

  2. From the Catalog • Introduces programming and use of digital computers. • Programming includes general problem-solving and the systematic development of algorithms • Use includes the coding of programs and practical experience in operating computers and peripheral equipment.

  3. Purpose of course • Educate STEM students in the use of three types of software to solve appropriate problems in their major fields: • Spreadsheets • Symbolic computation using computer algebra systems • Numerical computation using standard modern computer languages, primarily C.

  4. Why do this? • A new paradigm – data driven science. • Data modeling, analysis, and simulation are becoming increasingly important in STEM.

  5. Why three types of software? • There are different types of applications. • There are differences in resources. • There are differences in what you have to interface with.

  6. Excel spreadsheets

  7. Why spreadsheets? • Spreadsheets are readily available. • They have surprising functionality. • The Excel spreadsheet software may be free to students at Howard University due to the special Howard-Microsoft connection.

  8. Other spreadsheets • Open Office – available for Apple, Windows, and Linux computers – free download from OpenOffice.org. • The spreadsheet is Calc • Numbers – available for Apple computers –not usually free.

  9. Excel capabilities • Many functions are available for • Statistical computations • Graphing • Arrays • Matrices • etc

  10. Functions – a glorified calculator • ABS Returns the absolute value of a number • ACOS Returns the arccosine of a number • ACOSH Returns the inverse hyperbolic cosine of a number • ASIN Returns the arcsine of a number • ASINH Returns the inverse hyperbolic sine of a number • ATAN Returns the arctangent of a number • ATAN2 Returns the arctangent from x- and y-coordinates • ATANH Returns the inverse hyperbolic tangent of a number

  11. CEILING Rounds a number to the nearest integer or to the nearest multiple of significance • COMBIN Returns the number of combinations for a given number of objects • COS Returns the cosine of a number • COSH Returns the hyperbolic cosine of a number • DEGREES Converts radians to degrees • EVEN Rounds a number up to the nearest even integer • EXP Returns e raised to the power of a given number

  12. FACT Returns the factorial of a number • FACTDOUBLE Returns the double factorial of a number • FLOOR Rounds a number down, toward zero • GCD Returns the greatest common divisor • INT Rounds a number down to the nearest integer • LCM Returns the least common multiple • LN Returns the natural logarithm of a number • LOG Returns the logarithm of a number to a specified base • LOG10 Returns the base-10 logarithm of a number

  13. ODD Rounds a number up to the nearest odd integer • PI Returns the value of pi • POWER Returns the result of a number raised to a power • PRODUCT Multiplies its arguments • QUOTIENT Returns the integer portion of a division • RADIANS Converts degrees to radians • ROMAN Converts an arabic numeral to roman, as text • ROUND Rounds a number to a specified number of digits • ROUNDDOWN Rounds a number down, toward zero • ROUNDUP Rounds a number up, away from zero

  14. SIGN Returns the sign of a number • SIN Returns the sine of the given angle • SINH Returns the hyperbolic sine of a number • SQRT Returns a positive square root • SQRTP Returns the square root of (number * pi) • TAN Returns the tangent of a number • TANH Returns the hyperbolic tangent of a number • TRUNC Truncates a number to an integer

  15. Some Array and Matrix Functions • MDETERM Returns the matrix determinant of an array • MINVERSE Returns the matrix inverse of an array • MMULT Returns the matrix product of two arrays • SUMX2MY2 Returns the sum of the difference of squares of corresponding values in two arrays • SUMX2PY2 Returns the sum of the sum of squares of corresponding values in two arrays • SUMXMY2 Returns the sum of squares of differences of corresponding values in two arrays

  16. Some Statistical Functions • AVERAGE Returns the average of its arguments • DEVSQ Returns the sum of squares of deviations • LINEST Returns the parameters of a linear trend • LOGEST Returns the parameters of an exponential trend • MEDIAN Returns the median of the given numbers • MODE Returns the most common value in a data set • STDEV Estimates standard deviation based on a sample • TDIST Returns the Student's t-distribution • … • …

  17. Functions in Excel • Easy to create in the Visual Basic editor • Standard syntax Function Fcn_Name (arg) Fcn_Name = xxx End Function

  18. User-defined Functions in Excel • Easy to create in the Visual Basic editor • Standard syntax – reserved words Function Fcn_Name (arg) Fcn_Name = xxx End Function

  19. Example Function Square_It(num) Square_It = num * num End Function (Create in VB Macro editor – use the Tools menu)

  20. Numerical Computations

  21. Numerical computation • Standard technique for many complex problems • Many well-established libraries of subprograms • Works well on many classes of supercomputers • Most numerical approximation is applied linear algebra

  22. An old Cray vector supercomputer

  23. A lot of hand craftsmanship • Wires had to be cut by hand to make sure there were no timing delays or bottlenecks • The speed of light was too slow to have several of these older machines act in tandem.

  24. Alliant FX-8

  25. Supercomputers • Vector computers could do vector operations (+, -) in a single clock cycle for long vectors 256 or more entries. • Parallel computers could do computations in parallel (think dual-core, but much larger) • The good scientific developers had the target computer’s architecture in mind when developing algorithms and programs

  26. A cheaper idea- clusters • Originally, place multiple CPUs in racks, with an operating system to control communication of data and instructions. • Now, place boards with many processors in racks with an operating system to control communication of data and instructions.

  27. Many types of clusters • Linux • Windows • Mac

  28. Even “cheap” machines are expensive • To buy • To operate • utilities • To program

  29. Good quality numerical software • Extensive libraries geared to the particular machine’s architecture. • Nearly all the most useful numerical libraries are written in FORTRAN or C. • Often interface with other languages.

  30. We won’t be using supercomputers or clusters as a basic part of this course. • Exception – some students will do some of their C programming on a cluster, depending on the situation and the needs of their major. • Personal computers are sufficient for an introductory course

  31. Computer Algebra Systems

  32. Why three types of software? • Computer algebra systems can: • Create exact answers to problems • Produce infinite-precision arithmetic (a better term is “unlimited-precision”) • Many well-tested routines • Perform mathematical calculation in fields such as algebra and calculus much muchmuch better than humans

  33. What about computer algebra systems? • Run on many computers, even some parallel computers and clusters • Not much gain by running on vector machines

  34. TI Explorer 2 – a “Lisp Machine”

  35. Computer algebra systems • Many of the older ones were written in Lisp (a language often used for AI) • Macsyma • Maxima • MuMath • Derive • Some use C (Maple) • Hard to tell for Mathematica, Matlab

  36. One unfortunate flaw of CAS • They run out of room! • The CAS will generate lists (in Lisp, C, or whatever language) as necessary. • Sometimes these lists stay in memory even after they are no longer needed. • This means that memory can be exhausted.

  37. Types of arithmetic • Integer • Real (or floating point) • Extended precision (double precision) • Complex • Other?

  38. Integer arithmetic • Often limited by the size of a computer “word” • Integers can be too big or small • Largest unsigned integer in a 32-bit machine is 232 – 1 • Largest positive integer in a 32-bit machine is 231 – 1 • Smallest unsigned integer in a 32-bit machine is often - 231

  39. Arithmetic with decimals Floating point arithmetic: • Has largest and smallest numbers. • Has positive number that is closest to 0. • Has negative number that is closest to 0. • Has truncation errors (3.14 is not 3.14159) • Has round-off errors (3.14 * 3.14 is 9.8596)

  40. Arithmetic with decimals, cont. Fixed point arithmetic • Usually two decimal places • Round-off can be severe • Who stole my bank interest example • No problem with smallest positive number

  41. CAS • Can have “infinite precision” or, at least, “unlimited precision” • The trade-off is that arithmetic takes much longer and requires more space

  42. For next class • Download Maxima from sourceforge.net and install it, along with some documentation. • Bring laptop to class.

  43. MAXIMA

  44. maxima.sourceforge.net/misc/maxima-opinions.pdf

  45. There are many computer algebra systems • Maxima (successor to Macsyma) • MIT Macsyma, later to Symbolics • DOE Macsyma • Now free under GPL • Can use, modify, bundle according to Gnu Public License • Must release source code in any development

  46. All CAS packages are powerful

  47. Other high quality software • Mathematica • Elaborate, good graphics • Student versions available for yearly license • Some university-wide licenses (here?) • Matlab • Currently available in CLDC • Maple • Canadian-made

More Related