Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10903 > unrolled thread

Re: Fitting a Complicated Function

Started byPeter Klamser <klamser@googlemail.com>
First post2012-07-13 06:56 +0000
Last post2013-08-02 06:47 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Fitting a Complicated Function Peter Klamser <klamser@googlemail.com> - 2012-07-13 06:56 +0000
    Re: Fitting a Complicated Function rdlady@gmail.com - 2013-08-02 06:47 +0000

#10903 — Re: Fitting a Complicated Function

FromPeter Klamser <klamser@googlemail.com>
Date2012-07-13 06:56 +0000
SubjectRe: Fitting a Complicated Function
Message-ID<jtogrl$qll$1@smc.vnet.net>
... Mathematica loves complex results, even when there is no need for it.

where are the data?

Peter

2012/7/10  <mpdgeorgin@gmail.com>:
> I'm trying to fit a very complicated function and I'm having some problems.
>
> Right now I'm trying to do a Constrained fit where my parameters are R,m,a.
>
> FindFit[data, {
>   Exp[-x/R] +
>    Exp[-x/R]*
>     Sum[((-a*x^(1 - m))^n)*
>       Hypergeometric1F1[-m*n, 1 + n - m*n, x/R]/
>        Gamma[1 + n - m*n], {n, 1, 15}], 1 < R < 30,
>   0 < a < .5, .4 < m < 1}, {R, m, a}, x]
>
> The error that appears is :
>
> Power:infy : infinite expression
> FindFit:nrmnum : the function value Indeterminate is not a real number at{R,m,a} = {2, 0.94, 0.45}
>
> This is strange because I can evaluate the function at these values and it gives me a real, finite result.
>
> I have a couple questions:
>
> 1) Is there a way to check what the Find fit function is actually doing? As in can I look at the code to see exactly where its going wrong.
>
> 2) What should my next step be? according to my PI, simplification of the function doesn't lead anywhere.
>
> Thanks
>
> Marcel
>

[toc] | [next] | [standalone]


#15273

Fromrdlady@gmail.com
Date2013-08-02 06:47 +0000
Message-ID<ktfkm3$4pa$1@smc.vnet.net>
In reply to#10903
I'm having a similar problem in Mathematica.
When I try to fit data to my formula I get errors like this:

p = Fit[data, {1, x, y, k, z, a, b, k/x, z/x, z/y, z/k, a/y, b/x, b/y, b/k, b/z, b/a }, {x, y, k, z, a, b}]

MathematicaScript -script script.m  | head


                                                 1
Power::infy: Infinite expression -- encountered.
                                                 0.

                                                 1
Power::infy: Infinite expression -- encountered.
                                                 0.

                                 
This is because some "a" and some "b" in my training set are zeros. How can I run linear regression with this formula (x, y, k, z, a, b, k/x, z/x, z/y, z/k, a/y, b/x, b/y, b/k, b/z, b/a ) without changing my a and b values?

On Friday, July 13, 2012 2:56:53 AM UTC-4, Peter Klamser wrote:
> ... Mathematica loves complex results, even when there is no need for it.
> 
> 
> 
> where are the data?
> 
> 
> 
> Peter
> 
> 
> 
> 2012/7/10  <mpdgeorgin@gmail.com>:
> 
> > I'm trying to fit a very complicated function and I'm having some problems.
> 
> >
> 
> > Right now I'm trying to do a Constrained fit where my parameters are R,m,a.
> 
> >
> 
> > FindFit[data, {
> 
> >   Exp[-x/R] +
> 
> >    Exp[-x/R]*
> 
> >     Sum[((-a*x^(1 - m))^n)*
> 
> >       Hypergeometric1F1[-m*n, 1 + n - m*n, x/R]/
> 
> >        Gamma[1 + n - m*n], {n, 1, 15}], 1 < R < 30,
> 
> >   0 < a < .5, .4 < m < 1}, {R, m, a}, x]
> 
> >
> 
> > The error that appears is :
> 
> >
> 
> > Power:infy : infinite expression
> 
> > FindFit:nrmnum : the function value Indeterminate is not a real number at{R,m,a} = {2, 0.94, 0.45}
> 
> >
> 
> > This is strange because I can evaluate the function at these values and it gives me a real, finite result.
> 
> >
> 
> > I have a couple questions:
> 
> >
> 
> > 1) Is there a way to check what the Find fit function is actually doing? As in can I look at the code to see exactly where its going wrong.
> 
> >
> 
> > 2) What should my next step be? according to my PI, simplification of the function doesn't lead anywhere.
> 
> >
> 
> > Thanks
> 
> >
> 
> > Marcel
> 
> >

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web