cmr72 has asked for the wisdom of the Perl Monks concerning the following question:
I do not have any real code for the kernel as I am somewhat lost in even starting out.#!/usr/bin/perl -w use strict ; my $samplesize = $ARGV[0] ; my $max = $ARGV[1] ; chomp(my $prog = `basename $0`) ; if ($#ARGV < 1) { print "\nUsage: ./randomnumber.pl <samplesize> <max num>\n" ; exit ; } for (my $i = 0; $i<$samplesize; $i++) { my $range = $max ; my $random_number = int(rand($range)) - $max/2; print "$random_number \n"; }
Thanks ahead for your help.#!/usr/bin/perl -w use strict ; my $tria ; my $epan ; my $unif ; while ( <STDIN> ) { my @line= split ; my $point = $line[0] ; $tria = 1-abs($point) ; #abs($point)<=1 ? $tria = 1-abs($point) : $tria = 0 ; $epan = .75*(1-$point*$point) ; #abs($point)<=1 ? $epan = .75*(1-$point*$point) : $epan = 0 ; $unif = .5 ; #abs($point)<=1 ? $unif = .5 : $unif = 0 ; print "$point $tria $epan $unif\n" ; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Kernel Density Estimation
by Mr. Muskrat (Canon) on Aug 29, 2012 at 20:25 UTC | |
|
Re: Kernel Density Estimation
by philiprbrenan (Monk) on Aug 29, 2012 at 20:24 UTC | |
by cmr72 (Initiate) on Aug 29, 2012 at 22:29 UTC | |
by cmr72 (Initiate) on Aug 30, 2012 at 10:08 UTC | |
by cmr72 (Initiate) on Aug 30, 2012 at 13:13 UTC | |
|
Re: Kernel Density Estimation
by flexvault (Monsignor) on Aug 29, 2012 at 20:35 UTC |