midterm preparation CSC263

Mid term season seems endless!

This is my posting for preparing csc263.

Let’s start!

Abstract data type(ADT)?

We’re talking about mostly about Abstract data type and how to analyze its running time.

Before to jump into the idea, what is “Abstract data type”?

Abstract data type is like a imaginary machine that have some skills that we need to use.

Programmer is the engineer to build this robot. But if you just simply want to this robot, you just need to know what operation you can use with this.

For example there is a stack in ADT. Just think of one robot called “stack” and what it does is stores all the things that you put in it and take it back to you the item but in reverse order that you put in. So the item that you put in at the last time, will be popped it out first.

Programming is the implementation of this ADT. (i.e., building process of this robot)

Since this is for my midterm preparation, I’ll just explain shortly about each ADT and maybe write more later on.

Today, we will talk about 6 major abstract data structure that I’ve learned in my class.

Insane? Yes, let’s do this without any help from alcohol.

Priority Queue 

Priority Queue is a data structure that stores all items by its priority. Priority Queue is very useful in the real life.It’s like a note that you put on your wall. You will probably put a number besides each item in the list by it’s priority. By the way, by saying priority queue, I’m referring “minimum priority queue” (maximum priority queue is you’re saying a item in order of the size of key in the minimum case, it’s revering the order(i.e., minimum 1,2,3… maximum 5,4,3…))

 Usually, we use heap(complete binary tree) for priority queue. The reason why is heap has nice compact property in it. So you can get the item that has the highest priority in O(1) time. Also, by using the compact property, you can convert it as a list and  since in the list it’s indexed already you don’t need to store key(priority) and also you can get an advantage of using arithmetic between index which takes also O(1) time.

So like all the ADT, we need to perform specific operation on them.

What operation would you expect your priority queue(Memo) will take care of?

The list of work that handles is like this.

Decrease-Key(S,i,k): decrease the value of element at the index ‘i’ to key k

Insert(S,x): insert element x into Set S. 

Minimum(S): return the item with the smallest key.

Extract-Min(S): remove-return element of S with smallest key

All code for those functions are below.

Decrease-Key(S,i,k){

if S[i]< k:

error: Can’t decrease anymore.

S[i] = k

while i > 1 and S[parent] > S[i]:

S[parent], S[i] = S[i], S[parent]

parent = i

}

Insert(S, x){

S.size = S.size + 1

S[size] = ∞

Decrease-key(S, S.size, x)

}

Minimum(S){

return S[0]

}

Extract-Min(S){

k = S[0]

S[0] , S[S.size -1] = S[S.size -1], S[0]

Min-Hipify(S, 0) #It’s just a bubbling down process.

}

I think the “Insert” is pretty smart to move of using the function “Decrease-key”

Binomial Heap

Binomial Heap is bit more fun than the “Priority Queue”.

Binomial Heap is a set of Binomial Tree that has minimum-heap property.

If we can call the Priority Queue as a “Memo”, then we can call the “Binomial Heap” as a calendar.

So it’s a collection of Memos that is listed by date and each entry for a day is binomial tree.

Let’s see what is mean by “Binomial Tree”

Binomial Tree is Tree that has a mean-heap property and it can be defined in a recursive way.

So it’s like this.

It starts from a node and to increase the size of tree, you need to put same thing and you can go to the next level. Not obvious? I can explain this by pictures below.

The first one is valid because it’s adding same things but second one is not. Easy?

So if you add same thing, the thing that you’re adding becomes the left most child of the root of another tree and you should decide which tree will be the tree that contains root by their value.

So the tree at the right side of addition is added to the other tree b/c they should keep min-heap property(i.e., small things should precede the big things)

So the formal drawing will be look like above.

There are some important things that you need to remember regarding this tree.

THINGS that you MUST stick into your brain about “binomial tree”!

For “Binomial Tree B_k(k is the height of the tree)”

1. There are 2^k nodes.

– Well, B1 = 2*B0 and B2 = 2*B1 = 2^2B0.

Hence, Bk = 2^kB0 and the number of node for B0 = 1.

Hence, Bk = 2^k.

2. The height of the tree is k.

Well, we define Bk in terms of height.

3. There are exactly kCi nodes in the height i. (C is combination)

(I explained about this at the end of this list)

4.The root has a “k” degree, which is grater than that of any other node; moreover if the children of the root are numbered from left to right by k-1, k-2, ….,0 child i is the root of the subtree Bi.

Well, the first sentence is not a very exciting fact. Because, when you’re adding something to it, you are adding the root as a sub child of the other tree’s root. SO the children nodes of the root is increased by 1. Oh by the way degree is just another term to call # of children nodes. I know most of terms are annoying. I guess there are some obnoxious people in the academic filed keep saying “We have to call this and this!”. It’s annoying to me. Anyway, second sentence in 4. seems pretty interesting. That’s saying that if you took out a root then you have k sub – trees. But it’s just merely tree was recursively defined and the tree has all the sub tree that we added recursively.. That’s it.

5. The height of the tree is lgn. Well the height of Bk is k and the # of nodes are 2^k = n hence, k=lgn.

So let’s explore the 3. part. It’s related to the reason why we call this kind of tree as binomial tree.

kCi is the coefficient for a^ib^(k-i) and a^(k-i)b^i in the binomial, (a+b)^k.

Hence, we call this tree as binomial tree.

It took me for a while to understand why this kind of things happen b/c I couldn’t find any information of this from the internet. SO this below is what I’m guessing.

Let me use the example of B3.

To make B3, we need to “two” B2s.

Let’s call the tree at the left as “B” and the other as “A”. Then, write “b” on the all nodes in “B” and let’s write “a” on the nodes of “A”. # of nodes of A, B = 4 = 2^2.  # of nodes of  B3 = 2^3.

Well, just notice the fact above and let’s them put together to make B3.

Can you see the symmetric structure of that?

The total number of nodes in tree should be 2^3, the number of node at the first floor should be 1 and the most important thing is the tree should be symmetric!

Now what you can think of? Yes, binomial of (A+B)^3 = (A+B)(A+B) (A+B) because binomial is symmetric and it the coefficient for the end term(a^3 and b^3) is zero! and also the sum of all the coefficient is 8= 2^3 which is the total # of nodes. We can think of why this happen esially. Just put 1 for A and B. When we think of tree in terms of the number of nodes, each node whether it’s from A or B it is just 1. So we put 1 for A,B and we got 2^3. I hope it more make sense. So the all the outcome that “I” wonder(Why it’s called binomial tree and why each height has the number of nodes which is same as the coefficient of binomial?) was actually because of it’s symmetric structure. (Oh, it’s still my guess, so maybe it’s wrong to assert it.)

Well, that was fun-wasting of time..And now we

It was not hard to prove it. You can use induction but I just wanted to understand why this kind of things happen.

So finally binomial heap is the list of these binomial trees.

e.g., {B1, B3, B5}

It’s sorted by the height of the trees and any tree can’t have same height in the list. Each item is actually the root of the each binomial tree. Well, That’s the rule that we need to stick with. Let me show you some picture of Binomial Heap.

<Some pic later from PDF no internet in my home. DARN IT>

There are some property we want to look at before what operation it has

1. Each tree has mean-heap property

2. For any non-negative integer k, there is at most one binomial tree that root has k degree.

And in the PDF file that my prof gave to me, it’s saying the 2. part implies that n-node binomial heap(Binomial heap that contains n nodes total) has at most bottom of (lgn)  + 1 trees.

First time I heard that, I was what? how? and then I started understand after I saw an example given in the file. It’s saying that we need to observe the number of binary string to express a number. So if you got 11 then it’s 1101 => 4 strings which is (bottom of lg11 )+ 1 = 3 + 1.

And we can apply this for our binary heap. Let’s say we got n-node binomial heap then, since binomial heap is a merely list of the binomial trees, we can express n as some kind of form of 2^k + 2^j …. It’s absolutely same as how we represent a number with binary string.

But only difference is if the binary digit is 0 it doesn’t matter to count the binary string but it’s meaning that there is no binomial tree for that spot. Confused right?

Let’s think of 11 case. Using binomial 4 strings you can make the number and the string is

1101. But let’s think of 11-binomial heap! Then there’s only B0 , B1, B3 tree which are 3 trees because the spot for B2 is 0.

Well, we saw all the property then, let’s go to the operation part.

The operation that we can do with this ADT is like below.

1. Make-Binomial-Heap

2.Find-Minimum

3. Union

4. Insert

5.Extract-Min

6.Decrease

7.Delete

AVL tre

Augmenting data structure

-list tree, weighted tree

Hashing

Disjoint set

Advertisements

Devide Conquer Comibine & Master theorem

Let’s make a pause on the our bad soap drama for a moment and  Get some course materiel.

Why? It’s simply because I need to study it for upcoming Assignment. Moreover, It’s a pretty interesting topic.

By the way, have you ever worked in the factory?

Well, I have for a day. (It was a day job which was darn hard. My mom wanted me to earn money by myself after I graduate high school, so I had to work if I need money.)

As I remember from the day, how factory works is pretty close to the algorithm of “Divide, Conquer and Combine”.

 “Divide, Conquer and Combine” is an algorithm to solve some problem that we can somehow infer some “recursive sense.”

The way algorithm work is simple. If you found a messy problem. Don’t try to deal with it by one trying. Divide the work to several small piece and Conquer the pieces one by one and combine them nicely. Sounds like factory?

What factory does, they divide work by type and also divide people for each work. Then they make each group conquer specific work that assigned to them and after done that they combine the work to a “Product.” So in a car factory, some group of people are taking care of wheels and others paint the cars.. after they done that they put all together to make a car.

 That’s how divide, conquer and combine algorithm works.

Well, wait a minute what is a recursion?

Recursion is very simple and fun idea. It’s essentially doing same thing over and over.

So it’s like you go in to a room by opening a door but there is a door inside and you go in to another room. and..so on. You’re keeping doing something over and over.

Have you ever draw something when somebody was talking to you?

Well, I’ve never done that but when I was having a lecture…yes.

I’m pretty sure that I draw something like.

I drew a big rectangle and drew one in the inside….keep “same thing” over and over.

That’s recursion.

Can you imagine when I’ll finish my job of drawing the rectangles?

Well if there’s no space for me to draw then I’ll finish it.

But careful! Some recursion can be finished and some can’t be. Like this function below.

Endless_love(i = 1, String your_name){

Print “This is %s  time(s) that I was born and fall in love with $s” , % i %your_name;

Print “My life is done and if I reincarnate, I hope meet %s again!” % your_name;

i++;

Endless_love(i, your_name)

}

If I call my Endless_love function(aka stalker function), like this Endless_love(Adam) will print out like below.

This is 1 time(s)  that I was born and fall in love with Adam

My life is done and if I reincarnate, I hope meet Adam again!

This is 2 time(s)  that I was born and fall in love with Adam

My life is done and if I reincarnate, I hope meet Adam again!

This is 3 time(s)  that I was born and fall in love with Adam

My life is done and if I reincarnate, I hope meet Adam again!

and so on Endlessly.

Yup this is a bad example of recursion because of its cheesiness and also it can’t be finished.

By the way, “What is a problem that we can solve using recursion?”, if you ask.

It’s just a problem such that you can divide by pieces and the pieces keep the properties that it used to have. Hard? Think about a “Tofu”.

You can divide the tofu by pieces. After you divide them, I dare to ask you what the pieces are.

“Well, it’s a still tofu”

Yes. That’s recursive problem.

Can’t believe me? Well, I can give you a more boring example which sometimes people found more make sense and logical.

Let’s say you have a function that find a maximum element in an array. So below is the pseudo code for it.

Get-maximum(array A){

if A.size == 1:

return A[0]

A-half1 = A[: A.size *1/2];

A-half2 = A[A.size*1/2:];

return max{ Get-maximum(A-half1), Get-maximum(A-half2) };

}

By using this code, you can get the maximum element in an integer array. By writing this code, I just showed you how the getting maximum problem can be recursive problem. The reason why it can be recursive problem is  when I chopped the array in the code as A-half1 and A-half2, the two pieces are still array like A. (Like half of tofu is still a tofu). Hence I could call the Get-maximum function recursively on those pieces.

Since we can solve the problem recursively, we can set a formula for the running time for this kind of problem also recursively like blow.

case 1: T(n) = aT(n/b) + f(n)

or

case2: T(n) = aT(n/b) + cT(n/c) +f(n)

Well, there can be more cases most of time in csc236 I think it’s enough if we can deal with those cases.

So case1 is there are “a” sub-cases that has size of n/b and for case 2, there are “a” sub-cases size of n/b and “c” sub cases size of n/c that’s it.

Solving a problem using the DCC(“divide, conquer and combine algorithm”) algorithm is useful but not hard. So it’s great. Let’ me move on to the master-theorem, after I explain what is the master-theorem, I’ll give you an example that mix  the”divide, conquer and combine algorithm” and the master theorem.

Well, master..? What it reminds to me is..

Kung-fu master?

In the recursion world, it’s has similarity with this cute panda.

First of all, it’s a kick-ass, you don’t need to even think, if you have this theorem with you. Secondly, it’s not perfect. There’s a limitation, like our cute panda is not always smart and sometimes bit clumsy. (but still they are kings in their world!)

Let’s see how our master for the recursive world looks like.

If we can express the running time formula for our recursive problem like this,

T(n) = aT(n/b) + f(n) where a>=1 and b>1 then we can use the master theorem to get the T(n).

The limitation of the theorem is the running time formula should be in the form of the one that I introduce above.

f(n) = Θ(n^d) then

 Θ(n^d) if a < b^d

Θ(n^d* logn) if a = b^b

Θ(f(n)) if a > b^d

So you can get the running time of the recursive problem very easily with this formula.

Here’s a link for the proof for the theorem that I’ll read when I have a time so read if you have a time!

http://www.ugrad.cs.ubc.ca/~cs320/2010W2/handouts/MasterTheoremProof.pdf

Introduction to linguistics

I started learn linguistic from this semester ,because it sounds fun! But in fact, I found out that you need to memorize things a lot which I hate most to do in this world. I don’t like remembering anything seriously. But, then, why not approach it in a fun way? By learning linguistics and computer science, who knows that I would make some awesome translator which is absolutely way batter than Bing’s or Google’s. Then, you can go everywhere by cheaper price than now! World will be more peaceful ,since they understand others more. Also, people will collaborative more easily, so tech will be developed faster. Anyway, I can’t wait to see that.  That’s one of my dream actually. It might sound too idealistic ,but trying is always worthwhile. It’s better than doing nothing, at least.

Introduction

So, shell we start?

By the way, before we start studying Linguistics, What’s the Linguistics anyway?

Well, It’s easy to answer the question, linguistics has broad area and a lot of academic branches in it. Generally, it is a study about “How human language works.” I’ll introduce some branches of it, here but essentially it’s just study all about human language. But who knows that you might meet across with bit silly questions on the test. So, for that reason, I’ll explain it, here.

1. Its structure and mechanism(by it, i refer to Human Language)

I know, it just looks like blah blah. I’ll just give you a simple example of it.

e.g., I don’t like remembering vs not I do like remembering

The structure of second one is ‘bucked up’, we can say. So Linguistics study, why some kind of structure we can tell it’s ‘bucked up’ or not.

2.principle of use: hidden meaning

It also looks blah blah. So yes, anther example

e.g., Your girl friend/boy friend:”I think that clothes is so pretty, It would be super good if I have one.”(↔ hidden meaning: I want that clothes for my coming birthday present.)  CLEAR, right? When people say, most of time, I felt they contain some kind of  hidden meaning  and in fact, I use it in that way ,also. For example, if I find something is weird, I’d say “it’s uhm.. interesting?” or “Well, that’s VERY interesting.” But that doesn’t necessarily mean that I found that is really nice. I used the word often in a very negative way not to harm any other people’s feeling.

3.the way language is acquired

It looks straight forward. I saw one video of an experiment that is done for a long time for making chimpanzee to learn human language.  But they failed, unfortunately. But actually I don’t think it’s pretty interesting. Because if someone put me in the water to make me learn the way that dolphin communicate with each other or put me in a tiger cage to make me learn the way that tiger communicate, I don’t think that I can learn of it, ever. So it was a very unfair experiment to chimpanzee. However, I feel interesting to see that some people failed to learn a language while most people can. Also, it’s interesting to see that some people can learn several languages easily while most people can’t. So if we can see those contrast, there must be a reason for that. So linguistics study of it.

4.How language changes over time

