

Java example source code file (gammadistribution.mac)
The gammadistribution.mac Java example source code/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * This Maxima script allows the creation of reference data for the Gamma * distribution. */ /* * Set floatingpoint accuracy to four times the double precision. */ fpprec : 64; /* * Probability density function for Gamma distribution with shape parameter a * and scale parameter b. */ p(x, a, b) := (x / b)**a * exp(x / b) / x / gamma(a); /* * Make sure x is a list of exactly representable doubles: use only poweroftwo * fractions of unity. */ out : openw("gammadistributionshape1.csv"); x : float(makelist(i / 32, i, 1, 3200)); y : p(bfloat(x), 1, 1); printf(out, "~{~h, ~h~%~}", join(x, y)); close(out); out : openw("gammadistributionshape8.csv"); x : float(makelist(i / 32, i, 1, 3200)); y : p(bfloat(x), 8, 1); printf(out, "~{~h, ~h~%~}", join(x, y)); close(out); out : openw("gammadistributionshape10.csv"); x : float(makelist(i / 4, i, 1, 400)); y : p(bfloat(x), 10, 1); printf(out, "~{~h, ~h~%~}", join(x, y)); close(out); out : openw("gammadistributionshape100.csv"); x : float(append(makelist(i / 32, i, 1, 32 * 3), makelist(i + 3, i, 1, 297))); y : p(bfloat(x), 100, 1); printf(out, "~{~h, ~h~%~}", join(x, y)); close(out); out : openw("gammadistributionshape142.csv"); x : float(append(makelist(i / 32, i, 1, 32 * 10), makelist(i + 10, i, 1, 440))); y : p(bfloat(x), 142, 1); printf(out, "~{~h, ~h~%~}", join(x, y)); close(out); out : openw("gammadistributionshape1000.csv"); x : float(append(makelist(i / 32, i, 1, 32 * 10), makelist(i + 10, i, 1, 2990))); y : p(bfloat(x), 1000, 1); printf(out, "~{~h, ~h~%~}", join(x, y)); close(out); Other Java examples (source code examples)Here is a short list of links related to this Java gammadistribution.mac source code file: 
Copyright 19982019 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.