Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping the root function 1

Status
Not open for further replies.

cjm2176

Structural
Joined
Dec 5, 2009
Messages
4
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.

Is there another way to go about this?


Thanks!
 
>> 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)

TTFN

FAQ731-376
 
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
 
It's an argument, yes, but when you call the root function, it needs a starting guess value to start the root finding algorithm.

TTFN

FAQ731-376
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top