$ TypeScript // Smoothmax function: smooth approximation of Math.max(0, x) for differentiability const smoothMax = (val: number, beta: number = 100) => { // Prevent overflow: for large val*beta, approximate linearly if (val * beta > 20) return val; return Math.log(1 + Math.exp(beta * val)) / beta; }; COMMAND_BLOCK: TypeScript // Smoothmax function: smooth approximation of Math.max(0, x) for differentiability const smoothMax = (val: number, beta: number = 100) => { // Prevent overflow: for large val*beta, approximate linearly if (val * beta > 20) return val; return Math.log(1 + Math.exp(beta * val)) / beta; }; COMMAND_BLOCK: TypeScript // Smoothmax function: smooth approximation of Math.max(0, x) for differentiability const smoothMax = (val: number, beta: number = 100) => { // Prevent overflow: for large val*beta, approximate linearly if (val * beta > 20) return val; return Math.log(1 + Math.exp(beta * val)) / beta; }; CODE_BLOCK: TypeScript // Actual code for the -weight: 500;">update lambdaVec[i] = Math.max(0, lambdaVec[i] + mu * c[i]); CODE_BLOCK: TypeScript // Actual code for the -weight: 500;">update lambdaVec[i] = Math.max(0, lambdaVec[i] + mu * c[i]); CODE_BLOCK: TypeScript // Actual code for the -weight: 500;">update lambdaVec[i] = Math.max(0, lambdaVec[i] + mu * c[i]); - x: The variables we can change (lens curvature, thickness, etc.) - f(x): The objective function (the amount of blur we want to minimize) - g(x): The equality constraint (e.g., Focal Length - 50mm = 0) - λ: The Lagrange multiplier (the repulsive force pushing back from the constraint wall) - Click the link below to open the optical system: Link to pre-optimized optical system - An overwrite confirmation window will appear; click "OK". - Click the "Optimize" button on the screen. - A pop-up window will open; click the "Run" button. - Wait a few seconds. The optimization will -weight: 500;">start, and you will see the optical system updating. - When "done" is displayed, the optimization is complete!