PyGamLab.Functions Module

The PyGamLab.Functions module is a powerful collection of functions based on fundamental formulas from materials science, physics, thermodynamics, and engineering. It serves as an essential toolkit for researchers, engineers, and scientists working with modeling, simulations, and computational design.

This module integrates a wide array of physical, thermodynamic, and material property functions, each designed for quick and accurate calculations. By offering well-tested functions rooted in established scientific principles, PyGamLab.Functions is a perfect addition to any computational modeling pipeline, enhancing both productivity and precision.

### Benefits of the Functions Module: - Wide Range of Functions: Includes essential equations for material properties, thermodynamic calculations, strength predictions, and much more. - Modeling and Simulation: Directly applicable in simulations and modeling tasks, allowing users to integrate physical laws and engineering formulas seamlessly into their workflows. - High Precision: All functions are built to deliver accurate results, ensuring the integrity of your computational models. - User-Friendly: Simple interface and intuitive function names make it easy to call and integrate these functions into any scientific Python project.

The PyGamLab.Functions module is ideal for anyone working in materials modeling, thermodynamic analysis, and computational design. Its broad applicability and reliable performance make it a go-to resource for engineering simulations and predictive modeling.

@author: Ali Pilehvar Meibody (Alipilehvar1999@gmail.com)

@Director of Gamlab: Professor M. Naderi (Mnaderi@aut.ac.ir)

@Graphene Advanced Material Laboratory: https://www.GamLab.Aut.ac.ir

PyGamLab.Functions.Activation_Energy(k, k0, T)[source]

Calculates the activation energy (Ea) using the Arrhenius equation.

Parameters:
  • k (float) – The rate constant at temperature T.

  • k0 (float) – The pre-exponential factor (frequency factor).

  • T (float) – The temperature in Kelvin.

Returns:

The activation energy (Ea) in Joules per mole (J/mol).

Return type:

float

PyGamLab.Functions.Activity_Coef(wB, wC, wD, eBB, eCB, eDB)[source]
Parameters:
  • wB (float) – Weight percent of B

  • wC (float) – Weight percent of C

  • wD (float) – Weight percent of D

  • eBB (float) – Interaction coefficient of B and B

  • eCB (float) – Interaction coefficient of C and B

  • eDB (float) – Interaction coefficient of D and B

Returns:

fB – Activity coefficient of B

Return type:

float

PyGamLab.Functions.Aeroscope_Stress_Concentration(max_stress, nominal_stresss)[source]

Calculates the stress concentration factor.

Parameters:
  • max_stress (float) – The maximum stress experienced by the material.

  • nominal_stresss (float) – The nominal stress applied to the material.

Returns:

The stress concentration factor (K).

Return type:

float

PyGamLab.Functions.Arithmetic_Sequence(start_num, common_difference, n)[source]
An arithmetic sequence is an ordered set of numbers that have a common difference between each consecutive term.
start_numint

the first term in the sequence.

common_differenceint

the common difference between terms.

nint

number of terms.

a_n :int

the nᵗʰ term in the sequence

PyGamLab.Functions.Atomic_Packing_Factor(radius, crystal_structure)[source]
Parameters:
  • crystal_structure (Type of the crystal (Fccc , Bcc or ...))

  • (float) (radiuse)

  • Returns

  • SC (Atomic packing factor for)

  • BCC

  • FCC

PyGamLab.Functions.Atomic_Percentage(n_1, n_2, n_3, n_4, Entry, output, m_1, m_2, m_3, m_4, M_1, M_2, M_3, M_4, w_1, w_2, w_3, w_4)[source]
Parameters:
  • n_1 (float) – The number of moles of the first atom.

  • n_2 (float) – The number of moles of the second atom.

  • n_3 (float) – The number of moles of the third atom.

  • n_4 (float) – The number of moles of the fourth atom.

  • Entry (str) – what type of entery you have?

  • output (str) – The atomic percentage is based on which atom?

  • m_1 (float) – The mass of the first atom.

  • m_2 (float) – The mass of the second atom.

  • m_3 (float) – The mass of the third atom.

  • m_4 (float) – The mass of the fourth atom.

  • M_1 (float) – The atomic mass of the first atom.

  • M_2 (float) – The atomic mass of the second atom.

  • M_3 (float) – The atomic mass of the third atom.

  • M_4 (float) – The atomic mass of the fourth atom.

  • w_1 (float) – The weight percentage of the first atom.

  • w_2 (float) – The weight percentage of the second atom.

  • w_3 (float) – The weight percentage of the third atom.

  • w_4 (float) – The weight percentage of the fourth atom.

Returns:

It will return the atomic percentage based on the given inputs.

Return type:

float

PyGamLab.Functions.Austenite_Martensite_VC(C)[source]

This function calaculates the volume change of a unit cell in Austenite to Marteniste transformation.

Parameters:

C (float) – C is the percentage of carbon in chemical composition of steel.

Returns:

VC – VC is the percentage of volume change of a unit cell in Austenite to Marteniste transformation.

Return type:

float

PyGamLab.Functions.BMI_Calculation(W, H)[source]

This function calculates body mass index :type W: :param W: Weight in kilograms :type W: float :type H: :param H: height in meters :type H: float :param Returns: :param float: :param BMI_Calculation:

PyGamLab.Functions.Beer_Lambert_Law(a, l, I0)[source]

This function caclculate the output light intensity when a light pass through a material :type a: :param a: absorption coefficient. :type a: float :type l: :param l: length. :type l: float :type I0: :param I0: incomming light intensity. :type I0: float

Returns:

I – output light intensity.

Return type:

float

PyGamLab.Functions.Binomial_Probability(n, k, p)[source]
Parameters:
  • p (float) – ehtemal voghoo beyn 0ta 1

  • n (int) – tedad dafat azmayesh

  • K (int) – tedad dafaat bord

  • pishamadi(bord (return ehtemal rokh dadan pishamad dar fazaye do) – ba tedad n azmayesh va tedad k bord

  • shekast) – ba tedad n azmayesh va tedad k bord

PyGamLab.Functions.Biomaterial_Degredation_Rate(W1, W2, T)[source]

This function calculates the degradation rate of biomaterials

W1int

initial mass

W2int

final mass

Tint

time of degredation

Returns int

Biomaterial_Degredation_Rate

PyGamLab.Functions.Bouyancy_Force(d, V)[source]

Calculates the buoyant force acting on an object submerged in a fluid.

Parameters:
  • d (float) – The density of the fluid (e.g., in kg/m^3).

  • V (float) – The volume of the fluid displaced by the object (e.g., in m^3).

Returns:

The buoyant force in Newtons (N).

Return type:

float

PyGamLab.Functions.Bragg_Law(h, k, l, a, y)[source]

This function calculate the diffraction angle of a incidence wavelenght through a crytal special plate

Parameters:
  • h (int) – x direction of the plate.

  • k (int) – y direction of the plate.

  • l (int) – z direction of the plate.

  • a (float) – Unit Cell.

  • y (float) – incidence wavelenght.

PyGamLab.Functions.Brinell_Hardness_Calculation(d1, d2, D, p)[source]

this function is utilized for calculating Brinell hardness. characterizes the indentation hardness of materials through the scale of penetration of an indenter, loaded on a material test-piece. It is one of several definitions of hardness in materials science. In this method, steel ball indentor is used.

1. d1: float d1 represents diameter of impress of indentor.

2. d2 : float d2 represents diameter of impress of indentor

3. D : float diameter of indenter

3. p : int applied load

Returns –> BHN (Brinell Hardness Number)

PyGamLab.Functions.Burning_Rate(L, t)[source]

Calculates the burning rate according to the ASTM D3801 UL-94 test.

Parameters:
  • L (float) – The burning length in millimeters (mm).

  • t (float) – The burning time in seconds (sec).

Returns:

The burning rate in millimeters per minute (mm/min).

Return type:

float

PyGamLab.Functions.Calculate_ECB(chi, Ee, Eg)[source]

This function calculates the conduction band edge energy (ECB) of a semiconductor using Mulliken electronegativity theory.

Parameters:
  • chi (float) – The absolute electronegativity of the semiconductor (eV), calculated as the geometric mean of the absolute electronegativity of the constituent elements. For ZnO, chi=sqrt(chi_Zn*chi_O)=5.79 eV.

  • Ee (float) – The energy of free electrons on the standard hydrogen electrode (SHE) scale (eV). For standard scale, Ee=4.5 eV.

  • Eg (float) – The bandgap energy of the semiconductor (eV). For ZnO, Eg=3.23 eV.

Returns:

ECB – The conduction band edge energy (eV).

Return type:

float

PyGamLab.Functions.Calculate_Pipe_Heat_Transfer(mu, muW, rho, Cp, Pr, K, u, d, l, Tw, Tb1)[source]
Parameters:
  • mu (float) – Fluid dynamic viscosity (pa.s).

  • muW (float) – Dynamic viscosity at wall temperature (pa.s).

  • rho (float) – fluid density (kg/m³).

  • Cp (float) – DESCRIPTION.

  • Pr (float) – Prantel number.

  • K (flout) – Thermal conductivity(W/m.K).

  • u (float) – fluid velocity (m/s).

  • d (float) – Pipe diameter (m).

  • L (float) – Pipe length (m).

  • Tw (float) – Pipe wall temperature.

  • Tb1 (float) – Average fluid temperature().

  • Returns

  • number (Nusselt)

  • number

  • coefficient (convective heat transfer)

  • transfer (total heat)

  • temperature. (and outlet)

  • -------

  • None.

PyGamLab.Functions.Carnot_Efficiency(T_c, T_h)[source]
Parameters:
  • (float) (T_cold)

  • (float)

  • Returns

  • float (Efficiency of the cycle)

PyGamLab.Functions.Change_In_Pressure_Of_a_Mercury_OR_Water_Column_Manometer(Type_Of_Fluid, h, g=9.81)[source]

Calculates the change in pressure in Pascals (Pa) for a mercury or water column manometer.

Parameters:
  • Type_Of_Fluid (str) – The type of fluid in the manometer (‘water’ or ‘mercury’). Case-insensitive.

  • h (float) – The height difference in the manometer column in meters (m).

  • g (float, optional) – The acceleration due to gravity in meters per second squared (m/s^2). Defaults to 9.81.

Returns:

The change in pressure (Delta_P) in Pascals (Pa).

Return type:

float

Raises:

ValueError – If the Type_Of_Fluid is not ‘water’ or ‘mercury’.

