Python and Mathematics: Matrix Calculus, Probability Theory, and Recurrence Relations, Schemes and Mind Maps of Calculus

An overview of various topics in Python programming, including matrix calculus, recurrence relations, and probability theory. It covers concepts such as list comprehension, list slicing, passing functions, and reading and writing files. The document also includes useful properties of matrices and calculus, as well as examples of coin payment problems and probability theory. It is intended for individuals interested in learning or expanding their knowledge of these topics.

Typology: Schemes and Mind Maps

2021/2022

Uploaded on 09/27/2022

brandonflowers
brandonflowers 🇬🇧

4

(13)

233 documents

1 / 30

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS221 Section 1
Foundations
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e

Partial preview of the text

Download Python and Mathematics: Matrix Calculus, Probability Theory, and Recurrence Relations and more Schemes and Mind Maps Calculus in PDF only on Docsity!

CS221 Section 1

Foundations

Roadmap Python Matrix Calculus Recurrence Relation Probability Theory

Gotchas

  • Integer division
  • Tied objects
  • Global variables

References

  • Official Documentation (has a tutorial): https://docs.python.org/2.7/
  • Learn X in Y minutes: http://learnxinyminutes.com/docs/python/
  • You don’t need to know numpy. But if you want to: http://nbviewer.ipython.org/gist/rpmuller/

Useful Properties

”v − squared” = ‖v‖^22 = v · v = vT^ v (A + B)T^ = AT^ + BT (AB)T^ = BT^ AT

Matrix Calculus f (w) = (a · w + 1)^2

Compute ∇wf (w)

A Useful Quantity ∇ww>Cw = (C + C>)w

Matrix Calculus f (w) = ‖w‖^22

Compute ∇wf (w)

Roadmap Python Matrix Calculus Recurrence Relation Probability Theory

Coin Payment Problem

Suppose you have an unlimited supply of coins with values 2 and 3 cents How many ways can you pay for an item costing 8 cents?

  • Refer to the extra section handout for more information regarding how the code computing this would

Roadmap Python Matrix Calculus Recurrence Relation Probability Theory

Probability Law of total probability:

P(A) = ∑ n P(A ∩ Bn) = ∑ n P(Bn|A)P(Bn)

Bayes’ rule:

P(A|B) = P(B P|A(B)P)(A)

Random Variables Discrete: P(A = a) or pA(a) Continuous: P(A = a) fA(a) F (c) = P(A ≤ c) =^ ∫^ −∞c fA(a) da