Docsity

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

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