PyGamLab.Functions.Circle_Area(radius)[source]
Parameters:

radius (int) – radius of circle.

Returns:

circle_area – area of circle.

Return type:

int

PyGamLab.Functions.Circle_Perimeter(radius)[source]
Parameters:

radius (int) – radius of circle.

Returns:

circle_perimeter – perimeter of circle.

Return type:

int

PyGamLab.Functions.Cohen(m, r, /)[source]

Cohen equation is used to predict the yield stress of a polymeric blend containing a rubbery dispersion phase.

mint or float

The yield stress of polymeric matrix, N/m^2 or Pa or …

rfloat

Volume fraction of rubbery phase, 0<r<1.

b : int or float The yield stress of polymeric blend, N/m^2 or Pa or …

PyGamLab.Functions.Component(a, b)[source]
alist

multi-dimensional vector

blist

multi-dimensional vector

cfloat

The component of b on a

PyGamLab.Functions.Concentration_Calculator(CA1, unit_CA1, CA2, unit_CA2, Q1, unit_Q1, Q2, unit_Q2)[source]
Parameters:
  • CA1 (float) – Concentratoion of the first flow

  • unit_CA1 (str) – Unit of concentratoion of the first flow

  • CA2 (float) – DESCRIPTION.Concentratoion of the second flow

  • unit_CA2 (str) – Unit of concentratoion of the second flow

  • Q1 (float) – Molar volume of the first flow

  • unit_Q1 (str) – Unit of molar volume of the first flow

  • Q2 (float) – Molar volume of the second flow

  • unit_Q2 (str) – Unit of molar volume of the second flow

Return type:

Flowrate and concentration of the output flow

PyGamLab.Functions.Contact_Angle(num1, num2, num3)[source]
Parameters:
  • num1 (float) – a solid and atmospher surface tenssion.

  • num2 (float) – a liquid and atmospher surface tension.

  • num3 (float) – a solid and liquid boundary tension.

  • Returns

  • degrees

PyGamLab.Functions.Convective_Heat_Transfer_Internal_Flow_Dittus_Boelter(Re, Pr, fluid_thermal_conductivity, hydraulic_diameter, delta_T, length, heating=True)[source]

Calculates the convective heat transfer rate for fully developed turbulent flow inside a smooth circular tube using the Dittus-Boelter correlation. This is a widely used empirical correlation in heat exchanger design and thermal analysis of internal flows.

Parameters:
  • Re (float) – The Reynolds number of the flow (dimensionless, Re > 10000 for turbulent flow).

  • Pr (float) – The Prandtl number of the fluid (dimensionless).

  • fluid_thermal_conductivity (float) – The thermal conductivity of the fluid (in W/(m*K)).

  • hydraulic_diameter (float) – The hydraulic diameter of the tube (in meters). For a circular tube, this is simply the inner diameter.

  • delta_T (float) – The temperature difference between the surface and the bulk fluid (in Kelvin).

  • length (float) – The length of the tube over which heat transfer occurs (in meters).

  • heating (bool, optional) – A boolean indicating whether the fluid is being heated (True) or cooled (False). This affects the exponent of the Prandtl number. Defaults to True (heating).

Returns:

The convective heat transfer rate (in Watts).

Return type:

float

PyGamLab.Functions.Convert_Gas_Constant(gas_constant, from_unit, to_unit)[source]

Converts the gas constant from one unit to another.

Parameters:
  • gas_constant (float) – The value of the gas constant in the initial unit.

  • from_unit (str) – The initial unit of the gas constant (e.g., “J/mol.K”, “cal/mol.K”, “atm.L/mol.K”, “cm^3.atm/mol.K”).

  • to_unit (str) – The desired unit for the gas constant (e.g., “J/mol.K”, “cal/mol.K”, “atm.L/mol.K”, “cm^3.atm/mol.K”).

Returns:

The converted value of the gas constant in the desired unit, or “Invalid” if the units are not recognized.

Return type:

float or str

PyGamLab.Functions.Copolymer_Type(Copolymer, Polymer_num=2)[source]

Copolymer: str Unit types are shown by charachters which are seperated by a space Example: ‘polymer_A polymer_A polymer_B polymer_A polymer_A polymer_B’

Polymer_num: int It represents the number of polymers in this structure which could be 2 or 3 default = 2

PyGamLab.Functions.Corrosion_Rate(W, D, A, t)[source]
Parameters:
  • W (int or float) – The change in weight of specimen (mg)

  • D (int or float) – The density of specimen (g/cm^3)

  • A (int or float) – The surface area of specimen (in^2)

  • t (int or float) – The time(h)

Returns:

CR – The corrosion rate (mpy)

Return type:

int or float

PyGamLab.Functions.Cost_Indicators(ac, ev)[source]

Calculates the Cost Variance (CV) and Cost Performance Index (CPI).

Parameters:
  • ac (float) – The Actual Cost of Work Performed (ACWP).

  • ev (float) – The Earned Value (EV).

Returns:

A tuple containing the Cost Variance (cv) and Cost Performance Index (cpi).

Return type:

tuple

PyGamLab.Functions.Critical_Diameter(d, r, /)[source]

This equation predicts the critical diameter of rubber particles toughening a polymeric matrix. :type d: :param d: critical distance between rubbery particles, angstrom or mm or nm or ….. :type d: int or float :type r: :param r: Volume fraction of rubbery phase, 0<r<1. :type r: float

Returns:

  • dc (int or float)

  • the critical diameter of rubber particles

PyGamLab.Functions.Crystal_Percent(H, W, H100)[source]

Calculates the percentage of crystallinity in a polymer.

Parameters:
  • H (float) – The enthalpy of the polymer in milliJoules (mJ).

  • W (float) – The weight of the polymer in milligrams (mg).

  • H100 (float) – The enthalpy for a 100% crystalline polymer in Joules per gram (J/g).

Returns:

The crystallinity of the polymer in percent (%).

Return type:

float

PyGamLab.Functions.Debye_Temperature_Heat_Capacity(T, TD)[source]

Calculates the dimensionless heat capacity according to the Debye model, a solid-state physics model that approximates the contribution of phonons (lattice vibrations) to the specific heat of a solid.

Parameters:
  • T (float) – The absolute temperature in Kelvin (K).

  • TD (float) – The Debye temperature of the material in Kelvin (K), a characteristic temperature related to the material’s lattice vibrations.

Returns:

The dimensionless heat capacity (Cv / (9 * n * k_B)), where n is the number of atoms and k_B is the Boltzmann constant. To get the actual heat capacity, this value needs to be multiplied by 9 * n * k_B.

Return type:

float

PyGamLab.Functions.Defect_Density(Beta, Theta, K=0.9, Landa=1.5406)[source]
Parameters:
  • Beta (Float) – Full width at half maximum (FWHM).

  • Theta (Float) – Bragg’s Diffraction Angle.

  • K (Float, optional) – Scherrer Constant. The default = 0.9.

  • Landa (Float, optional) – X-ray Wavelength. The default = 1.5406.

Returns:

  • D (Float) – Crystallite size (nm)

  • Delta (Float) – Density of defect for crystallite structures from XED crystallography calculated from reverse the Scherrer Equation.

PyGamLab.Functions.Degradation_Percentage(C0, Ct)[source]

This function calculates the degradation percentage of a pollutant solution in a photocatalytic process.

Parameters:
  • C0 (float) – Initial concentration of the pollutant solution (mg/L)

  • Ct (float) – Concentration of the pollutant solution at a certain time interval (mg/L)

Returns:

Percentage – The degradation percentage (%) of the pollutant solution.

Return type:

float

PyGamLab.Functions.Density(m, V)[source]

It’s the formula for obtaining density.

Parameters:

mfloat

Mass

V: float

volume

PyGamLab.Functions.Diffusion_Coefficient_Calculator(Peak_Current, A, C, Scan_Rate, n, is_reversible)[source]
Parameters:
  • Peak_Current (Float) – Peak of current (A).

  • A (Float) – Electrode area (cm**2).

  • C (Float) – Concentration of electroactive species (mol/L).

  • Scan_Rate (Float)

  • (mV/s)

  • n (int)

  • electron (number of transfered)

  • is_reversible (bool) – Type of reaction. ‘True’ is reversible, ‘False’ is irreversible

Returns:

Diffusion Coefficient calculates from Randles-Sevcik aquation. type

Return type:

float

PyGamLab.Functions.Diffusion_in_Gases(Diffusion_Type, Diffusivity, Separate_Panels_Distance, Pressure_in_Panel_A, Pressure_in_Panel_B, PressureBM, Gas_Constant, Total_Pressure=101299.99999999999)[source]

Calculates the molar flux (N_A) for diffusion in gases under different conditions.

Parameters:
  • Diffusion_Type (str) – The type of diffusion: ‘Two_way_equimolal_diffusion’ or ‘one-way_diffusion’.

  • Diffusivity (str) – A key representing the gas pair for which the diffusivity is known (e.g., ‘H2_CH4’).

  • Separate_Panels_Distance (float) – The distance between the two panels or points of measurement (in meters, m).

  • Pressure_in_Panel_A (float) – The partial pressure of component A at point 1 (in Pascals, Pa).

  • Pressure_in_Panel_B (float) – The partial pressure of component A at point 2 (in Pascals, Pa).

  • PressureBM (float) – The log mean pressure of the non-diffusing component B (in Pascals, Pa) - used for one-way diffusion.

  • Gas_Constant (float) – The ideal gas constant (in J/(mol·K)).

  • Total_Pressure (float, optional) – The total pressure of the system (in Pascals, Pa). Defaults to 1.013 * 10**5.

Returns:

The molar flux of component A (N_A) in mol/(m^2·s).

Return type:

float

PyGamLab.Functions.Diffusivity(MA, MB, T, rAB, K, εAB, f, Pt=101299.99999999999)[source]

Calculates the binary gas-phase diffusivity using a modified Chapman-Enskog equation. Note: The formula seems to have a sign issue based on typical diffusivity calculations.

Parameters:
  • MA (str) – The chemical symbol or identifier for gas A (must be a key in the ‘M’ dictionary).

  • MB (str) – The chemical symbol or identifier for gas B (must be a key in the ‘M’ dictionary).

  • T (float) – The temperature in Kelvin (K).

  • rAB (float) – The average collision diameter between molecules A and B (in Angstroms, Å).

  • K (float) – A dimensionless collision integral parameter (related to the Lennard-Jones potential).

  • εAB (float) – The Lennard-Jones energy parameter for the pair A-B (in Kelvin, K).

  • f (float) – A correction factor (dimensionless).

  • Pt (float, optional) – The total pressure in Pascals (Pa). Defaults to 1.013 * 10**5 (1 atm).

