Tag Info

Extracting variables from an expression

Using an undocumented function: ...
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 ...
• 13.9k
Accepted

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 ...
• 55.2k

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: ...
• 25.5k
Accepted

Checking if all the variables are present in the defined function

Using an undocumented function: ReduceFreeVariables[u] === Sort[vas]

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 / ...
• 137k
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
• 12.6k

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 ...
• 272k
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 ...
• 36.4k
Accepted

Is it possible for Mathematica to output the name of a matrix as opposed to its matrix form?

You can decompose any Hermitian 2×2 matrix $A$ into a sum over Pauli matrices, $$A=c_1\mathbb{1}+c_x\sigma_x+c_y\sigma_y+c_z\sigma_z$$ and the coefficients $(c_1,c_x,c_y,c_z)$ can be computed by the ...
• 49.1k
Accepted

Apply ToString to a list of variables

In addition to Mr.Wizard's answer here is a collection of other possibilities: ...
Accepted

Context inside Do[...]-loop

Begin["mycontext"] affects the parser, not the evaluator. These are separate expressions: Begin["mycontext`"]; ...
• 236k
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 ...

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}
• 31k

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.
• 29.7k
Accepted

How to Obtain Complete List of Properties

Importing "MTX" returns a SparseArray, so you can do A["Properties"]. ...
• 36.9k

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 _ ...
• 181

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: <...
• 67.5k
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 ...
• 240k
Accepted

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

YES. Use Script Numbers like ScriptThree \[ScriptThree]=4
• 531
Accepted

Name of patterns cast as expressions from strings

StringCases["223", a : DigitCharacter ~~ b : DigitCharacter /; Evaluate[Unequal @@ (ToExpression /@ Characters["ab"])]] ...
• 399k

Construct 1 variable function from given 2 variable function

What you want is called "currying". Not involving new operators you may try: ...
• 54k
Accepted

Make matrixes with numbered name

You can use ToString and ToExpression to form the variable names and make assignments to them. Variable names: ...
• 37.9k
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 ...
• 9,020
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 ...
• 148k

Does Mathematica have that function which returns the variables back

Edit Thanks @BobHanlon ...
• 78.4k

Is it possible for Mathematica to output the name of a matrix as opposed to its matrix form?

This is a partial answer addressing only the first example given. If you Set the value of a symbol, the symbol can never appear in the output, only its value. ...
• 161k

Apply ToString to a list of variables

You're going to first need to hold {data1,data2} unevaluated in some way; either define it first, use SetDelayed (short form <...
• 272k