DEPARTMENT OF ECONOMICS
ECON 2750A
Assignment #2
Prof. K.C. Tran
Due Date:
Thursday, February 8, 2018
1. (a) If the dimension of matrix A is 3 5 and the product AB is 3 7 , what is the
dimension of ma
Exercise 1
a) Define token attributes of the following, Z = 2x * y + x
b) Define token attributes of the following (i.e show Identifiers, keywords,
numbers etc. )
i) If (A+3<400) A = 0;
Else B = AA
ii
Lexical Analysis(Finite Automata)
Finite Automata
A finite automaton (FA) is a simple idealized machine used to
recognize patterns within input taken from some character set
(or alphabet) C.
The job
Code Generator
Issues in the Design of a Code
Generator
Input to the code generator
Target programs
Memory management
Instruction selections
Register allocation
Choice of evaluation order
Input
Compiler; it is a program that translates source program to target program.
Interpreter; a program that reads the source program and produces the results of executing the
source.
Qualities of a compil
Computer Science 2620, CRN 31005 Fundamentals of Programming II
Course Outline Fall 2014
Time of Lectures:
TuTh 12:15 13:30
Room: D633
Instructor:
Dr. S. Hossain
Office: C576
Academic Assistant:
Arie
Binary search
When the list elements are ordered
Given a list A
Ordered means it can be non decreasing order, a0 >= a1 >= an-1
How many times is the while loop iterated?
Answer:
The while loop is exit
Solutions to Homework 3 (part 2)- Math 3410 1. (Page 108: # 3.61) Reduce each of the following matrices to echelon form and then to row canonical form:
2 4 2 -2 5 1 1 2 -1 2 1 1 1 2 0 4 . (a) 2 4 9 ,
Homework 3 (Solutions)
(1) We get
84
=
22 3 7
846 = 2 3 141
111 = 3 37.
(2) Let n be a number with exactly three divisors. Let n = p1 p2 pk be
1
2
k
its prime factorization. Then we get
3=
(i + 1).
Si
Homework 2
(Due: Thursday Feb 9th)
(1) Calculate (n 1)! mod n for n cfw_2, 3, 4, 5, 6, 7, 8, 9, 10, 11.
(2) Find the remainder of
1! + 2! + 3! + + 100!
(3)
(4)
(5)
(6)
when it is divided by
(a) 2
(b)
Homework 8
(1)
(2)
(3)
(4)
Show that there is no positive integer n such that (n) = 14.
Find all positive integers n such that (n)|n.
Show that if m and n are positive integers with m|n, then (m)|(n).
Homework 10 Solutions
(1) Note that x is a primitive root if it has order 6 modulo 7. To make sure
x has order 6, it suces to check that does not have order dividing 3 or
2. So, we need to check if x3
Homework 1
(Due: Thursday Jan 19th)
(1) Assume that there is a surjective map : N S. Show that the map
: S N given by (s) = min 1 (s) is injective.
(2) Assume that : S N is injective. Show that there
Homework 2
(Due: Thursday Jan 26th)
Recall that we say a and b are coprime to each other if their greatest common
divisor is 1.
(1) For a given prime p, how many positive integers less than p are copr
This is a quick example of Hensels lemma.
Say we want to solve the equation f (x) = x3 + 8x 5 0 (mod p3 ) where p = 5.
We can check that f (0) 0 (mod p). Also f (0) 3 (mod p).
Here is one way of doing
Homework 5 - Solutions
(1) Given a, c, and m, the linear congruence ax c (mod m) is satised if and
only if there is an integer y such that ax + my = c.
Note that the solutions to ax + my = c can be so
Homework 7
(1) Find the last digit of the decimal expansion of 71000 .
(2) Show that if a is an integer such that a is not divisible by 3 or such that a
is divisible by 9, then a7 a (mod 63).
(3) Show
Homework 6 - Solutions
(1) Let f (x) = x3 + 8x2 x 1.
(a) Checking all congruences we get that x 4, 5 (mod 11).
(b) We apply Hensels lemma to the two roots x 4 and 5 (mod 11).
x 4 (mod 11) First note t
Homework 5: Due Nov 29th (Thursday)
(1) Evaluate the limits (note i, j, and k are the three basis vectors in R3 ):
(a) lim (t2 , 4t, 1/t)
t3
(b) lim (e2t i + ln(t + 1)j + 4k).
t0
r(t)
where r(t) = (si
(1) (a) Let
(b) Let
(c) Let
(2) Suppose
Sample midterm 1
an = n n. What is a5 ?
br = 2ar . What is b2 ?
ck = ak ak+1 . Find a formula for ck .
that lim an = 4 and lim bn = 2. Determine
2
n
n
(a) lim a
Sample nal
(1) True or False
(a) There are convergent sequences that are not monotonic.
(b) If lim an = 10 then there is an integer N such that 9.9 < aN < 10.1.
n
(c) There is a sequence an so that a1