예제 #1
0
            public Flow ToFlow(Lst <Equation> eqs, Style style)
            {
                // this is a bit redundant because eventually we call Flow.Normalize, but Normalize does not handle pos, etc.
                Flow result;

                if (op == "id")
                {
                    result = Monomial.ToFlow(args[0], eqs, style);
                }
                else if (op == "time")
                {
                    result = Flow.zero;
                }
                else if (op == "poly 1/[]")
                {
                    Flow arg0 = Monomial.ToFlow(args[0], eqs, style);
                    if (arg0 is NumberFlow num)
                    {
                        result = new NumberFlow(1 / num.value);
                    }
                    else
                    {
                        result = OpFlow.Op(Flow.one, "/", arg0);
                    }
                }
                else if (op == "poly []^(1/[])")
                {
                    Flow arg0 = Monomial.ToFlow(args[0], eqs, style);
                    Flow arg1 = Monomial.ToFlow(args[1], eqs, style);
                    if (arg0 is NumberFlow num0 && arg1 is NumberFlow num1)
                    {
                        result = new NumberFlow(Math.Pow(num0.value, 1 / num1.value));
                    }
                    else
                    {
                        result = OpFlow.Op(arg0, "^", OpFlow.Op(Flow.one, "/", arg1));
                    }
                }