Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8044281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:10:44+00:00 2026-06-05T05:10:44+00:00

First, is this the correct C++ representation of the pdf gaussian function ? float

  • 0

First, is this the correct C++ representation of the pdf gaussian function ?

float pdf_gaussian = ( 1 / ( s * sqrt(2*M_PI) ) ) * exp( -0.5 * pow( (x-m)/s, 2.0 ) );

Second, does it make sense of we do something like this ?

if(pdf_gaussian < uniform_random())
   do something
else
   do other thing

EDIT: An example of what exactly are you trying to achieve:

Say I have a data called Y1. Then a new data called Xi arrive. I want to see if I should associated Xi to Y1 or if I should keep Xi as a new data data that will be called Y2. This is based on the distance between the new data Xi and the existing data Y1. If Xi is “far” from Y1 then Xi will not be associated to Y1, otherwise if it is “not far”, it will be associated to Y1. Now I want to model this “far” or “not far” using a gaussian probability based on the mean and stdeviation of distances between Y and the data that where already associated to Y in the past.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:10:46+00:00Added an answer on June 5, 2026 at 5:10 am

    yes. boost::random has gaussian distribution.

    See, for example, this question: How to use boost normal distribution classes?

    As an alternative, there’s a standard way of converting two uniformly distributed random numbers into two normally distributed numbers.

    See, e.g. this question: Generate random numbers following a normal distribution in C/C++

    In response to your last edit (note that the question is completely different as edited, hence my answer to an original one is irrelevant). I think you’d better off first formulating for yourself what exactly do you mean to mean by “modelling far or not far using a gaussian distribution”. Then reformulate that understanding in math terms and only then start programming. As it stands, I think the problem is underspecified.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to (numerically) calculate the first and second derivative of a function for
Code first: '''this is main structure of my program''' from twisted.web import http from
Two things, first this is my first question in this forum and I do
I have 2 XML files, first this one which works just fine: <?xml version=1.0
In linking a sports event to two teams, at first this seemed to make
First off this is in Microsoft Office 2010. I'm comparing two different worksheets each
This first bit works: $my_id = 617; $post_id_7 = get_post($my_id); $title = $post_id_7->post_excerpt; echo
Pls see this first: Good Coding Practices So, this is my design. Website 2.Business
I first asked this question, which I figured out how the EDT works and
The first time this loop iterates works well but after I press the char

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.