Returns:

The binary gas-phase diffusivity (DAB) in m^2/s, or “Invalid inputs” if MA or MB are not recognized.

Return type:

float or str

PyGamLab.Functions.Distance(x, y, z, a, b, c, d)[source]

The formula of the distance between a point and a plane in three-dimensional space is as follows:

D=(abs(a*x+b*y+c*z+d))/sqrt(a**2+b**2+c**2)

xint

The x-axis component.

yint

The y-axis component.

zint

The z-axis component.

aint

The coefficient of x in the plane equation.

bint

The coefficient of y in the plane equation.

cint

The coefficient of z in the plane equation.

dint

The constant in the plane equation.

Dfloat

The distance of point-to-plane

ExampleDistnace between (1,-2,4) and the plane 13*x-6*y-5*z+3=0

is 0.527

PyGamLab.Functions.Drag_Force(Velocity, Fluid_Coefficent, Fluid_Density, cross_sectional_area)[source]

Calculates the drag force acting on an object moving through a fluid.

Parameters:
  • Velocity (float) – The velocity of the object relative to the fluid (e.g., in m/s).

  • Fluid_Coefficent (float) – The drag coefficient (dimensionless).

  • Fluid_Density (float) – The density of the fluid (e.g., in kg/m^3).

  • cross_sectional_area (float) – The cross-sectional area of the object perpendicular to the direction of motion (e.g., in m^2).

Returns:

The drag force acting on the object (e.g., in Newtons).

Return type:

float

PyGamLab.Functions.Electrical_Resistance(v, i)[source]
Parameters:
  • i (int)

  • R (It represents electrical resistance.)

  • v (int) – Voltage or potential difference between two points

  • i – I is the electric current that passes through a circuit

  • R

PyGamLab.Functions.Encapsulation_Efficiency(W1, W2)[source]

This function calculates the percentage of drug loaded in the carrier during drug delivery

W1float

weight of free drug

W2float

weight of total drug

Returns float Encapsulation_Efficiency

PyGamLab.Functions.Error_Function(z)[source]
Parameters:

z (int or float) – Error function argument

Returns:

erf – error function value

Return type:

float

PyGamLab.Functions.Euler_Diff_Solver(a, b, xf, h, x0=0, y0=0)[source]
This function solve linear differential equation of the following form:

yprim = dy/dx = f(x,y) = a*x^2 + b*x

by the Euler’s method that is a numerical method for approximating differential equations.

Parameters:
  • a (float) – Polynomial coefficient..

  • b (float) – Polynomial coefficient.

  • xf (float) – Independent variable’s final value.

  • h (float) – Step size.

  • x0 (float, optional) – Independent variable’s initial value. The default is 0.

  • y0 (float, optional) – Initial function value at x0 (y0 = y(x0)). The default is 0.

Raises:

TypeError – The quadratic coefficient of the equation should not be zero.

Returns:

y – Returns function value at desired point (xf) or y(xf).

Return type:

float

PyGamLab.Functions.Euler_Method(a, b, h, x0, y0)[source]

Euler’s method law: y = y0 + h *yprim

Parameters:
  • a (float) – Polynomial coefficient.

  • b (float) – polynomial coefficient.

  • x0 (float) – Initial value.

  • y(x0) (y0 =) – function value.

  • h (float) – Step size.

Return type:

This function returns function value (y) at specific value (x).

PyGamLab.Functions.Fabric_Drape_Coefficient(fabric_weight, fabric_thickness, bending_length)[source]

This function estimates the drape coefficient of fabric according to 3 factors:

Parameters:
  • fabric_weight (int or float) – weight of fabric.

  • fabric_thickness (int or float) – thickness of fabric.

  • bending_length (int or float) – the length difference.

  • Drape_Coefficient (int or float) – Result.

PyGamLab.Functions.Fabric_GSM(Warp, Weft, Warp_Count_Nm, Weft_Count_Nm, Shrinkage_Percent=5)[source]

This function calculates weight fabric in GSM unit.

Parameters:
  • Warp (int or float) – The number of warps in 1 cm.

  • Weft (int or float) – The number of wefts in 1 cm.

  • Warp_Count_Nm (int or float) – Warp yarn metric count.

  • Weft_Count_Nm (int or float) – Weft yarn metric count.

  • Shrinkage_Percent (int or float, optional) – The percentage difference in the length of woven and non-woven yarn. The default is 5.

  • Fabric_GSM (int or float) – Result.

PyGamLab.Functions.Fabric_Porosity(air_volume, total_volume)[source]
Parameters:
  • air_volume (int) – enter the volume of pores in fabric in mm^3.

  • total_volume (int) – Enter the total volume of fabric in mm^3.

Returns:

Fabric_porosity – This function calculates the fabric porosity in mm^3.

Return type:

int

PyGamLab.Functions.Fabric_weight(density, area)[source]
Parameters:
  • density (int) – enter the density of fabric in g/mm^2.

  • area (int) – Enter the area of fabric in mm^2.

Returns:

Fabric_weight – This function calculates the fabric weight in g.

Return type:

int

PyGamLab.Functions.Factorial(a)[source]

The product of all positive integers less than or equal to a given positive integer.

Parameters:

a (int)

Returns:

factorial – the product of all positive integers less than or equal to a given positive integer .

Return type:

int

PyGamLab.Functions.Faraday_Corrosion(current_density, time, atomic_weight, density, valence)[source]

calculate penetration depth from corrosion

current_density: A/m² time:hour atomic_weight: g/mol density: g/cm³ valence

PyGamLab.Functions.Fibonachi_Sequence(N)[source]

Generates a Fibonacci sequence up to the N-th term.

Parameters:

N (int) – The number of Fibonacci numbers to generate. Must be a positive integer.

Returns:

A list containing the first N Fibonacci numbers.

Return type:

list

PyGamLab.Functions.Fick_Sec_Thin(Thickness, Diffusion_coefficient, Time, Thin_layer_Consistency, Position, Thin_Layer_Metal, Second_metal)[source]

Fick’s second law predicts how diffusion causes the concentration to change with respect to time. In the case where a thin film of a different metal is placed between two thick films of another metal, and due to heat and a certain time, the amount of penetration of the first metal into the second metal will be investigated. :type Thickness: :param Thickness: The thickness of the thin layer metal is used. use cm for input :type Thickness: float :type Diffusion_coefficient: :param Diffusion_coefficient: It shows the diffusion coefficient of the metal placed in the middle compared to the metal on its side. use cm^2/seconds for input :type Diffusion_coefficient: float :type Time: :param Time: It shows the duration of the diffusion check. use seconds for input :type Time: float :type Thin_layer_Consistency: :param Thin_layer_Consistency: It shows the initial concentration of thin metal. use gr/cm^3 for input :type Thin_layer_Consistency: float :type Position: :param Position: Indicates the location required to check the concentration. use cm for input :type Position: float :type Thin_Layer_Metal: :param Thin_Layer_Metal: What is the material of the thin layer used? :type Thin_Layer_Metal: str :type Second_metal: :param Second_metal: What is the metal material in which the primary metal should penetrate?. :type Second_metal: str

Returns:

C_x_t – It shows the concentration of the metal separated from the thin layer and moved in a certain time in the desired location. output will be gr/cm^3

Return type:

float

PyGamLab.Functions.Filler_Weight(M, FR1, FR2, FR3)[source]

Calculates the weight percentages of three fillers in a polymer matrix.

Parameters:
  • M (float) – The weight of the polymer matrix in grams (gr).

  • FR1 (float) – The weight of the first flame retardant in grams (gr).

  • FR2 (float) – The weight of the second flame retardant in grams (gr).

  • FR3 (float) – The weight of the third flame retardant in grams (gr).

Returns:

A tuple containing three lists, representing the weight percentages of FR1, FR2, and FR3, respectively.

Return type:

tuple

PyGamLab.Functions.Final_Temp_Irreversible_Adiabatic(Initial_temperature, External_pressure, Internal_pressure, C_V, C_P, R, Unit_of_measurement, Number_of_gas_atoms)[source]
Initial_temperaturefloat

Initial temperature of an ideal gas.

External_pressurefloat

The pressure that enters the system from the environment.

Internal_pressurefloat

The pressure that enters the system wall from the inside.

C_Vfloat

The ideal gas constant-pressure specific heat.

C_Pfloat

The ideal gas constant-pressure specific heat..

Rfloat

The molar gas constant or ideal gas constant.

Unit_of_measurementstr

DESCRIPTION.

Number_of_gas_atomsstr

DESCRIPTION.

Returns:

Final_Temp – Outputs the final temperature if the system operates adiabatically irreversible.

Return type:

float

PyGamLab.Functions.First_Row_Pascal_Triangle(k)[source]

Calculates the factorial of a non-negative integer k, which corresponds to the (k+1)-th row’s first and last element in Pascal’s Triangle (if rows start from 0).

Parameters:

k (int) – A non-negative integer.

Returns:

The factorial of k (k!).

Return type:

int

PyGamLab.Functions.Fracture_Toughness(s, c, location)[source]

this function calculates fracture toughness based on applied stress, crack length, and location

fracture toghness formula:

K1C = a*s* (math.sqrt(3.14* c))

where:

K1C is the fracture toughness, a is a geometric factor, s is the applied stress, c is the crack length.

Parameters:
  • s (1.) – applied stress

  • c (2.) – crack length

  • location (3.) – represents the location of crack

  • toughness) (Returns --> K1C (fracture)

PyGamLab.Functions.Friction_Law(mass, angle, /, MOTCS, moving)[source]

This function calculates the friction force on the object by taking the mass of the desired object, the material of the two contact surfaces, the angle of the contact surface with the horizon and the movement state of the object.

Parameters:
  • mass (int) – The mass of the desired object (KG).

  • angle (int) – The angle of the contact surface with respect to the horizon (RAD).

  • MOTCS (str) – Material of two contact surfaces. The contact surfaces considered : STEEL ON STEEL STEEL ON ALUMINUM STEEL ON COPPER COPPER ON CAST IRON COPPER ON GLASS GLASS ON GLASS RUBBER ON DRY CONCRETE RUBBER ON WET CONCRETE TEFLON ON TEFLON

  • moving (str) – Is the desired object moving? (YES OR NO).

Returns:

F – Frictional force applied to the target object (N).

Return type:

float

PyGamLab.Functions.Geometric_Sequence(first_variable, second_variable)[source]

This function obtains the result of a geometric progression

Parameters:
  • first_variable (int) – The value of the first variable.

  • second_variable (int) – The value of the second variable.

Returns:

gives the result of the geometric exponential function.

Return type:

int

PyGamLab.Functions.Gibs_free_energy(H0, T, S0)[source]
Parameters:
  • H0 (float) – Enthalpy of material in the pressure of 1atm in pure state. The number should be in terms of joul or kilojoul. It must have the same unit as entropy.

  • T (float) – Temperature of material. The temperature should be in terms of Kelvin.

  • S0 (float) – Entropy of material. The number should be in terms of joul or kilojoul. It must have the same unit as enthalpy.

Returns:

G – This function give us the amount of Gibs free energy of the material at the pressure of 1atm. The terms of this function is joul or kilojoul.

Return type:

float

PyGamLab.Functions.Gravitational_force(G, FT)[source]
Parameters:
  • G (float) – The gravitational force is a force that attracts any two objects with mass.

  • FT (float) – The force of gravity varies with latitude and increases from about 9.780 m/s2 at the Equator to about 9.832 m/s2 at the poles.

Returns:

F – The force of gravity is also called as Newton’s law of gravitation. Mathematically, F = GMmr2. where F = force of gravity, G = gravitational constant, M = mass of one object, m = mass of other object, r = distance between two objects.

Return type:

float

PyGamLab.Functions.Gravitational_force_formula(g, m_mars, m_sun, r_mars_sun)[source]
Parameters:
  • g (float) – The gravitational force is a force that attracts any two objects with mass.

  • m_mars (float) – Mars’ mass is 6.42 x 1023 kilograms, about 10 times less than Earth. This affects the force of gravity. Gravity on Mars is 38 percent of Earth’s gravity, so a 100-pound person on Earth would weigh 38 pounds on Mars

  • m_sun (float) – The sun has a mass of 1.9891x1030 kg = 4.384x1030 lb = 2.192x1027 tons, or a mass 333,000 times that of the Earth. The radius of the Sun is 696,265,000 meters = 696,265 km = 432,639 mi or a radius 109 times that of the Earth.

  • r_mars_sun (float) – Mars is about 128 million miles (206 million km) from the sun, and at its farthest distance (aphelion) Mars is about 154 million miles (249 million km) from the sun.

Returns:

F2 – The force of gravity is also called as Newton’s law of gravitation. Mathematically, F = GMmr2. where F = force of gravity, G = gravitational constant, M = mass of one object, m = mass of other object, r = distance between two objects.

Return type:

float

PyGamLab.Functions.Half_Inhibitory_Concentration(A1, A2, A3)[source]

This function determines the drug’s efficacy in biological process inhibition

A1int

absorbance of the experimental wells

A2int

absorbance of the control wells

A3int

absorbance of the blank wells

Returns
float

Half _Inhibitory_Concentration

PyGamLab.Functions.Hall_Petch(d_grain, sigma0, k)[source]

calculate yield strengh with grain size in Hall Petch k(float) = MPa·√m Hall Petch constant d_grain = size of grain according to meter

PyGamLab.Functions.Hall_Petch_Relationship(grain_size, yield_strength_boundary, k_hp)[source]

Calculates the yield strength of a polycrystalline material based on its grain size using the Hall-Petch relationship. This fundamental concept in materials science explains how reducing grain size generally increases the strength of a material by increasing the number of grain boundaries that impede dislocation motion.

Parameters:
  • grain_size (float) – The average grain size of the polycrystalline material (typically in micrometers or millimeters).

  • yield_strength_boundary (float) – The yield strength of a single crystal of the material (or a material with infinitely large grains), representing the intrinsic strength (in MPa or equivalent units).

  • k_hp (float) – The Hall-Petch coefficient, a material-specific constant that reflects the strength of grain boundaries in impeding dislocation motion (in MPa * sqrt(length unit)).

Returns:

The yield strength of the polycrystalline material (in the same units as yield_strength_boundary).

Return type:

float

PyGamLab.Functions.Hardness_vickers(F, d)[source]
Parameters:
  • F (float) – Applied force in terms of kilogram.

  • d (float) – Medium diameter of indentor effect in terms of milimeter.

Returns:

HV – This function give us the amount of hardness of material that evaluated by vickers hardness tester. The terms of this is Kg/mm2.

Return type:

Vickers hardness

PyGamLab.Functions.Heat_Capacity(m, c, T1, T2)[source]

This function caclulate the amount of heat capacity of a mass :type m: :param m: mass. :type m: Float :type c: :param c: specific heat coefficient. :type c: float :type T1: :param T1: primary temperature. :type T1: float :type T2: :param T2: secondary temperature. :type T2: float

PyGamLab.Functions.Heat_Exchanger_Transfer(U, Th1, Th2, Tc1, Tc2, C, dot_m)[source]
Parameters:
  • U (float) – Overall heat transfer coefficient.

  • Th1 (float) – Hot fluid inlet temperature.

  • Th2 (float) – Hot fluid outlet temperature.

  • Tc1 (float) – Cold fluid inlet temperature.

  • Tc2 (float) – Cold fluid outlet temperature.

  • C (float) – Special heat.

  • dot_m (float) – Debbie Jeremy.

Returns(delta_T_LMTD,Q,A)

None.

PyGamLab.Functions.Heat_Transfer_Rate(Thermal_conductivity, area, tempreture_difference)[source]

This function is used to calculate heat transfer rate by using thermal conductivity, area of transformation, and tempreture of to sides of transformation. In this formula, heat transfer rate is in Btu/(hr*square ft*F), area is in square ft, and tempreture difference is in F.

PyGamLab.Functions.HeatـTransferـCoefficient(k, A, t1, t2, d)[source]
Parameters:
  • k (int)

  • A (int)

  • t1 (int)

  • t2 (int)

  • Q (int)

  • Q – It indicates the rate of heat transfer.

  • k – Heat transfer coefficient

  • A – is the heat transfer coefficient.

  • t1 – The area of ​​the surface from which heat is transferred.

  • t2 – Initial temperature

  • d (int) – Secondary temperature

PyGamLab.Functions.Hooke(strain, young_modulus)[source]

Calculates stress using Hooke’s Law for elastic materials under uniaxial loading.

Parameters:
  • strain (float) – The dimensionless strain (change in length divided by original length).

  • young_modulus (float) – The Young’s modulus (elastic modulus) of the material (in Pascals or equivalent units).

Returns:

The stress experienced by the material (in Pascals or equivalent units).

Return type:

float

PyGamLab.Functions.Ideal_Gas_low_with_unit(R='(L.atm) / (K.mol)', V=1, n=1, T=0)[source]

It calculate the Pressure of ideal gas.

Parameters:

Pfloat

Pressure

Vfloat

The amount of Volume

n : float

The amount of substance

Tfloat

Temperature

Rfloat

ideal gas constant

PyGamLab.Functions.Income_Tax(a)[source]
Parameters:
  • a (float) – daramad fard dar yek mah

  • iran (Returns maliyat bar daramad fard dar yek mah dar)

  • -------

PyGamLab.Functions.Incompressible_Fluids_Pressure(d, h)[source]

Calculates the pressure at a certain depth in an incompressible fluid.

Parameters:
  • d (float) – The density of the incompressible fluid (in kg/m^3).

  • h (float) – The depth below the surface of the fluid (in meters).

Returns:

The absolute pressure (P) at the specified depth in Pascals (Pa).

Return type:

float

PyGamLab.Functions.Indeterminate_degree_of_truss(m, j)[source]

This function calculates the degree of indeterminacy of the truss by taking ‘m’ number of truss members and ‘j’ number of nodes.

Parameters:
  • m (int) – Number of members truss.

  • j (int) – Number truss node members.

Returns:

n – The indeterminate degree of truss.

if n=0 : The truss is determinate. if n>0 : The truss is statically unstable. if n<0 : The truss is indeterminate.

Return type:

float

PyGamLab.Functions.Insertion_Sort(non_sorted_list)[source]

Sorts a list of elements in-place using the Insertion Sort algorithm.

Parameters:

non_sorted_list (list) – The list of elements to be sorted.

Returns:

The sorted list (the original list is modified in-place).

Return type:

list

PyGamLab.Functions.Latice_Parameter(structure, r)[source]

this function calculates Latice parameter based on crystal structure.

Parametrs

1. structure : str structure includes crystal structures such as FCC, BCC, SC, HCP, and DC.

FCC: face centered cubic BCC: body centered cubic SC: simple cubic HCP: hexagonal close pack DC: diamond cubic

2. r: float —> (nm) r represents atomic radius.

Returns –> latice parameter (a)

PyGamLab.Functions.Lattice_Parameter(r, structure)[source]
Parameters:
  • r (float) – r is atomic radius of material. It is in terms of angestrom.

  • structure (str) – Structure of material is face center cubic or body center cubic.

Returns:

a – a is lattice parameter of material in unit cell. It is in terms of angestrom.

Return type:

float

PyGamLab.Functions.Lennard_Jones_Potential(r, sigma, epsilon)[source]

Calculates the Lennard-Jones potential energy between two non-bonding atoms or molecules as a function of the distance ‘r’ between them. This potential models the balance between short-range repulsive forces (Pauli repulsion) and long-range attractive forces (van der Waals forces).

Parameters:
  • r (float) – The distance between the two atoms or molecules (in Angstroms or other length units).

  • sigma (float) – The distance at which the potential energy is zero (related to the size of the particles).

  • epsilon (float) – The depth of the potential well, representing the strength of the attraction.

Returns:

The Lennard-Jones potential energy (in energy units like Joules or electronvolts, depending on the units of epsilon).

Return type:

float

PyGamLab.Functions.Lorentz_Lorenz_Constant(n, ro)[source]

n(float)= refrective index ro(float)=density g/cm3 or kg/m3

Retuen:

R=(float) constant related to light properties of materials(polymers, plstics,…)

PyGamLab.Functions.Mandaliof_Properties(E)[source]
Parameters:

E (string) – The chemical symbol of the Element

Return type:

Nothing

PyGamLab.Functions.Mass_Of_Rubber_In_Internal_Mixer(filler_percentage, type_of_rotors, V)[source]

Estimates the mass of rubber in an internal mixer based on filler percentage, rotor type, and mixer volume.

Parameters:
  • filler_percentage (float) – The percentage of filler in the rubber compound.

  • type_of_rotors (str) – The type of rotors in the internal mixer (‘tangential’ or ‘intermix’). Case-sensitive.

  • V (float) – The volume of the internal mixer. The unit of volume will determine the unit of the returned mass (assuming a consistent density factor).

Returns:

The estimated mass of rubber in the internal mixer. The unit will depend on the unit of V.

Return type:

float

PyGamLab.Functions.Mass_Transfer_Intensity(result_1, size_of_the_surface)[source]

Calculates the Mass Transfer Intensity (MTI).

Parameters:
  • result_1 (float) – A mass transfer related result (the units of this parameter will determine the units of MTI).

  • size_of_the_surface (float) – The size (area) of the surface where mass transfer occurs (in square meters, m^2).

Returns:

The Mass Transfer Intensity (MTI_ἠ). The units will be the units of result_1 multiplied by square meters.

Return type:

float

PyGamLab.Functions.Mc_Cabe(F, Zf, Xd, Xw, R, alpha, q)[source]

This function is used for Mc-Cabe calculation in Distillation Towers F : Feed Rate Zf : volatile composition in Feed Xd : volatile composition in Distillate Xw : volatile composition in Waste R : Reflux alpha : Volatility coefficient q : the quantity of liquid in feed Returns the number of tray

PyGamLab.Functions.Miner_Rule_Fatigue(n, N)[source]
Parameters:
  • n (list) – number of cycles at stress level

  • N (list) – number of cycles to failure at stress level

Returns:

sigma

Return type:

float

PyGamLab.Functions.Mtt_Test(C1, C2)[source]

This function measures the metabolic activity of the cell

C1int

viable cells

C2int

total cells

Returns float

Mtt_Test

PyGamLab.Functions.Nanoparticle_Aspect_Ratio(lenght=1, width=1, height=1)[source]

Calculating the Nanoparticle_Aspect_Ratio

Parameters:
  • lenght (int) – lenght of a nanoparticle DESCRIPTION. The default is 1. unit(nm)

  • width (int) – width of a nanoparticle DESCRIPTION. The default is 1. unit(nm)

  • height (int) – height of a nanoparticle DESCRIPTION. The default is 1. unit(nm)

Returns:

Nanoparticle_Aspect_Ratio – the ratio of maximum dimention of a nanoparticle to minimum dimention of it.

Return type:

float

PyGamLab.Functions.Nanoparticle_Surface_Area(Shape, Diameter=0, a=0)[source]

Calculating the surface area of nanoparticle by determinig the shape

Parameters:
  • Shape (str)

  • (sphere

  • tetrahedron) (cube or)

  • Diameter (int)

  • 0. (DESCRIPTION. The default is)

  • nanoparticles) ((it is needed for cubic or tetragonal)

  • unit(nm)

  • a (int)

  • dimention

  • unit(nm)

  • 0.

  • nanoparticles)

  • unit(nm)

