Best way to fit three functions

In summary, the conversation discusses the problem of finding the best values for x, y, z, and t that fit a set of data for three nonlinear functions. One suggestion is to minimize the sum of squared residues for all data points simultaneously, using Newton's approximation method or a similar algorithm. Another suggestion is to define a fit quality function and use a program for minimization.
  • #1
LCSphysicist
646
162
TL;DR Summary
I have basically three set of data, each set corresponding to a function, so that the data should fit the function, and each function is dependent of 4 parameters. How to find the best 4 parameters that fit it?
So I have $$f(x,y,z,t,n) = 0,g(x,y,z,t,n) = 0,h(x,y,z,t,n) = 0 $$ and i need to find the best ##[x,y,z,t]## that fit the data, where n is the variable. Now, the amount of data for each function is pretty low (2 pair for f (that is, two (n,f)), 3 pair for g and another 3 pair for h)

The main problem here is: the functions are highly non-linear. So i have no idea how can i write a program to find the best x,y,z,t!

I have thought of try to simultaneously minimize the residues, for example, for f:
$$R(f) = \sqrt{(f(x,y,z,t,n_1) - y_1)^2+(f(x,y,z,t,n_2) - y_2)^2}$$
(where y is the f obtained on thee data at n_1 (the pair i have cited above))

But this minimization subject to the condition that ##R(g), R(h)## (here, three terms) also be minimum. So maybe i could use Lagrangian method:
$$dR(h) = \lambda dR(g) + \mu dR(h)$$
But this is going to be extremelly massive and tedius to write a code, and the code will take days to run. As i said, the functions are non-linear.

Any method suggestion? or program suggestion?
 
Mathematics news on Phys.org
  • #2
Extremely massive and tedious is probably the best you can get. If it was one occurrence, I'd advise WolframAlpha or plot the 3 functions and visually pick the best fit (further improved with Newton's approximation method).

For now I'd advise to combine the requirements for all the data points on f, g and h and rewrite them as ##function - data = 0## and then the square of the left hand side must be minimal for all data points simultaneously: so take the derivative with respect to ##n## of these squares all added up and approximate where this formula in ##n## equals 0 using Newton's approximation method or some better root finding algorithm.

Wiki on Newtons method
 
Last edited:
  • Like
Likes mfb
  • #3
You'll need to decide what you consider "best fit". Write that down mathematically as fitquality(x,y,z,t), then feed it in a program for minimization.

The sum of squared residues for all data points (data point minus the applicable function) sounds like a good start.
 
  • Like
Likes Maarten Havinga

FAQ: Best way to fit three functions

What is the best way to fit three functions?

The best way to fit three functions is to first identify the purpose and goal of fitting these functions. This will help determine the most appropriate approach and method to use. It is also important to consider the complexity and interdependence of the functions, as well as the available data and resources.

Can I use a single model to fit three functions?

It is possible to use a single model to fit three functions, but it may not always be the most accurate or efficient approach. Depending on the nature of the functions, it may be more appropriate to use separate models for each function or to combine multiple models to fit all three functions simultaneously.

What factors should I consider when fitting three functions?

When fitting three functions, it is important to consider the data quality and quantity, the complexity of the functions, the assumptions and limitations of the chosen model, and the overall goal of the analysis. It may also be helpful to consult with other experts or conduct sensitivity analyses to ensure the validity and robustness of the results.

How do I determine the accuracy of a fitted model for three functions?

The accuracy of a fitted model for three functions can be evaluated using various metrics such as mean squared error, R-squared, and root mean square error. These metrics can help assess how well the model fits the data and how much of the variation in the data is explained by the model. It is also important to validate the model using independent data or through cross-validation techniques.

Are there any specific software or tools that can help with fitting three functions?

Yes, there are various software and tools available that can assist with fitting three functions. Some commonly used tools include statistical software such as R, Python, and SAS, as well as specialized software for specific types of functions such as nonlinear regression or time series analysis. It is important to choose a tool that is suitable for the specific functions and data being analyzed.

Similar threads

Replies
11
Views
1K
Replies
13
Views
2K
Replies
2
Views
2K
Replies
1
Views
765
Replies
1
Views
919
Replies
13
Views
2K
Back
Top