Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
24 views

Factoring out a parameter

I have some function: f[a_,b_,c_]:=Sqrt[a^2+b^2+c^2] Is there a way that I can factor out parameter (variable) b like this: <...
1
vote
1answer
48 views

What is the recommended way to plot a function with a dependent variable?

I am currently learning the basics of Mathematica. I can't seem to find a straightforward answer in the Wolfram documentation, probably for a lack of clarity in my queries. For example, I want to ...
1
vote
1answer
33 views

Question about ListPlot of variables [closed]

My question is trivial but I don't seem to be able to get the answer. Suppose that I do a numerical computation (division of some numbers that come from the numerical solution of an NDSolve or ...
3
votes
2answers
47 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. ...
6
votes
0answers
61 views

Nested rules and automatic renaming of variables [duplicate]

I understand why $ happens here: ClearAll[foo] foo[a_] := (x_ :> a x) foo[1] ...
1
vote
2answers
78 views

Possible to solve this function?

I have this function: Emax[T_, d_] := -(1/2) + d + d/(-1 + E^(d/T)) - 1/2 Coth[1/(2 T)]; All I want is to transform this Function so I get: ...
1
vote
2answers
46 views

Showing variable values on a 3D Plot

I am running a 3D plot a 100 times to show the dynamics of two undetermined variables (cM and cR) for a 100 values of ...
0
votes
1answer
21 views

Extract and name PNG's from loops [duplicate]

I want to extract PNG files and name them depending on the dummy variable of a loop. For example, starting from ...
0
votes
0answers
31 views

matrix perturbation general formula with random values

Is there a way to generate an arbitrary-sized diagonal matrix of variables, not numbers, in mathematica? Probably unnecessary context: For a research question I'm pursuing, I want to find general ...
0
votes
1answer
33 views

Use Solve for two Functions to find 1 common Variable

I have 2 functions that look like this: F[t_,d_]:= 10+t+2d G[t_,d_]:= 5+t+d I'd like to solve this in such a way to know for which t both Function have the Same value. I assume that this won't be ...
17
votes
2answers
304 views

When to name a variable with $

There are some symbols in the Wolfram Language that start with $, including $Abort, ...
1
vote
1answer
43 views

Mathematica is picking up variable definition from other files

Mathematica is using definitions from other open files in the same folder. I want variables not defined in a particular file to be treated as undefined variables. I do not want Mathematica to pick ...
0
votes
0answers
25 views

What's “expr”, “opts”, “s”, “uspec” in Names[“Global`*”]

