Array formulas, piecewise functions



Two questions:

1) I'm familiar with array formulas from Excel, such that
one can do formulas like

=sum(if(and($G$2:$G$30000>=H2,$G$2:$G$30000<H3),1,0))

which in this case produce a count of all those cells
between g2 and g30000 that lie between the values in h2 and
h3. If column H contains bins for a histogram, this formula
will list the frequencies for those bins. (Note that one has
to press Ctrl+Shift+Enter to make this array formula work.)

Gnumeric's documentation for array formulas is confusing:
http://www.gnome.org/projects/gnumeric/doc/sect-data-formulas.html

It shares a lot of similarities, apparently, with Excel's
array formulas, but it's not working for me. How do I have
to change the Excel formula to make it work in Gnumeric?

2) I have a piecewise function defined as follows:

f(t) = (1/2)t^2         , 0 < t < 1
     = -(t^2 - 3t + 3/2), 1 < t < 2
     = (1/2)(3-t)^2     , 2 < t < 3
     = 0                  elsewhere

In Excel, assuming t was in column A, I'd do something like
so:

=if(and(0<a1,a1<1),.5*a1^2,if(and(1<a1,a1<2),-(a1^2-3*a1+3/2),...))

It's a mess, but that's what I'd do.

I can't get that to work in Gnumeric; it's returning FALSE
or TRUE when it should be returning a value.

Can someone give me pointers on representing piecewise
functions in Gnumeric?

Thanks much,
Steve

-- 
Stephen R. Laniel
steve laniels org
+(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key

Attachment: signature.asc
Description: Digital signature



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