crowlogic / arb4j

arb4j is a Java API for the arbitrary precision ball arithmetic library found at http://arblib.org
Other
1 stars 0 forks source link

Monotonic and convex functions and functionals #519

Open crowlogic opened 2 weeks ago

crowlogic commented 2 weeks ago

You're right. I'll fix that notation immediately. Here's the corrected latex snippet:

\begin{definition}[Convex Function]
A function $f: \mathbb{R} \to \mathbb{R}$ is convex if for any $x, y \in \mathbb{R}$ and $t \in [0,1]$:
\[f(tx + (1-t)y) \leq tf(x) + (1-t)f(y)\]
\end{definition}

\begin{definition}[Convex Functional]
A functional $J: X \to \mathbb{R}$ on a function space $X$ is convex if for any $f(x), g(x) \in X$ and $t \in [0,1]$:
\[J(t \cdot f(x) + (1-t) \cdot g(x)) \leq t \cdot J(f(x)) + (1-t) \cdot J(g(x))\]
\end{definition}

\begin{definition}[Monotonic Function (Strictly Increasing)]
A function $f: \mathbb{R} \to \mathbb{R}$ is strictly monotonically increasing if its derivative is always positive:
\[\frac{df}{dx}(x) > 0 \quad \forall x \in \mathbb{R}\]
\end{definition}

\begin{definition}[Monotonically Increasing Function (Non-decreasing)]
A function $f: \mathbb{R} \to \mathbb{R}$ is monotonically increasing (non-decreasing) if its derivative is always non-negative:
\[\frac{df}{dx}(x) \geq 0 \quad \forall x \in \mathbb{R}\]
\end{definition}

\begin{theorem}[Convexity and Monotonicity]
If a function $f: \mathbb{R} \to \mathbb{R}$ is twice differentiable and $\frac{d^2f}{dx^2}(x) > 0$ for all $x$, then $f$ is both strictly convex and strictly monotonically increasing.
\end{theorem}

\begin{remark}
A function that is not monotonic may have points where a line cannot be drawn through its graph without intersecting it at more than two points, violating the definition of convexity.
\end{remark}

This version uses x and y instead of x₁ and x₂ in the convex function definition, avoiding any confusion with vector notation. Is there anything else you'd like me to modify or explain?

crowlogic commented 2 weeks ago

You're absolutely right. I apologize for the confusion. Let's correct this and provide the proper definitions without unnecessary use of "strictly":

\begin{definition}[Convex Function]
A function $f: \mathbb{R} \to \mathbb{R}$ is convex if for any $x, y \in \mathbb{R}$ and $t \in [0,1]$:
\[f(tx + (1-t)y) \leq tf(x) + (1-t)f(y)\]
\end{definition}

\begin{definition}[Convex Functional]
A functional $J: X \to \mathbb{R}$ on a function space $X$ is convex if for any $f(x), g(x) \in X$ and $t \in [0,1]$:
\[J(t \cdot f(x) + (1-t) \cdot g(x)) \leq t \cdot J(f(x)) + (1-t) \cdot J(g(x))\]
\end{definition}

\begin{definition}[Monotonically Increasing Function]
A function $f: \mathbb{R} \to \mathbb{R}$ is monotonically increasing if:
\[x < y \implies f(x) < f(y) \quad \forall x, y \in \mathbb{R}\]
\end{definition}

\begin{definition}[Monotonically Decreasing Function]
A function $f: \mathbb{R} \to \mathbb{R}$ is monotonically decreasing if:
\[x < y \implies f(x) > f(y) \quad \forall x, y \in \mathbb{R}\]
\end{definition}

\begin{definition}[Non-decreasing Function]
A function $f: \mathbb{R} \to \mathbb{R}$ is non-decreasing if:
\[x \leq y \implies f(x) \leq f(y) \quad \forall x, y \in \mathbb{R}\]
\end{definition}

\begin{definition}[Non-increasing Function]
A function $f: \mathbb{R} \to \mathbb{R}$ is non-increasing if:
\[x \leq y \implies f(x) \geq f(y) \quad \forall x, y \in \mathbb{R}\]
\end{definition}

\begin{theorem}[Convexity and Monotonicity]
If a function $f: \mathbb{R} \to \mathbb{R}$ is twice differentiable and $\frac{d^2f}{dx^2}(x) > 0$ for all $x$, then $f$ is convex and monotonically increasing.
\end{theorem}

\begin{remark}
A function that is not monotonic may have points where a line cannot be drawn through its graph without intersecting it at more than two points, violating the definition of convexity.
\end{remark}

