34 votes

Character to replace _ in symbol names?

This has been discussed on comp.soft-sys.math.mathematica. The gist is that there are lots of Unicode characters you could use, e.g. \[LetterSpace] or ...
Martin Ender's user avatar
  • 8,754
21 votes

Extracting variables from an expression

Using an undocumented function: ...
J. M.'s eventual burnout's user avatar
14 votes
Accepted

How to transform a function from f[#1] to f[x]

Well, the easy way is to evaluate it for [x,y]. f[x_, y_] = Sqrt[-1 + Tanh[#1 - #2]^2] &[x, y]; If you'd rather do it ...
John Doty's user avatar
  • 13.7k
13 votes

Character to replace _ in symbol names?

The issue is that Mathematica interprets underscore as Blank and interprets my_variable as a ...
dionys's user avatar
  • 4,321
13 votes
Accepted

When to name a variable with $

Look at the system context to see what the convention is. I can find 257 built-in symbols in 11.3, symbols = Names["System`$*"]; Length @ symbols (* 257 *) In ...
13 votes

How to transform a function from f[#1] to f[x]

I think the easiest way would be to define(name) the pure function f f = Sqrt[-1 + Tanh[#1 - #2]^2] & and use it accordingly ...
Ulrich Neumann's user avatar
11 votes

For any symbol, how can I get the full context-qualified name of the symbol as a string?

This is a variation of Leonid's answer that avoids the dependence on a context like "Test`" that must be empty: ...
ilian's user avatar
  • 25.5k
11 votes
Accepted

Checking if all the variables are present in the defined function

Using an undocumented function: Reduce`FreeVariables[u] === Sort[vas]
J. M.'s eventual burnout's user avatar
11 votes

General::ivar 0 is not a valid variable when using Series in Plot

There are couple of problems with your code. It is an image, it would be way nicer not to have to rewrite it. Plotting Series If you go to ref / Series / ...
Kuba's user avatar
  • 137k
11 votes
Accepted

Name a list with Table

Clear[first, second, third] names = {first, second, third} numbers = {{1, 1}, {2, 2}, {3, 3}} Table[Evaluate[names[[i]]] = numbers[[i]], {i, 3}] first second third
LouisB's user avatar
  • 12.3k
10 votes

Checking if all the variables are present in the defined function

Update Following your updated question I recommend filtering Level output with Variables as I proposed here. Then ...
Mr.Wizard's user avatar
  • 271k
10 votes
Accepted

What is and isn't a valid variable specification for Manipulate?

I suspect it's an internal decision by WRI to allow as variables only expressions of the form A[0, 1, 2], that is, a symbol with integer arguments. You could try ...
Michael E2's user avatar
  • 234k
10 votes
Accepted

Map[Remove[#]] doesn't seem to do anything

As stated in the comments, a is evaluated before being fed into Remove. We can prevent this by using ...
Greg Hurst's user avatar
  • 35.9k
9 votes
Accepted

Apply ToString to a list of variables

In addition to Mr.Wizard's answer here is a collection of other possibilities: ...
Alexey Popkov's user avatar
9 votes
Accepted

Context inside Do[...]-loop

Begin["mycontext`"] affects the parser, not the evaluator. These are separate expressions: Begin["mycontext`"]; ...
Szabolcs's user avatar
  • 234k
9 votes
Accepted

Why is DSolve different when the equation is built programmatically?

You attempt to solve the ODE at the time of definition of lsolve. At this point, q does not depend on ...
Henrik Schumacher's user avatar
9 votes

Name a list with Table

Clear[first, second, third] names = {first, second, third}; numbers = {{1, 1}, {2, 2}, {3, 3}}; With[{names = names}, names = numbers]; first {1, 1}
Chris Degnen's user avatar
  • 30.9k
9 votes

Partial derivatives in a variable name

I suggest using any of the other similar-looking characters: U+1D6DB 𝛛 U+1D715 𝜕 U+1D74F 𝝏 U+1D789 𝞉 U+1D7C3 𝟃 all of which seem to produce a valid symbol in Mathematica.
Domen's user avatar
  • 22.3k
9 votes
Accepted

How to Obtain Complete List of Properties

Importing "MTX" returns a SparseArray, so you can do A["Properties"]. ...
rhermans's user avatar
  • 36.3k
8 votes

Character to replace _ in symbol names?

I use $ as a separator. It is a valid symbol character. In my application I have a set of variables that need to be identified by coordinates, like for example a17_4_25. I can't just drop the _ ...
Shebla Tsama's user avatar
8 votes

Name a list with Table

With the following definitions: Clear[first, second, third] names = {first, second, third} numbers = {{1, 1}, {2, 2}, {3, 3}} a one-liner approach would be: <...
MarcoB's user avatar
  • 66.6k
7 votes
Accepted

An alternative to subscripts?

An alternative to subscripts as indices... Instead of: {Subscript[x, 1], Subscript[x, 2]} Let's use: x[1], x[2] And this ...
jackzellweger's user avatar
7 votes
Accepted

Want to return name of last defined variable without explicitly naming it

I think there must be a better way to accomplish the OP's ultimate goal than the general approach outlined above. But be that as it may, the following culls all the ...
Michael E2's user avatar
  • 234k
7 votes
Accepted

Is it possible to "escape" numbers so they can be used as a variable name?

YES. Use Script Numbers like ScriptThree \[ScriptThree]=4
Kelly Lowder's user avatar
7 votes
Accepted

Name of patterns cast as expressions from strings

StringCases["223", a : DigitCharacter ~~ b : DigitCharacter /; Evaluate[Unequal @@ (ToExpression /@ Characters["ab"])]] ...
kglr's user avatar
  • 392k
7 votes

Construct 1 variable function from given 2 variable function

What you want is called "currying". Not involving new operators you may try: ...
Daniel Huber's user avatar
  • 50.4k
7 votes
Accepted

Make matrixes with numbered name

You can use ToString and ToExpression to form the variable names and make assignments to them. Variable names: ...
Anton Antonov's user avatar
7 votes
Accepted

Incorrect syntax highlighting? "Variables made special by use in arguments" not working

Welcome to MMA SE! (Note that I think you shouldn't be using Evaluate there: consider i=3; Do2[Print[i], {i,5}].) Syntax ...
thorimur's user avatar
  • 9,010
7 votes
Accepted

How to use <* *> in tex to substitute mathematica variables

I haven't saved it. Well, if you do not save the latex to the file, it will not work. Here is a small template to use. This creates index.tex file, solves few integrals and solves an ode and saves ...
Nasser's user avatar
  • 142k
7 votes

Does Mathematica have that function which returns the variables back

Edit Thanks @BobHanlon ...
cvgmt's user avatar
  • 69.7k

Only top scored, non community-wiki answers of a minimum length are eligible