Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7313 > unrolled thread

Re: variable amount of Interpolation points

Started byBill Rowe <readnews@sbcglobal.net>
First post2011-12-17 07:53 +0000
Last post2011-12-17 07:53 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: variable amount of Interpolation points Bill Rowe <readnews@sbcglobal.net> - 2011-12-17 07:53 +0000

#7313 — Re: variable amount of Interpolation points

FromBill Rowe <readnews@sbcglobal.net>
Date2011-12-17 07:53 +0000
SubjectRe: variable amount of Interpolation points
Message-ID<jchhp8$il1$1@smc.vnet.net>
On 12/16/11 at 5:53 AM, konstantinweixelbaum@googlemail.com (Konny)
wrote:

>Is there a way to iterate inside an interpolation??

>I am thinking to make the amount of interpolation points variable.

>I tried this, but had no luck

>Interpolation[{For[i = 0, i < 4, i++, {i, 2 i}]}]

This doesn't work because For returns a Null and there is
nothing to interpolate. You can achieve your intent with:

Interpolation[Table[{k, 2 k}, {k, 0, 3}]]

Bottom line: don't use For. And if you want another reason to
not use For consider:

In[3]:= AbsoluteTiming[
  For[sum = k = 0, k <= 1000000, k++, sum += k]; sum]

Out[3]= {1.713264,500000500000}

In[4]:= AbsoluteTiming[Total@Range[1000000]]

Out[4]= {0.224719,500000500000}

In[5]:= AbsoluteTiming[Sum[n, {n, m}] /. m -> 1000000]

Out[5]= {0.077688,500000500000}

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web