help-octave
[Top][All Lists]

## computation and summation is hard [question]

 From: Jonathan Camilleri Subject: computation and summation is hard [question] Date: Sun, 8 Nov 2015 11:48:05 +0100

I am trying to use Octave to compute some basic computational algorithms, and, might need a ride on someone's back if you do not mind:

f = @(x) nchoosek(5,x)*0.1.^x*0.9.^(5-x)
f =

@(x) nchoosek (5, x) * 0.1 .^ x * 0.9 .^ (5 - x)

>> sum(f([0:5]))
error: Invalid call to nchoosek.  Correct usage is:

-- Function File: C = nchoosek (N, K)
-- Function File: C = nchoosek (SET, K)

How do I call the function therefore?
Example required

error: called from
print_usage at line 90 column 5
nchoosek at line 96 column 5
at line -1 column -1
error: evaluating argument list element number 1
>> sum([1:5]);
>> ans = sum([1:5]);
>> ans
ans =  15

Using Octave v4 on Windows Server 2007 aka Longhorn.

I would like to try out more complex algorithms as well, I have a list at https://www.facebook.com/Techy-News-548957768563392/?fref=ts, if you look under the AI post, until it disappears from the top I guess.

I am trying to compare this with MathLab as well, but I have some stumbling blocks with MathLab.

Regards,

--
Jonathan Camilleri