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

341 questions
Filter by
Sorted by
Tagged with
735 views

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

I am interested in working with the names of matrices as opposed to the actual matrices themselves. I would like Mathematica to recognise the content of a matrix and output its name rather than its ...
• 629
1 vote
50 views

### Why does functional form of integration output depend on variables used?

The following integration code is identical, except for the use of integration variables x vs k and constants ...
• 1,000
1 vote
65 views

### Import all files in NotebookDirectory, store each list in a variable with the file name without extension

I have many files stored in the notebook directory, which are called "lista.dat", "listb.dat", ... I would like to import all of them and save them as variables called "lista&...
• 23
1 vote
37 views

### Integral within another integral [duplicate]

I have to evaluate the following integral: $I(k) = \int^{42}_{0} dt \hspace{0.1cm} 3t^3*e^{i \int_{0}^{t}dx( x^2 - \sqrt{x^4+k^2/x}) }/\sqrt{t^4+k^2/t}$ The answer in : Iterated integral numerically ...
27 views

### How to find the argument dependance of an expression

Consider expressions such as X := f[n[1]][n[3]] g[n[7], n[1923]] I would like to construct a function that returns the list of $n$'s on which $X$ depends. I know ...
1 vote
71 views

### How can I solve this inequality? Can I provide extra information when doing Solve?

I am new to Mathematica so I could really use your help. I am hoping to figure out the condition that the following function is larger than 0. I tried to FullSimplify it and to simplify it myself ...
• 25
1 vote
31 views

### NDSolve with matrix variables and SymplecticPartitionedRungeKutta [closed]

I'm experimenting with solution of differential equations with matrix variables, where the right hand side is defined as a numerically evaluated function of a matrix. Here is a simple example: ...
• 303
1 vote
99 views

### Equation with 3 variables running forever [closed]

I am new to this and was trying to solve an equation. Yet, it is taking more than 6 hours, and I am unsure if I typed something wrong or if my laptop settings are incompatible with the software. Any ...
• 25
58 views

### Defining a function of a variable through another intermediate variable

The following is a really simplified version of what I'm trying to do. I have a variable fn defined in terms some other variable x. I then want to define a function of x through the variable fn. ...
• 471
1 vote
69 views

### Find an instance satisfying equation

I have the following equation with two variables xi and nu. ...
• 496
1 vote
86 views

### How can Mathematica merge $(1/t)^{1/3} t^{17/3}$ in an expression?

(1/t)^(1/3) t^(17/3) How to let Mathematica simplify it?
• 11
52 views

### Identify a condition among variables that satisfy an inequality

I have a symbolic function that produces the output a = (1 - e - mu/n) Log[(1 - e - mu/n)/(1 - mu/n)] + (e + mu/n) Log[((e + mu/n) n)/mu] If I substitute ...
• 496
67 views

### A specific usage of "Solve" function [duplicate]

It is something from Simplifying polynomials with conditions on variables, that intend to minimize the number of variables. The problem is the usage of Solve". I know how to solve equations, ...
• 115
56 views

### how to use subscripted variable such as a_i as the control of Manipulate?

I'd like to define a series of variables called $l_1$,$l_2$, etc., in Mathematica, using the "ctrl+_" shortcut. Moreover, I want to use these variables as the controls of a Manipulate[] ...
• 735
1 vote
140 views

### How can I define a function with a variable with subscript?

I want to define a function in Mathematica: $$h(\tau_x)=\tau_x$$ $\tau_x$ has no special meaning. To be honest, it's totally OK if I use the function $h(x)=x$ to replace $h(\tau_x)=\tau_x$. It doesn't ...
• 113
1 vote
100 views

### Generate family of linear inequalities from vector variable for use in FindInstance

