Skip to content

Instantly share code, notes, and snippets.

@cab1729
cab1729 / RiemannSiegel.java
Last active September 10, 2017 16:56
Code Samples - Core Java/Math: Riemann Hypothesis research
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class RiemannSiegel {
private static final double twopi = 2.0 * StrictMath.PI;
@cab1729
cab1729 / Bernoulli.java
Created November 14, 2013 01:21
Bernoulli functions with arbitrary precision. Uses MPFloat.
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import jgmp.MPFloat;
import de.luschny.math.factorial.FactorialPoorMans;
/**
@cab1729
cab1729 / DirectedWeightedGraph.java
Last active December 15, 2015 12:18
Graph Processing
import java.util.*;
/**
* @author jmenes
*
* DirectedWeightedGraph
* Uses a variant of an adjacency matrix to represent the graph.
* The weight itself is used as the edge connection indicator
* (it's really a cost matrix)
*
@cab1729
cab1729 / AppSiteMapProvider.cs
Created July 20, 2012 19:20
C# Site Map provider example - displays available user options based on security roles permissions
using System;
using System.Data;
using System.Configuration;
using System.Security.Permissions;
using System.Web;
using System.Web.Security;
// BO - Business Objects (Entities)
using Customer.BO;
using Customer.Services;
using Customer.Framework.Logging;
@cab1729
cab1729 / ComplexFun.cs
Created July 20, 2012 19:08
C# Math trig functions using System.Numerics.Complex type
using System;
using System.Numerics;
namespace MathFun
{
/// <summary>
/// Trig functions for Complex numbers
/// </summary>
/// <remarks>
/// main reference: Schaum's Outlines: Complex Variables ISBN-13: 978-0070602304
@cab1729
cab1729 / WSGetAllLicensePermitBySSN.cs
Created July 20, 2012 19:05
C# Web Service Example
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using Customer.Services;
using Customer.Entity;
package org.cab1729.portlets;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.ParamUtil;
import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.GenericPortlet;
@cab1729
cab1729 / PSLQ.java
Created July 1, 2012 20:16
PSLQ Algorithm
package org.cab1729.algorithms;
import org.cab1729.matrixmp.*;
import jgmp.MPFloat;
import numbercruncher.matrix.MatrixException;
/**
* @author jmenes
* The PSLQ Algorithm
@cab1729
cab1729 / MPFloat.c
Created January 4, 2012 21:09
MPFloat
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include "MPFloat.h"
#include "jcl.h"
#include <gmp.h>
@cab1729
cab1729 / Complex.java
Last active November 1, 2022 02:51
Code Samples - Core Java/Math: Complex Numbers/Functions
import java.io.Serializable;
import java.util.Formattable;
import java.util.Formatter;
/**
* Complex number class. A Complex consists of a real and imaginary
* part of type {@link double}.<p>
*
* Note: The methods inherited from <code>Number</code> return
* the value of the real part of the complex number.