liveBook · Manning

Convexity

As explained in Build a Robo-Advisor with Python (From Scratch)

A mathematical property of functions or sets that ensures line-segment combinations remain compatible with global optimization guarantees.

Convexity is a property of functions, sets, and optimization problems. It is valuable because convex problems can be solved efficiently, and a solution found is guaranteed to be globally optimal. Without convexity, a solver may stop at a local minimum or miss a better solution. section 10.1.2

Recognize convexity through two line-segment tests:

  • A function is convex when, for points x and y and 0 ≤ λ ≤ 1, f(λx + (1 − λ)y) ≤ λf(x) + (1 − λ)f(y). The graph stays below the line joining the endpoint values. section 10.1.2
  • A set is convex when every point on the line segment between any two points in the set also remains in the set; practically, it has no holes. section 10.1.2

Why portfolio constraints matter

A nonconvex objective can have multiple local minima, so initialization may determine which solution an algorithm finds. In portfolio optimization, adding constraints can reduce the concentrated or unintuitive portfolios produced by naive unconstrained optimization. section 10.4

Figure 10.4 A convex function
figure

Visualizes a convex function whose values along a segment remain below the line connecting the endpoint values. section 10.1.2

How Build a Robo-Advisor with Python (From Scratch) covers it

How deep it goes
Defines convex functions and sets mathematically, contrasts local and global minima, and stops short of solver implementation.
Examples
Uses function graphs, line segments, convex and nonconvex sets, and unconstrained portfolio optimization.
What you can do after
Evaluate solver reliability and apply constraints when nonconvexity or naive portfolio optimization can produce nonoptimal results.
How it connects
Connects optimization solvers, global optima, portfolio constraints, and ESG portfolio construction.

Also explained in

Compare how 2 books explain convexity →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Robo-Advisor with Python (From Scratch). The section links point to the parts of the book it draws on.