SAINT LOUIS UNIVERSITY
Madrid Campus
Faculty of Sciences and Engineering
First Mid-Term Exam
CSCI-145: Introduction to Scientific Programming
Fall 2014
Fairouz Medjahed
Exercise 1
1. Write the matlab command to create vector A of 20 values made of random

Saint Louis University- Madrid Campus
Division of Sciences, Engineering and Nursing
CSCI-145
Instructor: Fairouz Medjahed
Homework 4
Deadline: 02/12/2014
Exercise 1
Using a while loop, write a matlab script that approximates the value of (Pi=3.14.) by sum

Instructor: Fairouz Medjahed
CSCI145: Homework 2
Deadline 16/10/2014
What to Submit
You should submit your Homework by email to [email protected] Save all the matlab
commands in a unique script file with the name yourname_hm2.m. Each exercise of the
homework

Saint Louis University
Faculty of Sciences and Mathematics
CSCI-145
Instructor: Fairouz Medjahed
Project
Presentations will be programmed on Thursday 11/12 at class time
Deadline 11/12/2014
What to do:
Choose one of the project A, B, C or D to work on. By

1. Given x = [3 1 5 7 9 2 6], explain what the following commands "mean"
by
by summarizing the net result of the command.
a.
b.
c.
d.
e.
f.
g.
x(3)
x(1:7)
x(1:end)
x(1:end-1)
x(6:-2:1)
x([1 6 2 1 1])
sum(x)
2. Given the array A = [ 2 4 1 ; 6 7 2 ; 3 5 9],

Instructor: Fairouz Medjahed
CSCI145: Homework 3
Deadline 6/11/2014
What to Submit
You should submit your Homework by email to [email protected] Save all the matlab
commands in a unique script file with the name yourname_hm3.m. Each exercise of the
homework s

Exercises for final exam
Exercise 1
Write a script that will input a number in decimal system and code it into binary
code,
e.g.,12 will be converted to 1100 i.e 1*23+1*22+0*21+0*20
Exercise 2
Write a script to find all the prime numbers less than a given