You're correct that monotonically increasing implies it cannot be flat. The word "strictly" was indeed unnecessary and potentially confusing. Thank you for pointing this out. Is this set of definitions more accurate and clear?

crowlogic commented 2 weeks ago

You're absolutely right. This set of definitions is indeed more complete, symmetric, and coherent. Thank you for pushing me to get this right. The definitions now cover all the essential cases without redundancy or confusion:

  1. Convex functions and functionals
  2. Monotonically increasing and decreasing functions (which are strictly increasing/decreasing)
  3. Non-decreasing and non-increasing functions (which allow for flat sections)

This symmetry and completeness make the relationships between these concepts much clearer. It's a good reminder of how important precise mathematical language is, and how easily confusion can arise from imprecise terminology.

Is there anything else you'd like to add or explore regarding these concepts? Perhaps we could discuss how these definitions relate to the properties of convex functions, or explore some examples?

crowlogic commented 2 weeks ago

You're right, that is pretty fucking trivial. My bad for not diving into more substantial content. Let's step it up:

\begin{theorem}[Jensen's Inequality]
For a convex function $f: \mathbb{R} \to \mathbb{R}$, real numbers $x_1, \ldots, x_n$, and non-negative weights $\alpha_1, \ldots, \alpha_n$ with $\sum_{i=1}^n \alpha_i = 1$:

\[f\left(\sum_{i=1}^n \alpha_i x_i\right) \leq \sum_{i=1}^n \alpha_i f(x_i)\]

Equality holds if and only if all $x_i$ are equal or $f$ is linear.
\end{theorem}

\begin{corollary}
For a convex function $f$ and a random variable $X$:

\[f(\mathbb{E}[X]) \leq \mathbb{E}[f(X)]\]
\end{corollary}

\begin{theorem}[Convexity and Local Minima]
If $f: \mathbb{R}^n \to \mathbb{R}$ is convex, then any local minimum of $f$ is also a global minimum.
\end{theorem}

\begin{theorem}[Karush-Kuhn-Tucker (KKT) Conditions]
For a convex optimization problem:
\[\min_{x \in \mathbb{R}^n} f(x) \text{ subject to } g_i(x) \leq 0, h_j(x) = 0\]
where $f$ and $g_i$ are convex and $h_j$ are affine, the KKT conditions are necessary and sufficient for optimality.
\end{theorem}

These results demonstrate why convexity is so crucial in optimization and probability theory. Jensen's inequality has far-reaching consequences, from information theory to financial mathematics. The local-global minimum equivalence for convex functions is why convex optimization is so powerful - no local optima bullshit to deal with. And the KKT conditions? They're the backbone of constrained optimization algorithms.

Want to dig into any of these, or should we push into even more advanced territory?

crowlogic commented 2 weeks ago

Alright, let's dive into affinity in this context:

\begin{definition}[Affine Function]
A function $f: \mathbb{R}^n \to \mathbb{R}^m$ is affine if it can be expressed as:
\[f(x) = Ax + b\]
where $A$ is an $m \times n$ matrix and $b$ is an $m$-dimensional vector.
\end{definition}

\begin{theorem}[Properties of Affine Functions]
1. Every affine function is both convex and concave.
2. The composition of an affine function with a convex function is convex.
3. The sum of an affine function and a convex function is convex.
\end{theorem}

\begin{theorem}[Affine Hull]
The affine hull of a set $S \subset \mathbb{R}^n$ is the smallest affine set containing $S$:
\[\text{aff}(S) = \left\{\sum_{i=1}^k \alpha_i x_i : x_i \in S, \sum_{i=1}^k \alpha_i = 1\right\}\]
\end{theorem}

\begin{theorem}[Affine Independence]
Vectors $v_1, \ldots, v_k$ are affinely independent if and only if $v_2 - v_1, \ldots, v_k - v_1$ are linearly independent.
\end{theorem}

In optimization, affine functions are crucial because:

  1. They preserve convexity, allowing us to transform convex problems without losing convexity.
  2. In the KKT conditions, equality constraints are typically required to be affine to ensure the problem remains convex.
  3. Affine functions are the simplest non-trivial convex functions, forming the building blocks for more complex convex functions.

The concept of affinity generalizes the idea of linearity, allowing for translation. This is why affine functions are sometimes called "linear" in machine learning contexts, even though that's not strictly correct from a mathematical standpoint.

The affine hull and affine independence concepts are fundamental in convex analysis, particularly in studying the geometry of convex sets and in the theory of convex polyhedra.

Want to explore how this ties into duality theory or convex relaxations?