help-octave
[Top][All Lists]
Advanced

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

Re: Simple routine won't run.


From: David Mebane
Subject: Re: Simple routine won't run.
Date: Thu, 26 Jul 2007 11:08:12 -0400
User-agent: Internet Messaging Program (IMP) 3.2.5

Yes, perhaps it's a case of 1:00-in-the morning syndrome.  Sorry.


Quoting kensmith <address@hidden>:

> On Wednesday 25 July 2007 21:33, David Mebane wrote:
> > Hello
> >
> > Have written a (very first) octave routine:
> >
> > [begin code]
> > function fun=ent3(d)
> >
> > x31=0;
> > for i = 0:1
> > for j = 0:1
> > for k = 0:1
> > x31
> > +=(d^i*(1-d)^(1-i)*(d/2)^(k+j)*(1-d/2)^(2-k-j))*log(d^i*(1-d)^(1-i)*(
> >d/2)^(k+j)*(1-d/2)^(2-k-j)); endfor
> > endfor
> > endfor
> >
> > x21=0;
> > for i=0:1
> > for j=0:1
> > x21 +=
> > (d^i*(1-d)(1-i)*(d/2)^j*(1-d/2)^(1-j))log(d^i*(1-d)(1-i)*(d/2)^j*(1-d
>
> What is just before the "log" ?
>
>
> >/2)^(1-j)); endfor
> > endfor
> >
> > x22=0;
> > for j=0:1
> > for k=0:1
> > x22 += (d/2)^(k+j)*(1-d/2)^(2-k-j)log((d/2)^(k+j)*(1-d/2)^(2-k-j));
> > endfor
> > endfor
> >
> > fun = -12*x31 + 16*x21 + 6*x22 - 5(d*log(d) + (1-d)*log(1-d));
> >
> > endfunction
> > [end code]
> >
> > Running this gets me:
> >
> > [begin octave]
> > octave:5> ent3(0.1)
> > parse error near line 16 of file /home/dm215/Desktop/ent3.m
> >
> >   syntax error
> >
> > >>> x21 +=
> >
> > (d^i*(1-d)(1-i)*(d/2)^j*(1-d/2)^(1-j))log(d^i*(1-d)(1-i)*(d/2)^j*(1-d
> >/2)^(1-j)); ^
> >
> > error: `ent3' undefined near line 5 column 1
> > [end octave]
> >
> > which I don't completely understand.  Any thoughts?
> >
> >
> > Thanks,
> > -David
> >
> >
> >
> >
> > _______________________________________________
> > Help-octave mailing list
> > address@hidden
> > https://www.cae.wisc.edu/mailman/listinfo/help-octave
>
> --
> address@hidden
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>



reply via email to

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