Re: Array formulas, piecewise functions



Hi Steve,

I'm using the Gnumeric v1.6 and it return numeric values for me, to the
function (2). I used de following expression:

=if(and(0<A1,A1<1),0.5*A1^2,if(and(1<A1,A1<2),-(A1^2-3*A1+3/2),if(and(2<A1,A1<3),0.5*(3-A1)^2,0)))


Luciano Wolf
INdT


Stephen R Laniel wrote:
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



------------------------------------------------------------------------

_______________________________________________
gnumeric-list mailing list
gnumeric-list gnome org
http://mail.gnome.org/mailman/listinfo/gnumeric-list




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