gomathi

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2023 License: MIT Imports: 2 Imported by: 0

README

goMATHi : GOlang MATHs Interface

This is an effort to learn statistics with golang and create more optimized maths functions than python for learning data science. I dedicate this package to my GrandMother Smt. Gomathi Devi Jat.

Example Usage

  • Sample code to calculate mean
package main

import (
	"fmt"
	"github.com/miteshbsjat/gomathi"
)

func main() {
	fmt.Printf("Mean = %f\n", gomathi.Mean([]int{1, 2, 3, 4}))
	fmt.Printf("Median = %f\n", gomathi.Median([]int{1, 2, 2, 3, 4}))
}
  • Output
$ go run statistics.go
Mean = 2.500000
Median = 2.000000

Testing

  • Please run the following command to test this package
$ go test

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mean

func Mean[T Number](numbers []T) float64

Statistics: Find the mean of the n numbers

func Median added in v0.0.3

func Median[T Number](numbers []T) float64

Statistics: Find the median of the n numbers

func Quantile added in v0.0.4

func Quantile[T Number](p float32, numbers []T) T

Find the pth-percentile value in numbers

Types

type Number added in v1.0.0

type Number interface {
	constraints.Float | constraints.Integer
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL