The Python Oracle

Fast Numerical Integration in Python

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Track title: CC C Schuberts Piano Sonata No 13 D

--

Chapters
00:00 Question
01:19 Accepted answer (Score 4)
01:49 Thank you

--

Full question
https://stackoverflow.com/questions/2030...

Accepted answer links:
[What is memoization and how can I use it in Python?]: https://stackoverflow.com/questions/1988...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #numpy #numericalmethods

#avk47



ACCEPTED ANSWER

Score 4


If you have lot's of these to do and f is more complicated than your example, you could get some benefits from memoizing f and possibly g.

What is memoization and how can I use it in Python?

Basically, anywhere you can, cache a computation and trade memory for cpu.