# [SciPy-User] fitting data

Bala subramanian bala.biophysics@gmail....
Thu Jul 30 02:22:50 CDT 2009

```Sorry for not giving clear info. in my previous mail.

Actually, i have two equations 1) f = a * fb + (1-a) fo, where f, fb, fo are
known

and 2) a = 1/2ao[ (ao + x + bo) - { (ao + x + bo)2 - 4 ao bo }0.5 ]

>From eq 1, i should get 'a' and then i use this in eq 2 to find bo.

On Thu, Jul 30, 2009 at 7:49 AM, Johann Cohen-Tanugi <cohen@lpta.in2p3.fr>wrote:

> I thinkk he means that f0 and fb are two known function of x, and he is
> interested in the weight parameter a.
> You can try :
> from scipy import optimize
> def func(x,a): return a * fb(x) + (1-a) fo(x)
> fitp,cov=optimize.curve_fit(func,x,p)
>
> that is one of many options....
> Johann
>
>
>
> Chris Colbert wrote:
> > maybe i don't understand what you are asking, but if (a) is your only
> > unknown, just do:
> >
> > a = (f - f0) / (fb - f0)
> >
> >
> >
> > On Thu, Jul 30, 2009 at 1:32 AM, Bala
> > subramanian<bala.biophysics@gmail.com> wrote:
> >
> >> Friends,
> >>
> >> I am new and just joined the scipy community. I want to fit (least sq.
> fit)
> >> my data to the following equation. I would greatly appreciate if someone
> >> could help me with a sample code on how fitting is done with scipy.
> >>
> >> The function is : f = a * fb + (1-a) fo, where f, fb, fo are known.
> >>
> >> Regards,
> >> Bala
> >>
> >>
> >>
> >> _______________________________________________
> >> SciPy-User mailing list
> >> SciPy-User@scipy.org
> >> http://mail.scipy.org/mailman/listinfo/scipy-user
> >>
> >>
> >>
> > _______________________________________________
> > SciPy-User mailing list
> > SciPy-User@scipy.org
> > http://mail.scipy.org/mailman/listinfo/scipy-user
> >
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20090730/eb5509dd/attachment.html
```