The connection to PERL is simply that I'm writing my code in PERL. Here's the example code I'm playing with for transformative functions:
#!/usr/bin/perl use strict; use warnings; my @values = (-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0 +.2, -0.1, 0, 0.1, 0.111111, 0.12, 0.13, 0.16, 0.19, 0.2, 0.21, 0.2 +2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.00001, 1.001, 1. +1, 1.2, 1.3, 1.8, 1.9, 2.000001, 2.001, 2.1, 2.11, 2.2, 2.3, 2.4 +, 3.1, 4, 5, 6, 7, 8, 9, 10, 1.16873493792849e-06, 1088.99977561893); my $wval; my $wexp; my $wtanh; my $wfisher; my $we2; # http://mathworld.wolfram.com/HyperbolicTangent.html sub tanh($) { my $in = shift; my $a = exp($in); my $b = exp(-$in); return ($a - $b) / ($a + $b); } # https://support.office.com/en-us/article/FISHER-function-D656523C-50 +76-4F95-B87B-7741BF236C69 sub fisher($) { my $in = shift; return 0 if $in == 1; my $a = (1 + $in) / (1 - $in); return 0 if $a <= 0; return 0.5 * log($a); } sub e2($) { my $in = shift; return 0 if $in == 1; return 0.5 * exp((1 + $in) / (1 - $in)); } map { $wval = $_; $wexp = exp($_); $wtanh = &tanh($_); $wfisher = &fisher($_); $we2 = &e2($_); write; } @values; format STDOUT_TOP = value exponent(e) tanh fisher e2 --------- -------------------- ----------------- --------------- ----- +---------- . format STDOUT = @###.#### @######.############ @###.############ @###.########## @###. +########## $wval, $wexp, $wtanh, $wfisher, $we2 .
Mike

In reply to Re^2: Transformative functions...? by edwyr
in thread Transformative functions...? by edwyr

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.