Sunday, April 29, 2012

Loud music

Today was a nice day, so the spouse and I were driving around with the windows down.  And, then these stupid kids with there over-loud music start doing there thing.  Every red stoplight there'd be some asshole with his music blaring down at me.  The music itself was terrible, but even good music at that level would be bad.  I don't get it.  And yesterday, when I was at the used bookstore, there was some high-age school kid with music blaring through his earphones.  Why?

I sort of have a sound-track, myself, while doing my thing; music I remember in my head or though earphones at REASONABLE volumes.... I feel like it's my own personal "soundtrack."  I don't really want other people to know what I'm listening to, no do I want to hear what some asshole I've never met has on his soundtrack.

Plus, I like at be aware of the environment I'm in.  Sometimes, I like to listen to the sounds of cars while the window is down, or the wind or what-ever.  It almost feels like people with their music turn up so loud are trying to tune-out reality... A sort of half-assed form of suicide...
Enhanced by Zemanta

Sunday, April 8, 2012

Drinking

I really shouldn't drink anymore.  The aspirin is already tying up my liver, and the day after I drink I have an extreme difficulty communicating.  I like alcohol, but perhaps we need to part ways.

Friday, April 6, 2012

sumpin sumpin....

I got drunk tonight, wrote a Monte Carlo integration program in Java for shits, and now I'm watching The Marx Brothers "A Night at the Opera" which is pretty funny...

The error estimate is way off.  ...  I'm drunk, so fuck it.This is a crappy way to do integrals, but it is cheap and quick (relatively speaking).  During the Manhattan Project (back when computers where people rather than machines... and women, too, even though in today's society women hate math and prefer barbie dolls thanks for shitty advertizements and gender roles based on capitalist shit), this was how you did numerical integration.


import java.util.Arrays;
import java.util.Random;
/**
 *
 * @author discordantmind
 */
public class MonteCarloIntegration {
    public static void main(String[] args) {
        /* Create program to calculate Monte Carlo Integration
         * The integrand is a separate method called 'integrand'
         */
        // create random points for integration, and sort from highest to lowest
        int numberPoints = 20; // how many points along curve should be evaluated
        int endPoint = 2;
        double[] xposition = new double[numberPoints];
        Random xGen = new Random();
        for(int i=1 ; i < (numberPoints - 1); i++) {
            xposition[i] = endPoint * xGen.nextDouble();
         //   System.out.println(xposition[i]);
        } 
        xposition[0] = 0.;
        xposition[numberPoints - 1] = 2.;


        Arrays.sort(xposition); 
        
        // check to see if points are sort-of evenly spread out
        for (double dd : xposition){
            System.out.println(dd);
        }
        
        //Create new random number generators for x and y coordinates 
        Random xtestpoint = new Random();
        Random ytestpoint = new Random();
        
        // starting stuff for Monte Carlo shit
        double testx;
        double testy;
        double interval;
        int below;
        double testintegral;
        double area = 0; // initialize integral
        int numberRandom = 100; // number of random points for MC
        double error = 0; // initialize error counter thingy
        double rho; // density of points below curve
        /* BEGIN MONTE CARLO SHIT */
        for(int i=0; i < (xposition.length - 1); i++) {
            // Taking care of end points
            interval = xposition[i+1] - xposition[i];
            below = 0;
            for(int j=0; j<numberRandom; j++) {
                testx = xposition[i] + interval * xtestpoint.nextDouble();
                testy = 2.0 * ytestpoint.nextDouble();
                testintegral = integrand(testx);
                if(testy <= testintegral) {
                    below++;
                }
            }
            rho = below/ (double) (numberRandom);
            area += interval * 2.0 * rho;
            error += interval * 2.0 * Math.sqrt((rho - Math.pow(rho,2))/numberRandom);
        }
        System.out.println("Error estimate is " + error);
        System.out.println("Integral from 0 to "+ endPoint + " is: " + area);


    }
    public static double integrand(double x) {
        // plug in whatever function you want to integrate here as 'func'
        double func = Math.sqrt(4. - Math.pow(x,2)); 
        return func;
    }
}
I can't really drink hard liquor anymore.  I'm still taking aspirin therapy, which means I can't drink to heavily or I could hemorrhage into my brain.  But, the doctor said I can stop taking Plavix, which is nice...

Enhanced by Zemanta