Lecture-02.2 - Week 2.2 CSE 1540.03 January 11, 2012...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 1540.03 Week 2.2 January 11, 2012 Assignment Statement variable = expression Examples: i = 1 the two most common i = i + 1 assignment statements c = 5*(f-32)/9 x = 2.5 y = sin(x) + 3.14159 z = x / 10 n = m / 10 gives quotient from integer long division Worries: - unassigned variables - type conversion (on assignment) x = i (real integer) O.K. i = x (integer real) loses fraction part Arithmetic Expressions in Fortran - Convert two-dimensional mathematical notation to one-dimensional computer notation Example: a ac b b 2 4 2 - + - becomes: (-b + sqrt(b*b – 4*a*c))/(2*a) Built-in Functions (see Appendix 3 of textbook) Elementary Math sqrt(x) square root ( ) exp(x) exponential ( x e ) abs(x) absolute value alog(x) natural logarithm (base e , ln) alog10(x) base 10 log Trigonometric Functions sin(x) sine of angle x in radians cos(x) cosine of angle x in radians atan(x) arctangent of angle x in radians asin(x) arcsine of angle x in radians CSE 1540 Week 2.2 – January 11, 2012 page 1 of 2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
sinh(x) hyperbolic sine of angle x in radians Type Conversion Functions nint(x) rounds real x to integer
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/13/2012 for the course CSE 1540 taught by Professor Hofbauer during the Winter '12 term at York University.

Page1 / 2

Lecture-02.2 - Week 2.2 CSE 1540.03 January 11, 2012...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online