Skip to content

This is a Physical library for Go Language which includes multiple physical and mathematical formulas.

License

Notifications You must be signed in to change notification settings

Juandavid716/gophysics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gophysics - A Physics library for the Go programming language.

This is a Physical library for Go Language.
Which includes multiple physical and mathematical formulas.

Installation

Installation is done using go get.

go get -u github.com/Juandavid716/gophysics

These are following equations calculation which is supported by gophysics.

  • Constant acceleration equations

Constant acceleration equations

Velocity

Equations

Example

package main

import (
	"fmt"

	disp "github.com/Juandavid716/gophysics"
)


func main() {

	// Init the function where parameters are (initial velocity, acceleration)
	fy := disp.VelocityAcc(4, 5)
	fmt.Println(fy(3))

	// Init the function where parameters are (initial velocity, acceleration, initial displacement, final displacement)
	fmt.Println(disp.VelocityDisp(3, 5, 6, 8))
}

Output
19
29

Functions

Equations Method Arguments Return type
VelocityAcc() Vo, a float64 float64
VelocityDisp() v0, a, Xo, Xf float64

Displacement

Equations

Example

package main

import (
	"fmt"

	disp "github.com/Juandavid716/gophysics"
)


func main() {

	// Init the function where parameters are (initial velocity, acceleration, initial displacement)
	fx := disp.DisplaceAcc(5, 6, 4)

	// After t seconds, the displacement is..
	fmt.Println(fx(0))

	// Init the function where parameters are (initial velocity, final velocity, initial displacement)
	fv := disp.DisplaceVec(5, 5, 4)

	// After t seconds, the displacement is..
	fmt.Println(fv(3))
}

Output

4
19

Functions

Equations Method Arguments Return type
DisplaceAcc() Vo, a, Xo float64 float64
DisplaceVec() Vo, Vf, Xo float64 float64

About

This is a Physical library for Go Language which includes multiple physical and mathematical formulas.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages