Giter Club home page Giter Club logo

computational-thinking's Introduction

18.S191: Introduction to computational thinking for real-world problems

Go to course website 🎈

Welcome to MIT 18.S191 aka 6.S083 aka 22.S092, Fall 2023 edition! _For older semesters, see:

This is an introductory course on Computational Thinking. We use the Julia programming language to approach real-world problems in varied areas applying data analysis and computational and mathematical modeling. In this class you will learn computer science, software, algorithms, applications, and mathematics as an integrated whole.

Topics include:

  • Image analysis
  • Machine Learning
  • Network theory
  • Climate modeling

Go to computationalthinking.mit.edu to learn more!

computational-thinking's People

Contributors

3b1b avatar akielbowicz avatar alanedelman avatar alhirzel avatar bolasim avatar daniel-mietchen avatar dictino avatar dpsanders avatar eduardodut avatar fonsp avatar goretkin avatar hdrake avatar jin-park avatar jrdegreeff avatar laksh225 avatar leios avatar logankilpatrick avatar matthewwest avatar musabkilic avatar noeleont avatar pitmonticone avatar pjssilva avatar sbhhdp avatar shashi avatar stevengj avatar tasneemkoushar avatar tlienart avatar uriegas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

computational-thinking's Issues

broken link

The link that takes one to the summary of the course materials seems to be not working

week4/02-covid_data.jl Julia-1.5.2: ERROR: plot not defined

I get this error when i try to run 02-covid_data.jl in Pluto. I thought I was just missing a Pkg.add() but it seems plot() used to be available in earlier versions of Julia, but has been deprecated for quite a while, and I am not sure where the plot() should be coming from. (In the course website you write that you are using Julia 1.5.1.)

Notebooks MethodError: length

I have started following the course, and read through the first two notebooks. In both I get the following error that disables some of the code examples in the notebooks:

Failed to show value:

MethodError: no method matching length(::Nothing)

Closest candidates are:

length(!Matched::BitSet)

@ Base bitset.jl:348

length(!Matched::Base.AsyncGenerator)

@ Base asyncmap.jl:390

length(!Matched::RegexMatch)

@ Base regex.jl:285

...

Stack trace

