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.

learn more… | top users | synonyms

2
votes
1answer
69 views

Assiging random values to an array of variables [closed]

I want to create a number of variables and assign random values to them. This is possible in Python using a single line of command. To be more specific say I want to create 10 variables whose value ...
0
votes
1answer
48 views

How to give more importance to a variable in a chart

I have two variables, x and y. x goes from 0 to 10, 10 being best. ...
1
vote
0answers
33 views

How to avoid import evaluation until if wil return true

My goal is to import a data from url that depends of 1 parameter, this initialy value is null or undifined en yo have to selec some popup and then the variable has value, what is the method to do ...
1
vote
1answer
71 views

Adding letters and numbers to create a variable name [duplicate]

Let's say I have several variables, named R1, R2 and R3. I wanted to have a function ...
2
votes
0answers
46 views

Defining a function which takes lists as it arguments and threads over them [closed]

I want to define a function with lists as variables, which has the form like m = Table[2, {i, 5}]; f[x_, y_] = m*x + x*y; x and y are list variables; m is a ...
2
votes
1answer
65 views

How to choose variables of specific form

I am trying to work on a problem with a probability distribution. I wanted to get the result in analytical form. Suppose I need to keep p1, p2, p3, p4 variables such that p1+p2+p3+p4=1; How to use ...
2
votes
1answer
82 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 ...
1
vote
1answer
109 views

How to use Table to assign values to variables in a list?

I'm trying to do the following: R = {a, b, c, d, e, f, g, h, i}; Table[R[[n]] = RandomInteger[{0, 20}], {n, 1, Length[R]}] My intention is to assign a random ...
0
votes
0answers
36 views

Symbol-handling, force-replace instanced variables within functions! [duplicate]

Currently I am stuck with the issue of renaming an instanced variable like r1$23314 to a global one. This issue arises as I need to use a "localizeAll" Module in ...
0
votes
0answers
38 views

Is the letter “s” special in Mathematica? [duplicate]

I'm finding that the two versions of the expression below evaluate differently: ...
0
votes
0answers
19 views

same variable name is persevered as different variables in to different places in single code

So I am writing a simple strait forward code and it seems as if Mathematica is perceiving the same variable as to different ones. The code is this: ...
0
votes
0answers
48 views

Need help with notations [duplicate]

I can't create a custom variable with notation. Where is my problem? I have a big computation and I need to convert it to LaTeX. ...
2
votes
0answers
66 views

Plotting data with four variables; two labels for one of the axes

I am having difficulty related to 3D plotting task. I have a set of data points in the following form : ...
1
vote
1answer
62 views

Printing names of indexed variables instead of values

I'd like to display only the variable (indexed variable) name (in symbol form, not in string form) instead of its value in Mathematica. Say I have a variable foo[i] ...
2
votes
2answers
66 views

Can i change AutoStyles colors for undefined variables?

I want to change from blue to red the color of the undefined variables; but only for the current Notebook
0
votes
1answer
63 views

Can I name a variable as D(1,0,+1/2)? [closed]

I am trying to use variables with names as D(0,0,0), D(1,1/2,+1/2), etc. but I don't know how to do it.
1
vote
1answer
72 views

Is it possible to assign a value where the target is itself a variable

If I have a variable x := "a". Is there a way I can use it to assign a value to a, by just referring to ...
0
votes
1answer
57 views

Change of variables—Galilean transformation

I have a function of two variables, f[x, y], and I wish to do a Galilean transformation, i.e., y = z - v t, where ...
0
votes
0answers
87 views

Calculating the rank of an abstract matrix

I'm trying to compute the rank of a 4x4 matrix with 4 parameters and 2 variables. I tried to calculate its rank under some assumptions on those conditions and I kept getting rank 4. So I did an ...
0
votes
1answer
71 views

How to specify the domain of a variable?

How can I specify for every expression the domain of a variable without using assumptions everytime i have to simplify it?
1
vote
1answer
63 views

How to make strong assumptions?

Or put in another way, how to make a variable behave as it belongs to a specific domain, even outside the use of simplify or other commands alike? For example: ...
0
votes
1answer
76 views

Variable change

If I have the following Hamiltonian: ...
1
vote
2answers
75 views

Solutions to multivariate equation

Is there any way to get Mathematica to give a set of solutions (pairs of x and y that are integers) to an equation with multiple variables? Something like: ...
0
votes
0answers
34 views

Substitute all known values in matrix [duplicate]

There is probably a very simple way of doing the following, but I cannot find it. I have a an array of symbolic variables: coefficients = Array[c, 3] I then ...
1
vote
1answer
64 views

Problem using variable loaded from TextField

I'm trying to make a simple app, which loads some data via TextFields and then does something with that, but ... ...
1
vote
1answer
73 views

How can I plot a 3D graph that shows how a histogram varies with a particular parameter?

