BCEE 231 Homework SET #1
P1.1 (25 marks)
Given the first two coefficients
=
a0 0=
& a1 1 , the subsequent
coefficients are to be generated by the following recurrence relation 1:
an =
an 1 + an 2
for n =
2,3,
Write the computer program that produces the f
BCEE231 Programming for Building and Civil Engineers
Assignment #1
Catherine Nguyen (7384971)
Tutorial section M MA
Professor Sangsoo Han
Due date:
10 October 2014
Summary
P1.1
a) The problem asks to show that the equation E1 will be equal to 0.5 as x app
HW#2
Problem 1
The square root of a value V can be found using either one of the
following iterative formulas:
Formula (A)
r2
1
V
r1
2
r1
Formula (B)
r2
r1 (r12 3V )
3r12 V
where r1 is the previously estimated root.
Your task is to find out which of
BCEE 231 Homework Set #2
P2.1 (15 marks)
Complete the following functions to accomplish the tasks specified in
the program:
Ln(float xo, float Err)
cfw_ /* Compute and return ln(xo+1) (with Estimated Error
less than Err) using the recurrence relation in A
SAMPLE EXAMINATION QUESTIONS Chapter 1
The midterm (final exam) will have up to 8 (25) questions for 1 (3) hours. Adjacent students will have
different exams.
Special instructions: Closed book. No calculators. A nonelectronic dictionary is permitted.
A)
Exam
Name
MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.
1) On May 18, 1980, which Cascades volcano blew its top with the largest eruption in North America
in recorded history?
A) Mt. Shasta, CA
B)
Chapter 9
Graphs, Derivatives, and
Integrals of Functions of One Variable
In the fall of 1972 President
Nixon announced that the rate
of increase of inflation was
decreasing. This was the first
time a sitting president used the
third derivative to advance
Chapter 12
Tabular Data: Interpolation and
Least Squares Curve Fitting
Undertake something that is
difficult; it will do you good.
Unless you try to do something
beyond what you have already
mastered, you will never grow.
Ronald E. Osborn
12.1 The Issues
Chapter 7
Matrix Algebra and Systems
of Linear Equations
While one person hesitates
because he feels inferior, the
other is busy making mistakes and
becoming superior  Henry C. Link
7.1 Vectors .2
1. Definitions and Operations .2
2. Meaning of the Comput
Chapter 2
Program Design and Control Structures
A failure is a man who has blundered
but is not able to cash in on the
experience  Elbert Hubbard
2.1 Programs and Programming . 2
1. Flowchart: The Sequence of Logical Steps . 3
Review Questions 2.1 . 4
2.
Chapter 4
Programming with Arrays
But the fruit that can fall without
shaking,
Indeed is too mellow for me.
 Lady Mary Wortley Montagu
4.1 Array Variables: One Name for Many Storage Boxes . 2
4.2 Working with Array Elements using Loops. 6
Example 4.1 . 6
Chapter 3
Customized Power Tools:
UserDefined Functions
Each problem that I solved
became a rule which served
afterwards to solve other
problems Ren Descartes
3.1 Introduction. 2
3.2 Functions for Task Division . 3
1. Task Division . 3
2. Data Communica
Part II: Application of Procedural Programming
Chapter 5: Application to Problems on
Statics of Particles
The purpose of computing
is insight, not numbers.
 Hamming
5.1 Resultant of Forces . 2
1. The Resultant of 2D Forces . 2
Exercise 5.1 . 4
2. Compon
Structured Programming and
Applications for Engineers
Lecture notes for
BCEE 231
by K. H. Ha, Ph. D.
Professor of Engineering
Concordia University
Copyright by K. H. Ha, 2012
K. H. Ha  BCEE 231 Chapter 1  v3
1.i
Preface
"When I learned to program, you
BCEE ASSIGNMENT #3
ROMEO CRAIG JULATON
27741502
PROF. ALI NAZEMI
11/14/2016
P3.1
Output:
Magic square order 3
Magic square order 5
Magic square order 7
Magic square order 9
P3.2
Output:
The output of this program resulted in the length of the residual vec
Chapter 10
Partial Derivatives and
Multiple Integrals
He who has a why can endure
any how  Friedrich Nietzsche
10.1 Functions of Many Variables. 2
10.2 Plotting Functions of Two Variables. 2
10.3 Partial Derivatives . 3
1. Computation. 4
2. Application t
1)
main()
cfw_/ magic square of order 3, 5, 7, 9
float I;
for(I=3; I<=9; I=I+2)
cfw_
zero(MS[I,I]); / STORAGE FOR MAGIC SQUARE
MagicSquare(MS, I); / MAGIC SQUARE MS OF ORDER I
print(MS, I); / PRINT MS IN CUSTOM FORM
MagicSquare(mat A, float N)
cfw_/ set
SAMPLE EXAMINATION QUESTIONS Chapter 2
The midterm (final exam) will have up to 8 (25) questions for 1 (3) hours. Adjacent students will have
different exams.
Special instructions: Closed book. No calculators. A nonelectronic dictionary is permitted.
A)
SAMPLE EXAMINATION QUESTIONS Chapter 3
The midterm (final exam) will have up to 8 (25) questions for 1 (3) hours. Adjacent
students will have different exams.
Special instructions: Closed book. No calculators. A nonelectronic dictionary is
permitted.
A)
BCEE 231_M HW #1
Problem 1
The following function f ( x) can be expressed in two different but
equivalent forms as follows:
1
1 cos x
x2
1 sin 2 x
E2 f ( x) 2
x 1 cos x
E1 f ( x)
Note that E1 uses subtraction whereas E2 does not.
(a)
Write a program:
9/10/2015
Chapter1
Fundamentals of
Procedural Programming
Computer/Hardware/Program/Software
A computer performs computations and
makes logical decisions.
Hardware are physical devices of a computer.
A computer program is a set of rules and
instruction
main()
cfw_
P=150000; / Force
E=205000; / Elasticity modulus of steel
t=7; / Millimeters
L=5000; /Length of beam
b=getnum("Enter value of b"); / Ultimate solution would be for a function to randomly generate values
d=getnum("Enter value of d"); /
BCEE 231 Homework Problems
Most homework problems are nontrivial application of programming for
engineering computations. They integrate concepts, ideas, tools and algorithms
gathered from class demonstration, and from the experience accumulated while
st
Assignment 4
Problem 4.1:
Summary:
The objective of this question was to allow the computer to calculate the tension in
the cables for randomly generated values of theta.
There is an error in my code and therefore am not able to yield any computed data.
A
Chapter 8
A General Program for Equilibrium
Problems of MultiBody Systems
When Newton saw an apple fall, he found .
A mode of proving that the earth turns round
In a most natural whirl, called gravitation;
And thus is the sole mortal who could grapple
Si
Chapter 6
Application to Equilibrium
Problems of Rigid Bodies
Science is built with facts as a house
is with stonesbut a collection of
facts is no more a science than a
heap of stones is a house.
 Jules Henry Poincar
6.1 Moment of a Force about a Point
Sample Multiple Choice Questions Chapter 4
In Part 1: Consider carefully each question, and select the best answer
In Part 2: Write the answer number and its reason or justification.
_
Part 1
Note: Line numbers are added for reference only.
The situation:
Sample Multiple Choice Questions Chapter 7
In Part 1: Consider carefully each question, and select the best answer
In Part 2: Write the answer number and its reason or justification.
Part 1
The situation
In relation to the described situation:
1. Consider
#$K>+
/ Division operator
The division operator '/' does not apply to vectors and matrices.
#
Divisionoperator
$
/ Division operator
K
division, operator; operators, /; division
>
Win2
+
cmap:0000
#$K>+
/. Comment operator
Two consecutive slashes '/' make
structured programming and applications for building and civil engineer
BCEE 231

Fall 2016
main()
cfw_
clearplot();
y = getnum("enter the value of y");
plot(x, a=0, b=2, x*x*(1x/3)4*y/3);
plot(y, 0, 1, root1(x,0,2, x*x*(1x/3)4*y/3);
setrange(0,y,2,y);
r1 = root1(x, a, b, f(x)y);
print(^ "the root of the equationfor y=",y, "is r1:", r1);
f
structured programming and applications for building and civil engineer
BCEE 231

Fall 2016
main()
cfw_
ID = 1000; / INITIAL DEPOSIT
R
= 0.1; / RESERVE RATIO
reserve = ID * R; / RESERVE
Loan = ID  R; / LOAN
TD = R + Loan; / TOTAL DEPOSIT
TR = ID  Loan; / TOTAL RESERVE
TL = TD  TR ; / TOTAL LOAN
N =1; / INDEX
print(^,"
N","
D", "
reserve", "
L
structured programming and applications for building and civil engineer
BCEE 231

Fall 2016
P2.1
SqrtA(float V, float r1, float Error) / Square root function using the formula A
cfw_
KA=0;
for (i=1;i>0;i=i+1)
cfw_
r1 = 0.5*(r1 + V/r1); /r1 will constantly change
KA = i;
if(abs(sqrt(V)r1) <= Error) /Verifies if
cfw_
return r1;
break
SqrtB(flo