SoatDev IT Consulting
SoatDev IT Consulting
  • About us
  • Expertise
  • Services
  • How it works
  • Contact Us
  • News
  • July 5, 2023
  • Rss Fetcher


Years ago I wrote about how you can make a decent approximation to the Gaussian density by shifting and scaling the cosine function. This observation dates back at least as far as 1961.

Turns out you can do even better by raising the cosine term to a power. Not only can you get a good approximation, you can get an upper and lower bound of the same form.

In [1] the authors prove the following. For −π/2 < x < π/2,

left( frac{1 + cos x}{2}right)^a leq exp(-x^2) leq left( frac{1 + cos x}{2}right)^b

and

left( frac{2 + cos x}{3}right)^c leq exp(-x^2) leq left( frac{2 + cos x}{3}right)^d

with the best possible constants

begin{align*} a &= 4 \ b &= (pi/2)^2/log(2) approx 3.559707\ c &= (pi/2)^2 / log(3/2) approx 6.08536\ d &= 6 end{align*}

When the authors say “best” they mean best with respect to L2 norm, i.e. best the the least-squares sense.

The graph at the top of the page plots exp(−x²) as solid blue line, the first upper bound as a dotted green line, and the first lower bound as a dotted orange line. The blue and green lines blend into a single bluish-green line. You can barely see the orange line separate from the others. The curves are difficult to distinguish visually, which is the point.

The second pair of upper and lower bounds are even better. Here’s a plot of the errors for the second pair of bounds.

gaps in bounds

Note that the theorem is stated for the interval [−π/2, π/2], but the plot covers a wider range in order to show that the errors are still small outside the interval. Outside the specified interval, the lower bound error becomes positive, i.e. the lower bound is no longer a lower bound, though it’s still a good approximation.

[1] Yogesh J. Bagul and Christophe Chesneau. Some sharp circular and hyperbolic bounds of exp(−x²) with applications. Applicable Analysis and Discrete Mathematics, Vol. 14, No. 1 (April 2020), pp. 239–254

The post Cosine power approximation to Gaussian density first appeared on John D. Cook.

Previous Post
Next Post

Recent Posts

  • Karat Financial is bringing business banking to creators
  • Odyssey’s new AI model streams 3D interactive worlds
  • Spotify amps up podcast discovery with new features
  • Google Photos debuts redesigned editor with new AI tools
  • Meta wants to open more retail stores

Categories

  • Industry News
  • Programming
  • RSS Fetched Articles
  • Uncategorized

Archives

  • May 2025
  • April 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023

Tap into the power of Microservices, MVC Architecture, Cloud, Containers, UML, and Scrum methodologies to bolster your project planning, execution, and application development processes.

Solutions

  • IT Consultation
  • Agile Transformation
  • Software Development
  • DevOps & CI/CD

Regions Covered

  • Montreal
  • New York
  • Paris
  • Mauritius
  • Abidjan
  • Dakar

Subscribe to Newsletter

Join our monthly newsletter subscribers to get the latest news and insights.

© Copyright 2023. All Rights Reserved by Soatdev IT Consulting Inc.