001 package com.croftsoft.apps.insight; 002 003 public class Croft_Math { 004 ////////////////////////////////////////////////////////////////////// 005 // Croft_Math.java v0.0 (C) Copyright 1996 David Wallace Croft. 006 // 1996-08-24 007 ////////////////////////////////////////////////////////////////////// 008 009 static public double sigmoid ( double a ) { 010 ////////////////////////////////////////////////////////////////////// 011 // Also known as the "logistic function". 012 ////////////////////////////////////////////////////////////////////// 013 return 1.0 / ( 1.0 + java.lang.Math.exp ( -a ) ); 014 } 015 016 static public double sigmoid_derivative ( double a ) { 017 ////////////////////////////////////////////////////////////////////// 018 // The derivative with respect to the argument. 019 ////////////////////////////////////////////////////////////////////// 020 double y = sigmoid ( a ); 021 return y * ( 1.0 - y ); 022 } 023 024 ////////////////////////////////////////////////////////////////////// 025 ////////////////////////////////////////////////////////////////////// 026 }