Message Boards Message Boards

0
|
4545 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Need help making a Table of Roots

Posted 10 years ago

Hi folks,

I am having trouble getting this to work. I am trying to make a table of the first 10 roots of a function. I have made another list of "guesses" to aid the FindRoot function.

guess = {2, 7, 10, 13, 16, 19, 22, 26, 29, 32}
evals = Table[FindRoot[f3[x], {x, guess[[k]]}], {k, 1, 10}]

f3[x] is just an arbitrary function.

My problem is the list that the Table function creates looks like this.

{{x -> 2.19548}, {x -> 7.3898}, {x -> 10.2706}, {x -> 13.2423}, {x -> 
   16.2673}, {x -> 19.3251}, {x -> 22.4039}, {x -> 25.497}, {x -> 
   28.6}, {x -> 31.7103}}

I just need a list of the values of the roots. But each element of the list created by Table is of this form.

{x -> 2.19548}

I need it to look like this so I can access each value.

{ 2.19548, 7.3898, 10.2706, 13.2423, 16.2673, 19.3251, 22.4039, 25.497, 28.6, 31.7103}

How do you do something like this?

Thanks in advance :)

POSTED BY: larry davis
3 Replies

1 2 3 4 5 and etc^etc.

POSTED BY: Daniel Lichtblau

To being with, please see this article: How to use the output of functions like Solve

If you want to extact the value of x from FindRoot, then use x/.FindRoot[....]

POSTED BY: Sean Clarke
Posted 10 years ago

Thanks guys. That got me exactly what I needed.

POSTED BY: larry davis
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract