Пример #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());
			}
		}
Пример #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());
			}
		}
Пример #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());
			}
		}
Пример #4
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());
            }
        }
Пример #5
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());
            }
        }
Пример #6
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());
            }
        }