예제 #1
0
        /// <summary>
        /// Creates formula
        /// </summary>
        /// <param name="tree">Operation tree</param>
        /// <param name="level">Formula level</param>
        /// <param name="sizes">Sizes of symbols</param>
        /// <returns>The formula</returns>
        public MathFormula CreateFormula(ObjectFormulaTree tree, byte level, int[] sizes)
        {
            MathFormula      f  = FormulaCreator.CreateFormula(tree[0], level, sizes);
            MathFormula      p  = FormulaCreator.CreateFormula(tree[1], (byte)((int)level + 1), sizes);
            IObjectOperation op = tree[0].Operation;

            if (op.IsPowered())
            {
                if (op is ElementaryFunctionOperation)
                {
                    f.First[0] = p;
                }
                else
                {
                    f.Last[0] = p;
                }
                return(f);
            }
            MathFormula form = new MathFormula(level, sizes);
            MathSymbol  s    = new BracketsSymbol();

            s.Append(form);
            form.First[0] = p;
            return(form);
        }
예제 #2
0
        /// <summary>
        /// Creates formula
        /// </summary>
        /// <param name="tree">Operation tree</param>
        /// <param name="level">Formula level</param>
        /// <param name="sizes">Sizes of symbols</param>
        /// <returns>The formula</returns>
        public MathFormula CreateFormula(ObjectFormulaTree tree, byte level, int[] sizes)
        {
            MathFormula form = new MathFormula(level, sizes);
            MathFormula f    = new MathFormula(level, sizes);
            MathSymbol  sym  = new SimpleSymbol('¬', (byte)FormulaConstants.Unary, false, "¬");

            sym.Append(form);
            sym = new BracketsSymbol();
            sym.Append(form);
            form.Last[0] = FormulaCreator.CreateFormula(tree[0], level, sizes);
            return(form);
        }
예제 #3
0
        /// <summary>
        /// Creates formula
        /// </summary>
        /// <param name="tree">Operation tree</param>
        /// <param name="level">Formula level</param>
        /// <param name="sizes">Sizes of symbols</param>
        /// <returns>The formula</returns>
        public MathFormula CreateFormula(ObjectFormulaTree tree, byte level, int[] sizes)
        {
            MathFormula          form = new MathFormula(level, sizes);
            BinaryFunctionSymbol atan = new BinaryFunctionSymbol('A', "atan2");

            atan.Append(form);
            for (int i = 0; i < 2; i++)
            {
                form.First[i] = FormulaCreator.CreateFormula(tree[i], level, sizes);
            }
            return(form);
        }
예제 #4
0
        /// <summary>
        /// Creates formula
        /// </summary>
        /// <param name="tree">Operation tree</param>
        /// <param name="level">Formula level</param>
        /// <param name="sizes">Sizes of symbols</param>
        /// <returns>The formula</returns>
        public MathFormula CreateFormula(ObjectFormulaTree tree, byte level, int[] sizes)
        {
            MathFormula form = new MathFormula(level, sizes);
            MathSymbol  sym  = new FractionSymbol();

            sym.Append(form);
            for (int i = 0; i < 2; i++)
            {
                form.First[i] = FormulaCreator.CreateFormula(tree[i], level, sizes);
            }
            return(form);
        }
예제 #5
0
        /// <summary>
        /// Creates formula
        /// </summary>
        /// <param name="tree">Operation tree</param>
        /// <param name="level">Formula level</param>
        /// <param name="sizes">Sizes of symbols</param>
        /// <returns>The formula</returns>
        public MathFormula CreateFormula(ObjectFormulaTree tree, byte level, int[] sizes)
        {
            MathFormula form = new MathFormula(level, sizes);
            MathSymbol  sym  = new SeriesSymbol(index);

            sym.Append(form);
            sym = new BracketsSymbol();
            sym.Append(form);
            form.Last[0] = FormulaCreator.CreateFormula(tree[0], level, sizes);
            form.Last[1] = new MathFormula((byte)(level + 1), sizes);
            return(form);
        }
예제 #6
0
        /// <summary>
        /// Creates formula
        /// </summary>
        /// <param name="tree">Operation tree</param>
        /// <param name="level">Formula level</param>
        /// <param name="sizes">Sizes of symbols</param>
        /// <returns>The formula</returns>
        public MathFormula CreateFormula(ObjectFormulaTree tree, byte level, int[] sizes)
        {
            MathFormula f    = FormulaCreator.CreateFormula(tree[0], level, sizes);
            MathFormula form = new MathFormula(level, sizes);
            AbsSymbol   root = new AbsSymbol();

            root.Append(form);
            form.First[0] = f;
            if (arity == 1)
            {
                return(form);
            }
            MathFormula p = FormulaCreator.CreateFormula(tree[1], (byte)((int)level + 1), sizes);

            form.First[1] = p;
            return(form);
        }
        /// <summary>
        /// Creates formula
        /// </summary>
        /// <param name="tree">Operation tree</param>
        /// <param name="level">Formula level</param>
        /// <param name="sizes">Sizes of symbols</param>
        /// <returns>The formula</returns>
        public MathFormula CreateFormula(ObjectFormulaTree tree, byte level, int[] sizes)
        {
            MathFormula form = new MathFormula(level, sizes);
            MathFormula f    = new MathFormula(level, sizes);
            MathSymbol  sym  = null;

            if (symbol == '-')
            {
                sym = new BinarySymbol('-');
            }
            else
            {
                sym = new SimpleSymbol(symbol, false, (byte)FormulaConstants.Unary);
            }
            sym.Append(form);
            sym = new BracketsSymbol();
            sym.Append(form);
            form.Last.Children[0] = FormulaCreator.CreateFormula(tree[0], level, sizes);
            form.Last.Children[1] = new MathFormula((byte)(level + 1), sizes);
            return(form);
        }