| Author |
Comment/Response |
Haidong Chang
|
04/22/97 02:26am
Reply to message #296 from Elizabeth Earhart: > Reply to message #294 from Haidong Chang: > > I am finding the roots to an equation fairly regularly. The final line is > > > > data=Table[{vt, FindRoot[g==y,{y, Random[ ]}]}, {vt, 0, 0.4, 0.1}] > > > > y is the equation. Everything works OK. > > > > A typical answer would be a table with the following pairs of data: > > > > {0, {y->0.0608386}}, etc. > > > > My problem is how can I delete the ''y->'' so that I get a table of pairs od data of the form: > > {0, 0.0608386}, etc. > > You can do this with the command > > simpledata = {#1,y /. #2}& /@ data; > > -Elizabeth No Luck! the following messages appear: Function::slotn: slot number 2 in {#1, y /. #2}& cannot be filled from ({#1, y /. #2}&)[{0, {y->0.060838}}] ReplaceAll::reps:{#2} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. Does it have something to do with the y->0.06 term being in brackets? When I type in something like y->0.06 (nothing else just that)press enter, and then follow with y /. 415744t works (out = 0.06). If I add curly brackets it doesn't (out = {y->0.06}) Also I don't understand what /@ and haven't been able to figure it out from the online help.
URL: , |
|