This is a Physical library for Go Language.
Which includes multiple physical and mathematical formulas.
Installation is done using go get
.
go get -u github.com/Juandavid716/gophysics
- Constant acceleration equations
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
Equations | Method | Arguments | Return type |
---|---|---|---|
VelocityAcc() | Vo, a float64 | float64 | |
VelocityDisp() | v0, a, Xo, Xf | float64 |
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
Equations | Method | Arguments | Return type |
---|---|---|---|
DisplaceAcc() | Vo, a, Xo float64 | float64 | |
DisplaceVec() | Vo, Vf, Xo float64 | float64 |