You can do that by composing my answer with japhy's:

$l2 = 5; $h2 = 15; @data = ( 0.03, 0.1, 0.15, 0.5, 0.7 ); # exponential normalization $l1 = 0.03; $h1 = 0.7; ($l1,$h1) = map { 10**$_ } ($l1,$h1); @normalized = map { $l2 + (10**$_ - $l1) * ($h2 - $l2) / ($h1 - $l1) } @data; print " @normalized \n"; # 5 5.47560740136863 5.86545098040508 10.306017857952 15 # logarithmic normalization $l1 = 0.03; $h1 = 0.7; ($l1,$h1) = map { log($_) } ($l1,$h1); @normalized = map { $l2 + (log($_) - $l1) * ($h2 - $l2) / ($h1 - $l1) } @data; print " @normalized \n"; # 5 8.82227791363971 10.1095165638026 13.9317944774423 15

In reply to Re: Re: number normalization by fglock
in thread number normalization by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.