Returns:

  • Nanoparticle_Surface_Area (int)

  • unit(nm^2)

PyGamLab.Functions.Nanoparticle_Volume(Shape, Diameter=0, a=0)[source]

Calculating the Volume of a nanoparticle by determinig the shape

Parameters:
  • Shape (str)

  • (sphere

  • tetrahedron) (cube or)

  • Diameter (int)

  • 0. (DESCRIPTION. The default is)

  • nanoparticles) ((it is needed for cubic or tetragonal)

  • unit(nm)

  • a (int)

  • dimention

  • unit(nm)

  • 0.

  • nanoparticles)

  • unit(nm)

Returns:

  • Nanoparticle_Volume (int)

  • unit(nm^3)

PyGamLab.Functions.PengRobinson(T=None, P=None, Tc=None, Pc=None, w=None, MW=None, Phases=None)[source]

PengRobinson.m : calculates the compressibility factor,fugacity coefficient and density of a pure compound with the Peng Robinson equation of state (PR EOS)

Parameters:
  • T (float) – Temperature [=] K

  • P (float) – Presure [=] Pa

  • Tc (float) – Critical temperature [=] K

  • Pc (float) – Critical presure [=] Pa

  • w (float) – Accentic factor

  • MW (float) – Molar weigth [=] kg/mol.

  • Phases (int) – if Phases == 1, then calculates liquid fugacity; if Phases == 0 then calculates vapor fugacity

Returns:

  • Z (flout) – Compressibility factor

  • fhi (float) – Fugacity coefficient

  • density (float) – Density

PyGamLab.Functions.Planks_Fix(y, R, r)[source]

This formula is used to calculate the wall pressure of bleeding in the veins This function receives the variables y, r, R and returns the variable p p:It indicates the pressure of the bleeding wall. y:Surface coefficient is surface tension R:is the inner radius of the vessel. r:is the thickness of the vessel wall.

PyGamLab.Functions.Polygonal_Diameters(n)[source]
Parameters:
  • n (int) – tedad azlae chand zelei(az 2 ta bishtar).

  • zelei (Returns tedad ghotrhaye chand)

  • -------

PyGamLab.Functions.Power_Factor(i, v)[source]
Parameters:
  • i (int)

  • P (v and returns the variable)

  • i – It is an electric current that passes through a circuit

  • v (int) – It is an electric current that passes through a circuit

  • p (int) – It indicates the power used or produced.

PyGamLab.Functions.Principal_Stress(Sx, Sy, Sz, Txy, Tyz, Txz)[source]

make sure stress value is less than 1000 :type Sx: :param Sx: Normal stress along x :type Sx: (int or float) :type Sy: :param Sy: Normal stress along y :type Sy: (int or float) :type Sz: :param Sz: Normal stress along z :type Sz: (int or float) :type Txy: :param Txy: Shear stress along xy :type Txy: (int or float) :type Tyz: :param Tyz: Shear stress along yz :type Tyz: (int or float) :type Txz: :param Txz: Shear stress along xz :type Txz: (int or float)

Returns:

S_P – Principal stresses

Return type:

[S1,S2,S3]

PyGamLab.Functions.Print_Time(Print_speed, Volume, Printer_efficiency)[source]

volume(float)= usually Cm3

print_speed(float)= and is speed of print usually cm3 per hour)

Printer_efficience(float)= and between 0 -1)

Retuen:

Print_time=(float) the time of print in hour

PyGamLab.Functions.Pythagorean(side1, side2)[source]

It should be an orthogonal triangle and this function gives you hypotenuse

Parameters:
  • side1 (int) – side of “orthogonal triangle”.

  • side2 (int) – side of “orthogonal triangle”.

Returns:

hypotenuse – hypotenuse of “orthogonal triangle”.

Return type:

int

PyGamLab.Functions.Quadratic_Equation(a, b, c)[source]

This function find “x” in equation ax^2 + bx + c = 0

aint

known number.

bint

known number.

cint

known number.

The Quadratic Equation mostly have two answers!
x1 ,x2int

the unknown.

PyGamLab.Functions.Quantum_Harmonic_Oscillator_Energy(n, hbar, omega)[source]

Calculates the energy levels of a quantum harmonic oscillator, a fundamental model in quantum mechanics that describes systems undergoing oscillatory motion, such as vibrations of atoms in a molecule or lattice.

Parameters:
  • n (int) – The quantum number of the energy level (n = 0, 1, 2, …). n=0 is the ground state, and higher values represent excited states.

  • hbar (float) – The reduced Planck constant (h / 2π).

  • omega (float) – The angular frequency of the oscillator (in radians per second).

Returns:

The energy of the n-th quantum energy level of the harmonic oscillator (in Joules or electronvolts, depending on the units of hbar and omega).

Return type:

float

PyGamLab.Functions.Rectangle_Area(length, width)[source]

This function calculate the area of square too!

Parameters:
  • length (int) – length of rectangle.

  • width (int) – width of rectangle.

Returns:

rectangle_area – area of rectangle.

Return type:

int

PyGamLab.Functions.Rectangle_Perimeter(length, width)[source]

This function calculate the perimeter of square too!

Parameters:
  • length (int) – length of rectangle.

  • width (int) – width of rectangle.

Returns:

rectangle_perimeter

Return type:

int

PyGamLab.Functions.Rejection(CF, CP)[source]

Calculates the rejection rate (%) of a membrane based on pollutant concentrations.

Parameters:
  • CF (float) – The pollutant concentration in the feed solution (g/l).

  • CP (float) – The pollutant concentration in the permeate solution (g/l).

Returns:

The membrane rejection rate in percent (%).

Return type:

float

PyGamLab.Functions.Reynolds_Number_Pipe(d, u, vis, D_H)[source]

Calculates the Reynolds number for flow in a pipe.

Parameters:
  • d (float) – The density of the fluid (e.g., in kg/m^3).

  • u (float) – The average velocity of the fluid (e.g., in m/s).

  • vis (float) – The dynamic viscosity of the fluid (e.g., in Pa·s).

  • D_H (float) – The hydraulic diameter of the pipe (e.g., in meters).

Returns:

The Reynolds number (Re), a dimensionless quantity.

Return type:

float

PyGamLab.Functions.Rolling_Parameters_Calculator(roller_radius, flow_stress, sample_width, wanted_thickness_reduction, coefficient_of_friction=None)[source]
Parameters:
  • roller_radius (float) – roller radius in term of meter.

  • flow_stress (float) – flow stress of your sample in term of Pascal.

  • sample_width (float) – sample width in meter.

  • wanted_thickness_reduction (float) – wanted thickness reduciton (delta h) in terms of meter.

  • coefficient_of_friction (floea, optional) –

    coefficient of friction between the roller and your sample. notice :

    if you give nothing for friction of coefficeint, function assumed that this coefficient is 0.2 and didnt include the role of friction in the rolling force formula. (* 1.2) but if you enter a value for this, function include the role of friction in the process and multiplies the rolling force by 1.2

Returns:

  • delta_h_max (float) – the maximum thickness reduction that can be reached in terms of meter.

  • h_min (float) – minimum thickness that can be reached in terms of meters.

  • rolling_force (float) – the required force for rolling in terms of Newton.

### important : this function give all output in scientific notation.

PyGamLab.Functions.Sample_Size_Calculation(N, e)[source]

This function estimates the number of evaluable subjects required for achieving desired statistical significance for a given hypothesis.

Nint

population of the study

efloat

margin error

Returns int

Sample_Size_Calculation

PyGamLab.Functions.Shear_Rate(Q, p, r, n)[source]

Calculates the shear rate for a power-law fluid flowing in a pipe. Note: The variable ‘p’ is unusual in standard shear rate formulas for pipe flow. Assuming it might be pi.

