Mathematica Another Weird Mathematica Problem

  • Thread starter Thread starter spastic
  • Start date Start date
  • Tags Tags
    Mathematica Weird
AI Thread Summary
To convert a set of symbolic replacements into a numerical set, use the replacement operator "/." in the format {σ, μ, γ} /. {σ -> 0.653831, μ -> 9.31514, γ -> 7.22386}. This will yield the desired output of {0.653831, 9.31514, 7.22386}. Additionally, defining the replacement rules with a name, such as constants, allows for easier reuse, enabling the same operation to be performed by simply calling {σ, μ, γ} /. constants. This method simplifies the process of obtaining numerical values from symbolic representations.
spastic
Messages
6
Reaction score
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,
 
Physics news on Phys.org
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}
 
Ah, thanks. That makes things heaps easier.
Cheers,
 

Similar threads

Back
Top