예제 #1
0
            public static MathObject ExpandProduct(this MathObject r, MathObject s)
            {
                if (r is Sum)
                {
                    var f = (r as Sum).elts[0];

                    return f.ExpandProduct(s) + (r - f).ExpandProduct(s);
                }

                if (s is Sum) return s.ExpandProduct(r);

                return r * s;
            }
예제 #2
0
            public static MathObject ExpandProduct(this MathObject r, MathObject s)
            {
                if (r is Sum)
                {
                    var f = (r as Sum).elts[0];

                    return f.ExpandProduct(s) + (r - f).ExpandProduct(s);
                }

                if (s is Sum) return s.ExpandProduct(r);

                return r * s;
            }
예제 #3
0
            public static MathObject ExpandProduct(this MathObject r, MathObject s)
            {
                while (true)
                {
                    if (r is Sum)
                    {
                        MathObject f = ((Sum)r).elts[0];

                        return(f.ExpandProduct(s) + (r - f).ExpandProduct(s));
                    }
                    if (s is Sum)
                    {
                        var r1 = r;
                        r = s;
                        s = r1;
                        continue;
                    }
                    return(r * s);
                }
            }