I don't think it is an integer because when you create the array you can 
assign float coefficients to each term in the Polynomial.

El lunes, 19 de mayo de 2014 20:56:54 UTC+2, Tim Holy escribió:
>
> What's the element type of p? If it's an integer type, there's your 
> problem. 
>
> --Tim 
>
> On Monday, May 19, 2014 10:32:38 AM Albert Díaz wrote: 
> > I'm designing a function to, given a p Polynomial, divide the 
> coefficient 
> > of each of its terms by the one in the first term. 
> > 
> > function divide(p) 
> > 
> > 
> > red=p[1] 
> > 
> > 
> >         for j=1:length(p) 
> > 
> > 
> >                 p[j]=p[j]/red 
> > 
> > 
> > 
> > 
> > 
> >         end 
> > 
> > 
> > return p 
> > 
> > 
> > end 
> > 
> > 
> > It used to work, but now, if the result in p[j]/red is not a whole 
> number, 
> > it throws me an InexactError(). However, if p[j]/red is a whole number, 
> I 
> > have no problems in reassigning the coefficient of p[j]. 
> > 
> > 
> > Why does that happen and how can I solve it? 
>

Reply via email to