I don’t find this is interesting at all. In fact, everything is changing. You can argue with me that mathematical and  scientific facts are not changeable. But can you be sure that your knowledge of gravity will still work, if one day space just disappeared into the black hole and some new world come up? It might sounds crazy, I know, so let’s get back to the main point. So if you open any shakespeare’s book, you can see the fact that human language has changed. That’s it.

5.How language is instantiated in the brain

I think, this part is interesting.  But before that, what is mean by being instantiated? You can just think being represent or being recognized. So the main point is how the brain work with human language. Well, the reason I think it’s interesting is, if we know how it works then we give more help  to the people who can’t use human language because of some kind of malfunction in their brains.

6.it’s biological bases

This is talking how we can use human language with our body(i.e., mouth, throat and ears). I think this kind of theme is bit silly from my shallow view point as a person attending a linguistic introductory course, because any animal try to make the best use of what they got. For example, dolphin developed a way to communicate with other dolphin by using hyper sonic sound and bats do, too. So in a same sense, human use human voice to communicate with other human being. But in my lecture, my prof assert that human language is more sophisticated than other language ,so learning what biological feature makes it developed that way is important. However, seriously, can we assert surely that human language is more sophisticated than any other way that other animal is adapting? If then, why you can go out and pick up bats’ language in a sec? It’s like same as the experiment (that I introduced before) putting a poor chimpanzee into the human society to make him learn human language.  I just want to put those scientists into a chimpanzee cage to see if they can learn perfect chimpanzee language.’So don’t be duck’. Different is just different. That doesn’t make something better than another. That’s what I thought in my lecture. ‘That’s a duck head’s idea!’

Well, it’s too broad? There are some major area of linguistics that I can introduce to you.

Phonetics: This area is about the property of the sound of human language. 

What’s mean by that? Well, watch some foreign language youtube and write exactly how it sounds. Yup, what you’re doing is what I did for my Phonetics assignment except I did for English and used IPA symbols to record the pronunciation more correctly. It’s about how human language sounds and what organs(tongue, teeth etc)is used to pronounce those sound.

Phonology: This area try to classify the sound system

I just merely learned. But we learned about what specific sounds usually goes with some sound and don’t with others. Also, how to split sounds as bunch of segments. Those things.

Morphology: Principle of word structure

Well, I haven’t learned but I found this idea is bit tricky. So I found one cartoon about Morphology.

He said “I’m hungry” and mom gave him a cookie

He said “I’m thirsty” and mom gave him a juice

……..So he said “I’m televisiony”

and I understood. It’s a study about how words are related and spread out like that. e.g., huger, hungry

But well I might be mislead. So I’ll update it when I get to the lecture.

Syntax: analysis of the formation of sentences

There are free space for creativity but there are finite rules of how we should form sentences and it’s a study about it. Also, I haven’t got into.

So, let’s start about basic linguistic knowledge ,first.

1.The relationship between sound and meaning is arbitrary. 

Just take a example, if your child ask, “Why we call this as chair?” What would you answer.

The answer will be “Well, everybody call that chair so we call it char.”

Yes, how the word sounds is pretty random regardless of its meaning for most of time.

Why we’re not calling cows as mooers? It sounds silly but it’s more make sense compared to calling it a cow.

(Lecture example:Home is “casa” in Spanish and “dom” in Russian)

2.Language is characterized by “creativity” (but the creativity not limitless)

We can produce new words and understand some sentences we’re never heard of. This happened a lot to me in English, since English is my second language. So this means that language allows this creativity works while using it. So there is a saying , “Infinite use of finite human language” by some famous person that I’m not interested in. But there is an interesting question, being infinite is same as being limitless? Well, regarding the creativity of human language, the answer is “NO”. It’s infinite but it has its limit. You know that some sentence doesn’t make sense or impossible from you guts. That’s what we called “competence”

Competence vs Performance

Competence is, as I said before, a speaker’s knowledge of what can or can’t be said in their language. Performance is the way that the speakers use their language with their competence. Performance seems bit tricky to understand , it is just the way you use your language using competence. So, if it doesn’t make sense to you(to your guts), you would use it. That’s it.

3.Noun used as verbs in English

Have you ever heard of “I need to water my plant.” When I heard it at the first time, for me, it was bit weird but totally understandable(see? a example of the creativity of language). The reason it was bit weird for me,is I only used “water” as noun not a verb. But now I know why. It’s only because English sometimes use Noun as Verb.

(Lecture example: beach the boat, ground the airplane, bottle the wine)

but wait a minute, can all noun be verb, then?

Hell no. If it’s possible what’s the point of keeping verbs. However, it’s a question from my lecture slide. Let’s answer this question then.

Since we have verbs, there should be a limit and the reason/tendency for that some noun can’t replace verbs.

There are few reason/tendency for that.(The reason I put reason/tendency is sometimes it is what it is and hard to find any reasonable explanation for it.)

1. A new verb is not merely coined by noun if  the verb form of the noun is already exists

For example, we can say jail the robber but we can’t say prison the robber.

The reason is simple it’s because the verb form of prison (= imprison) exists.

2. There are some constraints regarding the time expression

In English, it’s possible to say, I summered in India or I wintered in Spain. But, It’s impossible to say, I one o’clocked in the street or I midnighted in the stree. Why?

It seems for the time expression, there is a tendency that only allows people to use time noun to refer some period of time. But the funny thing is, not all period English noun can be verb. e.g., I Autumned in Korea. So that’s why, I put it as tendency.

Grammar

It’s hard to talk about an language without it’s grammar. If you take any second language course, you will probably study its grammar. But what’s the grammar? There are 3 grammars that are defined. (You might say, “What? I learned grammar in my primary school and there was only one grammar!” ,but yes there are 3)

1. Prescriptive grammar

That’s the one that bugged you when you’re in the primary school. I know it bugged me ,when I had to take an English test in my school in Korea. It’s a merely thing that people think, we should follow to generate clean(snobbish) English. Ah, ha that’s why, I got super poor mark for the grammar all the times! (understood) I got actually all right other than grammar, almost every time, and now I found a reasonable explanation for that. So to summit up, prescriptive grammar is just a thing that some people think that’s THE WAY to use the language and you got tested for that unfortunately.

2. Descriptive grammar(Performance)

Descriptive grammar is just the rule or way that actually people use as long as the way makes the user be able to communicate with others, we can include it our descriptive grammar.

Descriptive grammar counters with Prescriptive grammar with the following points

1. All variety of human language is valid as long as it is understandable

2. There is no strong reason to push one mold for a language

3. Language is constantly changing and it’s very natural

4.There is no original language, language is created by adopting many sources from another

3. Mental grammar(Competence)

This is “What people know when they know a language”

Mental grammar is just a “gut feeling” that you have about an language.

The main difference between “Descriptive grammar” and “Metal grammar” can be described by one sentence below,

“The things that you make sounds doesn’t make sense to me!”(So you can see that Descriptive grammar doesn’t go well Mental grammar). Okay, So Metal grammar can tell what’s right or not by the gut’s feeling. But wait a minute. Can I just call it as gut feeling? As all academic field, in linguistics, there are always “formal” term for this.

We call this “gut feeling” as “Mental lexicon(aka mental dictionary)”. Since your mental lexicon includes all the sounds, meanings related to it and the rules of how to use it and so on, you can tell when something doesn’t make sense in your language.

So, Linguists are interested in Mental grammar(the cognitive part of language) but to study it, they need to study through descriptive grammar. Because, metal grammar is in our subconscious.

So, what’s mental grammar?

1.It contains information of sound

e.g.,  We know that there is no sound like “STBCCKEP” in English.

2.Certain sequence of sound correspond to certain meaning

I think it can be also applicable where “certain sequence of writing” correspond to “certain meaning”.

e.g., If you heard “HOT”, what it reminds you of?Pretty not much more than 2, but you can see the sound(word) (i.e., the sequence of sound/character) is related to something in your mind whatever it is. For me, well this?

Haha, where are you looking at? Not the girl, but BIKE is hot to me!

3.It contains rule to combine words to sentence

These rules are finite. It’s totally make sense. First, our brain has its limit. Second, let’s think about infinite rules..then, what’s the point of having rules? So, when we see some sentence, we look up our rules and if we can’t find it from our rule. We say, “In our language, it doesn’t make sense. That sentence is pretty bucked up.”. One more important thing is, this kind of rules, we don’t really learn in the school. Bring 8 years old kid and ask her/him some sentence is make sense or not. They’ll probably know what is bucked up or not. It’s acquired naturally.  Also, our mental grammar rules are not strict. We’re not machine. So there are always space for “Creativity”!

So what’s THE grammar in Linguistic among these three?

It’s descriptive grammar. We care of the grammar that people use presently. It’s science! (It’s Sparta!!)We keep if we need and discard if it’s useless. So we’re not talking about prescriptive grammar.  Because prescriptive grammar is useless to capture the whole flavor of language. It’s just a opinion of some people. (I love Science because, they’re ravels actually. They don’t care about authority. Let’s buck up authority with science!..yay?) Above, we talk about the characteristic of descriptive grammar but didn’t introduce terms for the characteristics and didn’t introduce some characteristics. So let me introduce the them nicely.

Generality: all language/dialect have their unique grammar system

Parity: all grammar is equal. Rip off your grammar test, it’s useless and time wasting seriously.

Mutability: grammar changes over time

Inaccessibility: grammar knowledge is not accessible.(This is so true, one day, one of my Chinese friend made a sentence in Korean and I know it was wrong! but couldn’t explain. I just kept saying, “Nah, it just doesn’t make sense…”

Universality: all grammar are alike in basic way. Well, I didn’t study all the language. So looked up the lecture node to find some example of this. One of example is like this, 

E.g., There is no language that say like this “He brought Ned’s bag” where He is Ned himself.

Phonetics

Phonetics is all about sounds. Make some sounds. “AH!!!!!!!!!!!!What a lovely midterm!!!!!”

Yes, good job. Well, sounds.. How do people in linguistics study sound(Let’s call them lin ppl)?

There are basically two ways to do that.

1.  Articulatory Property

It’s all about how do you make sounds with what you’ve got(your organs)

Any anatomical picture of any animal including human being is bit disturbing to me..X(

2.Acoustic phonetics

Sound is actually kind of wave. You push the air by making some noise and the wave of the air get into the other person’s ear and he will feel the wave and recognize the sound. Air is actually very sensitive, so when you move all the moving action that you take push the air and make noise. That’s why this earth is very noisy ,since everything is moving. So Acoustic phonetics is a study of the waves. I haven’t got into but it sounds actually interesting. Since if you can develop some way to distinguish some wave in detail and if you can predict what’s the words that is spoken by the wake and some other basic information then you can implement that into a machine. Sounds pretty interesting to me but to do so I need to pass the LIN 100..

Anyway today’s main focus is 1.

To learn the material, we need to have a tool for that called “IPA” search the fool name. It’s just a way to describe the sounds you might want to argue with me that we already got the alphabet.

Well, there are different sounds that are represented in the same way like “ough” in

Rough and though.

So, we need a better tool for that. It’s hard to write IPA, so you need to practice yourself but I have a good reference that I got from my friend.

http://www.yorku.ca/earmstro/ipa/vowels.html

Also, you can check it in the dictionary website here,

http://dictionary.reference.com/browse/tog?s=t

I think I also need to do some practice. For, practice I did translate Katy Perry’s “Friday night”. It was fun but it was bit embarrassing when I had to pronounce it. It’s pretty funny so I’ll scan it later and upload it.

Yup, I wasted my time a lot to do so now we need to hurry.

So what IPA make us realize about the language?

They’re implying that sounds can be segmented! Like we did using IPA.

Regarding this, there’s an situation supporting this “segmenting idea”. That’s “slips of the Tongue” She gave an example which was “melcome wat instead of welcome mat” but I do not agree. I haven’t seen any people talked like that. Come one. So I don’t believe that is an good example but I believe we can segment the sounds.

And we call this individual segment as “Phone”

Okay we got segment but how do we make the sound with these segments?

Well, sound is as I said before the wave of air. So we need to push the air with our organ that means we need to get some air first(“air supply”) and to make wave we need to vibrate the air using our larnyx(you can call it as vocal cords but “larnyx” sounds more snobbish.). We call this as the sound source. And you need to control the vibration with you mouth and tongue etc(the parnyx, oral cavity and nasal cavity) to make more accurate and specific sound. We call this as the “filters”

So let’s think of some specific organ like lung?

Lung needs 2 tings to get the air supply.

1. intercostal

The muscle that allow you to raise your chest to get airs.

2. diaphragm

The sheet below your lung that allow the air comes to your lung

About larynx, I think there are only 2 things important

1. vocal folds

It just two sheet of muscle in your larynx that have some space between them

2.glottis

We call the space between vocal folds as glottis

“Glottal stage”

glottis is important b/c depends on its stage, we can classify sounds for 4 classes

1. voiceless

The air from the lung passes the glottis without any fraction between the vocal folds. So it doesn’t vibrate the vocal folds

2. voiced

vice verse, sounds that vibrate the vocal folds

3. whisper

It’s very similar with voiceless but the anterior part of the larynx pulled together while the posterior part of the larynx have some space

4. murmur

This is pretty interesting! Pronounce behind. Can you say that “h” is bit breathy?

Yes, but it’s voiced right? That’s murmur. This happens because, it’s vibrating the vocal fords but in a relaxing way.

So we check 4 kinds of sounds but it’s not the standard way of classifying sounds.

There are 3 standard classes.

1.vowel

You know vowel, aren’t you? But do you why they’re called vowel altogether?

Well because they have some similarity. Such as..

1) Voiced

2) Not much obstruction when you pronounce it. e.g., pronounce k and a and compare them

3) sonorous

You can differentiate sonority of sounds by check how much you speak louder the segment than others. For example pronounce “a” and “t” which make more louder sound? Yes it’s “a”. Vowels are more sonorous than stops.  So the hierarchy of the sounds like below.

Vowels > Glides> Nasals > Fricatives > Affricatives >Sops

2.consonant

1) less sonorous

2) lots of obstruction

It’s just opposite from the vowels actually.

3.Glide(“y, w”)

We call this something between vowels and consonants

Because it has both property

1)Their articulation is similar with the vowels(i.e., not much obstruction and tongue and mouth act similar when they’re pronouncing vowels)

2)However they can’t not form a syllable in the same manner of vowels.

We’ll get to this point later, b/c syllable is not included in the midterm

Okay, we saw standard trio classes.

Now let’s get to more specific classification on them 

1. consonant

We can divide this as few parts which are labial, dental,alveolars,palatal,velar,glottis(I didn’t wrote all the classes b/c they’re not simply including any English sounds)

1)labial

labial sounds are articulated by lips

E.g., b,p,m

2) dental

dental sound are articulated by your teeth. Dental sound can be more classified by what other organ that you’re using with your teeth. E.g., “th” is interdental because you use your tongue between dental to make the sound. “f” is labiodental because you use a lip and teeth.

3)Alveolars

That’s the pic that I draw to explain the place of sound articulation, “a” is called alveolar ridge and the sounds made from there called Alveolar easy?

E.g., [n],[t],[d],[s],[z],[l].

There’s a trick to remember this, you can actually sound it but who knows for some case, but you need to know the animation called “Death Note”.  You will know what I’m saying down there if you watched it.

Death Note there is a L not Z” So remember the first consonant for each word.( maybe it’s not helpful..but at least for me. )

4) Alveopalatal

Alveopalatal is ” b’ ” area. The right after the Alveolar ridge.

pronounce “Ship, chip, judge and measure”  You can find this sound is Alveopalatal

5) palatal

Palatal is ” b” ” part.

It’s a hard palate in our mouth. Pronounce “y” then you can find “y” is palatal glide

6) velar

velum is “c” part soft part back in your mouth. The sounds made here called velar. [n], [k], [g] is the velar sounds and there a also trick to remember this. You can just remeber one surname in Korean “Kang” then all the consonant is velar sounds.

7) glottals

Do you remember “breathy sound” “h”? It’s “breathy” sound that is made by glottis since glottis is like a door to allow air get out from your lung and in the same way the flip sounds in better, bottle(we will talk about flip soon)are also glottals

Up to now we just talk about the place of sound articulation but

Even though the sounds share same place sound different. Why? because they have different manner.

What manner do I need to know? Well, there’s few classification regarding the manners.

1. voiced vs voiceless

2. nasal vs oral sound

1. and 2. are pretty easy so I’ll talk about it if I have a time

In English, there are 3 nasal consonant, [m,n] and IPA for -ing(can’t type)

3.Stops vs Continuant

