Skip to main content
1-Visitor
September 27, 2015
Solved

Trial and error

  • September 27, 2015
  • 3 replies
  • 3100 views

Hi,

I am trying to get a solution in mathcad in which we provide a specific value (say 0) initially followed by set of equations and finally giving result.

But if the result obtained is <> zero, program will automatically change the initial value until we get the final result (by trial and error) as or nearly zero.

this is one example.

Trial and error.jpg

Please help me solve this using Mathcad.

Thanks.

Best answer by RichardJ

Change your variables to functions of x, and then use a solve block to find the values of x for which Eq=0

3 replies

19-Tanzanite
September 27, 2015

Please post the worksheet (click on "use advanced editor" at the top right of the edit dialog)

23-Emerald V
September 27, 2015

Khalid Shaikh wrote:

Hi,

I am trying to get a solution in mathcad in which we provide a specific value (say 0) initially followed by set of equations and finally giving result.

But if the result obtained is <> zero, program will automatically change the initial value until we get the final result (by trial and error) as or nearly zero.

this is one example.

....

There are several methods of doing this in Mathcad.  For example:

1.  Rewrite your expressions as a program and then write a standard divide-and-conquer algorithm to change x such that Eq gets nearer to 0.

2.  Rewrite your expressions as a function and use the function Root to find the zeros.

3. Write a Solve Block around your expressions and use Find to look for an exact solution.  Use Minerr if Find fails to get an exact solution.

eg:  Solve Block to find square root of 9, given an initial guess of 9.

As Richard says, please post your worksheet ... nobody will want to retype all your work! 🙂   Plus there are a few values you havent' specified (eg, E) and it's also often a lot easier to diagnose problems from the worksheet than by looking at a picture.

Stuart

kshaikh1-VisitorAuthor
1-Visitor
September 28, 2015

Hi All,

please find attached MATHCAD file.

Thank you.

RichardJ19-TanzaniteAnswer
19-Tanzanite
September 28, 2015

Change your variables to functions of x, and then use a solve block to find the values of x for which Eq=0

kshaikh1-VisitorAuthor
1-Visitor
September 28, 2015

Thank you sir,

Wouldn't have been possible without your help

Regards,

Khalid Shaikh