How can I plot a 3D graph that shows how a histogram varies with a particular parameter? A simple example of this would be plotting a histogram of data described by a gaussian. The gaussian is of ...
0
votes
0answers
32 views

List of symbol names using `SymbolName` [duplicate]

With a list of variables, I want to create a table with variable names as TableHeadings. I am trying to get the list of variable names using the following code: ...
0
votes
0answers
94 views

How to assign equation solutions to variables [duplicate]

I have 12x12 Matrix with which I have to solve the equation below: ...
0
votes
0answers
12 views

Watching variables during Notebook work session [duplicate]

One feature that I have always wanted but could not find out if it was supported and that is to actively watch variables and their values while working in a Notebook session. In fact, there are two ...
1
vote
2answers
54 views

Summing over n variables [duplicate]

I am currently trying to create a function taht will sum over n variables, but I don't really know how ot implement it. It should look like this: $f[n]=\left(\frac{1}{6}\right)^n \sum _{x_1=1}^6\sum ...
0
votes
0answers
107 views

Add constraints to a variable number of parameter in Minimize

i want to use Minimize with a variable number of Parameter which works fine: ...
2
votes
1answer
102 views

Equivalent command to the Maple indets command

This carries on the discussion here and here. I had mistaken Variable[] to give you ALL variables in an expression, but apparently, it is not meant for that. ...
5
votes
1answer
343 views

Get expression type?

Is there a built in function that distinguishes between different kinds of variables? I mean something like: ...
1
vote
1answer
222 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, ...
0
votes
1answer
79 views

Get all variables in an expression with Variables[]

"\[Phi]" <> "1"; Variables[%] Exp["\[Phi]" <> "1"]; Variables[%] Exp[Subscript[\[Phi], 1]]; Variables[%] Say I have lots of variables used for ...
0
votes
0answers
47 views

Replacing variable names in a notebook

I am working on a code that simply imports and graphs a function. If I preset the directory I would have something that looks like this: ...
7
votes
2answers
300 views

Display variable name instead of value

Is there a way to display the variable name instead of its value? for example, I need something likevarname = 1; function[varname]; and the output is ...
1
vote
2answers
240 views

Pass the list of variables into function to change their values

I'm new to Mathematica, so I don't really know, how do what I want, and I don't even know how to google it. Doing one Mathematica task for my supervisor, I faced the following problem. I need to ...
1
vote
2answers
90 views

why the variable scope is not local when using evaluate to plot multicurve?

I noticed a surprising problem when using evaluate to plot multicurve, "evaluate" function actually consider global variable first, not the local! I can illustrate the problem using the following ...
1
vote
0answers
46 views

Settings to disable global scope

I am building a fairly large application in Mathematica, and globally scoped variables are causing issues. I would like globally scoped variables to be out-of-scope for my expressions, except by ...
0
votes
1answer
76 views

Why do For[] loop variables in different functions interfere?

I had something along the lines of: ...
1
vote
1answer
135 views

Assign values to variable names in lists

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 ...
2
votes
2answers
79 views

Pattern evaluation in nested function call

I'll put the question right here, but will add some context below in case someone wonders why the heck I'm trying to do this. Why is it that I have to do two passes to get the value of the arguments ...
0
votes
2answers
1k views

How to pass a list as function argument?

I have the following function lFreqPhylo[a_, Q_, b_, p_] := Sum[Log[freqFunction[r[[p]][[i]], L[[p]][[i]], a, Q, b, {i, 1, nbranches[[p]]}]; The objects L, r ...
0
votes
1answer
35 views

How to output local variables when error message is generated without interrupting evaluation?

I am running a calculation to generate a dataset. I use several iterations to sweep over a parameter space. A few times an error message is generated (which is not the problem per se). Is it possible ...
3
votes
2answers
136 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 ...
2
votes
1answer
88 views

Strange behavior using variable in Exists

I came across a behavior that doesn't make sense to me when I tried to use Exists in Reduce. If I run commands: ...
5
votes
1answer
333 views

Variable number of nested variable-range sums

I would like to express the following nested sum in Mathematica: $$ S(m,j,N) = \sum_{k_1=m+j-1}^{N-1} f(N,k_1) \sum_{k_2=m+j-2}^{k_1-1} f(k_1,k_2) \cdots \sum_{k_m=j}^{k_{m-1}-1} f(k_{m-1},k_m) $$ ...
1
vote
2answers
213 views

Do multiple instances of Mathematica run completely independently?

Let me simplify the problem I am trying to solve so that the issue I face is highlighted. Say, I want to generate $n$ samples of a Gaussian random variable. I have a script (say ...
4
votes
1answer
195 views

Why does one of my Manipulate integer variables get turned into a real?

I'm developing code for manipulating graphs. Spot the difference in the 2 Manipulates below: ...