[SciPy-User] fit with 3 parameters ok, fit with 4 is going wrong!

Eric Hermes ehermes at chem.wisc.edu
Thu Feb 6 15:15:05 EST 2014



On Thursday, February 06, 2014 2:10:16 PM, Daπid wrote:
> On 6 February 2014 20:00, Gabriele Brambilla
> <gb.gabrielebrambilla at gmail.com
> <mailto:gb.gabrielebrambilla at gmail.com>> wrote:
>
>     No, written in this way it is wrong. In the exponential I need:
>     (-x0/c)**d ; NOT (-x0/c)*d. Maybe I'm writing it in the wrong way
>     in Python...I attach an image with the function I want to write.
>
>
> Then, your function has a misplaced parenthesis. Usually, IDEs can
> tell you which parenthesis closes which one, so you can see if you are
> writing what you want. (See attached a couple of examples with vi).
>
> See if this fixes your original problem:
>
> a * x0**-b * np.exp(-(x0 / c)**d)

This is also not the same as Gabriele's original expression.  Observe 
that (-x0/c)**d != -(x0/c)**d.  The former case is the original 
expression, which is complex when x0/c is positive and d is 
non-integer.  This is the root cause of Gabriele's issue.

Eric

>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

--
Eric Hermes
J.R. Schmidt Group
Chemistry Department
University of Wisconsin - Madison



More information about the SciPy-User mailing list