SYSTEM: Win7 SP1 X64 Eng - MMA X64 On a very random occasion, I did something and some undesired result came up. So I checked Names["Global*"]`. All I had ...
0
votes
0answers
24 views

Problem in importing function in NDSolveValue

I have a code for solving a system of 2 differential equations (sol1). Given that what's inside is a bit heavy, I define functions so that I can call them. My issue is that when I write everything ...
2
votes
2answers
82 views

Define a function of a function of an arbitrary variable

I want to define a function called int that takes another function as an argument and yields an integral of that function from 0 to 1 (just for example). So I ...
0
votes
1answer
28 views

Plot interpolating function depending on free variable inside manipulate

I create an interpolating function which depends on some free variables. I then want to plot it inside a manipulate, but my output is empty. What am I doing wrong? ...
0
votes
1answer
33 views

Altering the Values of Global Lists Within Tables

Say I have some lists: list1 = {4} list2 = {2} list3 = {6} list4 = {9} list5 = {7}. I want to alter them in a table like so: ...
0
votes
1answer
46 views

Solve an equation with two specific domains?

In Solve an equation with specific domain? I asked how to write a code in Mathematica with one specific domain for one of its variables. Now I have a questions: If two of the variables are from ...
1
vote
2answers
70 views

Solve an equation with specific domain?

How can I write a code in Mathematica to solve an equation with variable in specific domains? For instance, I want to write a code for ...
-1
votes
2answers
72 views

How to replace Variable With Variable [closed]

Clear[a, b, c]; a = c; a =. ; b = a; b =.; c = b; c =.; Print[a, b] and the result is {a b} but I want the result ...
0
votes
1answer
65 views

Automatic variable naming

I am trying to construct a complicated code in which I need to name a lot of variables and their definitions. For Example: The problem is as follow: Once I insert new variable in between two, I ...
1
vote
1answer
44 views

Using Variables[] as the argument of Plot[]

I want to use the Variables[] function to extract the name of the variable of a function, such that I can use it later, e.g. in a ...
0
votes
1answer
46 views

How to plot solutions for simultaneous equations

I have 2 simultaneous equation of $x$ and $y$. Here is how I solve it, and it works. But I want to vary the parameters n and ...
2
votes
1answer
64 views

Relabeling and matching variables (in MultiplicationTable)

Suppose we have a set of data given here as the multiplication table of 8 elements labeled {1,2,3,4,9,10,11,12}: $$ \begin{array}{cccccccc} 1 & 2 & 3 & 4 & 9 & 10 & 11 & ...
1
vote
1answer
51 views

Use Manipulate for a global variable

I do have a global variable called w1, which is used as a factor in a dataset, however I want to make this factor dynamic. ...
0
votes
1answer
47 views

How can I evaluate a function using the results of Reduce?

Can I use the output of reduce to define a variable in a function definition? In other words, can I somehow skip the step where I manually enter t:=2? ...
0
votes
0answers
31 views

assigning numerical values to variable

I have a csv data file, has two columns of data. First column denotes time (t) and the corresponding value in the second column is flow rate (f). I would like to assign these values to an array f[t], ...
0
votes
0answers
88 views

What are the valid symbol names for packages?

Regarding to the message: ...
1
vote
0answers
45 views

Execute a notebook with a changing variable

I have created a notebook with one fix variable that I want to run from 1 to 100. Every time the whole notebook (all cells) shall be executed for the given number. At the end of the notebook, it shall ...
0
votes
1answer
56 views

Issue with variable recognition

Why are the variables r,s,u,v identified differently in the definitions of F2,G1,G2?
1
vote
1answer
57 views

How to evaluate user-defined functions with variables?

I have an extremely simple question, but I couldn't find anything anywhere, maybe I didn't know what to search for, so feel free to mark it as duplicate if there is a duplicate. Let's say that I ...
0
votes
1answer
44 views

Create an array of independent variables of variable size, all dependent upon the same dependent variable

I have an array of variables that I've constructed, that all depend on time s ...
0
votes
2answers
44 views

How can I create a row matrices of large dimension by a code? [closed]

I am trying to figure out how to create a function that can create the row matrix pattern below. co = {{a1, a2, a3, a4, a5, a6, ...., a100}};
3
votes
0answers
205 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: ...
0
votes
0answers
16 views

Variables in AskFunction

I'm trying to ask people for certain variables by using the AskFunction code as follows: ...
3
votes
2answers
116 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 ...
0
votes
0answers
70 views

Is there in Mathematica something like class in Java or struct in C? [duplicate]

I am new to Mathematica and I am very impressed with its features. Although I don't understand how to do a simple thing: for example, I want to create few point variables (say a,b,c,d,e), each storing ...
0
votes
0answers
36 views

The conditions used in Sum or ParallelSum: Calling a function/variable

For some reason, I encounter a problem when doing the Sum and ParallelSum (or doing the Do or ParallelDo, e.g. such as the issue here), I figured that the potential cause of the problem can be ...
0
votes
0answers
19 views

Write vector with variables and calculate its norm in terms of the variables [duplicate]

I have a vector v defined as follows: v[x_] = {0.5, 0., x} I calculate its norm, and expect for it to be ...
0
votes
1answer
63 views

Solving an equation of two variables by looping over different values for one variable [closed]

I have a function: f[x_,y_]=x+y. I would like to loop over some values of x, and solve for y ...
1
vote
1answer
39 views

Numerically solving a system of three nonlinear equations by predefining functions [closed]

I have three functions of three variables, f1(x,y,z),f2(x,y,z), and f3(x,y,z), and I'm ...
6
votes
1answer
177 views

Tremendous bug using EstimatedDistribution (using NMinimize) in v8.0 and v10.2

Let's define F4 and estimate the distribution of the data: ...
1
vote
3answers
131 views

How to extract variables with time subscript and their coefficients

I have a expression of the following form: $$x_{t}=a_{0}+a_{1}x_{t-1}+a_{2}y_{t-2}$$ where $a$'s are just coefficients and anything with time subscript is a variable. I would like to have list of ...
0
votes
0answers
45 views

to reduce the unknowns of a set of equations with several symbolic coefficients, e.g. using the GroebnerBasis

I have a set of $4$ equations with $4$ unknowns $\theta_1$ to $\theta_4$, and would like to eliminate the number of unknowns, to get a smaller set of equations, e.g. $n$ equations with $n$ unknowns, ...
0
votes
0answers
176 views

Extract fit error from parameter table to use as a variable

Is there anyway to extract the fit error and store it in a variable. I have done something similar to use actual fit results as ...
0
votes
0answers
29 views

function restorage problem [duplicate]

Code below f[1, 1] = 1; f[1, 2] = 2; f[1] = Min[f[1, 1], f[1, 2]] Outputs 1 However, the desired output is ...
0
votes
1answer
37 views

Taking variables from string

In a mathematica operation I am getting the o/p say, 1->2. For the next step, I want to use these two numbers as variables, say take them as 1 = m and 2 = n. How can I do it.
1
vote
2answers
82 views

variable dimension table

(A very simplified version of my code:) How can I create a Table[] with a variable number of dimensions, e.g.: ...
1
vote
2answers
104 views

How to transform a series of scalar variables to a vector variable? [closed]

Say a function is set: a := Sum[b[i], {i, 8}] As can be seen that b[i] is a scalar variable. Now I want to transform the ...
2
votes
1answer
73 views

How to form list of all OwnValues of symbols in Global context? [duplicate]

How do I get the list of all OwnValues of symbols in the Global` context? All my attempts have failed because ...