Skip to main content
3-Newcomer
April 14, 2026
Solved

How to skip the values of a root function where there is no solution possible

  • April 14, 2026
  • 2 replies
  • 114 views

Hi,

I am using root function to solve a function for different variables (variables are vectors) but some of these values don’t converge as there is no solution. How can I skip these values that don’t converge and make a table for those values and solve the rest? I have attached the MathCAD zip file. 

 

Thank you!!!

Best answer by Werner_E

As we can see the approach using “root” by providing the interval 0s to 0.15s does not always give us the first of all zeros (see n=1). 

If you intended to calculate the first occurrence you might be better off with using the “root”  function by providing a guess value (here I used t=0s as a guess. As we don’t k now the algorithm used by “root” there is no guarantee that doing so will always give us the first positive root, but in case of your function this seems to be the case and we even also get a solution for n=4 (which is way above the 0.1s you had chosen for the upper limit in your plot.

 

2 replies

25-Diamond I
April 14, 2026

You may use a try..on error.. statement to catch the errors which occur when no solution was found:

 

You may also plot the solutions found:

 

Werner_E25-Diamond IAnswer
25-Diamond I
April 14, 2026

As we can see the approach using “root” by providing the interval 0s to 0.15s does not always give us the first of all zeros (see n=1). 

If you intended to calculate the first occurrence you might be better off with using the “root”  function by providing a guess value (here I used t=0s as a guess. As we don’t k now the algorithm used by “root” there is no guarantee that doing so will always give us the first positive root, but in case of your function this seems to be the case and we even also get a solution for n=4 (which is way above the 0.1s you had chosen for the upper limit in your plot.

 

3-Newcomer
April 27, 2026

Thank you Werner for your help!