{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture-02.2

# Lecture-02.2 - Week 2.2 CSE 1540.03 Arithmetic Expressions...

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

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

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

View Full Document
sinh(x) hyperbolic sine of angle x in radians Type Conversion Functions nint(x) rounds real x to integer
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 2

Lecture-02.2 - Week 2.2 CSE 1540.03 Arithmetic Expressions...

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

View Full Document
Ask a homework question - tutors are online