gophysics

package module
v0.19.0 Latest Latest
Warning

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

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

README

gophysics

GitHub GitHub go.mod Go version Go Reference

A set of some of the most common physics formulas and constants.

Features

  • It provides Physics formulas and constants for calculation porpuses.
  • It allows to create some objects to simplify some calculations (see example).
  • It also provides some common Math formulas in Physics.

Which formulas are contained?

Classical mechanics
  • Force, Speed, Time, Work, Acceleration, Density, Intensity, Power, Momentum
  • Potential Energy, Mechanical Energy, Kinetic Energy, Frequency, Doppler Effect
  • Centripetal Acceleration, Centripetal Force, Pendulum Period, Projectile motion equations
Gravity
  • Potential Gravitational Energy, Universal Gravitational Law, Gravitational Field
  • Escape Speed
Fluids
  • Stokes's Law, Hagen-Poiseuille's Law
ElectroMagnetism
  • Ohm's Law, Capacitance, Voltage, Coulomb's Law, Energy Density
  • Electric Field, Eletric Potential Energy Difference.
Termodynamics
  • Gay-Lussac's Law, Net Heat Energy, Heat Flux, Eletric Field Flux, Joule Heating
Relativity
  • Lorentz Factor, Relativistic Time, Relativistic Distance, Relativstic Mass, Relativistic Momentum
  • Photoelettric Effect, Drift Speed.

How to use it

  • Download the 'formulas' package to get the Physics formulas:
go get -u github.com/Gabri432/gophysics/formulas
  • Download the 'constants' package to get the Physics constants:
go get -u github.com/Gabri432/gophysics/constants
  • Download the 'mathem' package to get the Mathematical functions and constants of the library
go get -u github.com/Gabri432/gophysics/mathem
  • Example of usage
package main

import (
    "fmt"
    "github.com/Gabri432/gophysics/constants"
    "github.com/Gabri432/gophysics/formulas"
)

func main() {
    fmt.Println(constants.C)   // Write a constant
    fmt.Println(formulas.Force(3, 4))   // Call a function
    myPlanet := formulas.PlanetBody{Mass: constants.EARTH_MASS, Radius: constants.EARTH_RADIUS} // Create a custom object
	fmt.Println(myPlanet.EscapeSpeed())  // Call object methods to ease some calculations
}

=== Output ===
299792453  
12 N       <<< When calling functions their output is the value and the measurement unit
11183.719071923773 m/s

  • Using mathematical functions
import (
    "fmt"
    "github.com/Gabri432/gophysics/mathem"
)

func main() {
    fmt.Println(mathem.Pi) // Writing a constant
}

=== Output ===
3.1415926535

Project Structure

Folders
gophysics (main)
  • gophysics.go, doesn't provide formulas, but other functions to simplify some actions.
  • license, readme.md, readme.it.md, CHANGELOG.txt.
formulas
  • classical.go, where all the Classical physics formulas are located.
  • fluids.go, where all the Fluid formulas are located.
  • gravity.go, where all the Gravity formulas are located.
  • thermodynamics.go, where all the Thermodynamics formulas are located.
  • electromagnetism.go, where all the Electromagnetism formulas are located.
  • relativity.go, where all the Relativity formulas are located.
constants
  • constants.go, where all the constants are located.
mathem
  • constants.go, where all the mathematical constants are located.
  • conversions.go, where all the main functions to make mathematical calculations are located.

Contributing to this project

Notes

  • Formulas were taken from this italian book: Title - "Fisica Volume 1", Authors - ["Paolo Mazzoldi", "Massimo Nigro", "Cesare Voci"].

Documentation

Overview

A package that provides different functions and constants for making some of the most common calculation in Physics.

Classical Physics, Gravity, Fluids, Termodynamics, Electromagnetism, Relativity are for now the covered areas.

As so this package does not claim to be the most extensive or the best one, but it is thought as a useful tool for the most common cases.

Formulas were taken from this italian book: Title - "Fisica Volume 1", Authors - ["P. Mazzoldi", "M. Nigro", "C. Voci"].

If you find any issue or any idea to improve the program you can use this link https://github.com/Gabri432/gophysics/issues/new.

Also If you enjoyed using this program consider putting a star in the github repository at https://github.com/Gabri432/gophysics.

The package is under the MIT License https://github.com/Gabri432/gophysics/blob/master/license.

Here is the documentation https://gabri432.github.io/angular-gophysics.io/

Thank you!! :)

Directories

Path Synopsis
It is a sub-package providing all the constants of the gophysics library
It is a sub-package providing all the constants of the gophysics library
The formulas package is the main sub-package of the gophysics library.
The formulas package is the main sub-package of the gophysics library.
Package mathem is a sub-package of the gophysics library.
Package mathem is a sub-package of the gophysics library.

Jump to

Keyboard shortcuts

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