Assignments |
Class Photo |
Course Home |
Lab Hours/Tutoring |
MATLAB info |
Schedule |
Submit
|
Computer Science 145
Scientific Programming
Spring 2009 |
|
Assignment
01
Use of scalars and operator precedence
Contents:
Overview
Topic: Use of scalars and operator precedence
Related Reading: Ch. 2 as well as coverage of scalars from lecture
Due:
Wednesday, 21 January 2009, 11:59pm
Please make sure you adhere to the policies on
academic integrity.
Problems to be Submitted (20 points)
You are to submit a single m-file that outputs the resulting
assignments for each of the following problems, in the given order.
Please make sure that your name is given in comments at the beginning
of the m-file and ensure that no output is generated by your scripts
other than the resulting answers.
Submit your m-file in accordance with cs.slu.edu/~goldwasser/145/submit.
- Problem A)
- Calculate and display the variable
- Problem B)
- Calculate and display the variable
- Problem C)
- Set the variable and then calculate and display
- Problem D)
- The number of ways of choosing objects out of a set of
objects can be computed as
where can be computed as factorial(n) in MATLAB.
Set the variables
and then compute and display
- Problem E)
- An earthquake with magnitude on the Richter scale releases
energy (in Joules) according to the formula,
Calculate and display the variable
- Problem F)
- According to the syllabus, late work submitted for this course
receives the grade of
where represents the grade the work would have recieved had it been on
time, and is the amount of time (in hours) that the work was late.
Set the variables
to represent work that would have
received a score of 95 if not penalized, but which was turned in 20
hours late.
Calculate and display the variable
- Problem G)
- The distance from a point to a line
is given by
Set the variables
and then
calculate and display
Note: you may use built-in functions sqrt and abs.
Michael Goldwasser
CSCI 145, Spring 2009
Last modified: Monday, 19 January 2009
Assignments |
Class Photo |
Course Home |
Lab Hours/Tutoring |
MATLAB info |
Schedule |
Submit