Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7313
| From | Bill Rowe <readnews@sbcglobal.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: variable amount of Interpolation points |
| Date | 2011-12-17 07:53 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jchhp8$il1$1@smc.vnet.net> (permalink) |
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}
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: variable amount of Interpolation points Bill Rowe <readnews@sbcglobal.net> - 2011-12-17 07:53 +0000
csiph-web