Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hi,
I took one of the equation from this topic https://community.ptc.com/t5/Mathcad/Newton-s-method/m-p/949155#M211771
I see that Solve Block does not give all the solutions of the system equations only by trying only one pairs of (x,y) guess values:
And we need to change manually the guess values in the hoping that we will get the all solutions. But what to do when we do not have other alternatives to know that the system of eq has more one solution and when with the limited guess values tried we got the same solution?
But my questions are:
1. Why Solve block gives solutions like x=-0.779 and y=-0.443, why other method gives x=-0.22, y=-0.69, and so on.
2. How one can be sure while using Solve Block he finds all the solutions of when solving the system of equations? As I do not like the solution given with solve block that we cannot be sure that we found all the solutions, as one cannot be sure that he tried all the variants for guess values.
Without changing the guess values we conclude that this system of equations has only one solutions as was presented in the Newton's method topic from where I took this example, but relying that the above systems of eq has only one solution is wrong, as we can see from below (total (x,y) pairs of solutions are at least 4, and not only 1 as the solutions of this system of eq was presented in Newton's topic). And moreover we can see that with solve block we can get more than 4 pairs of (x,y) solutions.
Solved! Go to Solution.
@Cornel wrote:
In this case I do not know how to make the plot,
Here you are. Every point of intersection of the blue and the red "curve" is a solution 🙂
but in above set of equations I do not know really how many set of (x,y) paris of solutions there are..
Neither do I. Here are a few solutions out of a list of 104 solutions (and this list sure is not complete, I guess).
Have fun!
How to use solve block for finding all the solutions of the system of eq, but being sure that one found/catch all the solutions by being sure that he tried all the guess values (so, without losing any solution)?
@Cornel wrote:
How to use solve block for finding all the solutions of the system of eq, but being sure that one found/catch all the solutions by being sure that he tried all the guess values (so, without losing any solution)?
Simple answer: You can't.
But you can try your best, e.g. by parametrizing the solve block and searching for solutions using a tight net of guess values. But you can never nbe sure not to miss solutions when you use numerical methods and most system of equations simply are to complicated for symbolic solution.
For example look at this another example:
In this case we cannot rely on the above other method like I showed in the first post:
But by using the solve block:
Now if we change again the guess values:
And so on, we could continue infinitely, without knowing if we found all the solutions.
For example let's say that we want to find the solutions of this system of equations for:
How to do?
Make plot to find the answers.
Make plot for this...:
And find the answer for:
In this case I do not know how to make the plot, at least as it is possible for the former set of equations from my first post..
And in the first set of system of eq we could be happy that there was about 4 set of pairs of solutions, but in above set of equations I do not know really how many set of (x,y) paris of solutions there are..
@Cornel wrote:
In this case I do not know how to make the plot,
Here you are. Every point of intersection of the blue and the red "curve" is a solution 🙂
but in above set of equations I do not know really how many set of (x,y) paris of solutions there are..
Neither do I. Here are a few solutions out of a list of 104 solutions (and this list sure is not complete, I guess).
Have fun!
@Cornel wrote:
For example look at this another example:
In this case we cannot rely on the above other method like I showed in the first post:
Yes, too bad! You never can rely on anything in life ...
And so on, we could continue infinitely, without knowing if we found all the solutions.
Correct! Now you got it!
@Cornel wrote:
...
But what to do when we do not have other alternatives to know that the system of eq has more one solution and when with the limited guess values tried we got the same solution?
Welcome to the world of Math! You always have to use your own brain and mathematical knowledge to deal with the task. Mathcad is a tool and as such has sure its limits.
BTW, there is no way, no algorithm which will provide ALL solutions for any arbitrary equation or system of equations.
Numeric algorithms always will provide you with just one solution based on the guess(es). Sometimes it helps to use the symbolics, but as we know its capabilities are limited, too (especially true for the symbolics in Prime). In case of your example,
In real Mathcad and even in Prime starting with version 10 you also can choose from a menu the numerical algorithm which should be used - changing the algorithm may return a different solution using the very same guesses sometimes.
Choosing "Conjugate Gradient" returns the 0.779/0.443 solution pair in your first example.
Of course you always can parametrize the solve block, turning it into a function of the guess values and then use a program with nested loops to try many guesses within a certain range, collect all results and then remove the duplicates. But again - there is no guarantee that you will find ALL solutions within the range that way.
Mathematical tools will certainly become better and more powerful, but they will always have their limits. The push-button mathematics that you are apparently calling for, which makes your own knowledge and skills obsolete, will probably not be available any time soon.
Without changing the guess values we conclude that this system of equations has only one solutions
A wrong conclusion and that's not the fault of Prime! It means that the user does not understand that his tools have limits and that he need to use his own mathematical knowledge, too.
The point is that you should not blindly trust your tools, but that you should know as much as possible about their limitations and weaknesses so that you can use them sensibly and profitably to your advantage and make your work easier.
@Werner_E wrote:Of course you always can parametrize the solve block, turning it into a function of the guess values and then use a program with nested loops to try many guesses within a certain range, collect all results and then remove the duplicates. But again - there is no guarantee that you will find ALL solutions within the range that way.
Do you have any idea on how this implementation would look like?
@Cornel wrote:
@Werner_E wrote:Of course you always can parametrize the solve block, turning it into a function of the guess values and then use a program with nested loops to try many guesses within a certain range, collect all results and then remove the duplicates. But again - there is no guarantee that you will find ALL solutions within the range that way.
Do you have any idea on how this implementation would look like?
Sure and examples can possibly be found here in older forum threads - I guess also in some of your own threads -mainly covering all(!?) zeros of an arbitrary function in just one variable.
In case your question is about parametrizing the solve block, here it is - you now conveniently can experiment with different guess values.
If you intend to write the program which creates a matrix of solution changing in small steps the guess values, you may run into the problem that some guesses might make the solve block fail, finding no solution. In that case your whole program would fail.
So it may be a good idea to wrap the "sol" function in a "try .. on error ..." statement:
Good luck!
BTW, I remember an oder thread initiated by Valery Ochkov where he played around (in real Mathcad) with numerical algorithms and the solution they provide depending on the guess values. Coloring each point (=pair of guess values) according to the solution it leads created some nice pictures. If you can find that thread you might be interested in the methods shown there.
EDIT: The mentioned thread was surprisingly easy to find: Portrait of roots of two equations
And is it possible to iterate an entire x, y vector of guess values?
Yes, its possible to use range variables but I would suggest that you instead use a program with for loops to create the 41 x 121 matrix of pairs. Furthermore you should wrap the sol function in a try..onerror... statement (I have shown in detail in one of my answers above) to avoid the effect seen in your picture - if the solve block fails for just one set of guess values, the whole calculation fails.
BTW, did you already look at the thread I pointed you to (Portrait of roots of two equations). You could try something similar with your equations. Maybe we can at least see some nice pictures ....
WRONG!!
There actually ARE four solution pairs, but you just found two of them. Two of your solutions are NOT solution to this system! Make a check!
The solutions are:
Yes, I forgot to check what pairs of solutions are indeed the solutions for this system.
But then why with this method fails to find all the solutions of the system? (that is, all the solutions, even if some prove to be the right solutions for the system, and others not). I did not see any problems in how the solutions of the system was obtained. This method cannot be used to find all the potential solutions?
By all solutions I mean also (0.779, 0.443), (-0.779, -0.443) to be found by above method