menu
Path
Computer Science Arts English Psychology Yoga Entrepreneurship
Note Mind Palace Apprentice Connect Panel Contact person
person
Contact Form

I want to...
Computer Science Arts English Psychology Yoga Entrepreneurship
All roads lead to Rome,
but you can still pick the better path.
AstraPath is a growing collection of free resources you can use to learn a new subject or skill, ranging from video lectures to text-based tutorials.
MIT 6.0001 Notes by johnh Hamlet Plot Analysis by elizabethmcclaire MIT 6.0001 Problem Set 1 by elizabethmcclaire by johnh by johnh
Broadcast your thinking process,
and learn from others.
AstraNote not just your notepad, but also a web of notes. Simply put, you get to use notes from other learners, and others can also see yours.
Of course, you also have the option to keep all your notes private.

MIT 6.0001 Notes

# Lecture 1: What is Computation?
   1.1 Topics of the courses
* iteration and recursion
  * organize and modularize
* ALGORITHMS!
* complexity of algorithms
   1.2 Construction of languages
* primitive constructs - numbers, strings, simple operators
* syntax - 3.2 * 5
* static semantics - syntactically valid strings have meaning; e.g. 3.2 * "hi" #static semantic error
* semantics - meaning associated with a syntactically correct string of symbols with no static semantic errors
        # syntactic + static semantic + semantic = all those errors come from
   1.3 Objects (or type)
      1.3.1 scalar object (can not be subdivided)
* int - represents integers, ex. 5
* float - represent real numbers, ex. 3.27
* bool - represent Boolean values True and False
* Nonetype - special and has one value, None
        # type() - see the type of an object
        # int() or float() - type conversions (cast)
      1.3.2 non-scalar (internal structure)
* list - [1, 2, 3]
   1.4 Expression <object><operator><object>
        # an expression has a value, which has a type
* i + j - the sum
* i - j - the difference
* i * j - the product
* i / j - the division #result is float
** i % j - the remainder when i is divided by j
** i ** j - i to the power of j
        # use parentheses () to tell Python to do these operations first
    1.5 Binding variables and values
* equal sign is an assignment of a value to a variable name
* pi = 3.14159; radius = 2.2; area = pi * (radius ** 2)
        # radius = radius +1 is equal to radius += 1

  
# Lecture 2: Branching and iteration
   2.1 string object type
      2.1.1 strings - letters, special characters, spaces, digits 
* hi = "hello there"; name = "qixiang"; - enclose in quotation marks or single quotes
* greeting = hi + " " + name - concatenate strings
* silly = hi + " " + name * 3 - operations on string
      2.1.2 INPUT/OUTPUT - print("") & input("")
* 2 way of printing sentences - print("My name is", x, "."); print("My name is " + x + " .")
      2.1.3 comparision operators on int, float, string (ascii table) 
* i == j - equality test
* i != j - inequality test
      2.1.4 logic operators on bools
* not a - True if a is False, False if a is True
* a and b - True if both are True
* a or b - True if either or both are True 
   2.2 branching and conditionals (CONTROL FLOW)
      2.2.1 if<condition> + <expression>
      2.2.2 elif<condition> + <expression>
      2.2.3 else: +<expression>
* <condition> has a value True or False
* evaluate expressions in the block if <condition> is True
   2.3 indentation - how you denote (indiate) block of code
* vs == and != 
   2.4 iteration and loops
      2.4.1 while loops
* while <condition>: <expression> 
   # <condition> evaluates to a Boolean; 
      if <condition> is True do <expression>;
      check <condition> again; 
      repeat until <condition> is False
* iteration through nums in a sequence - i = 0; while num < i: <expression>
      2.4.2 for loops
* for <variable> in range(start, stop, step)
   # loop until value is stop -1
      2.4.3 break STATEMENT
* exits only innermost loop!
      2.4.4 comparation between for and while LOOPS
* for LOOPS - 
   # known number of iterations;
      with an inner counter; 
      rewritiable through while LOOPS
* while LOOPS - 
   # unbounded number of iterations; 
      can use a counter but must initialize; 
      MAYNOT rewritiable through for LOOPS

# Lecture 3: String Manipulation, Guess and Check, Approximations, Bisection
   # last 3 are ALGORITHMS for guessing
   3.1 string manipulation
      3.1.1 definition and basic operation
* sequence of case sensitive characters
* compare operation - ==, >, < etc.
* length operation - len()
      3.1.2 indexing
* square brackets to index string
   # s = "abc" index: 0 1 2 or -3 -2 -1
      s[0] == s[-3] = "a"; s[1] == s[-2] = "b"; s[2] == s[-1] = "c"
      3.1.3 slicing
* slice strings using [start: stop: step]
   # s = "abcdefgh"
      s[3: 6: 2] = "df" 
* strings are "IMMUTABLE" - cannot be modified
   # change s = "hello" to s = "yello"
      s[0] = 'y' - ERROR!
      s = 'y' + s[1: len(s)]
      3.1.4 LOOPS RECAP (string loops)
* loop variable 
   - numbers - for var in range(4, 6): <expression>
   - indexing in string - for index in range(len(s)): <expression>
   - CHAR - for char in s: <expression>
      # more pythonic for char in word
* example - Robot cheerleader & Common letter
   3.2 guess and check algorithms (exhuasted enumeration)
* for guess in range(cube + 1) - test from 0 to cube
if guess ** 3 == cube:
print("Cube root of", cube, "is", guess)
   # guess a value for solution
   # check if the solution is correct
   # keep guessing and checking ...unitil find solution or guessed all values
   3.3 approximate solutions (find an approximate solution)
* Initial value
   - epsilon (how close to the target) and increment (how large each step is)
   - target and guess, and num_guesses
* while abs(guess ** 3 - cube) >= epsilon and guess <=cube:
guess += increment
num_guesses += 1
   # good enough approximation
   # start with a guess and increment by small value
   # keep guessing if abs(guess ** 3 - cube) >= epsilon, for some small epsilon
   # decreasing increment size - slower program
      increasing epsilon - less accurate answer
   3.4 bisection search method
* half interval each iteration and new guess is halfway in between
* guess CONVERGES on the order of log2N steps
* Initial low and high value - low = 0, high = guess, guess = (high + low) / 2.0
  While abs(guess ** 3 - cube) >= epsilon:
if guess ** 3 < cube:
low = guess  #re-define the low boundary
else:
high = guess  #re-define the high boundary
guess = (high + low) / 2.0
num_guesses +=1

Hamlet Plot Analysis

In telling the story of a fatally indecisive character’s inability to choose the proper course to avenge his father’s death, Hamlet explores questions of fate versus free will, whether it is better to act decisively or let nature take its course, and ultimately if anything we do in our time on earth makes any difference. Once he learns his uncle has killed his father, Hamlet feels duty-bound to take decisive action, but he has so many doubts about his situation and even about his own feelings that he cannot decide what action to take. The conflict that drives the plot of Hamlet is almost entirely internal: Hamlet wrestles with his own doubt and uncertainty in search of something he believes strongly enough to act on. The play’s events are side-effects of this internal struggle. Hamlet’s attempts to gather more evidence of Claudius’s guilt alert Claudius to Hamlet’s suspicions, and as Hamlet’s internal struggle deepens, he begins to act impulsively out of frustration, eventually murdering Polonius by mistake. The conflict of Hamlet is never resolved: Hamlet cannot finally decide what to believe or what action to take. This lack of resolution makes the ending of Hamlet especially horrifying: nearly all the characters are dead, but nothing has been solved.


The play’s exposition shows us that Hamlet is in the midst of three crises: his nation is under attack, his family is falling apart, and he feels deeply unhappy. The Ghost of the old king of Denmark appears on the castle battlements, and the soldiers who see it believe it must be a bad omen for the kingdom. They discuss the preparations being made against the threat from the Norwegian prince, Fortinbras. The next scene deepens our sense that Denmark is in political crisis, as Claudius prepares a diplomatic strategy to divert the threat from Fortinbras. We also learn that as far as Hamlet is concerned, his family is in crisis: his father is dead and his mother has married someone Hamlet disapproves of. Hamlet is also experiencing an internal crisis. Gertrude and Claudius are worried about his mood, and in his first soliloquy we discover that he feels suicidal: “O that this too, too sullied flesh would melt” (I.ii.).


The three crises of the play’s opening—in the kingdom, in Hamlet’s family, and in Hamlet’s mind—lay the groundwork for the play’s inciting incident: the Ghost’s demand that Hamlet avenge his father’s death. Hamlet accepts at once that it is his duty to take revenge, and the audience can also see that Hamlet’s revenge would go some way to resolving the play’s three crises. By killing Claudius, Hamlet could in one stroke remove a weak and immoral king, extract his mother from what he sees as a bad marriage, and make himself king of Denmark. Throughout the inciting incident, however, there are hints that Hamlet’s revenge will be derailed by an internal struggle. The Ghost warns him: “Taint not thy mind nor let thy soul contrive/Against thy mother aught” (I.v.). When Horatio and Marcellus catch up to Hamlet after the Ghost’s departure, Hamlet is already talking in such a deranged way that Horatio describes it as “wild and whirling” (I.v.), and Hamlet tells them that he may fake an “antic disposition” (I.v.). The audience understands that the coming conflict will not be between Hamlet and Claudius but between Hamlet and his own mind.


