Another Weird Mathematica Problem

  • Context: Mathematica 
  • Thread starter Thread starter spastic
  • Start date Start date
  • Tags Tags
    Mathematica Weird
Click For Summary
SUMMARY

The discussion focuses on using Mathematica to convert a set of replacement rules into a numerical set. Specifically, it demonstrates how to utilize the replacement operator (/.), allowing users to transform the output from {σ -> 0.653831, μ -> 9.31514, γ -> 7.22386} into {0.653831, 9.31514, 7.22386}. The method involves defining the replacement rules as a named variable, which simplifies the process of applying these rules to a list of symbols.

PREREQUISITES
  • Familiarity with Mathematica syntax and functions
  • Understanding of replacement rules in Mathematica
  • Basic knowledge of symbolic computation
  • Experience with list manipulation in Mathematica
NEXT STEPS
  • Explore advanced Mathematica functions for symbolic manipulation
  • Learn about defining and using named variables in Mathematica
  • Research the use of the ReplaceAll operator (/. ) in Mathematica
  • Investigate list operations and transformations in Mathematica
USEFUL FOR

This discussion is beneficial for Mathematica users, data analysts, and mathematicians who require efficient methods for handling symbolic computations and transforming output formats.

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

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K