Give me any character then I can differentiate it by 2 categories.

Stops and Continuant. Pronounce “d”. Before you do that you need to pause little bit. Yup, that’s stop. Pronounce “S”. Do you need to pause? No. That’s continuant.

I made a game so try to fill this board with the phones that I gave to you.

V less: voice less, B = bilabial, A=Alveolar,G=glottis

The answer is below.

So we’re done with the stops.

Now only continuant left and it’s only containing 3 parts.

1) fricate

fricate refers some sounds that make fraction in your mouth when you pronounce it like

[s]. Let’s do some game

LD: labiodental, I: interdental, A: Alveolar, AP: AlveoPalatal, G: glottis

The answer is like below

**Affricate

In stop, there’s something called affricate which is stop+fricate. I think since there’s a something(stop) before fricate it’s affricate. The example is like below

The first one is voiced and the last one is voiceless

Since affricate has fricate part, we’re including the affricate to the fricate when we classify them as “noisy fricate” and “less noisy fricate”

We call the noisy fricate as sibilant or strident

When I took the lecture, I didn’t understand what is exactly mean by “noisy” but I found more sensible way to explain what is mean by “sibilant”. We call some affricate or fricate as sibilant when the air stream go through along the tongue to the sharp edge of your teeth.

like this.

 

Try to solve this. A: Alveolar, AP: Alveolar Palatal

The answer is below:

2) liquid

liquid refers some continuant sound that make air passes through your mouth more freely.

Like L(lateral liquid) and R. I don’t actually get this stuff and I don’t why we need liquid but I’ll let you know when I study further.

For L, there’s something that we need to check before we go,

L is actually having two faces. Like some psychopath in movies.

One side of L is something we know that is pronounced in the alveolar area.

The other one called “dark l” and it’s pronounced in the velum. Just pronounce “fall” and “leaf”, which one has “dark l”?

: fall

There are also two sides of R

which is retroflex r and flap r

retroflex r is [r]. When you pronounce “rhyme”. You’re pronouncing [r]

but as you know, when you pronounce like “butter” you don’t say “t” that much unless you’re English. We usually use some kind of r sound which called “flap”

The last thing about liquid is liquid can be voiceless or voiced. We will talk about it later

3)glide

Glide is bit confusing for me. It looks likes constant when it’s written but my text book saying it’s semivowel. But come to think of it, It actually sounds like vowel and it is actually vowel in my language. I still don’t get why it’s not a vowel then, but I heard it’s because it can not form a syllable like vowels do, so we will get to the part later after my midterm

I’ll just explain the property of glide.

1. glide is continuant

2. there are only two glide in English [w], [j]

You can find [w] in “what”

It’s voiced and “labiovelar”

[y] is in “yes”

It’s voiced and palatal.

So we just look over some property of Consonant.

Let’s look at some vowel!

There are few property of vowel.

1. They don’t have much obstruction when you pronounce them

2. Vowels are syllabic

-what’s mean by that? Well, generally you can usually get a syllables in a word by separating segments by the vowels.

e.g., bu/si/ness/ one vowel per one syllable

but we will  get to that point more closely soon

3. The vocal track is more open

They don’t have much obstruction in your mouth but also there are not much fraction when the air goes through it, too compared to glide and consonant.

4. different vowel can be articulated by the shape of your lips and the position of your tongue.

I guess you can check how your lips change it’s shape when you pronounce it and the tongue, too.

But the tongue part is actually very important because we differentiate vowels by the position of tongue. So the tongue goes behind then we call the vowel as “back vowel”

** vowel can be differentiate by whether it’s tense or lax and also by whether it’s rounding lips or not.

5. vowels are sonorous sound

block you nose holes by simply hod you nose tight and try to make some vowel sound.

You will find it’s hard because vowels are sonorous!

*simple vowel/ complex vowel*

You can differentiate vowels as simple vowel or complex vowel.

simple vowel has very consistent property during it’s sounded

like put it has only one sound for u

but complex vowel changed its place of articulation when it’s sounded or other quality when it’s sounded in a syllable

The main example of the complex vowel is dipthong.

dipthong changes its place of articulation when it’s sound it move away from its initial sound position to a glide sound position.

For some dipthong that has drastic change, we call them as “major dipthong”

Let’s take some example

e.g., price it has one syllable and i is [aj] it has two sound and it goes to [j](i.e., glide)from [a]

You can here clearly that the vowel has two sounds. So it’s major dipthong

Minodipthong you can check it out in play[plej]

You might say “What?” It’s one vowel and glide, duh? I know!

but I guess as long as it’s placed next to each other and form a syllable I think people in linguistics take them as one complex vowel which is bit strange for me.

Or you can see go[gow] it’s minor dipthong.

We can check some example of dipthong in Canadian English and solve some problems in test.

Well, I feel bad that I’m writing in hurry and don’t go deeply but I’ll try to get back here before the final and sort this things out nicely.

minor dipthong

say [sej]

grow[grow]

major dipthong

** notice that for the major dipthong, even your lips are change drastically

my[maj]

now[naw]

boy[boj]

Now let’s classify vowels more specifically using their place of articulation

As I said before, we can differentiate the vowel by the position of the tongue.

Let’s see pete[pit] and pot[pat]

To sound [i], your tongue moves to high front and for [α] moves to back low, so we call [i] as high front vowel and [α] as low back vowel.

pat a is [ae] and it’s front low vowel

and that’s pronounce to[tu]. [u] is back high rounded vowel, since the lips are rounded.

So let’s take all the front vowels altogether.

Then you might ask how to distinguish ‘I’ and ‘i’

 The difference is tense. There is a example, take a look at “green” and “grin” which vowels are more tensed? green right? that’s [i] and it’s tense and [I] is corresponding lax vowel.

Usually, tense vowel is longer and higher in pitch and the position of the tongue.

Take a look at bait and bet bait is more tensed right? and it’s [e]

Now we’re done with the front vowel.

Let’s take a look at the back vowels.

[u] is tense and the other one is lax.

Okay we got back and front and then what? MID

There are two central vowel we need to take care of.

It’s corresponding to the sound “ㅓ” in Korean.

Both are mid, lax, central vowel. The “hat” symbol like one has more accurate sound and it appears as stressed vowel in English while the other ones called as  “schwa” sound and unstressed ,also the pronunciation of it is not so clear.

Up to now, we talked about the place of the articulation of vowels and consonant.

But other than this, we also talk about their proper in the perspective of the suprasegmental properties which are pitch, loudness and length.

Pitch is all about how you control the “air pressure”.

You can control the air pressure by using your “vocal fords”.

Try make some high pitch like soprano. You will recognize that you’re vocal folds are controlling the air amount that go through the glottis.

Tone and Intonation

Those pitch are moving around between segments when you’re talking. The pattern of the  movement, we call them as Tone and Intonation

The difference of Tone and Intonation is Tone is the movement of pitch that affects the meaning of the word and Intonation is the movement of pitch that doesn’t affects the meaning.

We call some language that has different meaning if we change the pitch called “tone language”.

e.g., Chinese is tone language.

There are two types of tone languages which are level-tone language and contour tone language.

Contour tone language can have the change of the tone in one syllabic element but in the level-tone language there are several stable tones for each syllabic element to use.

http://www.britannica.com/EBchecked/topic/496120/register-tone-language

 Intonation

Intonation is the change of tone that doesn’t change meaning.

But,(I hate use but here) in English, Intonation sometimes change the meaning of the speech.

Like “want some”. If you pitched high at the end it’s like want some? (we call this un-terminal contour b/c it’s not terminating conversation and change the tone in one syllabic element at the end)and If you pitched down, it’s like “want some.”(we call this terminal contour)

downdrift

downdrift is a phenomena related with the pitch

Since one pitch is reconizable if it’s distinct with the thigns around it. if you pronounce lower one precede the higher pithch you don’t need to have really high pitch so it can be little bit lower than usual that’s down drift.

http://www.spectrum.uni-bielefeld.de/TAPS/Connell.pdf