Parameters:
  • Q (float) – The volumetric flow rate (e.g., in m^3/s).

  • p (float) – Likely intended to be pi (π ≈ 3.14159).

  • r (float) – The radius of the pipe (e.g., in meters).

  • n (float) – The flow behavior index for a power-law fluid (dimensionless).

Returns:

The shear rate (γ̇) at the pipe wall (e.g., in s^-1).

Return type:

float

PyGamLab.Functions.Shear_Stress(F, A)[source]

Calculates the shear stress acting on a surface.

Parameters:
  • F (float) – The shear force acting parallel to the surface (e.g., in Newtons).

  • A (float) – The area of the surface over which the shear force acts (e.g., in square meters).

Returns:

The shear stress (τ) (e.g., in Pascals).

Return type:

float

PyGamLab.Functions.Solidification_Front_Composition(partition_coefficient, alloy_composition, solid_fraction, law_type='lever')[source]
Parameters:
  • partition_coefficient (float) – a non-dimensional value that describe the scope of liquidus line.

  • alloy_composition (float) – initial composition of your alloy in terms of Wt % of left element in phase diagram.

  • solid_fraction (float) – how much of your alloy solidified.

  • law_type (str, optional) – you can choose two different model for solidification. lever and scheil. The default is ‘lever’.

Returns:

  • solid_front_massfraction (float) – solid mass fraction in solidification front in terms of Wt % of left element in phase diagram.

  • liquid_front_conc (float) – liquid mass fraction in solidification front in terms of Wt % of left element in phase diagram .

notice :

This function round answers to two decimals.

PyGamLab.Functions.Solubility(a, b, c, T, T_unit, T_end)[source]

Parameters

bfloat

Constant.

cfloat

Constant.

Tfloat

Temperature.

T_unit:str

Unit of temperature.

T_end: float

Final temperature

Return type:

Determination solubility at different temperatures upto solubility< 1

PyGamLab.Functions.Sphere_Area(R)[source]
PyGamLab.Functions.Sphere_Surface_Area(radius)[source]
Parameters:

radius (int) – radius of sphere.

Returns:

sphere_surface_area – surface area of sphere .

Return type:

int

PyGamLab.Functions.Sphere_Volume(radius)[source]
Parameters:

radius (int) – radius of sphere.

Returns:

sphere_volume – volume of sphere.

Return type:

int

PyGamLab.Functions.Standard_Deviation(a)[source]

This function calculates the standard deviation of a list of numbers.

Parameters:

a (list) – a is a list of numbers.

Returns:

SD – SD is the standard deviation of a list of numbers.

Return type:

float

PyGamLab.Functions.Stress(strain, young_modulus)[source]

#The Young’s modulus (E) is a property of the material that tells us how easily it can stretch and deform and is defined as the ratio of tensile stress (σ=S) to tensile strain (ε=Ts)

Parameters:
  • strain (tensile strain (ε))

  • young_modulus (Modulus of Elasticity (N/m2))

Returns:

S

Return type:

tensile stress (σ)

PyGamLab.Functions.Stress_Intensity_Factor(stress, crack_length, crack_type)[source]

Calculate the stress intensity factor (K) based on the type of crack. K = crack_type * stress * (sqrt(pi * crack_length)) :type stress: :param stress: applied stress (sigma). :type stress: float :type crack_length: :param crack_length: lenght of the crack (a). :type crack_length: float :type crack_type: :param crack_type: there are 3 types of crack ‘surface’, ‘circular’, ‘internal’. :type crack_type: str :param Returns: Stress intensity factor (K). :type Returns: float

PyGamLab.Functions.TB(P, N)[source]

This function is used for bubble temp calculation in mixed solution P : pressure (mmhg) N : number of component Returns bubble temp

PyGamLab.Functions.TD(P, N)[source]

This function is used for dew temp calculation in mixed solution P : pressure (mmhg) N : number of component Returns bubble temp

PyGamLab.Functions.Tensile_Strength(f, a)[source]
Parameters:
  • f (int) – force required to break

  • a (int) – cross sectional area

  • -------

  • c (int) – Tensile_Strength

PyGamLab.Functions.Total_Solidification_Time_of_Casting(volume, surface_area, Cm, n, /)[source]
Parameters:
  • volume (float) – DESCRIPTION.

  • surface_area (float) – DESCRIPTION.

  • Cm (float) – It’s amount varies depending on the type of material

  • n (float) – It’s amount varies depending on the type of material but is usually equal to 2

Returns:

Total_Solidification_Time

Return type:

float

PyGamLab.Functions.Transient_Heat_Conduction_Semi_Infinite_Solid(T_s, T_i, alpha, x, t)[source]

Calculates the temperature at a depth ‘x’ and time ‘t’ in a semi-infinite solid initially at a uniform temperature ‘T_i’, whose surface temperature is suddenly changed to ‘T_s’. This solution is derived from the heat diffusion equation and is applicable when the solid is thick enough that the temperature change has not yet reached the opposite boundary.

Parameters:
  • T_s (float) – The constant surface temperature applied at t=0.

  • T_i (float) – The initial uniform temperature of the solid.

  • alpha (float) – The thermal diffusivity of the solid material (in m^2/s).

  • x (float) – The depth from the surface where the temperature is to be calculated (in meters).

  • t (float) – The time elapsed since the surface temperature change (in seconds).

Returns:

The temperature at depth ‘x’ and time ‘t’ (in the same units as T_s and T_i).

Return type:

float

PyGamLab.Functions.Trapezium_Area(Base1, Base2, Height)[source]

Parameters

Base2int

base of trapezium

Heightint

height of trapezium

Returns:

Area – Area of trapezium

Return type:

int

PyGamLab.Functions.Trapezium_Perimeter(Base1, Base2, Side1, Side2)[source]
Parameters:
  • Base1 (int) – base of trapezium.

  • Base2 (int) – base of trapezium.

  • Side1 (int) – side of trapezium.

  • Side2 (int) – side of trapezium.

Returns:

Perimeter – perimeter of trapezium

Return type:

int

PyGamLab.Functions.Tresca_Yield_For_Biaxial_Tension(c, hardness, sigma_xx, sigma_yy, tau_xy, /)[source]
Parameters:
  • c (float) – C is a coefficient that is between 0.3 and 0.4 depending on the type of material.

  • hardness (float) – brinell and vickers hardness.

  • sigma_y (float) – Uniaxial tensile yield strength of material.(Mpa)

  • sigma_y – Uniaxial tensile yield strength of material

  • sigma_xx (float)

  • sigma_yy (float)

  • tau_xy (float)

Returns:

Tresca – DESCRIPTION.

Return type:

TYPE

PyGamLab.Functions.Tresca_Yield_For_Principal_Stresses(c, hardness, sigma_1, sigma_2, sigma_3, /)[source]
Parameters:
  • c (float) – C is a coefficient that is between 0.3 and 0.4 depending on the type of material.

  • hardness (float) – brinell and vickers hardness.

  • sigma_y (float) – Uniaxial tensile yield strength of material.(Mpa)

  • sigma_1 (float) – Principal Stresses.

  • sigma_2 (float) – Principal Stresses.

  • sigma_3 (float) – Principal Stresses.

Returns:

Tresca – Tresca Yield(Mpa)

Return type:

float

PyGamLab.Functions.Triangle_Area(Height, rule)[source]

This function obtains the area of ​​the triangle

Parameters:
  • Height (float) – The size of the height of the triangle.

  • rule (float) – The size of the base of the triangle is.

Returns:

area – The output is the area of ​​the triangle.

Return type:

float

PyGamLab.Functions.Triangle_Environment(first_side, second_side, third_side)[source]

This function gets the perimeter of the triangle

Parameters:
  • first_side (float) – The size of the first side.

  • second_side (float) – The size of the second side.

  • third_side (float) – The size of the third side.

Returns:

Environment – The output is the perimeter of the triangle.

Return type:

float

PyGamLab.Functions.Velocity_Equation(V1, V2, a)[source]
Parameters:
  • V1 (float) – sorat avaliye moteharek.

  • V2 (float) – sorat nahayi moteharek.

  • a (floar) – shetab moteharek dar harekat ba shetab sabet.

  • sabet (Returns mizan jabejayi dar harekat ba shetab)

  • -------

PyGamLab.Functions.Vicker_Hardness_Calculation(d1, d2, p)[source]

this function is utilized for calculating Vickers hardness. in this method, pyramid shape indentor is used.

