Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97291588
d_rndschechter.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jan 4, 02:47
Size
724 B
Mime Type
text/x-c
Expires
Mon, Jan 6, 02:47 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23373693
Attached To
R1448 Lenstool-HPC
d_rndschechter.c
View Options
#include<math.h>
#include<fonction.h>
/* -------------------------------------------------------------------
return a random B absolute magnitude according to Schechter (1976)
distribution.
-------------------------------------------------------------------*/
double d_rndschechter(int *idum)
{
const extern struct g_cosmo C;
const extern struct g_source S;
double mrnd, prnd, dm;
dm = 5.0 * log10(C.h); /* C.h is in units of H0=50 */
do
{
mrnd = S.lfm_min + (S.lfm_max - S.lfm_min) * d_random(idum);
prnd = 2.0 * d_random(idum);
}
while (exp(0.921*(S.lfalpha + 1)*(S.lfm_star - mrnd)
- exp(0.921*(S.lfm_star - mrnd))) < prnd);
return mrnd + dm;
}
Event Timeline
Log In to Comment