WaBis

walter.bislins.ch

Datei: AntimateriePhotonenAntrieb.js

Inhalt der Datei: media/AntimateriePhotonenAntrieb.js
function APA() {
  this.Year = 31556925.261;     // [s] Tropisches Jahr
  this.Lj = 9460730472580800.0; // [m]
  this.c = 299792458.0;         // [m/s]
  this.c2 = this.c * this.c;

  this.d = 26000.0 * this.Lj;   // [m]
  this.a = 9.81;                // [m/s^2]
  this.MN = 100000;             // [kg]
  this.Q = 3.33564095e-9;       // [kg/N/s]
  this.t = 0;                   // [s]

  this.M_0 = 0;                 // [kg]
  this.MT_0 = 0;                // [kg]
  this.M_t = 0;                 // [kg]
  this.MT_t = 0;                // [kg]
  this.F_0 = 0;                 // [N]
  this.F_t = 0;                 // [N]
  this.V_0 = 0;                 // [kg/s]
  this.V_t = 0;                 // [kg/s]
  this.P_0 = 0;                 // [W]
  this.P_t = 0;                 // [W]

  this.a_rel = 0;               // [m/s^2]
  this.a_rel_min = 0;           // [m/2^2]
  this.TE = 0;                  // [s]
  this.T = 0;                   // [s]
  this.S = 0;                   // [m]
  this.v_max = 0;               // [m/s]
  this.v = 0;                   // [m/s]
  this.deltaTS = 0;
  this.deltaTSmax = 0;

  this.TimeUnitNum = 0;
  this.TimeUnit = '';
  this.TimeUnitSingle = '';
  this.TimeMult = 1;
  this.TimeSecPerUnit = 's/Jahre';

  this.LengthUnitNum = 0;
  this.LengthUnit = '';
  this.LengthMult = 1;
  this.LengthMeterPerUnit = 'm/Lj';

  this.MassUnitNum = 0;
  this.MassUnit = '';
  this.MassMult = 1;

  this.SpeedUnitNum = 3;  // c
  this.SpeedUnit = '';
  this.SpeedMult = 1;
  this.SpeedFormat = '';
  this.SpeedDigit = 0;

  this.TimeUnits = [
    'Jahre', 'Monate', 'Tage', 'h', 'min', 's' ];
  this.TimeUnitsSingle = [
    'Jahr', 'Monat', 'Tag', 'h', 'min', 's' ];

  this.TimeMults = [
    31556925.261,    // Jahre -> s (365.24219052083 * 1Tg = Tropisches- bzw. Kalenderjahr)
     2629743.77175,  // Mon -> s (Jahre/12)
       86400,        // Tg -> s (24 * 60 * 60s)
        3600,        // h -> s (60 * 60s)
          60,        // min -> s
           1
  ];

  this.LengthUnits = [
    'Lj', 'Lmon', 'Ltg', 'Lh', 'Lmin', 'Ls', 'AE', 'pc', 'km' ];

  this.LengthMults = [
    9460730472580800,   // Lj -> m (Definition nach Wikipedia: 365.25 * 1Lt, julianisches Jahr = 365.25 Tg)
     788394206048400,   // Lm -> m (Lj / 12)
      25902068371200,   // Lt -> m (24 * 60 * 60Ls)
       1079252848800,   // Lh -> m (60 * 60Ls)
         17987547480,   // Lmin -> m (60Ls)
           299792458,   // Ls -> m
        149597870700,   // AE -> m (Wikipedia)
   30856775812815000,   // pc -> m (Wikipedia, ca. 3.26Lj)
                1000    // km -> m
  ];

  this.MassUnits = [ 'kg', 't', 'Mt' ];

  this.MassMults = [
    1,   // kg -> kg
    1e3, // t  -> kg
    1e9, // Mt -> kg
  ];

  this.SpeedUnits = [ 'm/s', 'km/s', 'km/h', 'c' ];

  this.SpeedMults = [
    1,          // m/s  -> m/s
    1e3,        // km/s -> m/s
    1/3.6,      // km/h -> m/s
    299792458.0 // c    -> m/s
  ];

  this.SpeedFormats = [ 'std', 'std', 'std', 'fix0' ];
  this.SpeedDigits = [ 12, 12, 12, 15 ];
}

APA.prototype.SetUnits = function() {
  this.TimeUnit = this.TimeUnits[this.TimeUnitNum];
  this.TimeUnitSingle = this.TimeUnitsSingle[this.TimeUnitNum];
  this.TimeMult = this.TimeMults[this.TimeUnitNum];
  this.TimeSecPerUnit = 's/' + this.TimeUnitSingle;
  this.LengthUnit = this.LengthUnits[this.LengthUnitNum];
  this.LengthMult = this.LengthMults[this.LengthUnitNum];
  this.LengthMeterPerUnit = 'm/' + this.LengthUnit;
  this.MassUnit = this.MassUnits[this.MassUnitNum];
  this.MassMult = this.MassMults[this.MassUnitNum];
  this.SpeedUnit = this.SpeedUnits[this.SpeedUnitNum];
  this.SpeedMult = this.SpeedMults[this.SpeedUnitNum];
  this.SpeedFormat = this.SpeedFormats[this.SpeedUnitNum];
  this.SpeedDigit = this.SpeedDigits[this.SpeedUnitNum];
}

APA.prototype.Compute = function() {
  this.SetUnits();
  // Einstein
  this.T = 2.0 * this.EinsteinTofS( this.d / 2.0 );
  this.TE = 2.0 * this.EinsteinTEofT( this.T / 2.0 );
  this.S = 2.0 * this.EinsteinSRofT( this.T / 2.0 );
  this.v_max = this.EinsteinVofTE( this.TE / 2.0 );
  this.deltaTSmax = 1 / this.EinsteinDeltaTSofTE( this.TE / 2.0 );
  this.a_rel_min = this.EinsteinAEofTE( this.TE / 2 ) ;

  var t = this.t;
  if (t < 0) t = 0;
  if (t > this.T) t = this.T;
  if (t > this.T / 2) {
    var te = this.EinsteinTEofT( this.T - t );
    if (te < 0) te = 0;
    this.a_rel = -this.EinsteinAEofTE( te );
    this.v = this.EinsteinVofTE( te );
    this.deltaTS = 1 / this.EinsteinDeltaTSofTE( te );
  } else {
    var te = this.EinsteinTEofT( t );
    if (te > this.TE / 2) te = this.TE;
    this.a_rel = this.EinsteinAEofTE( te );
    this.v = this.EinsteinVofTE( te );
    this.deltaTS = 1 / this.EinsteinDeltaTSofTE( te );
  }
  // Antrieb
  this.M_0 = this.MassAtTime( 0 );
  this.MT_0 = this.M_0 - this.MN;
  this.M_t = this.MassAtTime( t );
  this.MT_t = this.M_t - this.MN;
  this.F_0 = this.a * this.M_0;
  this.F_t = this.a * this.M_t;
  this.V_0 = this.Q * this.F_0;
  this.V_t = this.Q * this.F_t;
  this.P_0 = this.V_0 * this.c2;
  this.P_t = this.V_t * this.c2;
}

APA.prototype.MassAtTime = function( t ) {
  var u = this.a * this.Q;
  return this.MN * Math.exp( u * (this.T - t) );
}

APA.prototype.EinsteinTEofS = function( s ) {
  var sacE = s * this.a / this.c2;
  var x = sacE + 1;
  var sqrtArgE = x * x - 1;
  var relErrorE = Math.abs( (((sacE + 1) - 1) - sacE) / sacE );
  var sqrtArgN = 2 * sacE;
  var relDiffNE = Math.abs( (sqrtArgE - sqrtArgN) / sqrtArgN );
  if (relDiffNE / 4 < relErrorE) {
    // small sac -> choose Newton formula
    var te = Math.sqrt( 2 * s / this.a );
  } else {
    // bigger sac -> choose Einstein formla
    // te = (c/a) * sqrt( (a*s/c^2 + 1)^2 - 1 )
    te = (this.c / this.a) * Math.sqrt( sqrtArgE );
  }
  return te;
}

APA.prototype.EinsteinTofS = function( s ) {
  var sacE = s * this.a / this.c2;
  var x = sacE + 1;
  var sqrtArgE = x * x - 1;
  var relErrorE = Math.abs( (((sacE + 1) - 1) - sacE) / sacE );
  var sqrtArgN = 2 * sacE;
  var relDiffNE = Math.abs( (sqrtArgE - sqrtArgN) / sqrtArgN );
  if (relDiffNE / 4 < relErrorE) {
    // small sac -> choose Newton formula
    var t = Math.sqrt( 2 * s / this.a );
  } else {
    // bigger sac -> choose Einstein formla
    var arg = Math.sqrt( sqrtArgE );
    // asinh(arg) = Math.log(arg + Math.sqrt(arg * arg + 1))
    // x = sqrt(arg^2 + 1)
    var asinh = Math.log( arg + x );
    var t = (this.c / this.a) * asinh;
  }
  return t;
}

APA.prototype.sinh = function( x ) {
  return (Math.exp(x) - Math.exp(-x)) / 2;
}

APA.prototype.asinh = function( x ) {
  return Math.log( x + Math.sqrt( x * x + 1 ) );
}