Length, stress [:],  primary ‘, ` secondary stress

Speech production in English

We’ve talked about the property of the sound of the individual segment. However, speech is the sequence of them and like the life is sequence of events and each events affect another, each segment affects how other segments sound

Pronounce “plower”, you don’t pronounce “p” exactly and “l”. When you pronounce “pl”, your tongue is heading toward to your alveolar ridge before your lips are separated.

We call this as “coarticulatoin”

Since coarticulation = sounds together, so there should be some change in the way to pronounce individual segment. We call this as “Process”

One of the process is “assimilation” which means that a sound become similar with the neighboring sounds.

For a example for the assimilation, vowel that precede a nasal consonant also get nasalized, together.We put “~” on top of the IPA symbol of the vowel if it’s nasalized.

We call this assimilation as “regressive assimilation”

Can you see that it’s kind of backward affection? You talk in a order of red cross but nasal assimilation takes place in a blue direction. So we call it “regressive assimilation”

Progress assimilation 

One of the progress assimilation is devoicing of sonoroant. If voiceless segment is precede the glide or liquid(i.e., [l,r,w,j]) then the liquid or glide become voiceless. We put a little circle at the bottom of the liquid or glide if it goes through voice assimilation.

Place of articulation is another example of progress assimilation. Let’s take a look at “impossible” and “intolerable”. We use “im-” or “in-” to negate something, since “p” is bilabial sound and m also. “im-” goes with “possible”. By the same reason, since [n],[t] are both  alveolar sounds, so “-in” goes with “tolerate”.

Flapping is also one of assimilation. Pronounce “butter”. Then you can feel that you’re kind of pronounce “r” similar sound when you pronounce “tt”. Because u and e are both continuant “tt” also changed to continuant like sound and that’s flapping

Dissimilation

There is also something called “dissimilatoin”.  This is opposite of the rule of assimilation and bit rare case than “assimailation” But this happens in order to make us pronounce easier. Pronounce “fths” and “fts” which one is easier? later one right? If too many similar things are jumbled up together it’s hard to make difference between them so English put some stop segment like [t] to pause between similar things. For example, fifths is not pronounced as [fifΘs], since it’s f, th, s are all fricative, it’s hard to pronounce them altogether. Insted of that, we pronounce [fifts]. (Making our life easier by putting t(i.e., stop) between similar segements.)

Deletion

It’s the situation when some segment is not pronounced. In English, usually a schwa sound is deleted if the next vowel is stressed.

Deletion can be happened sometimes instead dissimilation.   Instead of [fifts], people sometimes jut delete one between two similar things like [fifs].

Epenthesis

It’s actually “Insertion”, I don’t know why it’s called Epenthesis instead of Insertion.

As we saw that when the nasal consonant is followed by un-nasal sound their places for articulation try be same like “impossible and intolerable” ,so sometimes insertion can happen if a nasal sound is followed by non-nasal sound has a different place of articulation, then we put something between them that has same place of the articulation from the nasal sound.

E.g., warmth [warm’p’th]

Metathesis

Metathesis is we move phonemes to ease our work to pronounce the words

e.g., prescribe sounds like perscribe

Vowel reduction

To make back vowel and front vowel, you need to move your tongue back and forth for most of time , it’s easier to pronounce the central vowel. So there is a tendency to pronounce central vowel, when the actual vowel is not stressed. We call this tendency as “vowel reduction” and in English, most of time, “schwa” is pronounced in the vowel reduction.

e.g.,  [kʰæ´nədə] ->  [kʰənéjdiən]

Aspiration

When voiceless stops comes to the first then hey hare aspirated.

Phonology

Phonology is a subject how the sounds system is controlled and governed in Languages.

There are two major section in Phonology.

1. Find some sound pattern in languages

2.Find the principles underlying in the sound patterns

And the things that Phonology studies is segment, feature and syllable

And also studies how sounds are related with the meaning. We call two sounds are contrast if they change the meaning when we exchange them in a word like c and p in cap, gap

Minimal pair

We call two words as a minimal pair if they have only one different segment at the same position and they have a meaning difference

e.g.,loose [lus] and lose [luz]

We call the situation of what sound following and preceding as “environment”

Near Minimal Pair

It’s not perfectly differ by one segment but similar enough to make a contrast

Phonemes

Segment that contrast to each other called Phonemes. We use [] for Phones and // for Phonemes

Complementary distribution

Complementary distribution happens between two elements when one elements occurs in one environment and the other one occurs only in the complementary environment.

We can take an example of devoicing of sonorant or dark l and normal l

you know they have complementary distribuition but it’s not contrast ,so we say those segments are phonetically distinct but not phonologically distinct.

Where one segment is phonetically distinct while not in phonologically. We call them as allophones of phoneme.

Allophones: predictable variants

Phoneme: phonological unit

So we have two representation which are phonemic representation and phonetic representation.

/l/ = [l0], [l]

Phonological knowledge is something that we store in our head(metal lexicon)

Phonetic things are something happening very automatically. Hence if you know the Phonological distribution of a language, you can say you know the language.

What we do with this phonological knowledge?

So to study a language, you need to know how the language phonologically distributed.

There are some steps to do that.

Step1: Are there any minimal pairs for the sound?

yes. Well then you complete your job you found two sounds that belong to different phonemes.

if no, go to the step 2: List the environment where the sound occur

step 3: search for the pattern and check if they are in complementary distribution

 Example:

Determine whether [s], [ʃ] and [z] in Korean are all allophones of the same phoneme or of any of them are in contrast. If they are all members of the same phoneme, state the distribution of the allophones and pick one as the basic sound of the phoneme. [ɯ] is a high back unrounded vowel.
[ʃihap]  ‘game’
[ʃipsam]  ‘thirteen’
[inza]  ‘greetings’
[yʌŋzučɯŋ]  ‘receipt’
[son]  ‘hand’
[sosʌl]  ‘novel’
[us]  ‘upper’
[ʃilsu]  ‘mistake’
[ʃinho]  ‘signal’
[paŋzək]  ‘cushion’
[ʃesuʃil]  ‘washroom’
[sᴐm]  ‘sack’
[sæk]  ‘color’

I’ll write the steps to solve this problem in my hand and later on I’ll scan it.

*free variation

Free variation in linguistics is the phenomenon of two (or more) sounds or forms appearing in the same environment without a change in meaning and without being considered incorrect by native speakers.[1][2] Examples from English include:

*either has two ways of pronunciation

*tomato has few ways to pronounce it.

Classes in Phonology:

In phonology, a natural class is a set of sounds in a language that share certain phonetic features

e.g., Glide and Liquid are non-sonorant consonant

*******************************

I was practicing how to figure out some sounds are different phonemes or just allophones ,but I was kind confused after if figure two sounds are complementary distributed then why we conclude them are allophones. Becuase they can be just completely different phonemes and they can have complementary distribution by chance. But the fact is that the chance is very low if we think about our sample set is the whold data of lanugage(i.e., after generalization). Like ham, cam if they are different phone, then whatever the environment is we can use the h and c very freely. So there should be no rule to distiniguish them because they’re already distinguished in our brain(i.e., Mental Lexicon! remember difference of phonemes are stored in our Mental Lexicon hence we don’t have any need to implement any rule to differentiate)

However, if they’re allophones then we didn’t store them in our brain so there should be some rule to differentiate them if we can say they are different.

The component that mislead me was the size of set. Usually, for the research we have sufficient size of date so that we can generalize.

Yup. so the mystery is solved.

http://people.umass.edu/scable/LING201-SP11/Slides-Handouts/Allophones-Phonemes.pdf

**Note: I got a lot of source from everywhere ,but I feel lazy to write all the source and I’m not an expert of Linguistics so don’t believe 100 % here.

CSC209 Shell Programming

What we will going to talk about?

Unix? Unix is a kind of OS system like Window. Why we need to learn Unix in 209? That was also my question, when I was starting this course. I think it is related with the history of C. C is essentially developed to work with Unix. Here, I wouldn’t explain a lot about very detail. I will just get the important point about Unix and Shell Programming. Let’s do this.

 Unix file system

To learn Unix file system, stand up and go outside and look at some trees! You might think I’m crazy but hell no. Unix file system just looks like upside down tree. The very first file that contains everything, we call this “root” and its name is “/”. Few directories are stemmed from the root tree, the important ones are “usr, “bin”. “bin” stands for “binaries” and “usr” stands for “users”. The reason they are important is bin contains important programs that user need to use to manipulate to Unix file system. (e.g., cp, ls ← don’t worry about this right now, you will learn soon) and “usr” contains “Home”  directory that usually contains all the subdirectories and files that users made. You might wonder why I’m keep saying “users” instead of “user”. It is because almost every computer has a capacity of having multiple users. So they have a  directory called “usr”(users) to store each user’s directory. So let’s say your Emily’s family share one computer and Emily’s mom usually don’t use computer so Emily’s father, Jack and Emily are only using it. Then in “usr” directory, there will be two sub directory called “Emily” and “Jack” if they set their first name as their user name.

Well, you said it’s upside down tree, but It’s not a real tree! What it is?

Yeah, you’re right. Unix file system is one big hierarchy of files and I was saying the structure of it, just looks like upside-down tree. But it’s not a real tree ,because Unix File system is entirely composed of files and file is a named collection of information. The file is stored at Disk(actual hard disk). There are 4 types of files in Unix system.

Ordinary File

Ordinary Files is like plain coffee, it has basic capacity as a file. (i.e., we can store text, program, some other data in it but that’s it)

     Directory File

Directory is a special type of file that has information about other files that it contains. Directory File doesn’t contain actual data of files it’s containing ,but contain ‘information’ of them (i.e., their name and their “inode”). What is inode? Well, I’ll talk about it later, but it’s just a pointer that is pointing to the place where actual data of a file is stored in a hard disk and inode also has all the other information of file except for its name and the actual data.

Device File

Device file is a file make users be able to communicate with actual devices (such as “printer” and “keyboard”). So in Unix, you can control all your device like you control your text file! (as long as you know how to use it well and I don’t yet.)

Link File

Link file is a file that has same i-node with the original file. What that means? You can make a link file for an ordinary file by typing “ln       original_file       link_file”. Then even though link_file has different name from the original file it actually points same chunk of disk that contains file contents.

Inode 

All file has it’s inode. i stands for index because each node has a special number like “index”. We called this index as I-number and it is for Unix OS to differentiate files in the disk .(i.e., so the actual file name is for human beings, then how computer connect inode and its file name? we’ll talk about it soon. ) inode contains ALL the information of file except for ‘file name’ and ‘file content’. That’s actually very natural that Inode doesn’t contain “file name” and “file content” ,because first of all “file content” is stored in the actual disk and Inode directs where the file content is stored in the disk. About file name, think about link file. Link file has a different name from the original file but it should have same inode to save computer memory. If inode contains file name, you need to make another Inode for all the link file ,even though the all the inodes point a same disk space!(What a waste!)

Inside of inode

So what exactly inode contains? inode contains file size, file owner, the group that file is belongs to, file access right, hard link count, time stamps(e.g., when is the last time of modification? etc..)

Well, if it doesn’t have a file name, how computer connect its file name and inode?

Well, each directory has a table that maps each file name and its inode. So if you refer one file by it’s name, computer recognize it by it’s inode.

How I should work with this i-node

You might want to work with this i-node since i-node has almost every data of file. How are you going to work with this data structure? There are several command you might be interested in.

1. ls command 

ls stands for “list file”. It lists information of files depends on what options you give to it.

If you type “ls -al”, you computer will list all the files in your working directory with it’s inode information. The output will be separated into 6 columns.  1st column: access permission, 2nd column: the number of  the hard link!  It has interesting feature you might be wonder so I’ll introduce later. 3rd column: owner, 4th column: size in bytes, 5th column: data and time modification and 6th column: name. If you make a directory in your file, then you can see that 2nd column for the directory is 2 by default it’s because first one hard link as itself and there is a hidden hard link called “.” in the directory. You can see this hard link if you type ls -a(“a” stands for all and it shows all the hidden files in the working directory to you.). So if you type “cd .” then you will stay in your working directory and a hard link for its parent is created by default named “..”. Hence when you create a sub-directory in your directory then you’re increasing the number of hard link of your directory. Because when you create a sub-directory, it will create a linked to its parent named “..”.  first column is also very interesting and “useful” because with this you can control the access permission of your file. Well, If you share a computer with your family using different usernames, you might have some files that you don’t want you’re parent to see. (Oh, come one.) So, you might want to change the permission for the file. First, let’s see how you can see the information of the permission. The outcome of the first column will be 10 characters that looks like “blah blah” first character of it(let’s say position 1), refers the type of the file. d: directory, -: ordinary file, l: symbolic link(is that different from the hard link? Yes. we will talk about it soon) position 2-4 : permission for the owner (r- read, w-write, x-execute), 5-7: permission for the other users in the same group(important one to know how to prevent your parent from checking some files ) 8-10: permission for all other users. – denotes the lack of the right. if there is – where there should be w then it means no permission for writing.

So how would you change this file permission? 

We can change the permission by using a command called “chmod(stands for change mode)”.

You can use the command like this way “chmod g-rwx filename” to prevent your parents from accessing some of your files. This means remove the permission of reading, writing and executing from your group.

Symbolic link (What makes symbolic link different from the hard link? )

I mentioned the symbolic link above but I haven’t explained what it is. Hence, let’s talk about it now. The concept of symbolic link is very similar with the’ short cut’. While hard link takes same amount of space as its original file symbolic link only takes as much as the path to the original file and while hard link can’t be linked to directory, symbolic link can be linked to directory. Symbolic link has only one data: “the path” to the original file. It’s like alias.  we call a collection of information as “a” (i.e., a is a file name) then make a hard link for a named b(i.e., then b just have a data that is “/usr/home/a”, assumed that we’re in a home directory, if we try to some operation on b, computer directly interpret that action is for a.) Since the data the symbolic link is different, it is natural that it has different inode from the original file.

Well, what’s the point of having  symbolic link, by the way?

Well, as I said, you can’t make a hard link for a directory because of the recursion problem.  Let’s say you have a hard link called b for directory a inside a. If I said try to delete b, then it should delete a, and to delete a, it should delete b……………….Super recursive. Since computer doesn’t want to resolve those case, it just excluded the case of directory having a hard link but except for “.” and “..”. Hidden hard link for directory. You can’t modify these two.  Since the symbolic link just refers the original file, so we need to worry about the recursion problem.  Also, it only takes little space of it, so you don’t need to worry about it’s taking much space. That’s the clever part of it.

How to navigate Unix File System?

In Unix, you’re supposed to surfing around your file system using console which is looks super cool but not very intuitive and sometimes dangerous! (One time, I deleted all my file because I typed one line (= rm -rf *) mistakenly and it wasn’t recoverable) However, it can be also powerful! In Window, you need click every time to manipulate your files and directories but just type one line, you can do everything! Anyway, let’s get back to our main point.

Emily

Music —-SecretePictureReading

(Big Bang, Epik High)      (Diary)       (Good-Memory)   (Poem, Novel,Comic book)

 (Love Dust, Ego)                                            (Pocket Monster)

I hope the tree structure that I made is understandable. Music have 2 drectories called Big Bang, Epik High(some bands I listen) and Big Bang have 2 files called Love Dust and Ego. So now, I’ll drop you some place in this file system and you need to surf to another place  that I order you to go. In this journey, you will learn how to navigate Unix file system. Please, survive! So first, I’ll drop you at “Big Bang” and you need to go to  “Epik High” directory by using just one line. How would you go? There are always 2 ways of approaching it. First using a absolute path! You can approach to the designated directory by typing “cd /usr/home/Emily/Music/Epik High” (cd stands for  “change directory”) but it’s too tedious to type all of them. Then you can type “relative path”!  Relative path is easy if you think that you’re going to Epik high from Big bang by your feet. So you need to first get out of Big Bang then you will be in Music and after you will go into the Epik High. That’s it. <Music → Epik High> How would you type this. To go to the parent directory (in this case, Music), you need to type two dots (=”..”). So you will type “cd ../EpickHigh” That’s it. But one more interesting is you can also type ~ to refer whole absolute path to you user directory (in this case “Emily”), so you can just type “cd ~/Music/Epikhigh” and it is same as you type “cd /usr/home/Emily/Music/Epik High”.

Command

We learn about how the file system is constructed, but How we will manipulate them. We use many interesting command to do that. We call these command as “software tools”! 

“To be good a good plumber, we need to know how to use tools and we need to eat a lot of mushroom! Yes, we must know how to use this tools in order to defeat the turtle monster and save our princess.

1. Pipe

The very first thing we will talk about is something called “pipe”. If you know Mario game little bit, you will know how the pipe magically works in the Mario world. If you don’t know, don’t worry I’ll tell you. After you clear one stage, there is a pipe. If you jump into the pipe you are sent to the next stage. That’s it. Interestingly, that’s how pipe works in Unix. If you pipe your output to somewhere then your out put became an input to the somewhere(So the Mario who finished a stage go to the next stage through a pipe and need to start  for the next stage.) I can actually explain more easy way if you want, by the way “|” is pipe in Unix,  2+3|+4 = 9 (you can’t do this in Unix but it’s just for helping your understanding ). It became 9, because the out put of 2 +3 = 5 became the input for “+ 4″after the pipe, so 5 +4 = 9.

The real example will be this, “cat somefile | sort” , then the line that I wrote will sort all the content in “somefile”.

2.command>file

You can see this as kind of pipe. It’s called redirection and it just redirect the output to the file. So if you type  “cat somefile> file” then it’s output will be redirected to the file. So if you open up the file, you can check the output. There are actually more  symbol like ‘>’ for redirection.  ‘>’ only redirect standard output(i.e., it doesn’t redirect any error, so if any error occur while running the command, the error message will not be redirected to file, so it will be just printed on your working console or standard output). If you want to redirect the error, too then you need to use “>&” instead of “>”. If you only redirect error message then you can do this! “2>”. Then it will redirect only error message.

I found this website has a such nice information of  redirection, so check it out. http://www.codecoffee.com/tipsforlinux/articles2/042.html

3.Filtering

Most of unix command are designated for filtering by our professor. Well, I guess that’s kind of make sense because all Unix system is composed of files and you want to manipulate content of it in your way to do something else. If you just want to see the content as it is, you can just double click it.  Since manipulating content is filtering, so I guess that’s why there are a lot of command for filtering. Okay, anyway “by an expert”(My prof), filtering is important from the perspective of software tool. Remember Mario? To save our princess, we need to hurry!

3-1. sort

sort is simple command. Guess what it does! Yup, it sort every output of file. So let’s say you have a file called “name_list” and its content is like below

“name_list’s content”

eddie Albert

Jason Alexander

fred Astaire

Don Ameche

I got some “celebrity” names that I don’t know anyone of them, from the website called “Totally Usless Knowlege!” I always found there are too much celebrities (who are famous for nothing) in North America and i found it’s pretty funny.  Anway, if I type sort  “name_list”, then the output will be

Don Ameche

Jason Alexander

eddie Albert

fred Astarie

done. sort is sensitive about case matter.  If you don’t want to care about (i.e., if you want to treat “a” and “A” equivalent, then you can just put one option which is “-f” and if you want to sort by their last name, you can just add one more option which is “-k2” (k stands for “key”))

3.1 – sed

“sed” stands for “stream editer”. What is stream? In our case, it refers characters in a file. So sed means just kind of editor that we can use to manipulate the characters in file.  There are few options that we can try for sed, but one thing that might be useful is “-s” and s stands for “substitute”. So let’s say you have a text file and you want to substitute some words in it. Then you can use this option. How would you use it. See below example.

Let’s say I had a file called file.txt and inside it’s like this

“unix sucks! Using unix is such a pain of ass. I need to learn something to use it. Why don’t you use window?

It’s easy and you just need to click a lot. I hate to learn unix stuff ,so I’ll just click a lot! why don’t you let me be stupid? “

Okay let’s change unix to mac ,then you can type sed ‘s/unix/mac’ file.txt.   If you didn’t know the whole spelling of unix you can still do the job using “regular expression”(I’ll talk about it later). It will change the first occurrence of  unix to mac. So the first line will be “mac sucks! Using unix …” but for most of case, you will probably change all the occurrence of unix then what should we do? We put “g” which stands for global at the and of the command like this.

sed’s/unix/mac/g’ file.txt

If you want to change specific nth occurrence for each line, you can use something called “flag”. Let’s say, you want to change all the 2th unix of each line. Then you can type this.

sed’s/unix/mac/2’file.txt

But what if you want to find 2th unix and want to change all the occurrence of unix after that? (but Not the first one) Then you can combine “flag” and global together. Like this,

sed’s/unix/mac/2g’ file.txt 

You might want to add some characters around unix instead of changing to something else, then you can use ‘&’.

sed’s/unix/{&}/g’ file.txt 

In this case, it will change all the unix → {unix}

What else you should know.. well I was doing my homework, I found the grouping things are pretty useful.

So let’s get back to the “name_list” file, if you still remember. I put some of people’s name that we don’t need to know(No offense for those people ,but it’s true. Why the hell I should know their names? Waste of my memory absolutely.)

So “name_list” has some people’s full name and we want change every line in to this form

“My first name is <first name> and my last name is <last name>”

So we will take a first name as ‘group 1’ and  the last name as ‘group 2’. What should we do? Check this out!

sed’s/\(.*\) \(.*\)/”My first name is \1 and my last name is \2″

.* is regular expression for any characters. Since we have a space between first name and last name, I just said that put all the characters before one space as “group 1” and put all the characters after one space as “group 2” and put those group nicely in the formatted string that I gave you. That is what I was said. We must put \ for parenthesis because we don’t want computer interprete that we want to look for literal “(.*)” (←What the heck  is this word) and we want them know that is for grouping.

If you want to see the replaced line, you can type this

sed -n ‘s/unix/mac/p’ file.txt

if you don’t put -n, it will print out all the lines once if the line hasn’t replaced yet, and twice if the line has changed.

You can use mutiple sed with pipe.

and what else you should know about sed.. hmm.

Oh! If you want to change only specific line then you can do this.

sed 3 ‘s/unix/mac/’ file.txt

,then it will only change the 3rd line.

Too much..? Well there are actually 4 things left that you should know…(see? file.txt is actually right. Unix sucks! Let me click a lot in Window, please! )

You can append a line(putting a line after  specific lines)

sed ‘s/unix/ a “putting this line after the lines that are including the word unix”‘ file.txt

You can insert a line (putting the line before specific lines)

sed ‘s/unix/ i  “putting this line before the lines that are including the word unix”‘ file.txt

You can change specific lines

sed’s/unix/c “Any line that contains unix will be changed to this line”‘ file.txt

wc(word count)

“wc” is a very useful tool, if you want to just check how many lines that you have sort of things. If you type “wc myfile.txt” and the output is 2 10 50 then that means there are 2 lines, 10 words and 50 characters. People only use how many lines do they have in their file since usually most data base each data just took one line for one entry ,so if you count the number of lines in your file, you can get how much data you have in your file. So to get the number of lines in your file, you need to type “wc -l myfile.txt”. That’s it.

grep

grep is a tool to print lines that matches some pattern that I’m looking for.

For example, let’s say I heard form my friend C that my friend A and B talked about me what they’re chatting on facebook, so I hacked one of their facebook and got the chatting file. There were 40000 lines! and I’m super lazy to check all of it. So I decided to use grep, since my name is “Yelim” so I just type ‘grep “Yelim” chatFile’ and I found a lot of lines that contains my name!  Like “I miss Yelim (;” I felt really good after seeing all the nice statements that my friends made about me. But my friend C said, they also talked about me in Google chat and since they stopped and started talked for few times for that day, they have few files that might contains some content about me. So I hacked one of the friend’s g-mail account and got some files named google_chat_1, google_chat_2… and so on. I felt too lazy to type grep command for each file. However, soon I found with grep you can search multiple files in once!

Just type this grep Yelim google_chat_*, then it will search all the file has the formation of google_chat_(some character).

But interestingly, I couldn’t find much contents about me. So I decided to case insensitive search!

grep -i Yelim google_chat_* 

And.. I found a lot bit bothering my mind.  Like.. “Hmm.. I thought Yelim was my friend….”

So I decided take a look at the context! To see the context I had to get the lines around the line that bugging me.

So, I typed “grep -i -C 2  Yelim google_chat_*” to look 2 lines before the line and 2 lines after the line.

So it was like this.

I miss her.

She never get back my message!

Hmm.. I thougth Yelim was my friend

dissapointing

but well she might be busy.

Yes (: I do have good friends. I realized that I should send their mail right away from now on.

Additionally, if you either only want to print 2 lines before or only 2 lines after,

you can use -A for after -B for before instead of -C

tr(translate)

head,tail

uniq

cmp

diff

comm

join

find

Regular expression 

There are only bunch of rules that we need to remember to use this expression ,so I’ll start by introducing useful example

1.[a-z]+:

will match one or more lowercase

2.[abc]:

will match either a or b or c

3.[^abc]:

will match any character except for a,b and c

4.[a-z]:

will match any one lowercase

5.[a-zA-Z0-9]:

will match any letter or digit

6. xyz|abc:

will be match either ‘xyz’ or ‘abc’

Quantifier example

To search a pattern more effectively, we use quantifier. Like find some pattern that has one or more a=> a+(here ‘+’ is a quantifier)

1. X?

X is optional, X is occur once or not

2.X*

X occurs zero or more time

3.X+

X occurs once or more

4.X{n}

X occurs exactly n times

5.X{n,}

X occurs n time or more time

6.X{n,m}

X occurs at least n times but not more than m times

Glob expression 

Some command like grep, sed allow user to use “Regex”(aka regular expression). However, most of command in shell scripting use “Glob expression”. Except for few commands, glob expression is mostly used for Unix Shell.(I need to check about this with my prof)Hence, there’s a reason to learn it.

In glob expression, there are 4 rules that you should remember!  

  • ‘*’ matches any number of any characters(Hence, *.c will match with yelim.c, Emily.c blahblah.c You.c or just .c)
  • ‘?’ matches any One character (Hence, ?.c will match a.c, b.c, c.c but not dd.c and not .c)
  • [list of chars] it will match if the pattern is matched using one of the char in the list. (e.g., a[1234].txt matches a1.txt, a2.txt, a3.txt, a4.txt )
  • [range] instead of writng all the possibilities like giving a list of chars, you can give a range! Like, [1-6] (e.g., a[1-4].txt will wield same conclusion with the example above)

Shell Programming

Now, finally you got all the tool to be a nice plumber!

“Then, let’s start shell programming!”

How you start shell programming?

But, before that what is shell?

//will write it later: shell is a program that make users interact hardware stuff and file system.

Why we need to put sh before type the name of shell script?

//I will write this also later, typing sh is just for running the script by using “Bourne shell”. There are few other shells so you need to specify which shell you’ll use.

Some specialty of “Bourne shell”

There is a specialty of “Bourne shell” that I want to introduce to you. It’s called “here-document”. Instead of making the shell read a file input. You can give some multiple line text to command right away. I think it’s better to explain by comparison with “csh(c-shell)”.

Let’s say you want to echo this multiple line below.

“Hi, my Korean name is Yelim.

My English name is Emily.

What will be my Chinese name?

Having multiple names are fun.

Because it makes me feel like I’m 007 B) Bang!”

In csh, you can’t do echo with this multiple lines in once, either you need to put echo for each line or you need to put this lines in a file and “cat” it.

However messing up with file and putting a echo for every single line seems daunting. So our Bourne shell has its specialty called “Here-Document”. You can echo it by this way,

echo<<EOF

“Hi, my Korean name is Yelim.

My English name is Emily.

What will be my Chinese name?

Having multiple names are fun.

Because it makes me feel like I’m 007 B)! Bang!”

EOF

“EOF” just let echo know that where is the start of the file and where is the end of file.

Isn’t that nice, huh? As one lazy person, I think it’s pretty nice.

Finally, let’s start?

Path

First, you need to specify the path that computer will search in order to get the files of programming(e.g., usually command like “cat”, “echo” etc) that you will use in your shell script. You can set your path like below.

“PATH=/bin:/usr/bin”

file descriptor redirection

http://www.linuxnix.com/2012/02/linuxunix-redirection-operatorsfile-descriptors-explained-examples.html

http://docstore.mik.ua/orelly/perl/cookbook/ch16_08.htm

writing is in process

(I didn’t get this part quite yet, so I need to ask to a TA or my prof)

Variable

To do any some minor programming, you need to have some variables at least because the point of having a programming is making human work less and variable is doing same thing! make human work less. So let’s assign 3 to x.

You can type as x=3(just make sure that you don’t have any space between them b/c if you have any space the shell will recognize x as a command)

When you use it, you can call the x by using $ like this below.

“echo $x”

$ is just something to differentiate x as a character and x as a variable.

**Some important points of variable**

if you want to print $xy (i.e., 3y that means you want to print y right after $x without any space, remember $x was 3), but you can’t type echo $xy. Because, shell will interpret it as variable ‘xy’ not ‘x’. Hence, there is some special syntax that you can use. You can type “echo ${x}y”

You can have default value for the variable. Let’s say you’re supposed to get some value and put the value to a variable. But the input hasn’t come so the value is null. So what you can do is set a default value for that case. You can do that by typing this.

echo ${my_var-0}

If you didn’t specified your my_var, it will echo “0”.

Basic “if-else” statement 

Like any program language, shell scripting language also has “if- else statement”. Let’s take a look at a small example.

if  [$my_name = “yelim”];then

echo you’re right!

                                                            else

echo “get out (:”

                                                                          exit 1

                                                              fi

So if you don’t know my name, your program will be exit and get my nice “good-bye” message.

The interesting that we will look at here, is “fi” and “then”. You must put “;then” after if statement and “fi” after finishing all the if statement.

‘ ;’ in shell scripting

“;” can be used instead of new line.

“echo a; cat b.txt; sort c” is equivalent to

echo a

cat b.txt

echo c

Why do we need this? 

We might want to apply one command for the outcomes of all this command(then we do e.g., “echo a; cat b.txt; echo c)| sort” in that case you want to collect all the out put and sort together.

test command

sometimes we want to test some value is equal or less or bigger than something. Then we can use command “test” with some optin named -lt(less than), -eq(equal), -gt(greater than), -ne(not equal to), = for string comparison -ge(grater than or equal), -le(less than or equal ).

Let’s take an example of test.

We can use this test with “if”

if test 2 -le 3

                                                                             then

                    echo “yes, you’re right!”

                                                                             else

                                                                             echo “something wrong!”

Other than comparing strings, test has some more useful feature to use.

One is “test -f file.txt” it checks whether “file.txt” exists or not and if it exists, it returns “true” and I guess the “f” stands for “file”.

Another thing is “test -s file.txt” returns true if the file exists and the size of it is not zero. I guess ‘s’ refers to the “size”. (feel lazy)

You can use “OR” and “AND” like in most language!

 OR = “||” two pipe for some reason. (For my opinion, it looks like chopsticks)

And = “&&” It looks like two person sitting side by side.

Loop

Other than if and else statement “Loop” is the most basic needs for any programming language. Because programmers are super lazy. They are lazy so they don’t want to do repetitive work. They want Loop do the work. So like any other language, shell scripting language has two loops.

For loop and While loop

Let’s take a look at the for loop first.

for i in sleepy tired

                                                                        do

     echo “You can do it”

                                                                         done

for loop is pretty easy. It’s already Monday 2 a.m. So I’m really tired right now. So I put sleepy and tired for  “for loop”. Since there are 2 words, for loop will work for 2 times. That means it will print “You can do it” twice.

If you’re going to give an argument for “for loop”, then you don’t need to write the “in blah blah” part. You just need to type “for i” then it will execute “for loop” for the number of your argument.

Personally, I think While loop is more convenient and  more useful.

let’s say you want to to something for 10 times then you can do that with the for loop by typing

for i in 1 2 3 4 5…..10

                                                                      do

                                                                                 blah

                                                                      done

However, silly don’t do that. Do it like this.

                                                                        i=0

while test $i -lt 10

                                                                         d0

                                                                         blah

                                           i=`expr $i +1` #you must increase i by 1.

                                                                          done

Same simple structure, but don’t forget to initiate i first and increase it by 1. ` the back quote is like saying “this is command not string” to shell # I’ll explain later on more detail  and “#” is for commenting.

