1
$\begingroup$

When using the FindRoot function on a certain function, the returned object is a rule. Specifically, the outcome is {t -> 5.19188}. My question is how I could retrieve the 5.19188 value from this answer, or if this is even possible.

$\endgroup$
  • $\begingroup$ try t /. sol where sol ={t -> 5.19188}. Or, just sol[[1, -1]] . $\endgroup$ – kglr Sep 29 '17 at 21:40
  • $\begingroup$ Or (for completeness) a kludgy approach: {t -> 5.19188}[[1, 2]] $\endgroup$ – David G. Stork Sep 29 '17 at 21:42
  • $\begingroup$ Specifically, see mathematica.stackexchange.com/a/18706/12 $\endgroup$ – Szabolcs Sep 29 '17 at 22:03
0
$\begingroup$

This is done with the ReplaceAll command's infix notation syntax /.

sol={t->5.19188}
t/.sol
(*5.19188*)
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.