Another Weird Mathematica Problem

  • #1
6
1
When you solve something and it gives answers like this:
{σ -> 0.653831, μ -> 9.31514, γ -> 7.22386},
how do you get it to give
{0.653831, 9.31514, 7.22386}, i.e a set without the symbols?
Cheers,
 
  • #2
What it has given you is a set of replacement rules. These can be executed with the operator /. "replace" as in:

In[1]:= {σ,μ,γ}/. {σ -> 0.653831, μ -> 9.31514, γ -> 7.22386}

Out[1]:= {0.653831, 9.31514, 7.22386}

A typically way to use a set of replacement rules is to give it a name:

In[2]:=

constants = {σ -> 0.653831, μ -> 9.31514, γ -> 7.22386};
{σ,μ,γ}/. constants

Out[2]:=

{0.653831, 9.31514, 7.22386}
 
  • #3
Ah, thanks. That makes things heaps easier.
Cheers,
 

Suggested for: Another Weird Mathematica Problem

Replies
1
Views
474
Replies
1
Views
918
Replies
2
Views
957
Replies
1
Views
696
Replies
1
Views
613
Replies
6
Views
942
Replies
1
Views
967
Replies
1
Views
899
Back
Top