case

I didn’t use case when I was doing programming in java and python. But I used in my shell scripting when I was doing my assignment. Because it’s similar with “else if ” and shell scripting language doesn’t ahve a “esle if”. So it comes very handy. The example of case is like below.

case $1 in

sleep)

echo “I’ll be happy.”

study)

echo “My mom will be happy”

*)

echo “if I don’t sleep and I don’t study, mom and me both are not happy”

esac

Yes, I’m sleepy as hell. But I just want to finish this writing. So yes I’ll do what I need to do! It’s easy to understand how it works. What I thought interesting about it, is *) and esac.

*) includes all other remaining cases and esac actually same as “done” in loops. I don’t know why the developers chose “esac” instead of “done”. It’s VERY annoying to type it.

Shell function

I think we got the basic needs but to be a good programming language, it’s better to have a function. function is for me like a small and minor program inside a program. It’s also reduce our work.

You can make a function in this form below:

function_name(){

Things that you want to do in this function

}

You can call your function by it’s name!

Suppressing some special recognition

There are some characters that have special meaning in the shell programming.(e.g., “>”, “>>”,”>&” etc). If you want to take these kind of character as literal, how would you treat them? Suppose I want to echo this sentence, literally. (“My height > Your Height”). If you try, “echo My height > Your Height”. It wouldn’t work as you want. The program will make a file called “Your Height” and write My Height inside it. There are 3 ways of suppressing special interpretation of shell programming.

  1. Back Slash suppress suppress the special interpretation of an immediate-following character.
  2. Single quotes suppress everything inside them, just except for another single quote.(That is, there is no way to embedded any single quote inside single quotes)
  3. Double quotes suppress most special interpretation. The exception are back quote(i.e., you send a command inside double quotes), back slash(so you can put a double quotes around double qoutes), and dollar sign(so you can still use variables)

Tricky part to think about with quoting

If you quoting something, like “this”, usually most of program thinks it’s one chunk of input when it parse the input. But there is a problem with it in Shell Programming(Darn it, another thing to think? Let’s just click a lot in Window!). Sorry to notice you this. But it’s not that there’s no solution for the problem. So, let’s just take a look at the problem. 

The Problem: Let’s say you have a file name called “file1”, “file2” and “funny file” and you have a program called “prog” that is just “cat” the input file(i.e., print the content of the input files)

If you use $*(this variable stores all inputs), then “funny file” will be problematic. Because any space will be treated as different inputs. So our  program,”prog” will try to find files called “funny” and “”name”

**NOTICE: I’m merely a 2nd year student(= not an expert at all), so the content might be misleading you. So don’t believe 100%. Any correction will be appreciate it. I got many information from everywhere and pictures ,too. However, I’m too lazy to write all the source.

file descriptor and redirection

often there might be some error that we don’t want to show its message but, want to see them later on altogether. So in that case, we can redirect error using 2>

2 is one of file descriptor, and it stands for standard error

0 is standard input which is key board

1 is standard output which is you’re working window

2 is standard error

if you use tyep “command 2> errorlog” then the error wouldn’t be printed out.  Instead of printing error message, it will write the error in the errlog file.

The notion of “>” seems okay. You just got the file descriptor and put “>” before the file or direction that you want to redirect to. However, I felt little bit dizzy, when I saw “>&” ← this bad boy. But he turns out a pretty nice boy inside. So let’s get to know him. >&  is used, when you redirect one file descriptor to another. What I mean by that is for example you directed standard output to some file(output.txt) by typing command 1> output.txt”. Then, later on, you also want to redirect standard  error to the same place that the standard input is redirected.

Then, you type 2>&1, since “&” is meaning “and” we can interpret  in English as “redirect together to the where ever the file descriptor after >& is redirected, please”

—-

I need to study more on “trap”, “double quote and suprresiing some special notation” and “regex”

CSC209Cramming

C programming?

I read an article how C is developed, but for me, What’s the point of knowing those thing? I’m living well without having taking much History classes. So I just extracted some Point that might be good to know.

C is called ‘C’ because it stems from a language “B” .

Q. Why we discarded B?

A. Well, It’s because obviously B had some drawbacks. One of  the drawbacks is that B doesn’t know much about Data types (i.e., string, integers etc). So what that mean is, even if you type 1/2 *cookie'(i.e., number * string), it will do multiplication of them and you will get really a strange outcome! Proper language should prevent programmers from doing that doesn’t make sense. Anyhow, B is gone. R.I.P B. So what’s the good point of C then? Why we need to keep this language?

To use C, we need to know bit more about how computer(that machine thing) interprets our code(just bunch of writing like a love letter). So when you make some program for machine things(including computer), you can easily manipulate machine with C than any other language. I think that’s the point ,because when I was learning Python, I didn’t learn about how the computer interpret my love letter. Now, It’s the time for me to learn about this bad boy.

Compiler(Computer-C language translator)

Before jump into the C language, we need to know about little bit of Compiler. Why? That’s what I exactly thought why the hell we need to bother to learn Compiler? But think in this way, Writing a code is simply same as writing a letter to our bad boy(aka computer). He’s living in a country called “Machine world” and you’re living in another country called “Human World”. So somehow you need to send the letter to this bad boy. However, sadly any human aren’t allowed to enter into the “Machine world”. So you need to find some other way to send your letter to him. What would you do? Fortunately, we have something called “Compiler”. It’s a company that is founded by immigrants from “machine world” . Like many immigrants or foreign students, like me, they can’t speak human language well, but they can understand you! Since they are not human, they can send your letter instead of you to the machine world. That’s it. That’s what compilers do. Just to make sure, what I mean by “sending the letter” is actually “translating” human language into the machine language and we call this translated letter as “object file”.(they have form of “name.o” like your picture file have a name “dirty_party.jpg”)   Be careful with the typo, because compiler check the quality of your letter quickly and discard it if it has too bad quality. (We can call it this as “Syntax/Semantic Analyzing”)

GCC(GNU Compiler Collection)

Since we talked about what is Compiler generally, Let’s talk about a specific compiler. There are several compilers ,but I’ll cover about GCC. Because my school labs use UNIX operating system and GCC works for UNIX. If you’re using window operating system and wan to use GCC, you need to make UNIX-like environment in your computer by downloading Cygwin. If you’re mac user, you can use Xcode and Xcode is built in and it is including GCC.

Anyway, all U of T computer science student MUST know about GCC for CSC209 course, because GCC is a standard compiler for C programming.  What is mean by GCC? Genie Compiler for Computer programmer? No, good try though. It sands for GNU compiler collection. GNU is some organization that made this compiler.(i.e., I don’t care.) It’s just compiler collection, why it is a compiler collection? Actually, it was called originally, GNU C compiler but it started to compile other language, too. So it became a collection of compilers that support different language including C. That’s it and here we don’t care about compiling other language.

But we want to know how to make it useful for us! So, How to use it? 

After writing your love letter whatever(aka your c program), you just need to type

“gcc -o <a title for your compiled  program file> <your program file, e.g., something.c)>”

Why we should type “gcc – o”? 

Well, gcc stands for GCC, the name of compiler and -o is for just naming your output file. Since gcc has a default name for the output file, “a.out”, so if you want to change the name to “myletter.out” then you need to put “-0”.

If you want to get some warning sign ,whenever something went wrong, you can just add “-Wall” option. What does “-Wall” mean? It’s not wall that you have your house(I thought so, when I saw that first), it’s saying, “Warn me all”.

ZZZ..I’m bored, Just tell me how to write C program or Shoot me!

(NO!…Put it down..I meant ‘water’ gun.)

Oh, I almost tried to shoot you with my gun that I got from Mr.bond last year. Well, wake up. It’s time to learn how to write C program. Let’s Print your favorite girl/boy name.

#include<stdio.h>

int main(){

    printf(“Someone that I don’t know yet”)

    return 0;

}

Yes, I’m single because I’m still waiting for the someone. Well, that’s my private life ,so let’s move on. If you don’t have any knowledge of computer program whatsoever, or you just simply forgot to how to write it (like me), the code above will look like bunch of gibberish. So let’s try to understand what those gibberish are actually meaning for.

#include<stdio.h>

Well, it looks like it’s including something called “stdio.h”. Why we put # and <>? Let’s think about what # means  first, in C language. “#blah” called as  “preprocessor command” in C language. What is pre-processing? It seems like, there is something that we need to first. Like we need to open our eyes first to start our day. So that means our  bad boy(computer) needs to include something first before process our code. <> is just like “” and it’s implemented simply because to make sure what is the file name that we want to exactly include. e.g., if we our file name is ”   Cookie”(some space in the front of the word) then we need to have some way differentiate  it with “Cookie” or “Cookie     ” (some space after the word). Then we can do it with <>. e.g., <    Cookie> vs <Cookie> vs <Cookie      >. Then what’s stdio.h? h stands for header file. Before what is stdio.h, let’s talk about what does mean by “header file”.

Header File

