[CODE]using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Relativity
{
public class Special
{
private const double c = 299792458;
public static void IsLessThanC(double vel) {
if (vel > c) {
throw new System.ArgumentException("Parameter cannot be < c", "vel");
}
}
public static double LorentzFact(double vel) {
IsLessThanC(vel);
return 1/(Math.Sqrt(1 - (Math.Pow(vel, 2) / Math.Pow(c, 2))));
}
public static double TimeDial(double vel, double time) {
IsLessThanC(vel);
return time * LorentzFact(vel);
}
public static double LengthCont(double vel, double length) {
IsLessThanC(vel);
return length / LorentzFact(vel);
}
public static double RelMass(double mass, double vel) {
IsLessThanC(vel);
return mass * LorentzFact(vel);
}
}
public class General
{
private const double c = 299792458;
}
}[/CODE]
<‾<
Sorry, you need to Log In to post a reply to this thread.