Another Weird Mathematica Problem

  • Mathematica
  • Thread starter spastic
  • Start date
  • #1
6
1

Main Question or Discussion Point

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,
 

Answers and Replies

  • #2
1,250
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
6
1
Ah, thanks. That makes things heaps easier.
Cheers,
 

Related Threads for: Another Weird Mathematica Problem

Replies
8
Views
3K
Replies
3
Views
2K
Replies
7
Views
3K
Replies
8
Views
5K
Replies
1
Views
623
Replies
8
Views
4K
  • Last Post
Replies
2
Views
4K
  • Last Post
Replies
2
Views
2K
Top