To know what is mean by “Header File”, actually you need to know about  “forward declaration” and “function prototype” but well.. Let’s meet all the cute boys together. Let’s imagine that you visit “Korea” and someone invite you in their party. Then your friend told you that in order to go to the party, you need to bring your “Soju and some snacks”. Well, that’s header file; The file that contains a list of things that you would need for the party.  But you will probably  ‘What the heck “Soju” is?’. That means you don’t have idea about “Soju prototype”. So, you called to your friend and asked “What is Soju?” and Your friend said “Oh, it’s alcohol beverage. ” and you said “Oh, got it.” and the call is ended.  Now, you got what is mean by “Soju”. If you got the function prototype, then you will know what this function is. (what is returning, what are the inputs for this function etc..) .You will probably think “Shoot, It would’ve been much better, if he let me know what the Soju is, at the very beginning!”. Then you’re thinking of “forward declaration”. forward declaration is the action of putting the function prototypes in the very beginning of the program file. You can write all the function prototypes at the beginning of you program file or you can just list them in the “header file” and just simply write the name of your header file at the beginning of your file. Then “#include” command will copy the list and paste them into the very beginning of your program file.

You can find nice example and quiz about it at here, http://www.learncpp.com/cpp-tutorial/17-forward-declarations/

So stdio.h is a some kind of hear file. Simply it “stands for standard input and output”. It’s standard library header file for C. What is meaning by that? Well, if you know that programming is all about input and output and the meaning of standard, then I think it’s easy to understand it. It’s just a header file that contains all the function prototypes that need to at run all C program. That’s it. At least, You must have #include <stdio.h> to run your C program.

So now what? Let’s break ‘int man(){}’!

Oh, my. We just finished the first line. Darn it. I know, we need to be tedious if we want to learn Computer. Personally, I think it’s because Computer is super stupid. We need to instruct it what to do, one by one. But the thing is Computer is powerful! If you manipulate them well, you can be a BILLIONARE. Yup. That’s it. I must learn of it. Anyway,  let’s get back to our “main” point. what is int main(){}? First of all, You need to know about what is function. If you found a things that in form of “something1 something2 (blah1){blah2}”, then “good job!”, you found a function! Have you ever learned any kind of function in math? It’s same as it. If you don’t know what is function in mathematics, then I’ll tell you. Function is a thing that get input then expected output.  It’s like a vending machine. You insert coin and you get your beverage. Well, So “blah 1” is your coin(i.e., something that you’re putting in), and “something 1” is the type of thing that you will get. (i.e., pepsi or coke whatever you want, they are all beverage.) “something2” is the name of function(Vending machine). At last, “blah2” is instruction of how the vending machine should work in order to get your drink. So int main(){} is a function! and the type of its return value is integer and the name of the function is main. You MUST have main to run your program ,because it’s the start point of the execution of your program. So between “{ }” there are instruction for your vending machine(aka function).

printf()

printf is a function call. What does that mean? Except for main you need to call your function if you want to use it. So that means you want to use the function. That’s it. How do you use the vending machine? You need put the coin! Our coin is “the name of someone that we like for my case it will be printf(“?”), then your function will do something. printf will return you something or do something. Have you ever used some game machine that you need to put coin? Not all function gives something like vending machine to you. Some function will let you do something if they got coin like game machine. printf is one of the game machines. They let you print your input to the standard output(it’s just a default place that printing things are written on).

return 0

0 has some secrete code in it. Conventionally, if a program returns 0, then the program was successfully executed! Don’t confused with the  0 as Boolean value. As a Boolean value, 0 means false. Sometimes you might want to know if your program has finished successfully or not. So It’s convention to return 0 at the end of main. That’s why we had “int main(){}”, since we’re returning 0.

Compilation/Execution 

Yup, that was the function. After writing function, if you want to run your code. Just save your file and open up your console and type gcc  -Wall  -o <name of your object file(what about “Myfirstofile”?)><your c file name> then you just completed compilation. Magically, you will have object file. Execute your program is same as executing your object file. Don’t double click it! Elegantly, you can just type Myfirstofile.exe(for window users), or ./Myfirstofile(for Unix/Linux users) on your console. That’s it. You will see the printed name on your console.

Data type/Declaring

Writing code is a giving instructions to the computer. Most of instruction in the world has similar form.

“Do something with something”

We use functions, operators to order computer “Do something”

But with What?

That’s data! So Computer programming is “Do the list of job with data”

That’s it.

But ,But what’s data? 

Data is “Distinct Information, usually formatted in a special way” from ‘webopedia’. It’s saying that data is information ,but not any information! It should be distinct and mostly formatted uniquely. So let’s think about “2”, now tell me, 2 is integer or float?

Yes, 2 is integer. You can categorize 2 as an integer. So it’s distinct and it has it’s unique format that is distinguishable from float. Integer is one of data type of C. Data type is just categorization of data. e.g., 2 is integer , “2.34” is float.

Let me list some data type of C and introduce some interesting fact of them.

“int, char, long, float, double”

They’re all primary data type.  Primary type is like an ‘atom’ in chemist they are some kind of unit.

You can use those primary data type to make up the secondary data type which are

“Array, Structure, Unions, Pointers”

Let’s break the primary data type in half first!

If you take any math course above the primary school level, you will know what does mean by Integer. Yup. That’s it. That’s the integer we’re using in C. But, there is additional information that you might be interested in. The actual size for the integer type. Integer got 2 bytes usually. What is byte? well to know what is mean by “byte”, you should know “bit” first.

As you probably know, computers is stupid. Because they only know either 0 or 1. Darn stupid so they need to store all the information as a long, long sequence of 0 and 1. If computer can store a lot of 0 and 1, then it has good storage capacity. We need to tell the amount of its capacity and we use the number of 0 and 1 that it can store for that. Bit is just unit for that. If the computer only saving one either 0 or 1 ,then it has one bit. So the byte is composed of 8 bit. So that means if we have one byte, we can store 10000000 or 11000000 or any kind of 8- length of string that is composed of 0 and 1.

Hence, now you will understand what is mean by integer got 2 bytes(16 bits). By using Integer type, you can manipulate number form -32768 to 32768. Isn’t that enough? well, there are always some people want more. So now we have a “long”. That is also integer-like type but have more range that means they take up more space also. They take usually 4 bytes. So if you want to manipulate number above the integer, you better use the long type.

float and double are for decimal numbers. Their relationship is very similar with the one between int and long. float only takes 4 bytes but if you need more then you use double(double takes 8 bytes).

Lastly, for primary type there is a ‘char’.

‘char’ stores one character like ‘A’, ‘B’ or ‘c’ etc. ‘char’ is  1 byte data type. Hence it can store 8 bits. Its range is from -128 to 127, so we have a choice of 256 = 2^8.  You can declare your char type of variable with either number or character. (variable is just space place holder for data types. Like you store 1(integer) to variable ‘a’. Then when you print a, the computer will print ‘1’) E.g., char mychar = ‘a’  or char mychar = 65. (When you declare you variable, you need to put what type is it before you write the name of the variable.) You might say, “come on! 65 is not a character. If I say 65pple, can be it’s apple? Hell No. You mad computer science student!” But actually,  A will be interpreted as 65 by computer. Because, again computers are stupid, so they even don’t know what is mean by “A”. So they look up some dictionary that is called ASCII code. By ASCII code A is 65. Then they change it to some kind of a sequence of 0 and 1 in order to make computer understand.

So now we’re done with the primary data type.

Now, are you satisfied with this? Then let’s go to secondary data type. As I stated before,

“Array, Structure, Unions, Pointers” are the secondary data type.

Let’s look at the most important one first!

It’s called “POINTER!”.

Many people seems to have trouble to understand this notion. But well, come with me. Let’s break this bad boy in a half.

//writing is in process (I’ll write about pointer based on pointer introduction pdf from MIT)

But But, How do we use those data types?  I don’t want to put something in my brain that I don’t need to use!!

Okay, then let’s put aside the secondary data type for now and talk about how to use it first.

You can manipulate those datatype using variable. You store data in variable. So variable is some kind of pocket to put the things that you need. But only one for each pocket. You will probably have “A LOT” of pocket while you’re programming. Hence you need to at least write down on the pockets about what type of things that pockets have inside. That’s it. We call this (decide what type of object, your pocket will contain)as  declaring variable(i.e., make a pocket to store things) by typing like below.

Data_type variable_name ;

e.g., int MyInt;

When you make a pocket, you don’t need to put something at the same time. You can make a pocket first and you can put it later on. e.g., char mychar; and later on mychar = 2; is possible.

* bit interesting subject (1): const

“Const” stands for “constant” and this same as any int/float variable but it’s unchangeable.

If you set it, you can’t change it but that means you CAN prevent other people from changing it.

* bit interesting subject (2): unsigned/ signed variable

Since for integer, you got 2 bytes, so it’s 2×8 = 16 bits. (Actually it depends on the compiler and OS, you use. That’s what I heard in my lecture, so people sometimes use size of(), we well talk about this later in detail) You need to give a bit for sign and 15 bits to represent the number behind the sign.

The picture above is the example of the binary representation of -1.

So the range of the integer is from -2^15 to 2^15, but if you know that you’re only will assign positive number to a variable and you’re planning increasing the variable a lot over the range of integer. Then you can change some implementation of how integer is stored. Instead of using the first bit for a sign, you can use it to represent a number. So now you have a integer up to 2^16. you can do this by declaring your variable as “unsigned int”

e.g., unsigned int Myint;

Operator with variable

Let’s say if you want add two variables, then how would you do it? We do this by “Operator”. If you ever done any programming in Python, you might recognize that the operators used in C are pretty similar with the things in Python.

There is a chart that you can check those operator.

E.g., int var3 = var2 + var1,

float var4 = var2 / var1

Easy? But,usually we sue program to interact with the real world.

So we expect to get the values for variables from users. So how we will get those input?

How to read standard user input?

We can read directly from the key board.

In this case, we need to use “scanf” to get the value and will store it to a variable.

E.g., scanf()// stop for here for this moment.

Some website to check to write

http://www.codingunit.com/c-tutorial-how-to-use-pointers

http://www.codingunit.com/c-tutorial-more-on-pointers

http://beej.us/guide/bgc/output/html/multipage/scanf.html

http://pdos.csail.mit.edu/6.828/2012/readings/pointers.pdf

** Note: There might be some misleading information since I’m not an expert, so don’t believe it all and please get me correct if you find some flaws. Also I got ‘a lot’ of  information from ‘everywhere’. What I did is just writing and summing that up in a nice and understandable way(hopefully).  I feel super lazy to write all the source, BUT for you, I’ll list some of nice website that I thought useful, while I was searching the information to write this blog.

– http://www.codingunit.com/(Go to the c-tutorial section, very nice and I got a lot of information from here.)

Mat237 term dictionary for people who have only ‘RAM’ memory in their brains (like me)

x is a interior point of a set S. So if you make a ball with a certain size centered at x and if the ball is included in S. Then what? x is interior point and a set of points like x is interior of S.

  • boundary point: if you draw a ball centered at the point y and for any radius, if it makes a ball that some kind of half in and half out, we call the point is boundary point of the set and the set of points like y, we call boundary of S. 
  •  Open Set: A set is called open if it doesn’t have a boundary point e.g., {x|2<x<3} (i.e., if all the point in the set is interior points.)
  • Closed Set: A set is called closed if it contains all the boundary points {x|2≤x≤3}
  • Closure: Closure is  the union of the open set and it’s boundary. Essentially, it is just closed version of a set. e.g., water ball: it got inside filled water and got outside to make us to be able to grasp it.
  • neighborhood: It’s actually same idea of interior point. It’s just difference of perspective. This is the perspective of dots. What I mean by that is For a dot, a set is its neighborhood of it if the set contains the dot as it’s interior point.
  • 1.4 proposition (a): S is open ↔ Every points in the S are interior points.(No boundary points!)
  • 1.4 proposition (b): S is closed ↔ S^(Hey, this is my S complement.) is open (e.g., S={x|2<x<3} then S^ is {x|2≤x≤3})
  • Some Weird Example of open set and closed set [http://science.kennesaw.edu/~plaval/math4381/openclosed.pdf]

1) R is both open and closed.

– The reason: All the points in R is a interior point of R (i.e., we can draw limitless of balls which is fu..n?), so It’s open by the definition of Open set. Then the complement of R,  Ø should be closed. However  Ø is open, because it doesn’t contain any boundary point(i.e., it’s empty). Hence R should be both closed and open because of the complement of it is open and by the definition of open set. Doesn’t it contradict with 1.4 proposition? Hey, you silly. 1.4 proposition didn’t tell you that the set is only either open or closed(i.e., it can be both closed and open!) 2)   Ø is also both open and closed – The reason: Because R is both open and closed. 3) [a, b)  is neither open nor closed -The reason: Firstly, It is not open ,because a is a boundary point(i.e., So not all point in the set is interior point). Secondly, It is also not closed, because because it’s not including all the boundary point.(i.e., It is missing a.) Hence, It’s neither closed nor open. ** One TA gave me a good insight of openness, if you pick any point and if the point is anytime included in an interval in the set, the set is open! Take a look PS3! 

  • Convexity and Open Set: Open set is convex. By mean a Convex Set, every points in the set and the all the line segments connecting them should be in the set.

  Open ball is ,by definition, it’s all the points x ,such that |x-a| < r and let b and c in the open ball, then  it’s like this

Since |c| , |b| <r then all the point that connects c and b let’s say y, then |y| < r. So it should be in the open ball.

  • limit of a function: A real number that all the values of function are approaching in the restricted boundary. (i.e., take one interval, and you can see there is a cluster and the cluster is centered at a real number then the real number is king= limit. One person named f(k) from an interval country: “Hey, let me tell you a secrete. There is a funny story that OUR KING might not be the same species of us.” i.e., The King ,limit, doesn’t need to be a function value.)

like x=1, the limit is 2 but it’s not a function value. OUR KING is some other species. (Alien!!)

  • continuity: If OUR KING is our species then it’s continuous

Challenge Problem: xy/x^2 + y^2 (y,x≠0)doesn’t have a limit at 0, Why? -The reason: Well denominator and numerator are all going to 0, hence, we can apply lopital’s  law(I don’t know how to write his name but it sounds like that and I don’t have any intention to look up his name and write it down because he got some interesting character in his name that I can’t type in my English keyboard). However,  I haven’t learned anything about multivariable calculus yet. Hence we need to find some other way to prove this which is great.. Let’s think a line in R^2 that goes through the origin “y=cx” then we can substitute xy/x^2 + y^2 to cx^2/(c^2+1)x^2 then it goes to c/c^2 + 1 when x is approaching to 0. Since c hasn’t defined, we can’t define the limit. Hence the limit doesn’t exist (i.e., there is no cluster,follower, hence no King.) You can’t imagine the limit in R^k for k>2. Well I was ,too but eventually I understand. Just think your carpet on the floor and just lift it with your thumb and index finger so it’s kind of being lifted like pointy hat. Now look what you got! you grasp the king(the limit) our limit world between your finger. Imagine that the weird R^3 looks like function as your carpet and you just lifted it bit and the pointy part is OUR KING. Capturing a king was so easy.

  • Continuity of composite function: if f is continuous and g is continuous, then f •g is continuous.

