help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: series


From: Macy
Subject: RE: series
Date: Wed, 14 Aug 2013 11:49:33 -0700

Hope you learn by example...

The best way to handle any problem is to first make the problem SMALL, then 
learn from it.

What if the series had been limited to only 5 terms:
1 -3 5 -7 9 
then you'd see a VERY simple pattern. After 1, for every pair of terms you gain 
only 2, in this case the summation is 1 +2 +2 =5, which is EXACTLY equal to the 
number of terms! Now, all you have to do is find out how many terms it takes to 
get to 1001 and you can stop.
>From the simple example, the number of terms is the last number plus 1, 
>(9+1)/2 = 5, so if the last number is 1001 that yields (1001+1)/2 or 501


Or, you could gain skills using octave with...

Split the series.
x=2*[0:2:500]+1;x(1),x(251)
y=-(2*[1:2:500]+1);y(1),y(250)

Combine the two:
z=zeros(1,501);
z(1:2:501)=x;
z(2:2:500)=y;

Find the result:
sum(z)


Play around, practice. One solution doesn't teach nearly as much as learning 
the PROCESS.




--- address@hidden wrote:

From: <address@hidden>
To: <address@hidden>, <address@hidden>
Subject: RE: series
Date: Wed, 14 Aug 2013 16:57:13 +0000

Juli,

> -----Original Message-----
> From: address@hidden [mailto:help-octave-
> 
> Can you please assist with evaluating the following:
> 1-3+5-7+9-...+1001 using Octave

That's a variation on an old puzzle.  You don't need Octave, you
can probably do it in your head if you think about how you can
combine terms together to simplify it.  If you're required to use
Octave, think about splitting it into two different series, one
positive and the other negative.  Then you can use Octave's
ability to make sequences of numbers and do it in one line.  The
slow complicated way would be use a for-next loop.

Regards,
Allen
_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave




reply via email to

[Prev in Thread] Current Thread [Next in Thread]