# Questions tagged [variable]

Questions on the use or manipulation of Mathematica variables (i.e. names associated with a changeable value). Use [variable-definitions] or [assignment] for questions on variable context localization, or assignment.

209 questions
Filter by
Sorted by
Tagged with
4k views

### Extracting variables from an expression

I'm looking for a way to extract a list of variables from an expression, for example with an input like: ...
330 views

446 views

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

So I have this function : Sqrt[-1 + Tanh[#1 - #2]^2] & How can I transform it into f[x_,y_]=Sqrt[-1 + Tanh[x - y]^2] ...
1k views

### Assign values to variable names in lists [duplicate]

I hope somebody can help me in this (I guess) simple question: I have a list of variable names ls={w0,w1,w2} and another list of values ...
78 views

### Make assumption for function with variable argument

I would like to assume that a>t[b_] for any b, such that e.g. Simplify[a>t[c]]==True. ...
218 views

### An alternative to subscripts?

Are there any good alternatives to using subscripts to keep track of and uniquely identify many variables? I know that subscripted variables behave badly. Thanks!
287 views

### Series expansion of a multivariable function to an order n for any number of variables [duplicate]

Suppose I want to expand a multivariable function to an order n. ...
323 views

### One inequality with two variables

I would just like to know if this: ((a - b)/(b*Log[b])) - Log[Log[a]] + Log[Log[b]] exceeds 0 for any combination of a and <...
399 views

### How to make Mathematica express an equation in terms of previously defined functions

I was given a problem for my physics class, and perhaps I have taken it too far, but I wish to finish what I started. I have a function (i warn you that this does not look pretty) ...
636 views

### How to re-assign values to a List of variables?

The accepted Answer to this similar Question can only be used one time, so it's not suitable for my problem. I do high-dimensional calculations for which I need to make lists of variables, like so: <...
248 views

### Why is DSolve different when the equation is built programmatically?

Here is a simple differential equation. mwe=y[x]/.First@DSolve [{y'[x]==x-2*x*y[x],y==0},y[x],x] I get the answer $\frac{1}{2}-\frac{e^{-x^2}}{2}$ If I build ...
132 views

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

If you have a symbol with a value, you can clear it with Remove[]. Thus ...
161 views

### Context inside Do[…]-loop

Consider the following code: Begin["mycontext"]; myvar = 7; Print[Context[]]; Print[Context[myvar]]; End[]; with the output mycontext mycontext` Now ...
143 views

### How to find variables set through Get[“/some/path/dump.mx”]? [duplicate]

(NB: I could not find any good tags for this post. Please feel free to add better ones.) Suppose that the file /some/path/dump.mx was generated during an earlier ...
5k views

### Using Array Elements as Function Arguments

Suppose I have an array p = {a,b,c,d} and a function f that takes a variable number of arguments. I want to evaluate ...
33 views

### Computing Higher Order Tensor of Variable Rank

The following code takes a vector x of variable length, computes the outer product of the vector with itself to form the matrix $\rho$ of dimension $2^n \times 2^n$....
415 views

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

I have been having some trouble graphing a Taylor series approximation (Series). ...
499 views

### Getting a list of variable names as strings via a function

This is a new twist of an earlier question about how to get variable names as strings from a function. I would like to have a function that returns a list of variable names, each being a string, from ...
80 views

### From f[g[x,t]] to f[g]

How can you change f[g[x,t],t] to f[g,t] ? I have differential equations ...
114 views

### Solve and naming variables

Let's say, I do this: ...
328 views

### Combining Multiple Lists

Let's say I have 4 lists: list1 = {a,b,c,d}; list2 = {e,f,g,h}; list3 = {i,j,k,l}; list4 = {m,n,o,p}; I can combine them using Join ...
117 views

### How can we define lots of variables

I am new to Mathematica and some things I do not understand. Right now I need to write an algorithm which takes a polynomial in many variables, I denote it by $p_{i,j}$, and then I want to apply a ...
418 views

### Is it possible to find the size of a variable in a notebook?

I have a fairly large a list of matrices matsLst, which takes about 15 minutes to compute (but computes successfully each time). I can test in the notebook that ...
10k views

### Explanation for coloring of variables by code editor?

I was working on some homework just now, and I realized that some of my variables have different colors, and I am not sure why. In the example below f is black, ...
154 views

### Using a variable for two different purposes

I want to name a bunch of tables after the OEIS entries which describe them. Is there any way to use these names for both the table name and the link at the same time? The second line uses the ...
63 views

### Using Symbolize to Convert Multiple Variables at Once

So, I have created a list of subscripted and overdotted variables that I would like to symbolize, so I run them through a for loop. Seems to me that this would work? Any help is appreciated. ...
219 views

### Button with loop that iteratively updates slider in Manipulate

I have the toy Manipulate. ...
94 views

### Treat 2 variable as 1

Is there anyway to treat two variable, that are a result of expansion, as one? To use Solve[] I can do ...
478 views

### Protected Variable Error with Workbench 3.0

I have Wolfram Workbench 3.0, build 78, with Mathematica 10.4 as the front end. I am using Windows 10. I am trying to run a simple test source code test.m: ...
103 views

### Checking if input is a function

I would like to write a program to find the leading coefficient of a given polynomial. (Sounds easy, right?) I'd like to be able to handle the format x^2-x+7 (with ...
457 views

### Multiple variable assignment from a list

For example in Python, if we have a list of 3 elements, say ls = [1,2,3] and we want to assign a variable to each value (from left to right), one can do as follows: ...
48 views

### Variable assignment/replacement issues

I have three questions about variable assignment. Module[{z}, z = y; p'[y] /. p -> Function[y, Evaluate[z]]] When I run the above code, it outputs 0. 1) If I ...
205 views

### Pure function within another function

I am writing a function along the lines of the following: func[basis_,coordinates_,vars_]:=Table[Function[vars,monomial]@@@coordinates,{monomial,basis}] The idea ...
138 views

### PasteButton: Pasting expression name without quotation marks?

I am struggling to find a way to use PasteButton to paste the name of an expression (in particular a list) without showing the contents of the expression or without ...