MIT《计算机科学与编程导论》课堂笔记

本文是MIT《计算机科学与编程导论》课程的笔记,强调计算思维的概念和工具,以及如何像计算机科学家一样思考。讲解了编程中的基本元素、数据类型、操作和命令,强调了防御式编程和编程风格的重要性。课程涵盖了从早期计算机到现代解释器的历史,以及编程语言的图灵兼容性。还介绍了Python语言,包括其动态类型和变量赋值的特点,并探讨了循环和条件语句的使用。
摘要由CSDN通过智能技术生成
Introduction to Computer Science and Programming


Lecture 1

Focus on concepts and tools of computational thinking.
Learn how to think like a computer scientist.
Skills: 
     computational thinking 
     understand code
     understand ability & limits
     map it into computation
课程核心内容是计算思维的概念和工具,学习如何像一个计算机科学家一样思考。
掌握的技巧:学会计算思维,能读别人的源码(非常有用),了解计算的局限性和代价,用计算来描述其他领域的问题。

Not be handing out class notes. Students learn best when they take notes even if they never look at them. The process of writing is exercising both halves of your brain and
本课程不分发课堂笔记。最好的学习方式是记笔记,尽管很多人过后从来都不看。
但记笔记的过程能够同时锻炼左右脑。

Think like a computer scientist
-What is computation? Separate out which is computer from computational thinking.
-What is knowledge? Two categories: 
Declarative: √x is y means y²=x, x≥0
Imperative: 
     start with guess G 
     if G²≈x stop -> G
     otherwise new guess G <- (G + X/G) / 2 
     repeat
要区分开计算机和计算思维。
陈述性知识和过程性知识
过程性知识是关于如何推导的过程。一个古老的例子计算根号2,据说是古希腊数学家希罗Heron的贡献。

How do I build a mechanical process to capture that set of computation? A simple way is to build a little circuit to do this. That is actually an example of the earliest computers.
Fixed-program computers
-calculator
-Atanasoff, 1941 -> solved linear equations
-Alan Turing bombe -> used during WWII to break German Enigma codes
如何建立机械工艺来实现这种计算。简单的方法是建立一个小电路来实现,有存储的部件,加减法部件以及判断的部件。这其实就是最早的计算机,称作“ 固定程序计算机”。
例如只能做计算的计算器,解线性方程组的阿塔那索夫,二战中用于德国恩格玛密码的图灵。

Suppose you could build a circuit with the following property: the input to this circuit would be any other circuit diagram. That circuit would wonderfully reconfigure itself to act like the circuits diagram.
It's going to change how it does the computation. That would be cool and that exists. It's called an interpreter. It is the basic heart of every computer. What it is doing, is saying, change the game. This is now an example of a stored-program computer.




假设一种电路可以接收任意其他电路图作为输入,对它输入某特定用途的电路图,该电路就会奇妙地重组自身,让自己按照输入电路图进行工作。可以想象很多微小的机器人四处运动,插拔电线和元件进行重组,这有点挑战性。
它能够改变自己进行计算的方式。这确实存在,称作“解释器”。它是所有电脑的基础和核心,其作用是改变规则。这就是所谓的“ 存储程序计算机”。

A traditional recipe actually is based on a small set of primitives, a good chef with that set of primitives, can create an unbounded number of great dishes. Same thing holds true in programming. Given a fixed set of primitives, a good programmer can program anything.
In 1936, Alan Turing showed that with six simp
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值