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

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

  • April 14, 2026
  • 1 reply
  • 64 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!!!

1 reply

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:

 

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.