On Wed, Jul 29, 2009 at 10:27 AM, Bala subramanian<[email protected]> wrote: > I have to do the following: > > Eq 1) F = A * FB + (1-A) FO --------- (1) > > Eq 2) A = 1/2a0 [ ( ao + x + bo) - { ( ao + x + bo)2 - 4 aobo ) }0.5 ] > ............................. (2) > > KNOWN: F, FB, FO, ao, > UNKNOWN: bo > > I have to fit the data first to Eq 1, find A and then fit it to Eq 2 to find > bo. I know python programming but am very new to this kind of analysis. I > would greatly appreciate if you could provide me some guidance on how to do > the same. > > Thanks, > Bala >
It's good practice to reply-all to a mailing list and not to top post (replying at the top of an email), so it's easier to read and follow the discussion. What is your fitting criterion? Ie., are you trying to minimize the sum of squared errors (least squares), etc. There are different fitting criteria depending on what kind of data you have and where your noise is expected to come from. It looks like you could do this with a least squares fit if you want, putting linear constraints on the coefficients (which should be a part of the scipy.models soon), or you could rearrange the equations to get your unknown in only one place. Eq 1 would then be F = FO + A * (FB - FA) You can do similarly for equation 2 I think but didn't look closely. I'm still not sure what everything is in those equations. If you ask over on the scipy-user list and include the equations and a data example, you will almost certainly get some more help. Cheers, Skipper > > On Wed, Jul 29, 2009 at 3:59 PM, Skipper Seabold <[email protected]> > wrote: >> >> On Wed, Jul 29, 2009 at 9:42 AM, Eike Welk<[email protected]> wrote: >> > On Wednesday 29 July 2009, Bala subramanian wrote: >> >> Friends, >> >> >> >> I wish to do some curve fitting with python by defining my own >> >> equations. Could someone please give some guidance or examples on >> >> doing the same. >> > >> >> What kind of curve fitting exactly? Linear equations? Can you >> provide an example? >> >> > You can use the Numpy/Scipy libraries for that. I think they have >> > examples for curve fitting on their website. But unfortunately the >> > website is down (or my Internet is broken). >> > >> > http://www.scipy.org/ >> > >> >> There were some problems with the site yesterday as well. Scipy would >> be a good place to start. I am in the home stretch of completing a >> google summer of code project to integrate some mostly linear >> statistical models (different flavors of least squares fitting, >> generalized linear models, robust statistics, generalized additive >> models, etc.) into SciPy, which might also be of interest to you >> depending on your needs (some info here >> <http://scipystats.blogspot.com/>). There are also some "cookbook" >> examples from the scipy page that show some recipes for doing some >> basic curve fitting (OLS, interpolation) with the available tools. >> >> > There are also special mailing lists for Numpy/Scipy/Matplotlib users, >> > to which you should subscribe. This one would be good for your >> > question: >> > http://projects.scipy.org/mailman/listinfo/scipy-user >> > >> > >> > If I understand you right, you have a formula with some parameters. >> > Now you are searching for parameter values so that the formula really >> > goes through the data points. This is a task for optimization >> > functions. >> > >> > Kind regards, >> > Eike. >> > _______________________________________________ >> > Tutor maillist - [email protected] >> > http://mail.python.org/mailman/listinfo/tutor >> > >> _______________________________________________ >> Tutor maillist - [email protected] >> http://mail.python.org/mailman/listinfo/tutor > > _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
