Example #1
0
// LogCDF computes the value of the log of the cumulative density function at x.
func (w Weibull) LogCDF(x float64) complex128 {
	if x < 0 {
		return 0
	} else {
		return cmplx.Log(-1) + complex(-math.Pow(x/w.Lambda, w.K), 0)
	}
}
Example #2
0
	"runtime"
	"strconv"
	"sync"
	"time"
)

type ComplexFunc func(complex128) complex128

var Funcs []ComplexFunc = []ComplexFunc{
	func(z complex128) complex128 { return z*z - 0.61803398875 },
	func(z complex128) complex128 { return z*z + complex(0, 1) },
	func(z complex128) complex128 { return z*z + complex(-0.835, -0.2321) },
	func(z complex128) complex128 { return z*z + complex(0.45, 0.1428) },
	func(z complex128) complex128 { return z*z*z + 0.400 },
	func(z complex128) complex128 { return cmplx.Exp(z*z*z) - 0.621 },
	func(z complex128) complex128 { return (z*z+z)/cmplx.Log(z) + complex(0.268, 0.060) },
	func(z complex128) complex128 { return cmplx.Sqrt(cmplx.Sinh(z*z)) + complex(0.065, 0.122) },
}

func RunJulia() {
	t := time.Now()
	for n, fn := range Funcs {
		err := CreatePng("picture-"+strconv.Itoa(n)+".png", fn, 1024)

		if err != nil {
			log.Fatal(err)
		}
	}
	fmt.Println("Time passed: ", time.Since(t).Seconds())
}
Example #3
0
	"strconv"
	"sync"
	"time"
)

type ComplexFunc func(complex128) complex128

var Funcs []ComplexFunc = []ComplexFunc{
	func(z complex128) complex128 { return z*z - 0.61803398875 },
	func(z complex128) complex128 { return z*z + complex(0, 1) },
	func(z complex128) complex128 { return z*z + complex(-0.835, -0.2321) },
	func(z complex128) complex128 { return z*z + complex(0.45, 0.1428) },
	func(z complex128) complex128 { return z*z*z + 0.400 },
	func(z complex128) complex128 { return cmplx.Exp(z*z*z) - 0.621 },
	func(z complex128) complex128 {
		return (z*z+z)/cmplx.Log(z) + complex(0.268,
			0.060)
	},
	func(z complex128) complex128 {
		return cmplx.Sqrt(cmplx.Sinh(z*z)) +
			complex(0.065, 0.122)
	},
}

//This makes the program use all the cores in the processor
func init() {
	numcpu := runtime.NumCPU()
	runtime.GOMAXPROCS(numcpu) // Try to use all available CPUs.
}

func main() {
Example #4
0
func CorssEntorpy(T, O *Matrix.Matrix) *Matrix.Matrix {
	log := func(x complex128) complex128 { return cmplx.Log(x) }
	return Matrix.DotMultiplication(T, O.Apply(log))

}
func test4(val, val0 complex128) complex128 {
	return (val*val+val)/cmplx.Log(val) + val0
}