×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Looping the root function

## Looping the root function

(OP)
Hi,

I want to find and save the root of a function, make a small change to a parameter in the function and find the new root.

I defined the parameter over an interval, but MathCAD's root function doesn't like this (I get a message that says root only works with matrices or scalars), though there are no errors if I define the parameter with only one value.

I also tried using a for loop to evaluate the root, but MathCAD doesn't give either an output or an error, nothing happens.

Thanks!

### RE: Looping the root function

Can you post a worksheet?

Regards

Mike

### RE: Looping the root function

>>  Nowhere do you define beta.nd, so why is it a surprise that it's flagged as undefined?

>>  Your construct of k.nd is interesting, but not necessary.  Do:

i:0,1;10
k.nd[i:i/10

this will create an indexed variable k.nd

Also, you need to define beta.nd somewhere near the top of the sheet.

Then, you do

r0[i:root(f(beta.nd,k.nd[i),beta.nd)

### RE: Looping the root function

(OP)
Thanks! your explanation was very logical, and much easier than creating loops

Since I beta.nd was the argument to my function, I thought it did not have to be defined

### RE: Looping the root function

It's an argument, yes, but when you call the root function, it needs a starting guess value to start the root finding algorithm.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!