Re: Better median function?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Correction of my last mail:

function mg(sequence s) -- geometric mean
    atom p              -- only for s[i]>0!!
    intrger l
    l = length(s)
    if l then
        p = s[1]        -- !!!!!!!!
        for i = 2 to l
            if s[i] > 0 then
                p *= power(s[i],l)
            else
                return {}
            end if
        end for
        return p
    else
    return s
    end if
end function

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu