what is the properties of single function
3 次查看(过去 30 天)
显示 更早的评论
回答(1 个)
Jan
2018-6-30
编辑:Jan
2018-6-30
Dou you mean the function called single?
help single
doc single
It converts a number to a floating point value of type single, which stores about 8 digits. double 's store about 15 digits. While single uses 4 bytes per number, double needs 8 bytes.
36 个评论
marwan mokbil
2018-6-30
Thanks for your reply. My question about the single equation method which used in econometrics and used to estimate the nonlinear model
Jan
2018-6-30
Then please edit your question and add the required details there - even more than you have mentioned yet.
marwan mokbil
2018-7-1
编辑:Walter Roberson
2018-7-1
-Thank for your reply and sorry for the confusion.
Thanks for your reply.
In fact I have set of points of (x,y) as follow:
-2000000 0.616
-199700 1.742
-63190 3.28
-5631 8.130
-1845 9.123
-577 9.492
0 9.68
310 9.778
497 9.836
618 9.875
700 9.9
760 9.92
882 9.960
899 9.964
969.98 9.987
983.98 9.992
991.74 9.994
99.999 9.997
1007.5 9.999
1009.9 10
1009.975 10
I will be gratfule if you tell me the type of this function and is it possible to find it's equation.
Jan
2018-7-1
There is an infinite number of functions, which produce this sequence of numbers. So you have to specify at first to which kind of function you are looking for. I do not see the relation to the original question "What is the properties of single function".
Again: Please edit the question and add the required details there.
marwan mokbil
2018-7-1
Please if you draw this function you will find that it will be end to (1010, 10) So I thought it is special function and may be there is a way to find it's equation.
marwan mokbil
2018-7-1
Regarding the original quesition i already got the answer. It's one to one or many to one. Thanks for your help.
Jan
2018-7-1
@marwan mokbil: Please do not post new questions in the section for comments to an answer. Open a new thread instead.
Do you see how your data look in your comment?
-2000000 0.616 -199700 1.742 -63190 3.28 -5631 8.130 -1845 9.123 -577 9.492 0 9.68 310 9.778 497 9.836 618 9.875 700 9.9 760 9.92 882 9.960 899 9.964 969.98 9.987 983.98 9.992 991.74 9.994 99.999 9.997 1007.5 9.999 1009.9 10 1009.975 10
Is this a vector or a matrix? If this should be a matrix with x and y values, note that finding an equation is limited by the very coarse precision of the data. The last two Y values are equal.
Stephen23
2018-7-1
It's a some points of (x,y) as follow
-2000000 0.616,
-199700 1.742,
-63190 3.28,
-5631 8.130,
-1845 9.123,
-577 9.492,
0 9.68,
310.7 9.778,
497 9.836,
618 9.875,
700.5 9.9,
759.4 9.92,
882 9.959,
969.98 9.987,
983.98 9.992,
991.74 9.994,
9.999 9.997,
1007.5 9.999,
1010 10,
I will be gratfule if tell me the type of this function and is it possible to find it's equation.
Stephen23
2018-7-1
编辑:Stephen23
2018-7-1
@marwan mokbil: as you have already been told there are exactly infinite functions that pass through your data points (or indeed, any finite set of data points). This fact does not change just because you keep repeating your question. If you want to find just one of those functions, then you need to specify more than you have now, to narrow down the search , e.g. any prior knowledge, physical models, etc.
You might be able to makes some guesses by plotting the data, possibly using log plots.
If you do not have any prior knowledge, nor any real model to describe the system, another option is to fit a spline.
Walter Roberson
2018-7-1
log does not work at all well.
sum of sines can work fairly well, as can polynomials of degree 3 or up, or ratio of polynomials of equal degree of degree 2 or higher. The polynomials get pretty wild pretty quickly.
You effectively cannot tell the difference in fit between these possibilities to within numeric round-off: the R^2 for the fits become at least .993 and you pretty much start fitting against numeric accidents to go further.
marwan mokbil
2018-7-2
编辑:Stephen23
2018-7-2
Dear Stephen,
you mentioned in your reply the following
"as you have already been told there are exactly infinite functions that pass through your data points (or indeed, any finite set of data points)."
Could you please let me why we will have infinite equations for finite set of points. Is there any prove for that or can you tell me where can i read about this subject.
Jan
2018-7-2
编辑:Jan
2018-7-2
@marwan mokbil: The proof is trivial. Start with 2 points. You can draw one line through them, a polynomial of degree 1. But you can draw an infinite number of parabolas through them already, a polynomial of degree 2. There is an infinite number of polynomials for any higher order also. Then an infinite number of trigonometric series also, logarithmic functions, rationals of polynomials, etc.
The same happens for 3 points, except that there might be no polynomial of degree 1 and only 1 polynomial of degree 2. But again an infinite number of polynomials of higher orders, as well as other functions. This can be expanded to any number of points.
If you use "infinite functions that pass through your data points" as keyword in an internet search engine, you will find e.g.: https://www.mathworks.com/matlabcentral/answers/21734-finding-mathematical-function-of-set-of-points
Stephen23
2018-7-2
编辑:Stephen23
2018-7-2
@marwan mokbil: Jan explains the basic reasoning very clearly. Note that although there is one unique polynomial of degree N-1 for a set of N data points, in reality it will likely oscillate wildly for N greater than 4 or 5, so this has little practical use.
You either need to know/assume something about the underlying system model, or use a spline.
Walter Roberson
2018-7-2
I gave a constructive proof of infinite functions at https://www.mathworks.com/matlabcentral/answers/347829-how-to-fit-curve-using-derivatives-as-a-constraint#comment_467765
marwan mokbil
2018-7-2
Supose I gave you the system model and the set of points as follow. Say the function take this form of Y= aX^m-bX^n+cX^o-dX^p+eX^q. And i provide you with sufficient points of (x,y), can you find out the equation or still will have infinite number of equation. And if you can get the exact equation could you please tell me how you estimate the unknown a,b,c,d,e,m,n,o and q.
Walter Roberson
2018-7-3
Are m, n, o, p, q restricted to integers? If not, then is X restricted to non-negatives?
Walter Roberson
2018-7-3
I do not know yet. The mathematics gets a bit tricky. At the moment it looks plausible that for given real inputs, that there might be multiple complex m and n that satisfy the equation.
marwan mokbil
2018-7-3
Sorry Roberson. I miss understand you, do you mean it is possible to be solved but you may get several m,n,o... That satisfy the equation. (Is that means we will get several equations satisfy the set of points) Could you please clarify.
Walter Roberson
2018-7-3
I was working with the two term case for simplicity. With the two term case it looked like there is a simple expression for one of the two exponents but the other generally involved finding a numeric root. But the question became whether those were the only possible solutions, and as I proceeded step-by-step I could see that there were complex solutions as well. But what I have not resolved is whether the complex variations lead to contradictions.
marwan mokbil
2018-7-3
Thanks for your reply. Is it possible to inform me what tools you have used to estimate the unknowns.
Walter Roberson
2018-7-5
I ran into a snag even with the two-term version. It looks like when you start looking for alternative solutions, the system can get rather unstable, with round-off error being rather substantial. I am working on it again to check to see if I made an error in my calculations.
marwan mokbil
2018-7-5
Thanks Walter for your feedback and best of luck. But you are facing problem to estimate the unknowns (a,b,m,n) of the first tow terms.what would happen when you run all the Terms,do you think it will be possible to get the 10 unknowns for this equation. On the other hand I will be glad if you tell me what did you do to estimate the unknowns for the first tow term, I mean here did you used iteration to estimate the power (m,n) or you have another way to find them. Thanks for your patient.
Walter Roberson
2018-7-6
"Say the function take this form of Y= aX^m-bX^n+cX^o-dX^p+eX^q. And i provide you with sufficient points of (x,y), can you find out the equation or still will have infinite number of equation."
Some tests just showed me something that should have been obvious days ago:
There cannot be a unique solution for equations of this form.
Consider if you have
Y= aX^m-bX^n+cX^o-dX^p+eX^q
and you had determined values for all of a, b, c, d, m, n, o, p, q.
Now simultaneously exchange -a with b, and m with n . For example if it had turned out to be
Y = 1/5*X^(3/7) - 11*X^(-4) + cX^o - dX^p + eX^q
then a = 1/5, b = 11, m = 3/7, n = -4. Create a new equation
Y = anew*X^mnew - bnew*X^nnew + c*X^o - d*X^p + e*X^q
by anew = -b, mnew = n, bnew = -a, nnew = m, getting
Y = (-11)*X^(-4) - (-1/5)*X^(3/7) + c*X^o - d*X^p + e*X^q
These are different values for a, b, m, n than the original, but algebraically it is obviously the same equation sorted in a different order.
Therefore if there are N different terms, there are a minimum of factorial(N) different solutions for the variables, all of which are really the same equation. This situation would not occur if there was interaction between the terms.
Now, having N! different solutions is a very different matter than potentially having an infinite number of solutions. I still do not know the answer about potentially infinite number of solutions.
You can get the a, b, c, d, e coefficients through standard stepwise elimination methods without difficulty, constructing the equation set
[y1 = a*x1^m + b*x1^n + c*x1^o + d*x1*p + e*x1*q,
y2 = a*x2^m + b*x2^n + c*x2^o + d*x2*p + e*x2*q,
y3 = a*x3^m + b*x3^n + c*x3^o + d*x3*p + e*x3*q,
y4 = a*x4^m + b*x4^n + c*x4^o + d*x4*p + e*x4*q,
y5 = a*x5^m + b*x5^n + c*x5^o + d*x5*p + e*x5*q]
and solving the first one for a, substitute that a into the second, solve the new second for b, substitute the a and then the b into the third, and so on through the fifth. This gives relatively easy expressions for a, b, c, d, e .
After that, you have another 5 equations y6 through y10, in which you substitute in those values for a, b, c, d, e. Then you have to start solving for exponents, and that is where it gets difficult and quite nonlinear. Because exponential terms become involved immediately, you have to start trying to figure out whether there are potentially other complex-valued m, n, o, p, q that might satisfy the equations (and one set of test values I generated suggested that sometimes even with real-valued inputs you need complex solutions.)
marwan mokbil
2018-7-6
Thak you very much for the explanation. Here is some comments;
- it is very good observation to make a=-b and m=n But I think this is suitable for this equation only where (y=...+...-...+...-...+...) But this is not applicable if the equation take this form (...+...+...+...+...).
- regarding the Cofficion (a b c d e) as you minsioned that the standard stepwise elimination methods will handle it but I still do not no what did you do to estimate (m n o p q) where I know it is difficult to estimate them in one go,so did you used any iteration to find them or there is other method?
- regarding the infinite number of solution; I thought we will have infinit number of solution in case we do not know the system model (the equation), but if you have the system model I was think we will get only one solution ( really I get confused).
Any way I would like to thank you again for you help.
Walter Roberson
2018-7-6
For the form ...+...+...+...+... you just exchange coefficients unchanged.
"I thought we will have infinit number of solution in case we do not know the system model (the equation), but if you have the system model I was think we will get only one solution ( really I get confused)."
Equations of the form Y = +/- aX^m +/- bX^n +/- cX^o +/- dX^p +/- eX^q are non-linear, and non-linear equations are not always restricted to having only one solution, even over real values. For example,
x*exp(x) = -1/10
has two real-valued solutions, approximately -.1118325592 and -3.577152064
marwan mokbil
2018-7-7
Thanks Walter and I hope you get succeed in your test.
There is some thing els if you do mind. I have graph this graph approach to zero when x approach to (-infinite), And approach to 10 when x approach to (+ infinity). Can you tell me which type of function can fit this graph.
marwan mokbil
2018-7-15
Hi Walter, is it easy find the function of rational function (end beheivet function) if we know enough points of (x,y) or we will face the same problem as we faced before.
Walter Roberson
2018-7-16
Sorry, I cannot seem to find information about beheivet ?
For rational functions, it would depend upon what the individual terms were permitted to be.
If I understand correctly, there are signal processing tools to find ratios of polynomials approximating arbitrary signals. I would need to think more about the theoretical case.
If you were to use a finite set of points to find polynomials f(x), g(x) such that y = f(x)/g(x), then take any xn such that xn is not in the original x; then yn = (f(x)*(x-xn))/(g(x)*(x-xn)) is the same as f(x)/g(x) except at x = xn, where it is discontinuous. But since xn was an arbitrary point not present on input, we cannot know that the "real" behaviour at xn is not in fact discontinuous. So there are an infinite number of variant functions yn that describe the system as accurately as f(x)/g(x) does, so the ratio of polynomials cannot be unique.
Also, consider any finite subset of the original points, x0..xm with y0..ym, excluding at least one point, (xn, yn). We hypothesize that there is a unique y1(x) = f1(x)/g1(x) describing the subset.
Now, does that hypothesized unique y1(x) = f1(x)/g1(x) definitely predict that y1(xn) will be yn ? No, it cannot, because (xn, yn) could be arbitrary. So for each (xn, yn) not in the original set x0..xm with y0..ym, of points used to construct y1(x) = f1(x)/g1(x), there must be a distinct y2(x) = f2(x)/g2(x) that fully fits the fuller set of points x0..xn with y0..yn that includes (xn, yn) . But each of those infinite number of y2(x) must agree with y1(x) for each x in x0..xm, so each of those infinite f2(x)/g2(x) are also valid but different functions for f1(x)/g1(x), which contradicts the hypothesis that f1(x)/g1(x) can be found uniquely from x0..xm with y0..ym. Therefore it is not possible to find a unique ratio of polynomials to fit the points.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)