Advanced Mathematics for Economists: Static and Dynamic Optimization