Parameters:
  • d1 (1.)

  • indentor. (d1 represents diameter of impress of)

  • d2 (2.)

  • indentor (d2 represents diameter of impress of)

  • p (3.)

  • load (applied)

  • Number) (Returns --> VHN (Vickers Hardness)

PyGamLab.Functions.Voltage_Standing_Wave_Ratio(Vmax, Vmin)[source]
Parameters:
  • Vmax (float) – the highest voltage measured in transition line

  • Vmin (float) – the lowest voltage measured in transition line

Returns:

Row – its the domain of reflection coefficient of transition line

Return type:

float

PyGamLab.Functions.WLF(T, Tg, /)[source]

The WLF equation is a procedure for shifting data for amorphous polymers obtained at elevated temperatures to a reference temperature.

Parameters:
  • T (int or float) – Temperature, K or degree celsius, Tg<T<Tg+100..

  • Tg (int or float) – Glass Transition Temperature, K or degree celsius.

Returns:

  • aT (int or float)

  • shift factor.

PyGamLab.Functions.Wear_Rate(v, f, s)[source]

this function calculates abrasive wear rate

Parametrs

1. v : float —> (mm3) v represents wear volume

2. f: int —> (nm) —> (N) f represents normal load.

3. s: float —> (m) s represents sliding distance.

Returns –> wear rate (w)

PyGamLab.Functions.Wear_rate(V, F, S)[source]
Parameters:
  • V (float) – lost volume during the wear test in terms of cubic milimeters (mm3)

  • F (float) – Applied force in terms of newton.

  • S (float) – Sliding distance in terms of meter.

Returns:

K – This function is for claculation of wear rate if material after wear test. It is in terms of (10-6 mm3/N.m)

Return type:

Wear rate

PyGamLab.Functions.Web_Service_Analyze(services, resp_times, exe_CPU_costs, exe_Mem_costs, exe_Disk_costs, exe_Net_costs)[source]
serviceslist pof str

the list of services..

resp_timeslist of int

the list of the responce times of specified web services, measured in millisecond.

exe_CPU_costslist of int

list of the percent of execution costs in case of cpu for specified web services.

exe_Mem_costslist of int

list of the percent of execution costs in case of memory for specified web services.

exe_Disk_costslist of int

list of the percent of execution costs in case of disk for specified web services.

exe_Net_costslist of int

list of the percent of execution costs in case of network for specified web services.

Returns a list of services with their useful information for easily analyze.

PyGamLab.Functions.Welding_Deposition_Rate(Deposited_Metal_Mass, Welding_Time)[source]
Parameters:
  • Deposited_Metal_Mass (flaat) – Deposited_Metal_Mass is the amount of deposited metal during welding (kg).

  • Welding_Time (float) – Welding_Time is the consumed time for welding (hr).

Return type:

Deposition_Rate is the amount of deposited metal per hour during the welding operation.

PyGamLab.Functions.Welding_Heat_Input(Efficiency, Voltage, Amperage, Speed)[source]
Parameters:
  • Efficiency (float) – Efficiency is the proportion of useful inserted heat to the total inserted heat into the weldment.

  • Voltage (float) – Voltage is the electrical potential of the welding arc (V).

  • Amperage (float) – Amperage is the amount of electrical current in welding (A).

  • Speed (float) – Speed is the velocity of the welding tool (cm/min).

Return type:

Heat_Input is the useful heat inserted into the weldment.

PyGamLab.Functions.Young_Modulus(stress, strain)[source]

Calculates Young’s modulus (elastic modulus) of a material under uniaxial tension or compression.

Parameters:
  • stress (float) – The stress experienced by the material (force per unit area, e.g., in Pascals).

  • strain (float) – The dimensionless strain (change in length divided by original length).

Returns:

The Young’s modulus (E) of the material (in Pascals or equivalent units).

Return type:

float

PyGamLab.Functions.archimedes_principle(density_fluid, volume_displaced, gravitational_acceleration)[source]

Calculates the buoyant force acting on an object submerged in a fluid, based on Archimedes’ principle.

Parameters:
  • density_fluid (float) – The density of the fluid in which the object is submerged (e.g., kg/m^3).

  • volume_displaced (float) – The volume of the fluid displaced by the object (e.g., m^3).

  • gravitational_acceleration (float) – The acceleration due to gravity (e.g., m/s^2).

Returns:

The buoyant force acting on the object (e.g., in Newtons).

Return type:

float

PyGamLab.Functions.boltzmann_distribution(energy, temperature, boltzmann_constant)[source]

Calculates the probability of a particle being in a specific energy state according to the Boltzmann distribution.

Parameters:
  • energy (float) – The energy of the specific state.

  • temperature (float) – The temperature of the system in Kelvin.

  • boltzmann_constant (float) – The Boltzmann constant (approximately 1.380649 × 10^-23 J/K).

Returns:

The probability of the particle being in the specified energy state.

Return type:

float

PyGamLab.Functions.boyles_law(initial_volume, initial_pressure, final_volume)[source]

Calculates the final pressure based on Boyle’s Law (assuming constant temperature).

Parameters:
  • initial_volume (float) – The initial volume of the gas.

  • initial_pressure (float) – The initial pressure of the gas.

  • final_volume (float) – The final volume of the gas.

Returns:

The final pressure of the gas.

Return type:

float

PyGamLab.Functions.calculate_debye_temperature(velocity, atomic_mass, density, n_atoms)[source]

Estimate the Debye temperature (θ_D) of a solid material.

Parameters:
  • velocity (float) – Average sound velocity in m/s.

  • atomic_mass (float) – Atomic mass of the element (in g/mol).

  • density (float) – Density of the material (in kg/m^3).

  • n_atoms (int) – Number of atoms per formula unit.

Returns:

Debye temperature in Kelvin (K).

Return type:

float

PyGamLab.Functions.calculate_hardness_from_young_and_poisson(E, nu)[source]

Estimate Vickers hardness (HV) from Young’s modulus and Poisson’s ratio.

Parameters:
  • E (float) – Young’s modulus (GPa).

  • nu (float) – Poisson’s ratio (dimensionless).

Returns:

Estimated Vickers hardness (HV) in GPa.

Return type:

float

PyGamLab.Functions.coulombs_law(charge1, charge2, distance)[source]

Calculates the electrostatic force between two point charges using Coulomb’s Law.

Parameters:
  • charge1 (float) – The magnitude of the first charge (in Coulombs).

  • charge2 (float) – The magnitude of the second charge (in Coulombs).

  • distance (float) – The distance between the two charges (in meters).

Returns:

The electrostatic force between the charges (in Newtons).

Return type:

float

PyGamLab.Functions.darcys_law(flow_rate, permeability, area, pressure_difference)[source]

Calculates the value related to Darcy’s Law for flow through a porous medium. Note: The formula provided returns the difference, not a direct calculation of a single variable.

Parameters:
  • flow_rate (float) – The volumetric flow rate of the fluid through the medium.

  • permeability (float) – The permeability of the porous medium.

  • area (float) – The cross-sectional area through which the fluid is flowing.

  • pressure_difference (float) – The pressure difference across the porous medium.

Returns:

The result of the expression: (permeability * area * pressure_difference) - flow_rate. To solve for a specific variable, rearrange this equation.

Return type:

float

PyGamLab.Functions.doppler_effect(observed_frequency, source_frequency, velocity_observer, velocity_source, speed_of_sound)[source]

Calculates the observed frequency of a wave due to the Doppler effect.

Parameters:
  • observed_frequency (float) – The frequency of the wave as perceived by the observer.

  • source_frequency (float) – The frequency of the wave emitted by the source.

  • velocity_observer (float) – The velocity of the observer relative to the medium (positive if moving towards the source).

  • velocity_source (float) – The velocity of the source relative to the medium (positive if moving away from the observer).

  • speed_of_sound (float) – The speed of the wave in the medium.

Returns:

The calculated observed frequency.

Return type:

float

PyGamLab.Functions.elastic_potential_energy(spring_constant, displacement)[source]

Calculates the elastic potential energy stored in a spring.

Parameters:
  • spring_constant (float) – The spring constant (in Newtons per meter).

  • displacement (float) – The displacement of the spring from its equilibrium position (in meters).

Returns:

The elastic potential energy stored in the spring (in Joules).

Return type:

float

PyGamLab.Functions.entropy_change(heat_transfer, temperature)[source]

Calculates the change in entropy of a system.

Parameters:
  • heat_transfer (float) – The amount of heat transferred to or from the system (in Joules).

  • temperature (float) – The absolute temperature at which the heat transfer occurs (in Kelvin).

Returns:

The change in entropy (in Joules per Kelvin).

Return type:

float

PyGamLab.Functions.faradays_law(induced_emf, time, magnetic_flux)[source]

Calculates a value based on Faraday’s Law of induction. Note: The provided formula returns the difference, not a direct calculation of a single variable.

Parameters:
  • induced_emf (float) – The induced electromotive force (in Volts).

  • time (float) – The time interval over which the change in magnetic flux occurs (in seconds).

  • magnetic_flux (float) – The change in magnetic flux (in Webers).

Returns:

The result of the expression: induced_emf - (time * magnetic_flux). To solve for a specific variable, rearrange this equation based on Faraday’s Law: induced_emf = - d(magnetic_flux) / dt (the negative rate of change of magnetic flux).

Return type:

float

PyGamLab.Functions.gauss_law(electric_field, surface_area, electric_flux)[source]

Calculates a value related to Gauss’s Law for electricity. Note: The provided formula returns the difference, not a direct calculation of a single variable.

Parameters:
  • electric_field (float) – The magnitude of the electric field (e.g., in N/C).

  • surface_area (float) – The area of the closed surface through which the electric field passes (e.g., in m^2).

  • electric_flux (float) – The electric flux through the closed surface (e.g., in N·m^2/C).

Returns:

The result of the expression: (electric_field * surface_area) - electric_flux. According to Gauss’s Law, the electric flux through a closed surface is proportional to the enclosed electric charge: electric_flux = enclosed_charge / permittivity_of_free_space. For a uniform electric field perpendicular to a surface, electric_flux = electric_field * surface_area. To solve for a specific variable, rearrange the appropriate form of Gauss’s Law.

Return type:

float

PyGamLab.Functions.hadamard_product(matrix1, matrix2)[source]

Calculates the Hadamard product (element-wise product) of two matrices.

Parameters:
  • matrix1 (numpy.ndarray) – The first matrix.

  • matrix2 (numpy.ndarray) – The second matrix. Note: The dimensions of matrix1 and matrix2 must be the same for element-wise multiplication.

Returns:

The Hadamard product of the two matrices.

Return type:

numpy.ndarray

PyGamLab.Functions.heat_transfer(thermal_conductivity, area, temperature_difference, thickness)[source]

Calculates the rate of heat transfer through a material by conduction using Fourier’s Law.

Parameters:
  • thermal_conductivity (float) – The thermal conductivity of the material (e.g., in W/(m·K)).

  • area (float) – The cross-sectional area through which heat is transferred (e.g., in m^2).

  • temperature_difference (float) – The temperature difference across the thickness of the material (e.g., in Kelvin).

  • thickness (float) – The thickness of the material through which heat is transferred (e.g., in meters).

Returns:

The rate of heat transfer (in Watts).

Return type:

float

PyGamLab.Functions.hookes_law(spring_constant, displacement)[source]

Calculates the force exerted by a spring according to Hooke’s Law.

Parameters:
  • spring_constant (float) – The spring constant (in Newtons per meter).

  • displacement (float) – The displacement of the spring from its equilibrium position (in meters).

Returns:

The force exerted by the spring (in Newtons).

Return type:

float

PyGamLab.Functions.ideal_diode_equation(current, saturation_current, thermal_voltage)[source]

Calculates a value based on the Ideal Diode Equation (Shockley diode equation). Note: The provided formula returns the difference, not a direct calculation of the voltage across the diode.

Parameters:
  • current (float) – The current flowing through the diode (in Amperes).

  • saturation_current (float) – The reverse saturation current of the diode (in Amperes).

  • thermal_voltage (float) – The thermal voltage (Vt = kT/q), typically around 26 mV at room temperature (in Volts).

Returns:

The result of the expression: current - (saturation_current * (math.exp(current / thermal_voltage) - 1)). The standard form of the Ideal Diode Equation is: current = saturation_current * (exp(voltage / thermal_voltage) - 1). To solve for the voltage across the diode, rearrange this standard equation.

Return type:

float

PyGamLab.Functions.ideal_gas_law(pressure, volume, temperature)[source]

Calculates a value based on the Ideal Gas Law. Note: The provided formula returns the difference, not a direct calculation of the number of moles.

Parameters:
  • pressure (float) – The pressure of the gas (in Pascals).

  • volume (float) – The volume of the gas (in cubic meters).

  • temperature (float) – The temperature of the gas (in Kelvin).

Returns:

The result of the expression: (pressure * volume) - (gas_constant * temperature). According to the Ideal Gas Law: pressure * volume = number_of_moles * gas_constant * temperature. To solve for a specific variable (like the number of moles), rearrange this equation.

Return type:

float

PyGamLab.Functions.is_Pythagorean(a, b, c)[source]
Parameters:
  • a (float) – tool zele aval.

  • b (float) – tool zele dovom.

  • c (float) – tool zele sevom.

  • bedan (Returns be ma mige in adad mitoonan mosalas ghaem alazviye tashkil)

  • nemishe" (ba "mosalas ghaemalzaviye mishe" va" mosalas ghaemalzaviye)

  • -------

