# Shared parameter in TF1 function

Is there an easy way to share a parameter in a TF1 function?
Something like func1->ShareParameter(…) ?

I have two data sets which follow a a/x^b function, whereby the parameter b (the slope) is the same for both data sets.

Thanks

Hi Mary, Queen of Scots, welcome to the forum

…and the other parameters are expected to be different for the two samples, right? @moneta will probably give you a better answer - my “preliminary” one is:

You could have two nested minimizations:

1. outer: find the optimal b
2. inner: find optimal parameters for set 1 (given b), find optimal parameters for set 2 (given the same b), return the sum of \chi^2 (or whatever it is you’re using as the goodness of fit measure) from set 1 and 2 as the goodness of fit for b.
1 Like

Hi,

I guess what you would like to do is a combined fit to the two data set. For doing this, look at this tutorial:

Cheers

Lorenzo

2 Likes

Yessssss! That is exactly what I was looking for! Thanks a lot

I already integrated this in my code and it works.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.