New Library for Physics
|
04-24-2023, 11:40 PM
Post: #1
|
|||
|
|||
New Library for Physics
// Mechanics Formulas
EXPORT distance(v0,t,a) BEGIN LOCAL d; d:=v0*t+(1/2)*a*t^2; RETURN d; END; EXPORT velocity(v0,a,t) BEGIN LOCAL v; v:=v0+a*t; RETURN v; END; EXPORT acceleration(v,v0,t) BEGIN LOCAL a; a:=(v-v0)/t; RETURN a; END; EXPORT force(m,a) BEGIN LOCAL F; F:=m*a; RETURN F; END; EXPORT weight(m,g) BEGIN LOCAL W; W:=m*g; RETURN W; END; EXPORT friction(u,N) BEGIN LOCAL f; f:=u*N; RETURN f; END; EXPORT work(F,d,theta) BEGIN LOCAL W; W:=F*d*cos(theta); RETURN W; END; EXPORT kinetic(m,v) BEGIN LOCAL K; K:=(1/2)*m*v^2; RETURN K; END; EXPORT potential(m,h,g) BEGIN LOCAL U; U:=m*g*h; RETURN U; END; EXPORT power(W,t) BEGIN LOCAL P; P:=W/t; RETURN P; END; EXPORT momentum(m,v) BEGIN LOCAL p; p:=m*v; RETURN p; END; EXPORT impulse(F,t) BEGIN LOCAL J; J:=F*t; RETURN J; END; EXPORT spring_energy(k,x) BEGIN LOCAL Us; Us:=(1/2)*k*x^2; RETURN Us; END; EXPORT period(T) BEGIN LOCAL f; f:=1/T; RETURN f; END; EXPORT simple_pendulum_period(l,g) BEGIN LOCAL T; T:=2*pi*sqrt(l/g); RETURN T; END; EXPORT universal_gravitation(m1,m2,r) BEGIN LOCAL F, G; G:=6.67*10^(-11); F:=(G*m1*m2)/r^2; RETURN F; END; EXPORT circular_motion(v,r) BEGIN LOCAL a; a:=v^2/r; RETURN a; END; // Optics Formulas EXPORT snells_law(n1,n2,theta1) BEGIN LOCAL theta2; theta2:=asin(n1*sin(theta1)/n2); RETURN theta2; END; EXPORT magnification(i,o) BEGIN LOCAL m; m:=-i/o; RETURN m; END; EXPORT lens_formula(f,i,o) BEGIN LOCAL d; d:=1/f; d:=d-1/i; d:=d-1/o; d:=1/d; RETURN d; END; EXPORT thin_lens_power(f) BEGIN LOCAL P; P:=1/f; RETURN P; END; EXPORT mirror_equation(f,d,o) BEGIN LOCAL i; i:=1/f; i:=i-1/d; i:=i+1/o; i:=1/i; RETURN i; END; EXPORT mirror_magnification(f,d) BEGIN LOCAL m; m:=-f/d; RETURN m; END; // Electricity and Magnetism Formulas EXPORT coulombs_law(k,q1,q2,r) BEGIN LOCAL F; F:=k*q1*q2/r^2; RETURN F; END; EXPORT electric_field(F,q) BEGIN LOCAL E; E:=F/q; RETURN E; END; EXPORT electric_potential_energy(q1,q2,r,k) BEGIN LOCAL U; U:=k*q1*q2/r; RETURN U; END; EXPORT electric_potential(U,q) BEGIN LOCAL V; V:=U/q; RETURN V; END; EXPORT ohms_law(V,R) BEGIN LOCAL I; I:=V/R; RETURN I; END; EXPORT resistance(rho,L,A) BEGIN LOCAL R; R:=rho*L/A; RETURN R; END; EXPORT electric_power(V,I) BEGIN LOCAL P; P:=V*I; RETURN P; END; EXPORT magnetic_field(I,r) BEGIN LOCAL B, mu0; mu0:=4*pi*10^(-7); B:=(mu0*I)/(2*pi*r); RETURN B; END; EXPORT magnetic_force(q,v,B,theta) BEGIN LOCAL F; F:=q*v*B*sin(theta); RETURN F; END; EXPORT faradays_law(N,dphi,dt) BEGIN LOCAL emf; emf:=-N*dphi/dt; RETURN emf; END; EXPORT lensmaker_formula(n1,n2,R1,R2,d) BEGIN LOCAL f; f:=n2-n1; f:=f*(1/R1-1/R2+d/(n2*R1*R2)); f:=1/f; RETURN f; END; EXPORT drift_velocity(I,n,A,q) BEGIN LOCAL vd; vd:=I/(n*A*q); RETURN vd; END; EXPORT voltage_drop(I,R) BEGIN LOCAL V; V:=I*R; RETURN V; END; EXPORT magnetic_flux_density(B,n,I) BEGIN LOCAL mu0; mu0:=4*pi*10^(-7); LOCAL B1; B1:=mu0*n*I; B:=B1+B; RETURN B; END; EXPORT magnetic_flux(B,A,theta) BEGIN LOCAL phi; phi:=B*A*cos(theta); RETURN phi; END; EXPORT lorentz_force(q,v,B) BEGIN LOCAL F; F:=q*v*B; RETURN F; END; EXPORT electric_flux(E,A,theta) BEGIN LOCAL phi; phi:=E*A*cos(theta); RETURN phi; END; EXPORT capacitance(A,d,e0) BEGIN LOCAL C; C:=e0*A/d; RETURN C; END; EXPORT electric_field_capacitor(V,d) BEGIN LOCAL E; E:=V/d; RETURN E; END; EXPORT dielectric_constant(Co,C) BEGIN LOCAL k; k:=C/Co; RETURN k; END; EXPORT energy_density(E) BEGIN LOCAL u, e0; e0:=8.85*10^(-12); u:=(1/2)*e0*E^2; RETURN u; END; EXPORT electric_potential_capacitor(Q,C) BEGIN LOCAL V; V:=Q/C; RETURN V; END; EXPORT magnetic_moment(I,A) BEGIN LOCAL m; m:=I*A; RETURN m; END; EXPORT magnetic_dipole_moment(B,A,theta) BEGIN LOCAL m; m:=B*A*sin(theta); RETURN m; END; EXPORT magnetic_flux_through_loop(B,A,theta) BEGIN LOCAL phi; phi:=B*A*cos(theta); RETURN phi; END; EXPORT self_inductance(N,phi,I) BEGIN LOCAL L; L:=N*phi/I; RETURN L; END; EXPORT mutual_inductance(N1,N2,phi1,phi2) BEGIN LOCAL M; M:=N2*phi1/N1; M:=N1*phi2/N2; RETURN M; END; EXPORT inductance_per_unit_length(mu0,N,A) BEGIN LOCAL L; L:=mu0*N^2*A; RETURN L; END; EXPORT impedance(R,L,C,f) BEGIN LOCAL Z, w; w:=2*pi*f; Z:=sqrt(R^2+(w*L-1/(w*C))^2); RETURN Z; END; EXPORT resonance_frequency(L,C) BEGIN LOCAL f; f:=1/(2*pi*sqrt(L*C)); RETURN f; END; EXPORT quality_factor(R,L,C) BEGIN LOCAL Q, w; w:=1/(sqrt(L*C)); Q:=w*R/C; RETURN Q; END; // Thermodynamics Formulas EXPORT temperature_conversion_celsius_to_kelvin(C) BEGIN LOCAL K; K:=C+273.15; RETURN K; END; EXPORT temperature_conversion_kelvin_to_celsius(K) BEGIN LOCAL C; C:=K-273.15; RETURN C; END; EXPORT ideal_gas_law(P,V,n,R,T) BEGIN LOCAL P1; P1:=n*R*T/V; RETURN P1; END; EXPORT charles_law(V1,V2,T1,T2) BEGIN LOCAL k; k:=V1/T1; k:=k*V2; k:=k/T2; RETURN k; END; EXPORT boyles_law(P1,P2,V1,V2) BEGIN LOCAL k; k:=P1*V1; k:=k/P2; k:=k/V2; RETURN k; END; EXPORT gay_lussacs_law(P1,P2,T1,T2) BEGIN LOCAL k; k:=P1*T2; k:=k/P2; k:=k/T1; RETURN k; END; EXPORT first_law_thermodynamics(Q,W) BEGIN LOCAL U; U:=Q-W; RETURN U; END; EXPORT heat_capacity(Q,m,Delta_T) BEGIN Permanently banned |
|||
04-30-2023, 12:48 PM
Post: #2
|
|||
|
|||
RE: New Library for Physics
Library to be continued with advanced formulas
Permanently banned |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)