Esempio n. 1
0
        public static string GetFormula(string nameOfVariable, TransformedValueRepresentation transform)
        {
            switch (transform)
            {
            case TransformedValueRepresentation.Original:
                return(nameOfVariable);

            case TransformedValueRepresentation.Inverse:
                return("1/" + nameOfVariable);

            case TransformedValueRepresentation.Negative:
                return("-" + nameOfVariable);

            case TransformedValueRepresentation.DecadicLogarithm:
                return("lg(" + nameOfVariable + ")");

            case TransformedValueRepresentation.NegativeDecadicLogarithm:
                return("-lg(" + nameOfVariable + ")");

            case TransformedValueRepresentation.NaturalLogarithm:
                return("ln(" + nameOfVariable + ")");

            case TransformedValueRepresentation.NegativeNaturalLogarithm:
                return("-ln(" + nameOfVariable + ")");

            default:
                throw new ArgumentOutOfRangeException("ValueTransformationType unknown: " + transform.ToString());
            }
        }
Esempio n. 2
0
        public static double BaseValueToTransformedValue(double baseValue, TransformedValueRepresentation destTransform)
        {
            switch (destTransform)
            {
            case TransformedValueRepresentation.Original:
                return(baseValue);

            case TransformedValueRepresentation.Inverse:
                return(1 / baseValue);

            case TransformedValueRepresentation.Negative:
                return(-baseValue);

            case TransformedValueRepresentation.DecadicLogarithm:
                return(Math.Log10(baseValue));

            case TransformedValueRepresentation.NegativeDecadicLogarithm:
                return(-Math.Log10(baseValue));

            case TransformedValueRepresentation.NaturalLogarithm:
                return(Math.Log(baseValue));

            case TransformedValueRepresentation.NegativeNaturalLogarithm:
                return(-Math.Log(baseValue));

            default:
                throw new ArgumentOutOfRangeException("ValueTransformationType unknown: " + destTransform.ToString());
            }
        }
Esempio n. 3
0
        public static double TransformedValueToBaseValue(double srcValue, TransformedValueRepresentation srcUnit)
        {
            switch (srcUnit)
            {
            case TransformedValueRepresentation.Original:
                return(srcValue);

            case TransformedValueRepresentation.Inverse:
                return(1 / srcValue);

            case TransformedValueRepresentation.Negative:
                return(-srcValue);

            case TransformedValueRepresentation.DecadicLogarithm:
                return(Math.Pow(10, srcValue));

            case TransformedValueRepresentation.NegativeDecadicLogarithm:
                return(Math.Pow(10, -srcValue));

            case TransformedValueRepresentation.NaturalLogarithm:
                return(Math.Exp(srcValue));

            case TransformedValueRepresentation.NegativeNaturalLogarithm:
                return(Math.Exp(-srcValue));

            default:
                throw new ArgumentOutOfRangeException("ValueTransformationType unknown: " + srcUnit.ToString());
            }
        }
Esempio n. 4
0
 public static double FromTo(double srcValue, TransformedValueRepresentation srcUnit, TransformedValueRepresentation destUnit)
 {
     if (srcUnit == destUnit)
     {
         return(srcValue);
     }
     else
     {
         return(BaseValueToTransformedValue(TransformedValueToBaseValue(srcValue, srcUnit), destUnit));
     }
 }
Esempio n. 5
0
		public static double FromTo(double srcValue, TransformedValueRepresentation srcUnit, TransformedValueRepresentation destUnit)
		{
			if (srcUnit == destUnit)
				return srcValue;
			else
				return BaseValueToTransformedValue(TransformedValueToBaseValue(srcValue, srcUnit), destUnit);
		}
Esempio n. 6
0
		public static string GetFormula(string nameOfVariable, TransformedValueRepresentation transform)
		{
			switch (transform)
			{
				case TransformedValueRepresentation.Original:
					return nameOfVariable;

				case TransformedValueRepresentation.Inverse:
					return "1/" + nameOfVariable;

				case TransformedValueRepresentation.Negative:
					return "-" + nameOfVariable;

				case TransformedValueRepresentation.DecadicLogarithm:
					return "lg(" + nameOfVariable + ")";

				case TransformedValueRepresentation.NegativeDecadicLogarithm:
					return "-lg(" + nameOfVariable + ")";

				case TransformedValueRepresentation.NaturalLogarithm:
					return "ln(" + nameOfVariable + ")";

				case TransformedValueRepresentation.NegativeNaturalLogarithm:
					return "-ln(" + nameOfVariable + ")";

				default:
					throw new ArgumentOutOfRangeException("ValueTransformationType unknown: " + transform.ToString());
			}
		}
Esempio n. 7
0
		public static double BaseValueToTransformedValue(double baseValue, TransformedValueRepresentation destTransform)
		{
			switch (destTransform)
			{
				case TransformedValueRepresentation.Original:
					return baseValue;

				case TransformedValueRepresentation.Inverse:
					return 1 / baseValue;

				case TransformedValueRepresentation.Negative:
					return -baseValue;

				case TransformedValueRepresentation.DecadicLogarithm:
					return Math.Log10(baseValue);

				case TransformedValueRepresentation.NegativeDecadicLogarithm:
					return -Math.Log10(baseValue);

				case TransformedValueRepresentation.NaturalLogarithm:
					return Math.Log(baseValue);

				case TransformedValueRepresentation.NegativeNaturalLogarithm:
					return -Math.Log(baseValue);

				default:
					throw new ArgumentOutOfRangeException("ValueTransformationType unknown: " + destTransform.ToString());
			}
		}
Esempio n. 8
0
		public static double TransformedValueToBaseValue(double srcValue, TransformedValueRepresentation srcUnit)
		{
			switch (srcUnit)
			{
				case TransformedValueRepresentation.Original:
					return srcValue;

				case TransformedValueRepresentation.Inverse:
					return 1 / srcValue;

				case TransformedValueRepresentation.Negative:
					return -srcValue;

				case TransformedValueRepresentation.DecadicLogarithm:
					return Math.Pow(10, srcValue);

				case TransformedValueRepresentation.NegativeDecadicLogarithm:
					return Math.Pow(10, -srcValue);

				case TransformedValueRepresentation.NaturalLogarithm:
					return Math.Exp(srcValue);

				case TransformedValueRepresentation.NegativeNaturalLogarithm:
					return Math.Exp(-srcValue);

				default:
					throw new ArgumentOutOfRangeException("ValueTransformationType unknown: " + srcUnit.ToString());
			}
		}