Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 46318

Mathematica symbols are the ultimate atoms of symbolic data. Every symbol has a unique name, exists in a certain Mathematica context or namespace, and can have a variety of types of values and attributes.

4 votes

How can i replace the symbols in a list?

a->b is a shortcut for Rule[a,b]. Therefore, what you have to do is to replace Ruleby Subtract. E.g.: SeedRandom[1] list = Thread[{a, b, c, d, e} -> RandomInteger[100, 5]] (* {a -> 80, b -> 14, c -> …
Daniel Huber's user avatar
  • 56.4k
1 vote

How to set a value to the symbol denoted by a given string?

MMA evaluate arguments before feeding them to a function. Therefore, if Symbol[name] already has a value: value1 Evaluate[Symbol[name]] = value2 is equivalent to: value1 = value2 what is an error. T …
Daniel Huber's user avatar
  • 56.4k
1 vote
Accepted

What is the relationship between a list of symbols created by a specific name, and a express...

The evaluator will evaluate an expression until nothing changes any more. Consider some code that gives a recursion: x = Table[Symbol["x"][i], {i, 1, 2}] To begin, the right side is evaluated and giv …
Daniel Huber's user avatar
  • 56.4k
1 vote

How to generate unique symbols inside a module that can also be used for pattern names?

Do I misunderstand something, but it looks rather simple to get the coefficient and the exponent of x: foo[pol_, x_Symbol] := Module[{c, poly}, cs = Reap[ pol /. a_ x^n_ :> (Sow[{a, n}];) /. ( …
Daniel Huber's user avatar
  • 56.4k
1 vote

Intercepting typos/misstyped symbols and automatically correcting them in the FrontEnd

Unfortunately, the function in $NewSymbol does not alter the input, therefore it can only give a warning. But an easy and simpler solution is to define PRint[] and PRint[] to evaluate to the correct i …
Daniel Huber's user avatar
  • 56.4k
5 votes
Accepted

How to create a simple transformation function on lists using short form of ReplaceAll?

This is a bit tricky because you need to work with levels and "ReplaceAll" can not take a level. Instead you may use "Replace" with a level specification of {1}: Clear["Global`*"] seq = Sequence[z, y, …
Daniel Huber's user avatar
  • 56.4k