For the whole of the second act—the play’s rising action—Hamlet delays his revenge by pretending to be mad. We learn from Ophelia that Hamlet is behaving as if he is mad with love for her. We see him make fun of Polonius by talking nonsense which contains half-hidden jokes at Polonius’s expense. Hamlet tells Rosencrantz and Guildenstern that he has “lost all [his] mirth” (II.ii.). Only at the end of Act 2 do we learn the reason for Hamlet’s delaying tactics: he cannot work out his true feelings about his duty to take revenge. First, he tells us, he doesn’t feel as angry and vengeful as he thinks he should: “I[…]Peak like John-a-dreams, unpregnant of my cause” (II.ii.). Second, he’s worried that the Ghost wasn’t really a ghost but a devil trying to trick him. He decides he needs more evidence of Claudius’s crime: “I’ll have grounds/More relative than this” (II.ii.).


As the rising action builds toward a climax, Hamlet’s internal struggle deepens until he starts to show signs of really going mad. At the same time Claudius becomes suspicious of Hamlet, which creates an external pressure on Hamlet to act. Hamlet begins Act Three debating whether or not to kill himself: “To be or not to be—that is the question” (III.i.), and moments later he hurls misogynistic abuse at Ophelia. He is particularly upset about women’s role in marriage and childbirth—“Why wouldst thou be a breeder of sinners?” (III.i.)—which reminds the audience of Hamlet’s earlier disgust with his own mother and her second marriage. The troubling development of Hamlet’s misogynistic feelings makes us wonder how much Hamlet’s desire to kill Claudius is fuelled by the need to avenge his father’s death, and how much his desire fuelled by Hamlet’s resentment of Claudius for taking his mother away from him. Claudius, who is eavesdropping on Hamlet’s tirade, becomes suspicious that Hamlet’s madness presents “some danger” (III.i.) and decides to have Hamlet sent away: Hamlet is running out of time to take his revenge.


The play’s climax arrives when Hamlet stages a play to “catch the conscience of the king” (II.ii.) and get conclusive evidence of Claudius’s guilt. By now, however, Hamlet seems to have truly gone mad. His own behavior at the play is so provocative that when Claudius does respond badly to the play it’s unclear whether he feels guilty about his crime or angry with Hamlet. As Claudius tries to pray, Hamlet has yet another chance to take his revenge, and we learn that Hamlet’s apparent madness has not ended his internal struggle over what to do: he decides not to kill Claudius for now, this time because of the risk that Claudius will go to heaven if he dies while praying. Hamlet accuses Gertrude of being involved in his father’s death, but he’s acting so erratically that Gertrude thinks her son is simply “mad […] as the sea and wind/When they each contend which is the mightier” (III.iv). Again, the audience cannot know whether Gertrude says these lines as a cover for her own guilt, or because she genuinely has no idea what Hamlet is talking about, and thinks her son is losing his mind. Acting impulsively or madly, Hamlet mistakes Polonius for Claudius and kills him.


The play’s falling action deals with the consequences of Polonius’s death. Hamlet is sent away, Ophelia goes mad and Laertes returns from France to avenge his father’s death. When Hamlet comes back to Elsinore, he no longer seems to be concerned with revenge, which he hardly mentions after this point in the play. His internal struggle is not over, however. Now Hamlet contemplates death, but he is unable to come to any conclusion about the meaning or purpose of death, or to resign himself to his own death. He is, however, less squeamish about killing innocent people, and reports to Horatio how he signed the death warrants of Rosencranz and Guildenstern to save his own life. Claudius and Laertes plot to kill Hamlet, but the plot goes awry. Gertrude is poisoned by mistake, Laertes and Hamlet are both poisoned, and as he dies Hamlet finally murders Claudius. Taking his revenge does not end Hamlet’s internal struggle. He still has lots to say: “If I had time […] O I could tell you— / But let it be” (V.ii.) and he asks Horatio to tell his story when he is dead. In the final moments of the play the new king, Fortinbras, agrees with this request: “Let us haste to hear it” (V.ii.). Hamlet’s life is over, but the struggle to decide the truth about Hamlet and his life is not.

MIT 6.0001 Problem Set 1

#1a:
annual_salary = float(input('Enter your annual salary: '))
portion_saved = float(input('Enter the percent of your salary to save, as a decimal:​ '))
total_cost = float(input('Enter the cost of your dream home: '))
current_savings = 0
portion_down_payment = 0.25
down_cost = total_cost * portion_down_payment 
r = 0.04
monthly_salary = annual_salary/12
num_months = 0

while current_savings < down_cost:
    current_savings += monthly_salary * portion_saved + current_savings * r/12
    num_months += 1

num_years = num_months/12  

print('Number of months:', num_months)
print('Number of years:',num_years)

