Hello, my question is if there is a way to find all the points given a vector Y1, for a function, without having to evaluate each one manually (as seen in my file with point 4.609 and finding the X1 = 0.677), that the vector Y1 will change values (but all within the range of vectors X and Y), Thank you.
Solved! Go to Solution.
OK, we still don't know what you are really looking for - all solutions for any value in Y1, all solution in the X-range for every value in Y1 or just the smallest, first solution in the X-range for every value in Y1.
So here you get them all 🙂
I omitted any symbolics for the aforementioned limitation in Prime and used polyfit to get all solutions. This also means that you can't use this method if you intend to fit for anything else than a polynomial.
May be so
You can turn your solve block into a function:
Better use root not Find - it works in Express too
@ValeryOchkov wrote:
Better use root not Find - it works in Express too
Good point!
Please be more precise about what you are looking for at the end of the day.
As you fit with a polynomial of n-th order you will get n solutions for any value in your vector Y1. Not all of them may be real, not all of them may be within the range of X.
Are you looking for a n x 10 matrix of results consisting of all five solutions for all n values in Y1???
Your vector Y1 contains only two different values. With 4.609 (and n=5) we get five real solutions and two of them are in the range of X.
With 5.986 there is only one real solution at x=68.22. Way off the range of X. What do you expect as result here?
If you are only interested in the smallest solution within the range min(X) and max(X) you have to say so and also specify, what the result should be if there is no such solution (suggestion: NaN).
Or do you really want the n x 10 matrix?
Here is a small example how to get all solution using symbolic solve and defining the function QF in a way the coefficients are seen (otherwise the symbolics can't work with QF).
Unfortunately on contrary to real Mathcad we can't turn a symbolic evaluation into a function in limited Prime. So to deal with the different values in Y1 you would still have to resort to numeric methods. To get all roots of a polynomial you might use "polyroots".
OK, we still don't know what you are really looking for - all solutions for any value in Y1, all solution in the X-range for every value in Y1 or just the smallest, first solution in the X-range for every value in Y1.
So here you get them all 🙂
I omitted any symbolics for the aforementioned limitation in Prime and used polyfit to get all solutions. This also means that you can't use this method if you intend to fit for anything else than a polynomial.