PyGamLab.Functions.kinetic_energy(mass, velocity)[source]

Calculates the kinetic energy of an object.

Parameters:
  • mass (float) – The mass of the object (in kilograms).

  • velocity (float) – The velocity of the object (in meters per second).

Returns:

The kinetic energy of the object (in Joules).

Return type:

float

PyGamLab.Functions.lorentz_force(charge, velocity, magnetic_field)[source]

Calculates the magnetic force component of the Lorentz force acting on a moving charged particle.

Parameters:
  • charge (float) – The electric charge of the particle (in Coulombs).

  • velocity (numpy.ndarray) – A 3D vector representing the velocity of the particle (in meters per second).

  • magnetic_field (numpy.ndarray) – A 3D vector representing the magnetic field (in Teslas).

Returns:

A 3D vector representing the magnetic force acting on the particle (in Newtons).

Return type:

numpy.ndarray

PyGamLab.Functions.mass_energy_equivalence(mass)[source]

Calculates the energy equivalent of a given mass using Einstein’s mass-energy equivalence principle (E=mc^2).

Parameters:

mass (float) – The mass (in kilograms).

Returns:

The equivalent energy (in Joules).

Return type:

float

PyGamLab.Functions.maxwells_equations(electric_field, magnetic_field, charge_density, current_density)[source]

Represents a simplified form of two of Maxwell’s equations: Gauss’s law for electricity and Ampère-Maxwell’s law. Note: This function assumes that the div() and curl() methods are defined for the input field objects and returns a tuple representing the differences from zero as stated by the laws in a vacuum (no free charges or currents). For the full equations in media, permittivity and permeability would need to be considered.

Parameters:
  • electric_field (object) – An object representing the electric field, assumed to have a div() method.

  • magnetic_field (object) – An object representing the magnetic field, assumed to have a curl() method.

  • charge_density (float) – The electric charge density (in Coulombs per cubic meter).

  • current_density (object) – An object representing the current density, assumed to be involved in Ampère-Maxwell’s law.

Returns:

A tuple containing two values: - The result of the divergence of the electric field minus the charge density (related to Gauss’s law). - The result of the curl of the magnetic field minus the current density (related to Ampère-Maxwell’s law, neglecting the displacement current term for simplicity as per the input).

Return type:

tuple

PyGamLab.Functions.newtons_second_law(force, mass, acceleration)[source]

Calculates a value based on Newton’s second law of motion. Note: The provided formula returns the difference, not a direct calculation of a single variable.

Parameters:
  • force (float) – The net force acting on the object (in Newtons).

  • mass (float) – The mass of the object (in kilograms).

  • acceleration (float) – The acceleration of the object (in meters per second squared).

Returns:

The result of the expression: force - (mass * acceleration). According to Newton’s second law: force = mass * acceleration. To solve for a specific variable, rearrange this equation.

Return type:

float

PyGamLab.Functions.ohms_law(voltage, current, resistance)[source]

Calculates a value based on Ohm’s law. Note: The provided formula returns the difference, not a direct calculation of a single variable.

Parameters:
  • voltage (float) – The voltage across the conductor (in Volts).

  • current (float) – The current flowing through the conductor (in Amperes).

  • resistance (float) – The resistance of the conductor (in Ohms).

Returns:

The result of the expression: voltage - (current * resistance). According to Ohm’s law: voltage = current * resistance. To solve for a specific variable, rearrange this equation.

Return type:

float

PyGamLab.Functions.pH_Which(pH)[source]

Determines if a solution is acidic, neutral, or basic based on its pH value and prints the result.

Parameters:

pH (float) – The pH value of the solution.

Returns:

This function prints the classification of the solution and does not return a value.

Return type:

None

PyGamLab.Functions.photoelectric_effect(kinetic_energy, photon_energy, work_function)[source]

Calculates a value related to the photoelectric effect. Note: The provided formula returns the difference, not a direct calculation of a single variable.

Parameters:
  • kinetic_energy (float) – The kinetic energy of the emitted electron (in Joules or eV).

  • photon_energy (float) – The energy of the incident photon (in Joules or eV).

  • work_function (float) – The minimum energy required to remove an electron from the surface of the material (in Joules or eV).

Returns:

The result of the expression: kinetic_energy - (photon_energy - work_function). According to the photoelectric effect equation: kinetic_energy_max = photon_energy - work_function. To solve for a specific variable, rearrange this equation.

Return type:

float

PyGamLab.Functions.poisson(transverse_strain, axial_strain)[source]

Calculates Poisson’s ratio of a material under axial stress.

Parameters:
  • transverse_strain (float) – The strain in the direction perpendicular to the applied force (dimensionless).

  • axial_strain (float) – The strain in the direction of the applied force (dimensionless).

Returns:

Poisson’s ratio (v), a dimensionless material property.

Return type:

float

PyGamLab.Functions.predict_phase_from_gibbs(g1, g2, temp)[source]

Predict which phase is thermodynamically favored at a given temperature.

Parameters:
  • g1 (callable) – Gibbs free energy function for phase 1: G(T) in J/mol

  • g2 (callable) – Gibbs free energy function for phase 2: G(T) in J/mol

  • temp (float) – Temperature in Kelvin.

Returns:

Name of the stable phase (“Phase 1”, “Phase 2”, or “Both”).

Return type:

str

PyGamLab.Functions.pythagorean_theorem(a, b)[source]

Calculates the length of the hypotenuse of a right-angled triangle using the Pythagorean theorem.

Parameters:
  • a (float) – The length of one of the shorter sides of the triangle.

  • b (float) – The length of the other shorter side of the triangle.

Returns:

The length of the hypotenuse.

Return type:

float

PyGamLab.Functions.rayleigh_scattering(intensity, wavelength, particle_size)[source]

Calculates a value related to the intensity of Rayleigh scattering. Note: The provided formula returns the difference, not the scattered intensity.

Parameters:
  • intensity (float) – The initial intensity of the incident light.

  • wavelength (float) – The wavelength of the incident light.

  • particle_size (float) – The size of the scattering particles.

Returns:

The result of the expression: intensity - (particle_size / wavelength)**4. The intensity of Rayleigh scattering is actually proportional to (1/wavelength)^4 and the size of the particle. The provided formula doesn’t directly represent the scattered intensity.

Return type:

float

PyGamLab.Functions.root_degree2(a, b, c)[source]

Calculates the real roots of a quadratic equation of the form ax^2 + bx + c = 0.

Parameters:
  • a (float) – The coefficient of the x^2 term.

  • b (float) – The coefficient of the x term.

  • c (float) – The constant term.

Returns:

A tuple containing two real roots (may be equal if delta == 0), or None if no real roots exist.

Return type:

tuple or None

PyGamLab.Functions.rydberg_formula(wavelength, rydberg_constant, principal_quantum_number)[source]

Calculates a value related to the Rydberg formula for the wavelengths of spectral lines of hydrogen-like atoms. Note: The provided formula returns the difference, not the inverse of the wavelength.

Parameters:
  • wavelength (float) – The wavelength of the emitted photon.

  • rydberg_constant (float) – The Rydberg constant for the atom.

  • principal_quantum_number (float) – The principal quantum number of the energy level.

Returns:

The result of the expression: (1 / wavelength) - (rydberg_constant * principal_quantum_number**2). The standard Rydberg formula is: 1/wavelength = Rydberg_constant * (1/n1^2 - 1/n2^2), where n1 and n2 are principal quantum numbers.

Return type:

float

PyGamLab.Functions.uncertainty_principle(delta_position, delta_momentum, hbar)[source]

Calculates a value related to the Heisenberg uncertainty principle. Note: The provided formula returns the difference, not a direct evaluation of whether the principle is satisfied.

Parameters:
  • delta_position (float) – The uncertainty in the position of a particle.

  • delta_momentum (float) – The uncertainty in the momentum of the particle.

  • hbar (float) – The reduced Planck constant (h / 2π).

Returns:

The result of the expression: (delta_position * delta_momentum) - (hbar / 2). The Heisenberg uncertainty principle states that the product of the uncertainty in position and the uncertainty in momentum must be greater than or equal to hbar / 2: delta_position * delta_momentum >= hbar / 2. This function calculates the left-hand side minus the right-hand side. A non-negative result indicates that the principle is satisfied (within the limits of equality).

Return type:

float

PyGamLab.Functions.wavelength_frequency_relation(speed_of_light, wavelength, frequency)[source]

Calculates a value based on the relationship between the speed of light, wavelength, and frequency of an electromagnetic wave. Note: The provided formula returns the difference, not a direct calculation of one of the variables.

Parameters:
  • speed_of_light (float) – The speed of light in the medium (e.g., approximately 3e8 m/s in a vacuum).

  • wavelength (float) – The wavelength of the electromagnetic wave (e.g., in meters).

  • frequency (float) – The frequency of the electromagnetic wave (e.g., in Hertz).

Returns:

The result of the expression: speed_of_light - (wavelength * frequency). The actual relationship is: speed_of_light = wavelength * frequency. To solve for a specific variable, rearrange this equation.

Return type:

float

PyGamLab.Functions.youngs_modulus(stress, strain)[source]

Calculates a value based on the difference between stress and strain. Note: This is not the standard formula for Young’s modulus.

Parameters:
  • stress (float) – The stress experienced by the material.

  • strain (float) – The strain of the material.

Returns:

The difference between stress and strain.

Return type:

float