Q: Let f1(x,y) = x + y,  f2(x,y)= xy,  f3(x)=1/x, f4(x,y)= x-y, f5(x,y)=x/y. Then Let’s prove f4, f5 are continuous on {(x,y)| y≠ 0} using f1~f3. A: Blah, blah stuff. Well, it sounds like we need to use composite function property. Let’s see they are all either function on either R1 or R2 and Let’s see f4 can be made of a(x,y) + b(x,y)(i.e., f1(a(x,y), b(x,y))). Why? Well, there is no – in any other function ,so we can’t get it from anywhere so we need to use + but there is no + in anywhere than f1. It is just my instinct. So we will see if it’s right or not. If it’s not working well ,then I could just delete it ,so I wouldn’t be very embarrassed.  Then how can we make a(x,y)= x and b(x,y)=-y Can we? Let’s see. oh! 1/x * -1 = -1/x, xy * -1/x = -y. So b(x,y) = -f3(x) * f2(x,y) = f2(f2(f3(x),-1), f2(x,y)). Sigh, Let’s go to a(x,y) = x = xy * 1/y = f2(x,y)*f3(y) = f2(f2(x,y), f3(y))! Yay, then f4(x,y) = f2(f3(x), f2(x,y). Hence f4(x,y) = x -y =  f2(f3(x), f2(x,y) + f2(f2(f3(x),-1), f2(x,y)) = f1( f2(f3(x), f2(x,y), f2(f2(f3(x),-1), f2(x,y))) You know what? That was the best proof that I’m super silly! Haha, My text book is giving me this answer. Text book answer >> f1(x, f2(-1,y)) ! Haha, My answer will be THE PERFECT ANSWER if you mock your teacher though. However, there is a saying in Computer Science, “KISS” (Keep It Simple, Silly!). I know computer science is bit b**ch subject.  Anyway, I got a good lesson and hope you learn also from this silly action that I take. (You can at least learn that I’m super silly.) Oh, and we almost lost the key point! So, f4 is continuous? The answer is.. YES. Because it’s just simply composition of continuous functions! You might ask.. Why? Why the hell the composition of continuous functions are continuous. Well, there is a proof which is seems complicated to me,(I would’ve been good if I could teach KISS principle to the author of my text book when he was writing any proof.) So I’ll just explain it. So if f and g is continuous then, f•g is continuous. What that means? Well, that means f, g are continuous function? That is same as f and g is nice bridge without any hole in the middle. What is mean by making a composite function from them? That means we just connect 2 bridge. So Now you tell me, can I just cross the bridge called f•g or g•f? Please, be responsible for your answer! We’re trying to across a bridge that connect two dangerous cliffs. The answer is …YES! Easy ,huh?

  • Sequence:  “The ordered collection of mathematical objects. It can be finite or infinite. Can be written as {Xn}. We call the sequence is in a set, if and only if all the elements in the sequence are belong to the set.”

What? what is ‘Mathematical object’? I never eaten those things in my 21 years of life! So I looked it up and saw a lot of blah blah things. To sum it up in just one line, Mathematical object  is anything that is related to mathematics which means it’s the worst collection that you can have! If someone is saying that “Tara, It’s a gift for this Christmas for you, mathematical object! It’s such a collection that is most practical in this world” , “BANG!” I think I have enough reason to shoot him with my water gun. It’s like a bad poison collection to me! Just listen what they have in the collection, then you will nod your head! “Vecotr, Set, Points, Functions, Triangle, Topological Space..etc” PLEASE STOP. By just listing them, gave me a headache. “BAM! BAM!”   I reloaded my water gun for my safety reason.

  • Sequence and Set: We said that sequence is the collection of mathematical object. But is there anything that reminds of you if you heard of collection? Well, it starts from ‘S’.. Yes, It’s SET! Do you think the sequence can be called a set? I thought so, one minute before. I just looked the text book and “feel bucked up”. Yup, we can’t call it. Yeah, well that’s why we have different terms for them.  The reason can be easily explained by this example.

E.g., Xk = (-1)^k then the sequence is like this,

-1, 1,-1, 1, -1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1…….

But, the set will be like this,

{-1, 1}

Now, Tell Me. Looks same? Yup. That’s why I felt bucked up.

  • But well, what about a sequence in a set?

Well, that maybe a different argue from the above one. Because now the sequence is in a set, hence, there can’t be duplicate values. Well, then we can call the sequence as a ‘rule’ to give an index to each member in the set.

  • Convergence of a sequence: What is a convergence of a sequence?

Well, check this out.

8,4,2,1,0.5,0.25,0125………

What do you think?

It will eventually converge to ‘0’. Since the formula for the sequence is 16/2^k.

So if a sequence approaches to an unique number, then we call the sequence converges.(Note that I used the term ‘approach’, you don’t need to have 0 in the sequence to talk about convergence.)

The definition of convergence of sequence is like this.

A sequence Xn converges to “A” if and only if, for all ε, there is a natural number ‘K’ such that for all ‘n’ > K,  |Xn – A| < ε. Otherwise Xn diverges.

Does it sound “blah” to you? Well, I can give you a simple example. Let’s say I claimed that my score for the tests converges to 100 when I graduated U of T. By saying that, I mean my score approach far close to 100 than any other number. So it’s not approaching 99 or 99.99999! The number that is approaching MOST is 100. So give me any positive number!(aka ε,Epsilon) SO you gave me 0.00000000001 and told to me “well is there any point of you school life that all you score after that point, let’s say x and 100-x is less then 0.00000000001? then I can say it’s approaching close to 100”. Then I’ll just laugh at you and I’ll say, “Come on! give me any number! I can make it. Even if you gave me 0.000000000000000000000000000000000000000……000001, I can find some point of my school life after that my score X, 100-X is less than that one , So NOW tell me! Is the sequence of my grade is approaching 100?”

Can you say No? Think about it and compare my example to the definition if you want.

  • So we talked about the convergence of the sequence, but what about divergence? Divergence has bit of spectrum.

Yes, actually mostly we say there are at least 2 interesting divergences.  One is a sequence that is approaching to -∞ or +∞ and another one is oscillation.(the graph looks like is vibrating)    What’s the specific definition of Xn that goes to infinite? I’ll show you only one that goes to the positive infinity. We define a sequence Xn goes to the positive infinity, if from a certain point,let’s say k, X k > c for every c. So from a certain point, if you give me any number I have bigger one.Give me 10000000…..0000000000…00, well I can find a point, from that all the numbers that I have are bigger than that. Yup, undeniable. That’s the charming point of Mathematics.  

  • Do you remember that I said a sequence is a collection of any mathematical object? Let’s think of Xn as vector. Then, what is mean by Xn converges to L?

Before think about that, take a look at this cool inequality(1.3 in the textbook). Let’s say we have |X-A|(I just stole it from the definition!) and X and A are both vectors. By the definition of the convergence, |X-A| is less than ε. Then let’s expand it.  If we expand two vector, it looks like |(x1-a1, x2-a2,….)| Then by the 1.3 inequality, max(|x1-a1|,|x2-a2|,|x3-ax|,|x4-a4|….) ≤ |(x1-a1, x2-a2,….)| ≤ ε. Hence every component in X approach to the confronting component of A.

Theorem 1.13

  • Do you remember the closure of a set? From now, we talk about what is mean by a point is in a closure of set.

So random thing? Yes, but it is related to what we’ve learned just (i.e., sequence). Closure is like an entire house, including walls(boundary). What’s meany by something is belongs to the house? Let’s imagine a diamond in your wall. It’s belongs to your house and how you prove that belong to your house? You will probably get a drill and try to make a hole to the diamond and if you see the diamond other than outside, you can say that the diamond belongs to your house. Yeah, that’s the same idea. If there’s is a sequence inside the set that is approaching to the number, then you can say that number belongs to the closure of your set. If this example is too complicated for you, I can explain to you in a different way. Then we need to start what is mean by x is belongs to the closure of a set S. There are 2 cases for the situation. First, it can be an interior point of S. Second, it can be in the boundary.
Let’s think about the first case.
So, 3 is in the set S. You can find a sequence that has limit as 3.   The sequence is 1,3 or 1,2,3, or 5,4,3 anything that goes to 3.  So 3 is in the closure of the set S. Then, let’s think about when 3 is in the boundary of S.

When we think of the boundary case, I thought it’s better for me and you to think in R. So a set S is (0,3) and 3 is obviously is int the wall(the boundary), by meaning 3 is in the boundary that you can draw balls(look at the violet circles that I draw) in any size and all of them is half out of the set and half in the set. But, look closely the place of the half side that including yellow dots. Yellow dots are interior points and can you see that those yellow points are approaching to 3? Yes, So we can get all the yellow boys and call them as a sequence. So if 3 is in the closure of set S, then we can find a sequence that is approaching to 3.

Clear?

That’s the theorem 1.14 in the text book.

My Proof for 1.14:

Let’s look at 1.15. It’s bit more developed than 1.14 but it’s easy, if you understand what is mean by continuous in R^2.

Lets’s review, what is mean by being continuous in R^2.

I think this picture is capturing what is mean by continuous function in R^2. It’s saying when x is fairly close to a certain point c, if f(x) comes close to f(c), then we can say f(x) is continuous at c.

This is what 1.15 theorem.

Can you see the similarity between them?

We can actually make two statement as close as possible.

1. What is mean by x approaches to c

↔That’s equivalent to {Xn}  converges to c. But why the text book saying that any {Xn}?

In R^2 case, there is X-axis and there is only 2 way to approach to a point. right side and left side. To check the continuity of the function we need to check both sides. But, in R^n case.. we can approach to a point from every side. (Think about R^3 case, which represent our world. There’s a dot on a paper how many ways we have to approach it? A lot.) Hence they said, any sequence {Xn}, so we need to prove the continuity of f for arbitrary sequence {Xn}.

2. What is mean by f(x) approaches to f(c)?

↔ For those {Xn}, f(Xn) is f(c)

It’s essentially same, right?

It’s truly obvious that 1.15 is true, but can you prove it?

They way to prove it is fairly easy.

(A)You need to prove that {Xn} -> c then f({Xn})-> f(c) if and only if (B)(i.e., is same with) f is continuous at a.

Assume that f is continuous at a, then you can get the other result by using the definition of continuity and since to prove the equivalence, we need to prove for both ways, and the other can be too obvious and easy. So let’s take a  negation of the (B) and prove the negation of (A). It’s fairy easy to see it. But for the readers and my mark, I’ll post the picture of the proof. (Soon)

I just finished the proofs for 1.14 and 1.15 but they are a page for each.

Well. Let’s move on to the next section “Completeness”.

Completeness. Have you ever seen such a thing? Well, I haven’t including myself. (In fact, I’m the one of the most incomplete being in this world, I think.)

I have a roommate who works at the restaurant in the dessert section. He’s such a nice roommate. Anyway, sometimes he burned his arms and cut his hand by mistake like most people who work in restaurant do. So one day, by him, he was searching for a bandage to stop the bleeding from his hand. He saw the executive chef in the restaurant and asked him ,if he knows where is the bandage. But he just simply answered, “I don’t know, because I don’t cut my self.” Isn’t that cool? I think Something like completion and perfection is the limit value of your skills when your practice goes to the infinite.

Anyway, that was my definition of the completeness. But what’s the completeness in the calculus?

Completeness in the calculus is simply there is nohole” between the elements. So if I compare to my example, it could be nomistake“. For me, it sounds like “continuity”.

So if you got a,b and if b>a (i.e., if there is any possibility of having a hole)then there should c in the set, such that b>c>a.(then there should be something that cover the hole).

There is a property of Completeness in R. We call it as “The Complete Axiom”.

The Complete Axiom

E.g., S = (2, 3). Then supremum of S is 3. Then infimum of S is 2.

Sup S:

Inf S:

Due to this completeness, we have few theorem to study. Hate it? Well, you’re the one who stepped in to the hell. Welcome! (It’s actually same way that I feel. I’m in CS..I don’t need to take this hard course for any reason. But I just wanted to study deeper…)

Complete axiom is sometimes showed up with the compact sets.

That implies that the bounded set has an sup(S) and inf(S), and if we use the deifinition of sup(s) there must be a convergent sequence {x}_n to inf(S) and sup(S).  So if S is compact, then sup(S) and inf(S) are included in S.

First Theorem is, 1.16 The Monotone Theorem

What is mean by “the sequence is bounded? and the sequence is monotone?”

So if all the x that belongs to {xn} is included in a small interval (a,b), then we can say that {xn} is bounded. Monotone sequence, is either the sequence is increasing and decreasing sequence monotonically.

Let’s prove 1.16.

There is an another interesting theorem called (The Nested Interval Theorem).

My prof compare this theorem with killing a fly. If you capture a fly with your two hands with some space between two hands like this..

 So if you kept your hands close enough until they meet together, the fly will be die…

Such a nice example right?

Let me prove this here.

The main point of this theorem is all Intersect of Interval is not empty and it contains one element.

Let’s take another theorem 

This Theorem actually used the 1.17(The Nested Interval Theorem) to prove it.

Let’s take a look at 1.19

1.19 is the generalization of 1.18. But Now I’m bit confused with the part of putting all the component in 1.18

To take the last theorem for completeness, we need to know what’s the Cauchy sequence.

The definition of Cauchy sequence in real number is like below.

So, it’s the sequence that is approaching to each other but we don’t know whether it’s decreasing or not. The general form will be like the picture above. (can you see that all the sequence are getting closer?)

So the 1.20 Theorem is claiming that “a whole sequence” is convergent if and only if it’s Cauchy.

Cauchy sequence has an importance, when we prove that the lub(S) and glb(S) is in S if S is compact.

I’ll prove it later.

So, we’re done with the completeness. Completeness is all about “Convergent” and “Bounds”.

So let’s go to the Chapter 1.6(Compactness)

We call a Set is compact if it’s closed and bounded. Like [2,3]. As the book said, compactness is important because it’s yielding important facts about limits. I don’t know what’s saying right now. SO why not take a look at?

1.21 Theorem (Bolzano Weierstrass Theorem- I don’t know whether I typed correct)

We call this theorem as BW1 in my class because the name is very inefficient to use.

Well, if S is compact that means it’s closed and bounded. If it’s bounded set, it has a sub-sequence converged to a limit and the limit is included in the boundary of the set. Lastly since s is closed, it’s containing the boundary of the set. Hence if S is compact then every sequence of S has a convergent sub-sequence whose limit lies in S.  That was Bw1.

I’ll post the proof later.

This is the different version of explanation of the Bolzano – Weierstrass Theorem from Wiki.

The interesting thing in here, was A. I know it’s stating B from the text book but it didn’t tell me that A also can be inferred from the theorem.

But just think let  a set S, S= {Xn} be a set if Xn is bounded then S is bounded.

If S is bounded there is  a sequence which has a convergent sub sequence.

There is only a {Xn}, so Xn should have a convergent sequence.

That’s how I understood but bit uncomfortable with it actually.

******** we will think about it later

Do you remember Theorem 1.15? If you remember it, it’s rather easy to prove.

In 1.15, we got the definition of continuity of function in R^n.

In R^n, f is continuous if there is a sequence of Xn that converges to a and if f(Xn) converges to f(a). Since S is a compact set, it has limitless convergent sub-sequences and the limit is also included in S. Also, f is continuous function so f(xn) should converges to f(a) when Xn converges to a.  Since a is in S ,f(a) should be in the f(s). Then every sub-sequence of f(S) is convergent and the limit is included in the f(S). Hence, f(S) is convergent.

1.23 Corollary

Since f(S) is compact and bounded we can get the sup(f(S)) and inf(f(S)). Also, every sequence in f(S) is convergent. Hence, we can get the monotonic sequence out of it. Thus by 1.16 the monotone sequence theorem, the inf(S) and sup(S) are belong to f(S).

Let’s go to 1.7. It’s about “Connectness”(finally. Now I can solve the problem set 3)

The idea of Connectness is pretty easy. My textbook is saying, it should be all in one piece. So if you put together them, it act like one. Like this.

How do we know it’s one piece, if we put together?

Well, it’s just okay. If we know that this can’t be one piece when we put together like this.

Let’s say our set is the union of the man and the god but they’re separate and that was the also point of this picture.) So our set is not connected.

So if we got the basic idea than let’s crash the theorems!

To prove 1.25, we know what’s mean by interval in R^n.

The idea of interval is pretty simple. If you have points “a” and “b” in the interval S and a < b then there should be c that is a < c < b in S. So that means actually, there’s no hole in the interval. “NO hole”.. it’s kind of reminding me something. Yes “Completenss!” Well, I don’t know whether it’s related or not ,but we will see.

I just looked at it the proof, but for 1.25 I think the idea of Completeness doesn’t related with it. I’ll post it later.

It can be proved by using 1.14 which talking about a limit and the boundary. I’ll post the proof soon. (Before I got a quiz for mat237)

Did you forget what what was the Intermediate Value Theorem? Oh, well not me this time! Yay. Hope you didn’t but I’ll just post for later use for me or you.

So that means if you have a continuous function f and f(a) < f(b) , there should be M such that f(a)< M< f(b) and c2 such that f(c2) = M. For me, it looks like an extended version of completeness..

There is another important notion of connectness. It’s called “arcwise connected” or “pathwise connected”

“Arcwise conneted”(or pathwise connected) is much stronger version of connectenss.

The definition of “Arcwise connected” is like below.

So if you find a path(a continuous function to connect any two dots), then it’s a pathwise connected set.

We can see that the arcwise connected is a strong version of connected from the theorem 1.28.

I”ll post the proof soon ,but before that is the converse possible? The answer is “No”. The example of it given from the text book is like this.

You can’t find a path(a continuous function) from S1 to S2 but it’s still continuous. Because there is a point that in S2 is in the boundary of S1.

I found really nice an explanation for that and added my explanation on top of it.

http://planetmath.org/encyclopedia/TopologistsSineCurve.html

You can find the detail from the link that I posted above.

We saw the relationship between arcwise connected and just connected and found out that every connected set can’t be connected but the interesting is every open and connected set is arcwise conneced. That’s the last theorem we will look at about connected.

Since open set is the set of bubbles! You can make any bubble inside and go around in the bubble. But why not closed set?

Well, we saw the counter example of it already for 1.29. The reason why one subset of it can have all the boundary points of another subset. But if another subset somehow can’t go through to the boundary point using a continuous function then it can’t be arcwise connected.

So I mean there is some change that you can’t include the boundary point in your bubble. But the fact, by the definition of open set all is the bubble and you can make as much as you can, so you can go everywhere. But let me prove this. (post it later)

**Side kick: Quotient rule **

1.8 Uniform continuity(Not included in course material)

The idea of Uniform continuity is very simple. It means simple continuity + Sort of Bounded(so it doesn’t increase or decrease rapidly a lot up to the point that we lose our control)

So for simple continuity, it’s okay if you can draw in once with your pen without any stopping.

but for the uniform continuity, you can’t go crazy sometimes.

Usually, when we talk about simple continuity, we talk about a point but this is about all two random points in the function.

So like this 1) simple continuity 2) uniform continuity

