Exemplo n.º 1
0
        public Equation(IValue value)
        {
            if (value == null)
            {
                content = new Integer(0);
            }

            content = value.Direct();
        }
Exemplo n.º 2
0
        public Equation(IValue value)
        {
            if (value == null)
            {
                Content = new Integer(0);
            }

            Content = value.Direct();
            if (Content.Complexity > 5)
            {
                CustomSimplify();
            }
        }
Exemplo n.º 3
0
        public Product(IValue first, IValue second)
        {
            first  = first.Direct();
            second = second.Direct();

            if (first.Integerable && second.Integerable)
            {
                First  = first.ToInteger() * second.ToInteger();
                Second = new Integer(1);
                return;
            }
            if (first.Fractionable && second.Fractionable)
            {
                Fraction a = first.ToFraction();
                Fraction b = second.ToFraction();
                First  = new Fraction(new Product(a.Numerator, b.Numerator).Simple(), new Product(a.Denominator, b.Denominator).Simple());
                Second = new Integer(1);
                return;
            }
            if (first.Radicalable && second.Radicalable)
            {
                Radical a = first.ToRadical();
                Radical b = second.ToRadical();

                First  = new Radical(new Product(a.Radicant, b.Radicant).Simple(), new Product(a.Coefficient, b.Coefficient).Simple(), true);
                Second = new Integer(1);
                return;
            }
            if (First is Sum firstSum)
            {
                First  = new Sum(new Product(firstSum.First, Second).Simple(), new Product(firstSum.Second, Second));
                Second = new Integer(1);
                return;
            }
            if (Second is Sum secondSum)
            {
                First  = new Sum(new Product(secondSum.First, First).Simple(), new Product(secondSum.Second, First));
                Second = new Integer(1);
                return;
            }

            First  = first.Simple();
            Second = second.Simple();
        }
Exemplo n.º 4
0
 public ComplexNumber(IValue valueToSqrt, bool negative = false)
 {
     source   = valueToSqrt.Direct();
     Negative = negative;
 }