Friday, November 30, 2012
Ex 1.8 Ideal
The notion of an ideal of Z is a non-empty set of integers that is closed under addition, and closed under multiplication by an arbitrary integer. Let I be a non-empty set of integers that is closed under addition (i.e., a+b∈I for all a,b∈I ). Show that I is an ideal if and only if −a∈I for all a∈I.
== Attempt ==
⟹
If I is an ideal, clearly −a∈I, as a⋅(−1)∈I, picking -1 as an arbitrary integer.⟸
Given I is closed under addition, for all a∈I,a+a=2a∈I,2a+a=3a∈I, etc. Clearly, if −a∈I,aZ⊆I. In other words, if −a∈I,I becomes closed under multiplication by an arbitrary integer.◻
Thursday, November 29, 2012
Ex 1.7 a=bq+r
Division with remainder property:
Let a,b∈Z with b>0. Then there exist unique q,r∈Z such that a=bq+r and 0≤r<b.
Generalized division with remainder property:
Let a,b∈Z with b>0, and let x∈R. Then there exist unique q,r∈Z such that a=bq+r and r∈[x, x+b).
Show that the generalized division with remainder property also holds for the interval (x, x+b]. Does it hold in general for the intervals [x, x+b] or (x, x+b) ?
== Attempt ==
Consider the interval (x, x+b], which contains exactly b integers, namely ⌊x⌋+1, ...,⌊x⌋+b. Applying the division with remainder property with a−(⌊x⌋+1) in place of a:
a−(⌊x⌋+1)=bq+ra=bq+r+⌊x⌋+1 |
r∈{0, ..., b−1}r′∈{⌊x⌋+1, ...,⌊x⌋+1+b−1}={⌊x⌋+1, ...,⌊x⌋+b}r′∈(x, x+b] |
Consider the interval [x, x+b], which contains integers:
{⌈x⌉, ...,⌈x⌉+b−1,⌊x⌋+b} |
Similarly, consider the interval (x, x+b), which contains integers:
{⌊x⌋+1, ...,⌊x⌋+b−1,⌈x⌉+b−1} |
◻
Ex 1.6 a mod b with b<0
Given (a mod b) is defined to be a−b⌊ab⌋. Let a,b∈Z with b<0. Show that (a mod b) ∈(b,0].
== Attempt ==
First, ⌊ab⌋ is a unique integer m such that m≤ab<m+1. Equivalently, ab=m+ϵ for some ϵ∈[0,1).
a mod b=a−b⌊ab⌋=a−bm=b(m+ϵ)−bm=bϵ |
0≤ϵ<1, and given b<00≥bϵ>b0≥(a mod b)>b |
Tuesday, November 27, 2012
Ex 1.3 ⌊xm⌋
Let m be a positive integer. Show that for every real number x≥1, the number of multiples of m in the interval [1,x] is ⌊xm⌋; in particular, for every integer n≥1, the number of multiples of m among 1,...,n is ⌊nm⌋.
== Attempt ==
First, every real number x can be formulated as the sum of an integer and an ϵ∈R where 0≤ϵ<1. Using the "division with remainder property" (which says for every a,b∈Z with b>0, there exist unique q,r∈Z such that a=b⋅q+r and 0≤r<b), there exist q,r∈Z such that:
x=q⋅m+r+ϵ |
Obviously, q is the number of multiples of m in the interval [1,x]. To find q, we can start with dividing both sides by m:
xm=q+r+ϵm⌊xm⌋=⌊q+r+ϵm⌋ |
⌊xm⌋=q |
◻
Sunday, November 25, 2012
Ex 1.2 p≤n12
Let n be a composite integer. Show that there exists a prime p dividing n, with p≤n12
== Attempt ==
Given n is composite, there exists a,b∈N such that:
a⋅b=n |
If a = b, a=b=√n. So the prime p clearly exists.
If a < b,
a=√nb⋅√n |
◻
Prove (nn+1)2→1 as n→∞
This is equivalent to show that:
(∀ϵ>0)(∃n∈N)(∀m≥n)[ | (nn+1)2−1 |<ϵ ] |
(n+1)⋅ϵ>2ϵ>2n+1 |
|m2(m+1)2−1|=1−m2(m+1)2=2m+1(m+1)2≤2n+1(n+1)2=2(n+1)−1(n+1)2<2n+1<ϵ |
Wednesday, November 21, 2012
Linear plot with intercept and slope in R
# http://stat.ethz.ch/R-manual/R-devel/library/graphics/html/abline.html # http://stat.ethz.ch/R-manual/R-devel/library/graphics/html/plot.html # Set up coordinate system plot(c(-2,3), c(-1,5), type="n", xlab="x", ylab="y", main="y = 2x + 1") # Set up the x- and y-axis abline(h=0, v=0, col="gray60") # Set up a grid abline(h = -1:5, v = -2:3, col = "lightgray", lty=3) # Draw a line with slope=2 and y-intercept=1 abline(b=2, a=1, col="red")

Saturday, November 10, 2012
Drawing Function in Octave
# Some references # http://octave.sourceforge.net/octave/function/text.html # http://en.wikibooks.org/wiki/Octave_Programming_Tutorial/Plotting # http://math-blog.com/2011/04/25/plotting-and-graphics-in-octave/ x = [1:0.5:3] y=x.^2*3 plot(x,y,'-@') title("y=x^2*3") xlabel("x") ylabel("y") text(1.4,8,"(1.5,6.75)") text(1.9,13,"(2,12)") text(2.25,19,"(2.5,18.75)") print -dpng "foo.png"

Tuesday, November 06, 2012
Why rationals are incomplete
Let A = {r∈Q | r>0∧r2>3}. Show that A has a lower bound in Q but no greatest lower bound in Q. Give all details of the proof.
== Attempt ==
To show that A has a lower bound in Q is trivial. Clearly, zero is a lower bound of A in Q, as 0 < r for all r in A, and 0 is rational.
Let's assume A has a greatest lower bound x in Q. There are then only three possibilities:
Case 1: x2=3Case 2: x2>3Case 3: x2<3 |
Case 1: x2=3
The first case is obviously not possible, since √3 is irrational. See proof here.
Case 2: x2>3
For the second case, suppose
x=pq where p,q∈N and x2>3 |
p2>3q2 |
n22n+1 where n∈N |
n22n+1>3q2p2−3q2n2p2−3n2q2>6q2n+3q2n2p2>3q2(n+2n+1)n2p2>3q2(n+1)2n2(n+1)2⋅p2q2>3 |
y=n(n+1)⋅pq |
p2q2>n2(n+1)2⋅p2q2>3x2>y2>3 |
Case 3: x2<3
For the third case, suppose
x=pq where p,q∈N and x2<3 |
p2<3q2 |
n22n+1 where n∈N |
n22n+1>p23q2−p23n2q2−n2p2>2p2n+p23n2q2>p2(n+2n+1)3n2q2>p2(n+1)23>p2q2⋅(n+1)2n2 |
y=pq⋅(n+1)n |
3>p2q2⋅(n+1)2n2>p2q23>y2>x2 |
As shown in all cases above, it is not possible for A to have a greatest lower bound in Q. This completes the proof.
Sunday, November 04, 2012
Running QSTK from TextMate/Sublime Text 2 in OSX
Assuming QSTK has been installed
Sublime Text 2
Edit the Sublime's Python build file at:
~/Library/Application Support/Sublime Text 2/Packages/Python/Python.sublime-buildadding the QSTK environment variables. The file would then end up containing something like:
{ "cmd": ["python", "-u", "$file"], "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.python", "env": { "PATH": "/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/upune/QSTK/Bin", "PYTHONPATH": ":/Users/upune/QSTK:/Users/upune/QSTK/Bin", "QS": "/Users/upune/QSTK", "QSDATA": "/Users/upune/QSTK/QSData", "HOSTNAME": "5855pns93223.nag.nznmba.com", "QSDATAPROCESSED": "/Users/upune/QSTK/QSData/Processed", "QSDATATMP": "/Users/upune/QSTK/QSData/Tmp", "QSBIN": "/Users/upune/QSTK/Bin", "QSSCRATCH": "/Users/upune/QSTK/QSData/Scratch", "CACHESTALLTIME": "12" } }The environment variables that need to be defined can be found in the file:
~/QSTK/local.shNow one can execute those Python scripts under
~/QSTK/Exampls/Basic/with the usual Command-B shortcut key in Sublime Text 2.
TextMate
In TextMate, however, these environment variables would need to be added at
TextMate > Preferences > Shell VariablesThe Python scripts can then be executed with the usual Command-R shortcut key in TextMate.