# I Best fit of a function containing costants with error

1. May 16, 2017

### RaamGeneral

Hi.

Suppose I have a function $y=f(a,b;p;x)$ where a, b are known with some uncertainty and x, y were measured multiple times.
I want to find p through best fit.

I consider a, b to be gaussian variable.

I can imagine multiple ways to do this:
* I consider a, b parameters like p. I don't like this, moreover with the function I'm working on, I get uncertainties orders of magnitude greater than the value of the parameters.
* I ignore the uncertainties for a, b and proceed to do a numerical fit for parameter p like I would normally do.
* I thought I could make a large number of fits where a, b get gaussian-random values and obtain the probability distribution of p (I ignore the std dev given by the fits). Supposing this makes sense, how do I get the uncertainty for p from his probability distribution if this is not a gaussian function?

The function I'm working on is $$v(t) = \frac{F_T}{ \lambda} \ln \left( \frac{M_0 }{M_0 - \lambda t } \right)- gt$$ where $F_T$ is known exactly and $M_0$ is the parameter.
$\lambda$ and $g$ are known with uncertainties.

Thank you very much for any advice.
I have another problem, again with uncertainties, that arises from the same exercise. I will make another post in the future about that.

2. May 17, 2017

### BvU

Hello general,

You should be more specific. Not clear to me what T is in $F_T$. Is $F$ a constant or a function ?

And a bit clearer: Why start with $f(a,b,p,x)$, and then continue with a function $v(\lambda, g, M_0, t)$ (did I make the right reverse translation ?) ?

Do you have a heap of measurement series $v(t)$ with different $\lambda$ ? What is v, what is $\lambda$ ?

Is it feasible to develop the ln as a taylor series ${\lambda\over M_0} t + ... \$? That way you get rid of $\lambda$ -- if $M_0 >> \lambda$.

What are the dimensions ? $M_0$ looks like a mass but is a length ?

3. May 17, 2017

### RaamGeneral

$f(a,b;p;x)$ was generic to describe the problem; in my case the function is $v(\lambda,g;M_0;t)$. $F_T=45000$ N (newtons) exactly.

I have a bunch of t measured with error, and the respective v measure with error. The parameter to fit is $M_0$.

This function describes the velocity in (function of) time considering a thrust of 45000N that reduces the mass by $\lambda t$. $\lambda$ has the dimension of Kg/s.

$\lambda$ and g were estimated with uncertainties by other means.

I could use taylor, but I'd like to have also the exact result. Moreover, if I use taylor I still have g, which has uncertainty, which is the problem I'm posing.

Yesterday I tried gaussian generating $\lambda$ 10000 times (keeping g fixed to his best estimate) and making an histogram of the best fits of $M_0$. I got a gaussian shape and the sigma was negligible compared to the sigma given by the fits. I'm not surprised because $\lambda$ disappears in taylor.
I tried the same thing with g. This time the sigma was not negligible.

I thought I could sum the two sigmas in quadrature and consider this the solution of my problem. But I'm not sure it's correct.

I also gaussian generated both $\lambda$ and g, 10000 times at the same time. Maybe this is better than keeping one fixed and generating the other.

4. May 18, 2017

### BvU

Hats off for the thorough work !
If all is well, there should be no big difference and both ways come with the error in g ?

So you analyze a series of experiments where $M_0$ is to be determined ? One single $M_0$ or one per launch ?
Pretty hefty $F_T$ -- how do you know it's determined perfectly and the same each time ?

5. May 18, 2017

### BvU

And: about the formula. It starts off with $\Bigl( {F_T\over M_0}-g\Bigr)t$ but goes to infinity for $\lambda t \rightarrow M_0$ which prompts me to ask if it is sufficiently valid for the range of $t$ in your experiments. Surely there is the mass of the hull to consider too ?

6. May 18, 2017

### RaamGeneral

My ispiration for the problem comes from here:

Considering the free falling ship, I want to find the height (or the time) at which I can turn on the full thrust and let it land at zero speed. The algebrical problem is not difficult (altough the solution is found numerically) but I also know that saying $\tau=6.74$s is meaningless without any indication of uncertainties.

$M_0$ comprises the mass of the ship and the initial mass of the fuel. I also assume (and verify) that for the time intervals considered the fuel won't end.
From that minigame there are missing some parameters that I need in order to solve the problem. I got them through "experiments": $g, \lambda, M_0$.

My subproblem is now to propagate $g, \lambda$ errors to get an uncertainty for $M_0$.

The next thing I need to do is to propagate the errors of these three parameters when solving the following system of equations:
$$y(T,\tau)=0 \\ \dot{y}(T,\tau)=0$$

where T is the total time and $\tau$ the time when the thrust is turned on.

This was the second problem I was going to pose. But I see I could use the same technique: gaussian generating the parameters, solving numerically, and plotting the histogram.

My friend also had another idea: because in this particular system I can separate T and $\tau$ for each function like this:
$$y(T,\tau)=f(T) - g(\tau)=0 \\ \dot{y}(T,\tau)=h(T) - p(\tau) =0$$
$$f(T)=g(\tau) \\ h(t)=p(\tau)$$

So, he says, the uncertainty on the evaluation of f is the same as the uncertainty on g.
Expanding both function I obtain a system of equations with the unkown $\sigma_T,\sigma_\tau$.