Algebra.js
function(symbol, c) { 
            this.variable = variables(symbol)[0]; 
            if(!symbol.isPoly()) throw core.exceptions.NerdamerTypeError('Polynomial Expected! Received '+core.Utils.text(symbol));
            c = c || [];
            if(!symbol.power.absEquals(1)) symbol = _.expand(symbol);

            if(symbol.group === core.groups.N) { c[0] = symbol.multiplier; }
            else if(symbol.group === core.groups.S) { c[symbol.power.toDecimal()] = symbol.multiplier; }
            else { 
                for(var x in symbol.symbols) { 
                    var sub = symbol.symbols[x],
                        p = sub.power; 
                    if(core.Utils.isSymbol(p)) throw new core.exceptions.NerdamerTypeError('power cannot be a Symbol');

                    p = sub.group === N ? 0 : p.toDecimal();
                    if(sub.symbols){ 
                        this.parse(sub, c);  
                    }
                    else { 
                        c[p] = sub.multiplier; 
                    }
                }
            }

            this.coeffs = c;

            this.fill();
        }
function(symbol, c) { 
            this.variable = variables(symbol)[0]; 
            if(!symbol.isPoly()) throw core.exceptions.NerdamerTypeError('Polynomial Expected! Received '+core.Utils.text(symbol));
            c = c || [];
            if(!symbol.power.absEquals(1)) symbol = _.expand(symbol);

            if(symbol.group === core.groups.N) { c[0] = symbol.multiplier; }
            else if(symbol.group === core.groups.S) { c[symbol.power.toDecimal()] = symbol.multiplier; }
            else { 
                for(var x in symbol.symbols) { 
                    var sub = symbol.symbols[x],
                        p = sub.power; 
                    if(core.Utils.isSymbol(p)) throw new core.exceptions.NerdamerTypeError('power cannot be a Symbol');

                    p = sub.group === N ? 0 : p.toDecimal();
                    if(sub.symbols){ 
                        this.parse(sub, c);  
                    }
                    else { 
                        c[p] = sub.multiplier; 
                    }
                }
            }

            this.coeffs = c;

            this.fill();
        }
function ( symbol , c ) { this . variable = variables ( symbol ) [ 0 ] ; if ( ! symbol . isPoly ( ) ) throw core . exceptions . NerdamerTypeError ( 'Polynomial Expected! Received ' + core . Utils . text ( symbol ) ) ; c = c || [ ] ; if ( ! symbol . power . absEquals ( 1 ) ) symbol = _ . expand ( symbol ) ; if ( symbol . group === core . groups . N ) { c [ 0 ] = symbol . multiplier ; } else if ( symbol . group === core . groups . S ) { c [ symbol . power . toDecimal ( ) ] = symbol . multiplier ; } else { for ( var x in symbol . symbols ) { var sub = symbol . symbols [ x ] , p = sub . power ; if ( core . Utils . isSymbol ( p ) ) throw new core . exceptions . NerdamerTypeError ( 'power cannot be a Symbol' ) ; p = sub . group === N ? 0 : p . toDecimal ( ) ; if ( sub . symbols ) { this . parse ( sub , c ) ; } else { c [ p ] = sub . multiplier ; } } } this . coeffs = c ; this . fill ( ) ; }
Converts Symbol to Polynomial
@param {Symbol} symbol
@param {Array} c - a collector array
@returns {Polynomial}
Converts Symbol to Polynomial