what is the properties of single function
Show older comments
What is the properties of single function?
Answers (1)
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 Comments
marwan mokbil
on 30 Jun 2018
Walter Roberson
on 30 Jun 2018
That does not sound like a MATLAB question?
Jan
on 30 Jun 2018
Then please edit your question and add the required details there - even more than you have mentioned yet.
marwan mokbil
on 1 Jul 2018
Edited: Walter Roberson
on 1 Jul 2018
Jan
on 1 Jul 2018
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
on 1 Jul 2018
marwan mokbil
on 1 Jul 2018
Jan
on 1 Jul 2018
@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
on 1 Jul 2018
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.
@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
on 1 Jul 2018
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
on 2 Jul 2018
Edited: Stephen23
on 2 Jul 2018
@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
@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
on 2 Jul 2018
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
on 2 Jul 2018
Walter Roberson
on 3 Jul 2018
Are m, n, o, p, q restricted to integers? If not, then is X restricted to non-negatives?
marwan mokbil
on 3 Jul 2018
marwan mokbil
on 3 Jul 2018
Walter Roberson
on 3 Jul 2018
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
on 3 Jul 2018
Walter Roberson
on 3 Jul 2018
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
on 3 Jul 2018
Walter Roberson
on 3 Jul 2018
I was using Maple for the symbolic work.
marwan mokbil
on 5 Jul 2018
Walter Roberson
on 5 Jul 2018
Sorry, no, I am working on a number of different things at the same time.
marwan mokbil
on 5 Jul 2018
Walter Roberson
on 5 Jul 2018
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
on 5 Jul 2018
Walter Roberson
on 6 Jul 2018
"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
on 6 Jul 2018
Walter Roberson
on 6 Jul 2018
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
on 7 Jul 2018
Walter Roberson
on 7 Jul 2018
For example, 10/2*(tanh(x)+1)
marwan mokbil
on 15 Jul 2018
Walter Roberson
on 16 Jul 2018
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.
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!