in reply to Re: fitting double lognormal distribution on a dataset
in thread fitting double lognormal distribution on a dataset
G'day hdb,
... the documentation of Algorithm::CurveFit seems to specify that powers need to be written as x^n and not x**n.
Firstly, I will say that the first line of code in the Algorithm::CurveFit SYNOPSIS:
my $formula = 'c + a * x^2';
is written in a way that suggests this intent
$ perl -MO=Deparse,-p -e 'my $formula = $c + $a * $x**2;' (my $formula = ($c + ($a * ($x ** 2)))); -e syntax OK
more than it does this one
$ perl -MO=Deparse,-p -e 'my $formula = $c + $a * $x^2;' (my $formula = (($c + ($a * $x)) ^ 2)); -e syntax OK
However, further down they have
The formula should be a string that can be parsed by Math::Symbolic.
The doco for that module has
Warning: The operator to use for exponentiation is the normal Perl operator for exponentiation **, NOT the caret ^ which denotes exponentiation in the notation that is recognized by the Math::Symbolic parsers! The ^ operator will be interpreted as the normal binary xor.
[Update (cosmetic): 2 instances of quoting my own code — <blockquote>s removed.]
-- Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: fitting double lognormal distribution on a dataset
by hdb (Monsignor) on May 18, 2013 at 19:04 UTC | |
by sdani (Novice) on May 19, 2013 at 03:48 UTC |