# 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.

281 questions
Filter by
Sorted by
Tagged with
5k 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: ...
469 views

303 views

### Name a list with Table

I am struggling to find a way to assign a value from a list to names from another pre-defined list with Table[]. names = {first, second, third} ...
196 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 ...
7k 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 ...
108 views

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

This example is obviously not useful on its own, but it will cover everything I actually need to know for a more complicated function I'm making. The example is to recreate the ...
132 views

### How to plot solutions of a system of equations by changing colours when one of the variables increases by step?

I have a system of two 3-variable equations $SysEqs=\{f(x,y,z)=0\;,\;g(x,y,z)=0\}$ where the domain of variables are $$6 < x < 2 \pi \\ - \frac{15}{100} < y < 0\\ 0 < z < \frac 32$$ ...
101 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. ...
832 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. ...
404 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 <...
414 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) ...
83 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$....
729 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: <...
253 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 ...
135 views

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

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

### Construct 1 variable function from given 2 variable function

Given a function f[x , y]. The definition of f is not self-describing. (f was defined with objects other than f.) Then I want to construct a function g[x] such that f[x,y] and g[x][y] are the same, ...
53 views

### Name of patterns cast as expressions from strings

I'm trying to match a part of a string while imposing conditions on the patterns, e.g.: StringCases["223", a: DigitCharacter ~~ b: DigitCharacter /; Unequal[a, b]] ...
207 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 ...
704 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 ...
219 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. ...
492 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 ...
253 views

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

I have the toy Manipulate. ...
177 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 ...
91 views

### Use a variable to represent another variable?

I'm trying to create a list of functions by replacing variables in a template. I tried this: ...
683 views

### Multiple variable assignment from a list [closed]

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: ...
217 views

### Make matrixes with numbered name

Suppose I have two matrixes M1 = {{0, 0}, {0, 0}} M2 = {{0, 0}, {0, 0}} Now I wanna have $N$ matrixes in this form called M1, M2, M3, M4,...MN How to code to ...
873 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). ...
942 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 ...
92 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 ...