Suppose that I have a vector variable xvec = Array[x, 10]. How do I generate the family of linear inequalities F = \{ {x\in\mathbb{R}^{10}:x_1\geq x_2,\ldots,x_9\...
• 125
34 views

### sum elements (variables) of a vector variable [closed]

I would like to sum elements of a vector variable, e.g., Is xvec = Array[x, 10] s24 = Sum[xvec[i], {i, 2, 4}] where $s_{24}:=\sum_{i=2}^4 x_i$. However, I am ...
• 125
43 views

### Invalid Variable Error for Solve When Using Law of Cosines

I'm making a shadow simulator, and am using the Law of Cosines to calculate a certain angle in a triangle with two known widths and one known angle. I'm using Solve ...
80 views

### Problem with integration with indexed variable

I wonder why I can not have a correct integration form on Mathematica with some indexed variables. Indeed, when I write : ...
119 views

### Conflicting variables

So, I read a set of variables and respective values from a file and store them in a variable specs = {{"Type", "KP", "fp"}, {"LP1", 2, 2000}, {"Type", ...
277 views

### Repeating definitons of variables

I have the piece of definitions y = 1; x = 2; n = 2; a := (y^(x - 1) + n)/(y^(x - 1) + y^(x - 2)) I want to keep defining y as a by doing: ...
• 162
69 views

### Answer changes slightly when re-run

I am trying to resolve why I get slightly different answers when I re-run my notebook. Here is my full code: ...
• 1
1 vote
87 views

### Local variables in a module don't show their actual values

I need to do the following transformation that pick[a,b] -> ex[c|->{c[a],c[b]}] ex is a function that accepts a function as parameter which returns a list ...
• 307
248 views

### How to Obtain Complete List of Properties

I am working with Matrix Market matrices in Mathematica (specifically GEMAT12), and I saw from other posts that you call properties of a variable exemplified below: ...
• 165
73 views

### Can you dynamically create variable names in Mathematica? [duplicate]

I was wondering if there is a way of Mathematica to read a string or number and create variable with that name. For instance imagine that I have a file with the word data1. I would want to create a ...
72 views

### how to understand the locality of variables in Mathematica

(in the first i should say may be the title is not very accurate) how to understand case like the following: ...
• 353
69 views

### a basic question about variable in Mathematica

I can't describe exactly the problem I'm experiencing, but this kind of problem has a remarkable feature, that is, commands which couldn't work in the before can be executed correctly when i turn off ...
• 353
282 views

### Does Mathematica have that function which returns the variables back [duplicate]

Does Mathematica have this function where I can give a system of equations as an input and the function return back to me the variables which were included in that system. For example: input Function[...
215 views

### How to use <* *> in tex to substitute mathematica variables [closed]

I am generating tex files with a "for" loop in Mathematica. In each file I need to have different quantities. So I am defining a variable in Mathematica, which is is evaluated during each ...
1 vote
85 views

### Internal variable in Sum inside a function [closed]

I am writing a simple function which performs a sum, but run into an unexpected answer. ...
• 543
475 views

### Define a delayed function depending on a global variable as though the variable's contents was pasted

Problem Say I previously defined a variable (maybe through some extensive calculation) thing = (a+x)y Then, I want to use that expression elsewhere. In general, I ...
• 1,055
219 views

### Is it necessary to use Print inside a Block? [closed]

If I use a Block with variables already used and ask it to Solve an equation inside the Block...
• 339
22 views

### Replacing System` definitions in a context whilst still maintaing acces to them [duplicate]

Given the system operator TensorContract I can define a new one, TensorContractLazy with the attribute ...
• 872
52 views

### Reusing local variables through Reduce and ToRules

Problem: I am interested in solving a system of linear equations through Mathematica. In my current test scenario, I am having trouble using the Reduce function followed by the ToRules command. I ...
• 111
1 vote
37 views

### How to best query if an expression contains Symbol/variable

Say I have this expression, among many: ...
• 181
1 vote
92 views

### Why =. is not clearing the value of a variable in this case? [closed]

I am reading "Mathematics and Algorithms" as part of the Wolfram Tutorial series. In "Values for symbols" section of the "Algebraic Calculations" chapter it is described ...
• 333
50 views

### Function of two variables - how to supress one variable dependency

I have this equation i would like to solve: e0 = (2 \[Alpha]1g)/((1 - v1g) (c^2 - b^2)) Integrate[r \[Tau]1[r, t], {r, b, c}] - (2 v1)/E1 A1; Function e0 ...
• 97
67 views

### How to define variables properly in mathematica, a variable with two name [duplicate]

I wanted to define a variable in the name "beam_frequency", this is quite possible in other programming languages like python and Matlab. How to define two pair variable name in Mathematica ...
• 437
350 views

### Would it be poor advice to assign roman numerals as top variables?

For example like so. x = 10; xi = 11; xv = 15; Is there an automated way to spit these numbers out maybe 1-1000.
• 7,635
162 views

### Rewriting an expression while using another parameter

I wish to rewrite V and M with the given A. I have provided what the end result is supposed to look like. Here is V ...
• 121
41 views

### Scaling a variable multiplied by power series is not giving expected output

I have a power series getting multiplied by a variable, which gets scaled by the small parameter used in the power series. As an example, in the following dummy series: ...
107 views

### How to plot the perimeter of an ellipse where the variable is its eccentricity?

I'm basically just trying to plot a function where the x value is the eccentricity of an ellipse and the y value its perimeter. I've tried first defining the eccentricity ...
• 21
91 views

### How to define prefix that can turn numeric?

I put these prefix in my init.m file. First I Unprotect all these symbols, set values and then ...
• 2,430
1 vote
193 views

### Solving for linear combination of variables

I have a set of constraints on nine variables, ...
• 496
951 views

### List of letters longer than the alphabet

I would like to create a list of the first $n$ letters of the english alphabet. Importantly, I would like that in case $n$ is bigger than the size of the alphabet, the letters will start repeating in ...
268 views

### How to convert mathematica root expression to readable one? [duplicate]

I am trying to find out at what regions a function is monotonically decreasing. The function is a function of X and has two more variables epsilon and B with the constrains 0 < B, 0 <epsilon< ...
• 57
82 views

### Cannot Optimize where NSolve and NDSolveValue are involved with Multi-Variables

My Objective Function is Sqrt[Sum[((sol[[j]])^2), {j, 1, noofnode}]/noofnode] with variables v1, v2, v3, v4, v5, v6. But just ...
1 vote
146 views

### How to change the values of a parameter within the domain in NDSolveValue?

In the following code, e is constant within the domain. But I want to change the value of e continuously within the domain. For ...