Gnuplot: другой способ написать одну и ту же функцию в 1d и 2d

258
Sunil

Я запутался в следующем типе функций

f(x) = b/x**nb * exp(y_(y)/k)  f(x,y) = (b/(x**nb))*exp(y/k) 

Здесь, yкажется, то же самое в двух выражениях.
Я хотел бы понять разницу или сходство.

1

1 ответ на вопрос

0
Hastur

I can say you what I see and for sure I will miss something:

  1. f(x) = b/x**nb * exp(y_(y)/k); in this function there are:
    • one variable (x)
    • some parameters b,nb,k,y (note the last one)
    • one function y_(...) of the parameter y, defined somewhere else.
  2. f(x,y) = (b/(x**nb))*exp(y/k); in this function instead there are:
    • two variables (x and y)
    • some parameters b,nb,k
    • some () more :-)

Let's we do an example. Let we suppose that it is defined 1st function (f(x)) and y=3. We obtain a result (a plot, some numbers, a function definition, see it how you want).

To obtain the same result if instead it is defined f(x,y), we can use f(x,y_(3)).

Till now I hope it is enough plane. Of course y_() has to be defined before in both cases, and we can call the function y_(x') with any arbitrary parameter or fixed value: f(x,y_(AnotherParameter)), f(x,5)or with another function f(x,zZz_(y)), or simply with f(x,y).

In each moment you can have or the 1st or the 2nd defined in gnuplot, but not both at the same time. A second definition overwrite the previous one.


Now let's we complicate a bit the things:
Why can you find thing as y_(x') inside a function as the 1st, or instead of the simple variable in function 2d as f(g(x),h(y))?
Because when you analyse real data you can find that a constant parameter is not so constant, so can be cosy to give a functional dependence to that parameter.
If you write the dependence of the parameter at the extern of the function you can always change it quickly without have to modify the expression of the function itself. Moreover when you do a FIT you have just ready the function to plot of parameter behaviour respect ... respect his dependencies.

If the FIT shows that the parameter is a constant, you can repeat the FIT fixing the parameter to a simple constant, killing the functionality. (i.e. y_(x)=3, for each x it will answer always 3).
If the FIT doesn't converge you can try to find another functionality for the parameter.


IMHO it's better to avoid to use dummy variable (y) as a parameter because it becomes easily misleading.

Похожие вопросы