You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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