So the given formula for this is like below.

So if you give me the length : how close two point should be then I should bound the value of two points. SO for example x^2 is not uniformly continuous. because if you go x,y -> infinity then the difference of f(x) and f(y) -> infinity too.

Let’s go to 2.1 differentiability of one variable since 1.8 doesn’t give you any mark!

Now, our journey is begun. Take off, if you scared! We’re going to learn about differentiability(real stuff of calculus).

Before jumping into R^n let’s talk first of R.

What was the differentiability of R? (Something that we did for the introductory calculus class.)

The formal definition is like below.

So let’s call the red line as l(x)(l(x) = mx +b) and the blue line as f(x).

Then when l(a) = f(a) (the first point).

Then l(a) = ma + b and f(a) = ma + b.

Then b = ma – f(a).

Then we can make l(x) with f(a) by using some simple trick.

l(x) = m(x-a) +f(a)

So the gap between l(x) and f(x) at each point is

f(x) – l(x) = f(x) – m(x-a) – f(a)

‘x-a’ means how x is far from the a. So if it’s far then the gap(we call this Error) will be big.

So we want to focus on ‘x-a’ and want to see when we far some amount then what’s the error?

So let’s x-a = h (since it’s our focus)then let the total gap be a function of h, E(h) (error function) ; some outcome generated by putting h. it will be huge if the gap(h) is huge.

So E(h) = f(x) – l(a) (total gap or total error) =  f(x +h) – mh – f(a)

So E(h) + f(a) + mh = f(x+h)

Yes, it’s like that above.

By saying the f is “defferentiable” is if we minimalize h enough then we can approximate the value near a by using a linear line. That means, When h -> 0, f(a+h) -f(a)/(h) = m for some constant m.  And that means E(h)/h should go to 0.

The reason why is  f(a+h) = f(a) + mh + E(h)

f(a+h) – f(a) – E(h) = mh

{f(a+h) – f(a) – E(h) }/h = m

To be {f(a+h) – f(a)}/h = m, E(h) /h must go to 0.

m is the slope of the linear line but we call it as “derivative of f at point a or f ‘(a)”

To be E(h)/h -> 0 when h->0 E(h) should be o(h) “little o of h” as h->0.

The formal definition of “little o” is like this.

The explanation of E(h) from the text book is like this.

SO now we talk about derivative and what we can do with this?

We can get the local maximum or local minimum!

and 2.5 proposition is related with the Rolle’s theorem

So given situation; continuous on [a,b] and differentiable on (a,b), there should be c such that f ‘(c) = 0 and by the proposition 2.5 it’s either local maximum or local minimum.

The reason why the interval for the continuous is not open is that,  this below case can happen

Another theorem is “Mean Value Theorem”

It’s called a “Police theorem” sometimes as I remember  arccording to my 137 prof

Because, if you drove your car for 10km in 6 minutes then the average speed is 100 km ,that means there’s a point that you speed 100km! So if the police know this theorem, then you will be caught!

What else we can derive information from the derivative?

Theorem 2.8 gives me 3 things that we can derive..

b is simple enough but ‘a’ and ‘c’ involves some proof works. So I might later post some proof of it.

Okay, Okay. We’ve done this in MAT137( the introductory calculus course)!

Any new stuff in 2.1?

There is! It is called as “Vector Valued functions”.

What does that means?

I’m talking about a function which looks like this!

f= (f_1, f_2,…………….)

we can define the derivative of this in the same manner for each component in f

so f ‘ = (f ‘_1, f ‘_2,…………….)

So all the component should be differentiable.

So what’s the difference between “Vector Valued functions and just a simple function in R?”

There is some theorem that we can’t generalize from a function in R to the Vector Valued function.

Like Rolle’s Theorem ,since it’s saying there is f ‘(c) = 0 but come on f ‘ (c) is a still vector valued function so it can’t be any number in R.

So when we’re dealing with the Vector Valued function it’s better to be-careful of this.

2.2 Differentiability in Several Variables.

So we talked about functions in R -> R and very little bit of functions in R -> R^n (Vector Valued function). For this chapter, we will talk about R^n -> R.

So like this f(x,y) = x^2 + y^2. It’s going to make a  bowl like this!

But how would you differentiate the bowl at one point? There are too may ways to approach to the poin. Also from one point to another point the graph doesn’t go really approaching in an efficient way. It can take detour for some case. My prof actually act like a drunken person to explain the way of approaching to a point in this kind of graph.

So from the point of A to B if we keep increase x and y to approach B, then the path might be like the blue line, but if we only consider to the points that approaching B, it will be red dots.

This is all happened because there are too much variables that is uncontrolled. So the way,we do is take the partial derivatives.

The way to take partial derivative is like this.

You just do the derivative only to the respective of jth element.

The common notation is like above.

Last two are commonly used.

But What’s mean by the f (R^n -> R) is differentiable?

If all the possible X_n is differentiable, then it’s differentiable?

Actually, No.

Take some example.

So if you took partial derivatives at 0, f ‘_x = (0,0) and f ‘ _y= (0,0)

So does that mean f ‘(x,y) at 0 is (0,0)?

No, it’s impossible to have a derivative at 0 for this function because it’s not continuous.

The graph for this function for 0<x<1 and 0<y<1 is look like this.

So if you take a derivative respect to x or y it’ will give you 0, but it’s not quite satisfy whole information of  derivative of f at 0 generally. (Because it’s different by the direction) Note: G stands for the gradient.

So what condition should holds for f to be differentiable at the point of a?

So some neighborhood of a should have partial derivatives and continuous at a.

Why..?

It’s because of the fact that we need to use Mean Value Theorem for some neighborhood of a  and us the continuity of the point to prove f is differentiable at the point of a.

Unless you see the proof, -at least me- it’s hard to capture it.

I’ll post the proof soon. (Some proof are done with my hands but hard to find some time to scan those things and post it, actually)

We call the assumption part of 2.19 as the Calss C^1 or C^1.

C^1: A function f whose partial derivatives all exist and are continuous on an open interval S is said to be of  Class1 on S.  For short, “f is C^1 on S of”

and 2.17 and 2.19 says

If f is C1 => f is differentiable => partial derivatives exist.

The other way doesn’t work.

We checked that even if there is a partial derivatives it can’t be differentiable.

But is there any example where the f is differentiable and C1 doesn’t hold?

Simple example would be

f(x) = 1/2*x^2 (x >= 0)

f(x) = -1/2*x^2(x <0)

Okay, let’s move on.

So, up to now we talk about differentiability of f

When f is differentiable at a, if we zoom the function f at a a lot, it should looks like a linear line.

But, have you heard of differential?

Differential is the difference of two values f(a+h), f(a).

We talked that f(a+h) -f(a) = mh + E(h) where m is gradient of f and when h is differentiable at a.

E(h) -> 0 enough so that we can neglect it.

mh is ,in the idealistic situation, it’s a difference between f(a+h)  and f(a) on the hyper plane but

realistically it’s a linear approximation on the tangent plane.

So we talk about partial derivative and all the differentiability stuff.

differentialbility is including all the directions but what if we want to know the differential in the respect of the certain direction that is not axis?

So let’s look at point a, when we get the partial derivative, we fix the y to the some number and we get the derivative of x but wheat if we want to get the derivative for direction 1, 2, 3 and 4?

Then we now use the “Directional Derivatives”

Let’s look at the definition of it.

So it’s essentially same as f(a + h) – f(a)/h when h -> 0 but

instead of h, we have a unit vector that has an information of direction that we want to go and t is just parameter to make the difference to 0 like h-> 0.

So if you put u as (1,0,0,0…..all zero), then you’re getting a partial difference d1f.

because a + (h1, 0,0…) =a + tu = (a1 +h , a2, a3……….) and  |h|= |tu| = t|u| = t *1 = t

So now we know how to get derivative in the respective of a certain direction that we want.

But what’s the relationship between differentiability and  directional derivative?

There is theorem 2.23 about it.

Isn’t this amazing proof? Because it’s saying if you have a derivative of f at a then you can get any directional derivative by a simple calculation!

The reason is pretty simple, I’ll post the proof later.

The interesting stuff for this night is this,

Since by 2.24,

 So by this, it means the derivative of f at a is the derivative of direction that has the deepest direction or radical direction.

So Now, I think it’s time to start our journey to 2.3

It’s about Chain Rule

Chain rule is such an easy idea. If you understand how the differentiation works then you will know it’s all same.

You just have a long “chain – like” input.

There are only one version for single variable function R -> R but,now, we need know several version of it.

1. Z = f(x,y) and ,in turns, x and y is g(t), h(t).

This is very similar with the differential formula

Because differential is just the difference and we want to see the ratio of the different from the perspective of t.

Can you here that the formula is talking to you?

(For me, Not really.)

I was just imagining, my prof would ask like that kind of the question.

The proof is all about substitution. Today my prof said that the proving is translation for 3 times.

Let’s take some example of this.

For this kind of question, you need to figure out what type it is included.

x = g(t) and y =g(t) and z= f(x,y).

So It’s the first case that we just saw.

Did you get the answer..?

It’s 6.

Let’s take a look at the chain rule #2.

The best way to understand this is like below.

So just think like it’s kinda cogwheels that work together.

We call s and t as independent variables.

We called x, y as intermediate variables.

And at last, z is the dependent variable.

We just looked at where there are 2 independent variables and 2 intermediate variables.

But, what if there are n independent variables and m intermediate variables?

It’s just generalization of the 2nd version.

(C)

Since x_1 is function of (t_1, t_2, ….)

Hence the dx_1 is equal to like below.

 (A)

and w is the function of (x_1, x_2, x_3….) hence dw is like this

we can substitute x_j  with something of t like (A)

Then we got (C).

So let’s back to (C)

if we take the partial derivative of w with the perspective of t1 then since dtn for n != 1, is all 0.

So only terms with dt1 survive and dt1 is deleted because we’re dividing with it. and

it will be like this below.

and the thing in the box is exactly looks like

Let’s take a look some example.

This is the tree for the thing below

And this is the tree for below.

Derivative of a function with mixed level

So how can handle this?

We can handle in this way.

Just think t as “u(t) = t”

then it’s like this!

But this is problematic if there is one more independent variable. Like below case..

It’s valid way to get a partial derivative, but we need to come up with the different notation to differentiate notation to differentiate the green circle and the red circle.

Red circle we can actually write on like dw/du where u(t) = t but..

Yeah. Text book is introducing a new notation, which sucks.

So let’s take a look at…

 

That looks super ugly I thought…

and the text book also agreed..

So what if super messy and complex function came up to you and want you to solve it..

Well, there are some process that might help you

So it’s the same process that we did.

In the text book, there is a theorem (2.36) called Euler’s Theorem.

It’s really easy to prove but I don’t think it’s much related to the subject in this chapter.. But I guess we can still use this idea with the fact that we’ve learned about multivariable calculus.

Since we’re learning about Topology also at the end of this chapter, the textbook is talking about the topology part.

This is my reasoning about the topology part.

Today, my prof talked about this.. but I didn’t get this stuff. Now I can say I understand.

**Note: The things that I wrote above might wrong. It’s just for self reference. (for advanced calculus course course in U of T) If you found something to correct just let me know.

Bad Soap Opera(1) – Wolverine <3 Mike

[This is my illogical approach to prove the chain-like relationship between Well ordering principle, Mathematical Induction, and Complete Induction]

Let’s break the bad soap opera things.

WO => MI => CI => WO

I know, It’s boring.

So let’s called it differently.

What about “Wolverine” for WO, Mike for “MI” and Cinderella for “CI”.

Okay, then Wolverine likes Mike, Mike likes Cinderella and Cinderella likes Wolverine. Oh! Well, the names came from my subconsciousness, so I found out the sexuality of Wolverine now. Well I’m a gay-friendly person. (:

I read about how Wolverine become love Mike(get our secrete code!) and found out it’s bit tricky to explain. (Well, all love is complicate), but well then let’s ask to Wolverine how he grew his love for Mike.

Me: Hi, Wolverine

Wolverine: Hi, grr.

Me: I have a personal question to you, if you don’t mind.

Wolverine: What, grr?

Me: How become grew your love for Mike?

Wolverine: Hmm Well because I found out that my life philosophy can well support the Mike’s. Well, as you know, my philosophy is that there always ‘the smallest thing’. (In any subset of positive integer.)

Me: (Is that only reason that you like someone? Weird) I know.

Wolverine: So and you know that mike has a Philosophy of domino. It saying that as long as all the domino are in a nicely consecutive order, like one after another, with very nice spaces between them and if you find out that any two domino with that space between fallen down together, eventually after you pushed the very first domino, BOOM! “ALL” domino will fall down.

Me: I know which is I don’t think so. Sometimes my domino stops in the middle.

Wolverine: I said as long as you have “a very nice space” between you always put domino in a very unorganized way! His idea  might be little bit complicate to you but the point is Eventually All domino will fall down so if you check some property then you don’t need to wait until all domino is fallen down.

Me: No, Way! That’s the most fun part! Anyway, so why the hell your philosophy support Mike’s?

Wolverine: Listen, like you said Let’s assume that Mike was wrong, so even though we put domino in a really nice way ,but somehow we can’t make all the domino fall down and also assume that we wrote numbers  on all domino while we’re counting them in order.(i.e., so 1 is written on the very first domino, 2 is written on the domino right behind the very first one and so on.. )

Me:(Yes, there we go)

Wolverine: Just to make sure, it’s an assumption that we will get a contradiction to show that Mike is actually right. How mike can be wrong?

Me:(pfts, I hate people fallen in love! They’re all blind..)

Wolverine: Then there are some domino that are not fallen down yet. By my philosophy, there should be a domino with the smallest number written on it. Let’s call it “P”. Since when we started domino, we pushed the first one down, the domino with 1 written on it already fallen down. Hence, P is bigger then one. Then we can find a natural number k that is just 1 smaller than P.Let’s call it P’. Then P = P’ + 1. Are you following me?

Me: ZZZ..Uh what? Keep going! My reader will understand you… Hopefully.

Wolverine: Oh well, okay anyway. Then P’ should be written on the domino that has fallen down because P is the smallest number that hasn’t fallen down.(P = p’ + 1) But I randomly select 2 domino and put them nicely with the same distance that I had P and P’ and I found Both are always fallen down. So that means..P’ has fallen down so that P BETTER BE fallen down. So there’s a contradiction! That means P was actually fallen down. By my philosophy, any non empty set should have the minimum but the set of domino that hasn’t fallen doesn’t have a minimum! Because the domino that has the minimum number P is actually fallen down!! So what that means?

Me: curse, I don’t know. It’s because of some witchcraft things or ghost?

Wolverine: Hey silly, It means there is NO DOMINO that has’t fallen down! So the set of  domino that hasn’t fallen down is actually EMPTY!! Because they can’t have the MINIMUM!

Me: so What that means?

Wolverine: That means as long as my idea and the assumption that mike have(Any two domino with the nice space are actually fall down together) true, if you pushed the first domino down then BOOM! Eventually, you got all domino fallen down on the floor!! In other words, MY PHILOSOPHY absolutely support MIKE’S.

Me: Yeahy….Well That’s very interesting fact..You guys are the conqueror in the domino world! IMPRESSIVE.

Wolverine: Don’t be sarcastic, silly.

Me: Well, anyway thanks. That was the most longest talk about domino that I heard. I got to go to Mike!

Bye.

…To be continued.

**NOTICE: All pictures that I’m posting with my writing are not mine. It belongs to the someone else that I feel lazy to type their source.

Previous Older Entries