APA.prototype.EinsteinTofTE = function( te ) {
  var atc = this.a * te / this.c;
  if (Math.abs(atc) < 0.1) {
    // if term 3 of taylor polynom of sinh is out of range, then taylor2 is more precise than asinh
    // taylor asinh(x) = x - x^3/6 + 3*x^5/40
    var atc2 = atc * atc;
    var atc3 = atc * atc2;
    var atc5 = atc2 * atc3;
    var taylor2 = atc - atc3/6;
    var taylor3 = 3 * atc5 / 40;
    if (taylor2 + taylor3 == taylor2) {
      var t = taylor2;
    } else {
      var t = this.asinh( atc );
    }
  } else {
    var t = this.asinh( atc );
  }
  return this.c / this.a * t;
}

APA.prototype.EinsteinTEofT = function( t ) {
  var atc = this.a * t / this.c;
  if (Math.abs(atc) < 0.1) {
    // if term 3 of taylor polynom of sinh is out of range, then taylor2 is more precise than sinh
    // taylor sinh(x) = x + x^3/6 + x^5/120
    var atc2 = atc * atc;
    var atc3 = atc * atc2;
    var atc5 = atc2 * atc3;
    var taylor2 = atc + atc3/6;
    var taylor3 = atc5 / 120;
    if (taylor2 + taylor3 == taylor2) {
      var te = taylor2;
    } else {
      var te = this.sinh( atc );
    }
  } else {
    var te = this.sinh( atc );
  }
  te *= this.c / this.a;
  return te;
}

APA.prototype.EinsteinDeltaTSofTE = function( t ) {
  var atc = this.a * t / this.c;
  if (Math.abs(atc) < 0.1) {
    // if term 3 of taylor polynom of f = 1/sqrt(x^2 + 1) is out of range, then taylor2 is more precise than f
    // taylor 1/sqrt( x^2 + 1 ) = 1 - x^2/2 + 3*x^4/8 - 5*x^6/16
    var atc2 = atc * atc;
    var atc4 = atc2 * atc2;
    var atc6 = atc2 * atc4;
    var taylor2 = 1 - atc2 / 2 + 3 * atc4 / 8;
    var taylor3 = 5 * atc6 / 16;
    if (taylor2 + taylor3 == taylor2) {
      var deltaTS = taylor2;
    } else {
      var deltaTS = 1 / Math.sqrt( atc * atc + 1 );
    }
  } else {
    var deltaTS = 1 / Math.sqrt( atc * atc + 1 );
  }
  return deltaTS;
}

APA.prototype.EinsteinVofTE = function( t ) {
  return this.EinsteinDeltaTSofTE( t ) * this.a * t;
}

APA.prototype.EinsteinAEofTE = function( t ) {
  var atc = this.a * t / this.c;
  if (Math.abs(atc) < 0.1) {
    // if term 3 of taylor polynom of f = 1/(x^2 + 1)^(3/2) is out of range, then taylor2 is more precise than f
    // taylor 1/( x^2 + 1 )^(3/2) = 1 - 3*x^2/2 + 15*x^4/8 - 35*x^6/16
    var atc2 = atc * atc;
    var atc4 = atc2 * atc2;
    var atc6 = atc2 * atc4;
    var taylor2 = 1 - 3 * atc2 / 2 + 15 * atc4 / 8;
    var taylor3 = 35 * atc6 / 16;
    if (taylor2 + taylor3 == taylor2) {
      var a = taylor2;
    } else {
      var a = 1 / Math.pow( atc * atc + 1, 1.5 );
    }
  } else {
    var a = 1 / Math.pow( atc * atc + 1, 1.5 );
  }
  a *= this.a;
  return a;
}

APA.prototype.lnexp = function( x ) {
  return Math.log( ( Math.exp( 2.0 * x ) + 1 ) / 2.0 ) - x;
}

APA.prototype.EinsteinSRofT = function( tau ) {
  var atc = this.a * tau / this.c;
  if (Math.abs(atc) < 0.1) {
    // if term 3 of taylor polynom of lnexp(x) is out of range, then taylor2 is more precise than lnexp(x)
    // taylor ln( (e^2x + 1) / 2 ) - x = x^2/2 - x^4/12 + x^6/45
    var atc2 = atc * atc;
    var atc4 = atc2 * atc2;
    var atc6 = atc2 * atc4;
    var taylor2 = atc2/2 - atc4/12;
    var taylor3 = atc6 / 45;
    if (taylor2 + taylor3 == taylor2) {
      var sr = taylor2;
    } else {
      var sr = this.lnexp( atc );
    }
  } else {
    var sr = this.lnexp( atc );
  }
  return (this.c2 / this.a) * sr;
}

More Page Infos / Sitemap
Created Mittwoch, 20. August 2014
Scroll to Top of Page
Changed Montag, 12. Oktober 2015