Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Re: Data averages by time of day

by tsee (Curate)
on Feb 28, 2004 at 18:48 UTC ( [id://332503]=note: print w/replies, xml ) Need Help??


in reply to Re: Data averages by time of day
in thread Data averages by time of day

To get at the formula that results from the approximation, try this: (The normal Math::Approx methods also work on Math::Approx::Symbolic objects.)
use Math::Approx::Symbolic; my %data = ( (7*60+1) => 82, (23*60+48) => 188, ); my $approx = Math::Approx::Symbolic->new(undef, 3, %data); my $sym = $approx->symbolic(); print "$sym\n"; my $prettier = $sym->to_latex(); print "$prettier\n"; # Computing y-values: print $sym->value(x => time_of_day()), "\n"; # Doing that faster: use Math::Symbolic::Compiler; my ($closure) = $sym->to_sub(); print $closure->(time_of_day()), "\n"; # Way faster: use Math::Symbolic::Custom::CCompiler; my $inlined_c = $sym->to_compiled_c(); print $inlined_c->(time_of_day()), "\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://332503]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-04-16 05:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found