Here is what happened, the most recent locations are first:

    _similar_shape(itr::Nothing, ::Base.HasLength) @ [array.jl:710](https://github.com/JuliaLang/julia/tree/bd47eca2c8aacd145b6c5c02e47e2b9ec27ab456/base/array.jl#L710)
    _array_for(::Type{Core.MethodInstance}, itr::Nothing, isz::Base.HasLength) @ [array.jl:726](https://github.com/JuliaLang/julia/tree/bd47eca2c8aacd145b6c5c02e47e2b9ec27ab456/base/array.jl#L726)
    _method_instances(f_type::Any, t_type::Any) @ Tricks.jl:136
    #s1#1 @ Tricks.jl:20
    var"#s1#1"(T::Any, ::Any, f::Any, t::Any) @ 
    (::Core.GeneratedFunctionStub)(::UInt64, ::LineNumberNode, ::Any, ::Vararg{Any}) @ boot.jl:602
    content(x::HypertextLiteral.Result) @ convert.jl:91
    show(io::IOContext{IOBuffer}, m::MIME{Symbol("text/html")}, toc::PlutoUI.TableOfContentsNotebook.TableOfContents) @ TableOfContents.jl:502

The add packages lines cause a lot of problem

import Pkg
Pkg.activate(mktempdir())
Pkg.add([
Pkg.PackageSpec(name="Images", version="0.22.4"),
Pkg.PackageSpec(name="QuartzImageIO"),
Pkg.PackageSpec(name="PlutoUI", version="0.7"),
Pkg.PackageSpec(name="HypertextLiteral", version="0.5"),
Pkg.PackageSpec(name="ForwardDiff"),
Pkg.PackageSpec(name="NonlinearSolve"),
Pkg.PackageSpec(name="StaticArrays")
])

this cause a lot of problem, when opening the notebook every time it shows I need to add another packages, even though the packages do exists, these lines acutually does not add any packages to Julia, so it makes opening the notebook a pain.

Could you please do not add those lines in Notebook?

Thanks in advance

InteractiveUtils in hw0

I couldn't find any usage of it. Just wondering if it is needed? (seems to run without issues without it)

License

Hi,

I am preparing a course based on Pluto notebooks and I would like to base some of the material on notebooks from this repo. Since there is no license in this repository, would you mind clarifying under which conditions I can reuse some of the material?

In particular, I would like to use your install instructions, the hw0.jl and the notebook on basic syntax.

Best,
Fabian

hw6: `euler_integrate_step` test

Hi, based on the discussion in the class discord (copied below), should these conditionals be switched/tweaked?
https://github.com/mitmath/18S191/blob/1dddcc9cb2cb88dce5fb17dea23b67a7e70da9b7/homework/homework6/hw6.jl#L818-L821

I.e., to something like this?

if result  1462
	correct()
elseif result  6358
	almost(md"Use ``f'(a)``, not ``f'(a+h)``.")

Copied from discord server:

user1 Yesterday at 11:22 AM
Hi guys, silly question, but why in the Euler step they make us use:

Use f'(a+h) instead of f'(a)?

I've tried to infer it geometrically, but I get lost in the approximation details - does someone has a video/resource that explains the rationale behind this trick to improving accuracy?

Is it just because we're integrating 'forward' ?

IanWeaver Yesterday at 6:50 PM
Oh, I totally missed that! Thanks for pointing that out, I think they might have just hard-coded the wrong branches in the test, but this would definitely be something worth following up with the instructors about. For example, I think 6358 and 1462 might be switched, and that the almost message should read "Use f'(a), not f'(a + h)." instead. The later implementations of this method also look to agree with this.

There are certainly different numerical methods though where you can use the slope at different points, RK4 probably being the most famous example. You can also just use the slope at the end of the step, but that would then turn it into an implicit scheme known as backward Euler. In general, this would require a root-finding method or fixed-point iteration to solve. If you happen to be interested in those kinds of methods, I made a brief write up about it here, but I haven't updated that package in a while:
https://spacejam.readthedocs.io/en/latest/background.html#background

One of the nice things about implicit methods is how stable they are, but I think that is outside the scope of this homework assignment, which is another reason why I think the above problem you brought up might just be a typo.

Finally, for a quick intro to numerical methods, you can't beat the OGs:
https://www.youtube.com/watch?v=RGtCw5E7gBc
https://www.youtube.com/watch?v=q87L9R9v274(edited)
[6:53 PM]
I'll go ahead and open an issue about this and link to the discussion here 
Link to issue: #61

user2 Yesterday at 7:04 PM
yea, i was also weirded out by that because they used f'(a) in the preceding equation

Failed to load notebook

Failed to load notebook
The file D:\Julia SoftWare\18S191 SUBMISSION\hw0 (1).jl could not be loaded. Please report this error!

Go back

Error message:

File is not a Pluto.jl notebook
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] load_notebook_nobackup(::IOStream, ::String) at C:\Users\user.julia\packages\Pluto\qC4PK\src\notebook\Notebook.jl:113
[3] #8 at C:\Users\user.julia\packages\Pluto\qC4PK\src\notebook\Notebook.jl:164 [inlined]
[4] open(::Pluto.var"#8#9"{String}, ::String, ::Vararg{String,N} where N; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at .\io.jl:325
[5] open at .\io.jl:323 [inlined]
[6] load_notebook_nobackup(::String) at C:\Users\user.julia\packages\Pluto\qC4PK\src\notebook\Notebook.jl:163
[7] load_notebook(::String) at C:\Users\user.julia\packages\Pluto\qC4PK\src\notebook\Notebook.jl:180
[8] open(::Pluto.ServerSession, ::String; run_async::Bool) at C:\Users\user.julia\packages\Pluto\qC4PK\src\webserver\SessionActions.jl:16
[9] open at C:\Users\user.julia\packages\Pluto\qC4PK\src\webserver\SessionActions.jl:10 [inlined]
[10] (::Pluto.var"#try_launch_notebook_response#96"{Pluto.var"#try_launch_notebook_response#85#97"{Pluto.ServerSession}})(::String; title::String, advice::String, home_url::String) at C:\Users\user.julia\packages\Pluto\qC4PK\src\webserver\Static.jl:63
[11] (::Pluto.var"#serve_openfile#99")(::HTTP.Messages.Request) at C:\Users\user.julia\packages\Pluto\qC4PK\src\webserver\Static.jl:92
[12] handle(::HTTP.Handlers.RequestHandlerFunction{Pluto.var"#serve_openfile#99"}, ::HTTP.Messages.Request) at C:\Users\user.julia\packages\HTTP\atT5q\src\Handlers.jl:253
[13] handle(::HTTP.Handlers.Router{Symbol("##253")}, ::HTTP.Messages.Request) at C:\Users\user.julia\packages\HTTP\atT5q\src\Handlers.jl:467
[14] (::Pluto.var"#190#196"{Pluto.ServerSession,HTTP.Handlers.Router{Symbol("##253")}})(::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}) at C:\Users\user.julia\packages\Pluto\qC4PK\src\webserver\WebServer.jl:123
[15] handle at C:\Users\user.julia\packages\HTTP\atT5q\src\Handlers.jl:269 [inlined]
[16] #4 at C:\Users\user.julia\packages\HTTP\atT5q\src\Handlers.jl:345 [inlined]
[17] macro expansion at C:\Users\user.julia\packages\HTTP\atT5q\src\Servers.jl:367 [inlined]
[18] (::HTTP.Servers.var"#13#14"{HTTP.Handlers.var"#4#5"{HTTP.Handlers.StreamHandlerFunction{Pluto.var"#190#196"{Pluto.ServerSession,HTTP.Handlers.Router{Symbol("##253")}}}},HTTP.ConnectionPool.Transaction{Sockets.TCPSocket},HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}})() at .\task.jl:356

hw1 Ex3.5 noisify test

Hi,

Just wanted to let you know that the test for the answer to Ex 3.5 in Hw1 doesn't appear to be working properly. I get a correct answer for the following (obviously wrong) code:

function noisify(x::Number, s)
	rand_num = rand()
	noisy_num = x + rand_num
	noisy_num = clamp(noisy_num, 0., 1.)
	return noisy_num
end

Afraid I'm not not sure how to fix it though.

Notebook not being recognized by Pluto

Neither via copying the link on the MIT OCW page and pasting it to Pluto nor copying directly the link to the .jl file is working, as Pluto seems to not recognize it as a notebook.
I'm not quite sure what the problem really is.

Varible red overrides function in hw1.jl

For week 1 in Exercise 2.3 the student is required to write a function to quantize instances of subtypes of AbstractRGB e.g. RGB. The live docs imply that the functions red(c) green(c) and blue(c) can be used to "pull out" the RGB values from a pixel.

Screenshot 2021-01-17 at 22 29 19

However, the function red(c) is overwritten by a later variable assignment to red on L301

https://github.com/mitmath/18S191/blob/14ca6fa5178f5c0025c5e845c7c40b7ea219d0dd/homework/homework1/hw1.jl#L301

This causes an error to be displayed if the student assumes that red is a function, and tries to call it
Screenshot 2021-01-17 at 22 29 56

Commenting out the variable assignment reverts the function override
Screenshot 2021-01-17 at 22 30 54


I suggest that the variable red should be renamed to something like color_red to avoid overriding the function

[Website] Hide sidebar

Summary

Add a button to hide the sidebar on website

Details

  • The sidebar on the course website takes huge space.
  • This is okay for normal usage,
  • but when used in split screen mode with terminal on the side for following alogn with, then it becomes troublesome
  • as sidebar leaves very little space for the actual content.

Reference: Sidebar of youtube can be toggled full size, vs collapsed.

Screenshots

image

Versions

  • Last modified: May 11, 2022
  • Commit: 3481208

inverse_climate_model failed to precompile Plots

When run inverse_climate_model notebook, the following error appeared above the add and using package block.

Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to /Users/.julia/compiled/v1.6/Plots/jl_iDFh4p.
error(::String)@error.jl:33
compilecache(::Base.PkgId, ::String, ::Base.PipeEndpoint, ::Base.PipeEndpoint)@loading.jl:1360
compilecache(::Base.PkgId, ::String)@loading.jl:1306
_require(::Base.PkgId)@loading.jl:1021
require(::Base.PkgId)@loading.jl:914
require(::Module, ::Symbol)@loading.jl:901
top-level scope@Local: 13

is there a plan to start the course in Fall21?

Hi everyone,

I'm sorry to open this issue here on GitHub but there seem to be not many people active on the Discord server at the moment.
I am wondering if MIT will hold the course in Fall21.

Thanks!

Scrolling in the sidebar is broken

I cannot scroll on the lefthand sidebar. So Homework 2 isn't visible until I go fullscreen or use a device with a portrait mode.

Normal screen
image

Fullscreen
image

seam_carving.jl

Hi, I am running Pluto in chrome on windows 10 and get following error on the third code block. Is it possible to run the code on windows? curl.exe is installed.
failed process: Process('C:\WINDOWS\System32\curl.exe' -s -S -g -L -f -o 'C:\Users\ruper\AppData\Local\Temp\jl_2fRSvgqCWA' https://cdn.shortpixel.ai/spai/w_1086+q_lossy+ret_img+to_webp/https://wisetoast.com/wp-content/uploads/2015/10/The-Persistence-of-Memory-salvador-deli-painting.jpg, ProcessExited(35)) [35]

[email protected]:525[inlined]
download_curl(::String, ::String, ::String)@download.jl:44
[email protected]:62[inlined]
download(::String)@download.jl:89
top-level scope@Local: 17[inlined]

Preinstall packages for offline access

Not strictly an issue; I just thought this may be useful to others. Also not an expert in Julia so if there's an easier way to do this please do correct the script.

I wanted to access the notebooks offline but due to Pluto installing packages per notebook, each notebook must be instantiated while having internet access. This script does that for every notebook in the notebooks directory in the Spring21 branch:

using Glob
import Pluto
import Pkg

function main()
  dirs = glob("./week*/*.jl")
  for jl_file in dirs
    println(jl_file)
    Pluto.activate_notebook_environment(jl_file)
    Pkg.instantiate()
  end
end

main()

Code in "Newton method in 2D" doesn't match the latex equation

In section 1.6 on newton method, in the 2D implementation the julia code doesn't match the latex equations.
The new approximation is defined to be x1 = x0 + δ, but in the julia function it's written as return x0 - δ.
This works in the code because in the definition of δthe minus sign is also missing, so practically it doesn't matter (they cancel out). However, I think it would be more intuitive if the code matched the latex equations

Screenshot 2021-09-15 at 19 34 59

Typo on class Section 3.2 notes, the Fall 2023 edition.

When I read the notes, I found this typo - "need too" should be "need to".

The link is https://computationalthinking.mit.edu/Fall23/climate_science/odes_and_parameterized_types/.

On the paragraph This says that "the way to...

1691332663212

README updates vs index

It looks like much of the content on the readme and index page are the same. This may lead to confusion for those making website updates.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.