For Programmers: Free Programming Magazines  


Home > Archive > Mathematica > April 2005 > Re: FloorNot An Integer?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: FloorNot An Integer?
David Bailey

2005-04-28, 9:00 am

Scott Guthery wrote:
> I'm trying to use some of the NumericalMath approximations such as
> MiniMaxApproximation and RationalInterpolation with a function that
> includes array references of the form Array[[Floor[x]]]. The function
> plots and evaluates just fine but the NumericalMath functions are
> reporting the error:
>
> "Part::pspec: Part specification Floor[x] is neither an integer nor a
> list of integers."
>
> whereas the documentation states that Floor[x] IS an integer.
>
> What am I missing?
>
> Thanks for any insight.
>
> Cheers, Scott
>

Mathematica is complaining that at that point x did not have a value, so
Floor[x] remained unevaluated rather than presenting an integer to the
Part operation.

BTW, 'Array' is a built-in function - don't use it as a variable!

Presumably you expected x to have a value at this point, so perhaps you
should post a little more code - unless you have figured out the problem
by now.

David Bailey
dbaileyconsultancy.co.uk

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com