#1b
annual_salary = float(input('Enter your annual salary: '))
portion_saved = float(input('Enter the percent of your salary to save, as a decimal:​ '))
total_cost = float(input('Enter the cost of your dream home: '))
semi_annual_raise = float(input('Enter the semi­annual raise, as a decimal: '))
current_savings = 0
portion_down_payment = 0.25
down_cost = total_cost * portion_down_payment 
r = 0.04
monthly_salary = annual_salary/12
num_months = 0

while current_savings < down_cost:
    current_savings += monthly_salary * portion_saved + current_savings * r/12
    num_months += 1
    if num_months%6 == 0:
        monthly_salary *= (1 + semi_annual_raise)

num_years = num_months/12   
    
print('Number of months:', num_months)
print('Number of years:',num_years)

#1c
def whatrate():
    annual_salary = int(input('Enter the starting salary: '))
    total_cost = 1000000
    semi_annual_raise = 0.07
    current_savings = 0
    portion_down_payment = 0.25
    down_cost = total_cost * portion_down_payment 
    r = 0.04
    monthly_salary = annual_salary/12
    num_months = 36
    high = 10000
    low = 0
    ans = (high + low)/2
    numofsteps = 0
    
    max_savings = 0
    for i in range(1,num_months+1):
        max_savings += monthly_salary + current_savings * r/12
        if i%6 == 0:
            monthly_salary *= (1 + semi_annual_raise)
    if max_savings < down_cost:
        return print('It is not possible to pay the down payment in three years.')

    min_savings = 0
    for i in range(1,num_months+1):
        min_savings += monthly_salary * 0.0001 + current_savings * r/12
        if i%6 == 0:
            monthly_salary *= (1 + semi_annual_raise)
    if min_savings > down_cost:
        return print('You don\'t really need to save, mate.')    
    
    while abs(current_savings - down_cost) > 100:
        current_savings = 0
        monthly_salary = annual_salary/12
        numofsteps += 1
        for i in range(1,num_months+1):
            current_savings += monthly_salary * ans/10000 + current_savings * r/12
            if i%6 == 0:
                monthly_salary *= (1 + semi_annual_raise)
        if current_savings > down_cost:
            high = ans
        else:
            low = ans
        ans = (high + low)/2
    print('Best savings rate:', round(ans/10000,4))
    print('Steps in bisection search:​', numofsteps)

With Mind Palace, memorizing a whole book can be both fun and easy.
Mind Palace is a memory technique invented by Greek poet, Simonides of Ceos, beloved by Sherlock Holmes, and used by memory champions.
Learn by doing real projects provided big companies, startups, and NGOs.
If you don't practise, you're not really learning.
If you don't know how to practise, you won't pick up a skill.
Start a company Get a job at Tesla

This feature is still in beta. Leave your email to
get early access.

Launch your career while you're learning.
With AstraConnect, you can connect with companies and organisations early and learn on-demand skills.
Or, you can connect with startup founders and investors to launch your startup--that's how Astrasum was born!

Daily tasks:

Saturday 16 Jan 2021

Learn computer science on Astrasum ...

Routines:

- Learn computer science on Astrasum
- Every Saturday
...
Mastery comes from the power of repetition
Set your routines on AstraPanel and your daily to-dos will be automatically generated every morning.

Achieve your ambition with speed and joy now

Learn by doing. Do by learning.

×

Welcome to Astrasum

In most schools around the world, education means putting information into our brains and process them so that we can ace exams.

Nevertheless, as much as it does make us know more, most schools or educational systems often fail to make us more capable.

That is, the learning that takes place in school is mostly incomplete and does not equip us with skills that will enable us to create values that push humanity forward.

How so?

Well, if you dissect our learnin behaviour, you'll see it can be roughly divided into five steps.

  1. Find learning materials
  2. Input information (reading, listening, touching, smelling, tasting)
  3. Process input and generate knowledge (comprehending, memorising, associating...)
  4. Practise (doing a related project, solving hypothetical problems)
  5. Output value by apply the new skill

The problem is, for most subjects, schools often neglect the last two steps of learning. The kind of 'practice' we do is often just repeating the third step--processing information--over and over again in preparation for exams.

That's why there's often a gap when we just come out of schools and join the workforce. This system makes some of us really good at processing information, but makes most of us really bad at doing what our jobs need us to do.

On Astrasum, you get to fill this gap in your learning by doing projects matched with skillsets you want to pick up. You learn by doing a project, and you do a project by learning all the mini-skills required at the same time.

Now, get started and unlease your learning power within.

Step 1: Define your ambition

What do you want to be becoming?

Step 2: Get your project package matched with all the skills you need

What are the skills you need to have?

Step 3: Start implementing while learning fast

Learn by doing.
Do by learning.

Step 4: Create values and change the world

Land your dream jobs or turn your work into a real company.

How it works

Your Ambition
Matching Skills ⇢ Projects
Implementing ⇄ Learning
Real-world Feedback + Accelerated

The best way to achieve anything you want for free

Sign up to get started!