<div dir="ltr"><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">Hi everyone! Total <span class="gmail-il">Numpy</span> newbie here.</p><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">I'd like to create an array with a million numbers, that has a sine wave with exponential decay on the amplitude.</p><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">In other words, I want the value of each cell <code style="margin:0px;padding:1px 5px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;font-size:13px;vertical-align:baseline;box-sizing:inherit;background-color:rgb(239,240,241);white-space:pre-wrap">n</code> to be <code style="margin:0px;padding:1px 5px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;font-size:13px;vertical-align:baseline;box-sizing:inherit;background-color:rgb(239,240,241);white-space:pre-wrap">sin(n) * 2 ** (-n * factor)</code>.</p><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">What would be the most efficient way to do that?</p><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">Someone suggested I do something like this: </p><pre class="gmail-m_3550683175654527263gmail-lang-py gmail-m_3550683175654527263gmail-prettyprint gmail-m_3550683175654527263gmail-prettyprinted" style="white-space:pre-wrap;margin-top:0px;margin-bottom:1em;padding:12px 8px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;background-color:rgb(239,240,241);border-radius:3px;color:rgb(57,51,24)"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:inherit"><span class="gmail-m_3550683175654527263gmail-pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)">y </span><span class="gmail-m_3550683175654527263gmail-pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)">=</span><span class="gmail-m_3550683175654527263gmail-pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)"> np</span><span class="gmail-m_3550683175654527263gmail-pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)">.</span><span class="gmail-m_3550683175654527263gmail-pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)">sin</span><span class="gmail-m_3550683175654527263gmail-pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)">(</span><span class="gmail-m_3550683175654527263gmail-pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)">x</span><span class="gmail-m_3550683175654527263gmail-pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)">)</span><span class="gmail-m_3550683175654527263gmail-pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)"> </span><span class="gmail-m_3550683175654527263gmail-pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)">*</span><span class="gmail-m_3550683175654527263gmail-pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)"> np</span><span class="gmail-m_3550683175654527263gmail-pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)">.</span><span class="gmail-m_3550683175654527263gmail-pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)">exp</span><span class="gmail-m_3550683175654527263gmail-pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)">(</span><span class="gmail-m_3550683175654527263gmail-pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)">newfactor </span><span class="gmail-m_3550683175654527263gmail-pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)">*</span><span class="gmail-m_3550683175654527263gmail-pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)"> x</span><span class="gmail-m_3550683175654527263gmail-pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;color:rgb(48,51,54)">)</span></code></pre><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">But this would create 2 arrays, wouldn't it? Isn't that wasteful? Does <span class="gmail-il">Numpy</span> provide an efficient way of doing that without creating a redundant array?</p><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both"><br></p><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">Thanks for your help,</p><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px 0px 1em;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">Ram Rachum.</p></div>