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.

Filter by
Sorted by
Tagged with
1 vote
2 answers
81 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 ...
user avatar
  • 11
1 vote
2 answers
94 views

Replacement rule for functions of two variables

In Mathematica when I use the substitutions rule (/.) If I have two variables {NN,H} each variables has 5 values and i want to substitute about the first variable ...
user avatar
  • 69
0 votes
1 answer
60 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 ...
user avatar
  • 1,750
1 vote
1 answer
100 views

Solving for linear combination of variables

I have a set of constraints on nine variables, ...
user avatar
  • 270
5 votes
5 answers
840 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 ...
user avatar
0 votes
1 answer
76 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< ...
user avatar
  • 5
0 votes
0 answers
67 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 ...
user avatar
0 votes
1 answer
77 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 ...
user avatar
0 votes
0 answers
95 views

How to Optimize a Finite Element Model with Multiple Variables in Mathematica?

Urgent Help, Please !!! I am attaching my codes for a Finite Element Model which needs to be optimized and the Objective Function ("of" in the code) has been mentioned at the last line of ...
user avatar
0 votes
0 answers
91 views

Help with Error: Recursion depth of 1024 exceeded during evaluation

I am quite new to Mathematica. Please excuse my mistakes. I would appreciate if you could help me with the following set of commands. ...
user avatar
  • 1
0 votes
0 answers
33 views

how to delete a variable programmatically in a notebook from another notebook

how to delete a variable programmatically in a notebook from another notebook? c = b; I have already tried Remove[c] but ...
user avatar
2 votes
1 answer
34 views

Arrange an expression based on variables' names

I have a problem of arranging an expression as shown in the following picture. The first expression exp is derived from other functions and equations. I want to get ...
user avatar
  • 663
0 votes
0 answers
35 views

Changing variable order in an output [duplicate]

Is it possible to change variable orders in an output? For example, if i get: x= p l is it possible to change as: x= l p
user avatar
3 votes
1 answer
95 views

Partial derivatives in a variable name

I would like to create variable with names of the form \[PartialD]g and \[PartialD]\[PartialD]g. Is there any way to do this?
user avatar
1 vote
0 answers
73 views

Full Information Maximum Likelihood - Under some other name in Mathematica

I have recently stumbled upon something called FIML - Full Information Maximum Likelihood. Apparently this methodology helps overcome missing variables provided the gaps are random. Searching the ...
user avatar
  • 579
5 votes
1 answer
137 views

What Does this Syntax Mean in Ouput from DSolve?

When I run the code DSolve[y*D[f[x, y, z], z] - z*D[f[x, y, z], y] == 0, f[x, y, z], {x, y, z}] I get the following output. I don't understand this syntax. I ...
user avatar
0 votes
2 answers
70 views

Integrate of simple equation but is not solving!

I have this simple integral but I don't know why Mathematica can't solve it?! FullSimplify[Integrate[x/(-x^2 + a x + b)^(1/2), {x, Sqrt[b], Sqrt[R^2 + b]},Assumptions -> {a > 0, b > 0}]]
user avatar
  • 105
3 votes
2 answers
141 views

Making a list of variables

Consider the following code, which give a Manipulate object that returns the "total" of a certain variable var 1 ...
user avatar
  • 4,138
2 votes
0 answers
60 views

Extracting variables [closed]

Similar to this perhaps, but I prefer a built-in function. I have defined the expression L = a*b*c. Is there a Mathematica function that can identify and extract ...
user avatar
  • 21
2 votes
1 answer
215 views

How to replace the arguments of a function?

I have the following type of (very long) expression: $$\ldots + X[1,2,3,5] + X[2,4,5,6] + \ldots \tag{1}$$ where $X[a,b,c,d]$ is some undefined function. I would like to replace all the occurrences of ...
user avatar
  • 641
2 votes
1 answer
109 views

Coloring all the variables with the same name with the same color

I would like to know if there is a possibility to automatically color the variables with the same name with the same color. For example, like in the picture below: Right now I need to do it manually ...
user avatar
3 votes
1 answer
74 views

Performing matrix tensor product and getting a sum of its negative entries

I am given a $3 \times 3$ matrix $M$, which only has real entries. Is there an efficient way to do the following two operations with $M$? For a given input $n$, compute the $n$-fold tensor product $M^...
user avatar
2 votes
1 answer
75 views

Define variables dynamically to compute a function

Let's say I have defined a function $W(p, q)$, where $p$ and $q$ are integers between (and including) $0$ and $2$ and the function takes me to a real number. Upon an input $n$, where $n$ is a positive ...
user avatar
5 votes
1 answer
131 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 ...
user avatar
  • 558
0 votes
1 answer
40 views

In DynamicModule, InputField does not display the update when its variable updates through PopupWindow. How to fix this?

Here's a minimal example: ...
user avatar
  • 53
2 votes
0 answers
27 views

[NDSolve error]: Equation or list of equations expected instead of 0.0001` in the first argument {(s^\[Prime])[t]==-0.325 s[t]-1.5 i[t] s[t]-1.5 [closed]

I am trying to have 5 PDEs with 5 unknowns, with code below However, I always receive the error message that Equation or list of equations expected instead of 0.0001` in the first argument {(s^[Prime])...
user avatar
1 vote
0 answers
30 views

Error using list of discrete variables with WhenEvent

I came across an error when using a list of Discrete Variables with NDSolve and WhenEvent. As you can see in the minimal example, where I defined the 'testevent', when I use ...
user avatar
  • 115
0 votes
0 answers
100 views

Creating new variable names, Symbol or ToExpression

One can create new variable names by Symbol : In[1] Table[Symbol["x"<>ToString[i]], {i,1,5}] Out[1] {x1,x2,x3,x4,x5} But it is also possible to ...
user avatar
  • 2,451
0 votes
2 answers
79 views

Why does this simple code with Eliminate not give any result?

My goal is to obtain the function $s$ defined in the code below as a function of $\chi_1$, $\chi_2$, $\chi_3$. The code runs but never ends, although the problem does not seem too hard to solve for a ...
user avatar
  • 641
0 votes
1 answer
89 views

How to clear this variable [duplicate]

I can not clear this variable. How to clear?
user avatar
  • 1
0 votes
1 answer
48 views

Mean of Randomvariable

I want to calculate Mean[x+y]. x = NormalDistribution[] y = NormalDistribution[] Mean[x + y] ...
user avatar
1 vote
1 answer
68 views

Dynamic updating problem

Consider the code ...
user avatar
  • 4,138
0 votes
1 answer
74 views

Solve in parametric equations in term of a set of parameters

I am not sure the title is right but let me explain. I have the relations ...
user avatar
  • 151
3 votes
3 answers
223 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 ...
user avatar
  • 701
0 votes
0 answers
63 views

A function that maps Held symbol to string

Rougly my question is about constructing a function that maps Hold[var] to "var" even when var has an assigned value. In details : ...
user avatar
  • 2,451
2 votes
2 answers
67 views

How can I store vectors in a matrix

I am triying to generate realizations of a Gaussian random process using the KL expansion. For that, I need to multiply an eigenvector for an eigenvalue and a random variable. I have tried ...
user avatar
3 votes
1 answer
64 views

Definition of multiple variables from a list

I have a list of the form {{0, 0, 0, 0, 0, 0, a, b, c, d, e, f}, {0, 0, 0, 0, 0, 1, a, c, b, d, f, e}, {2, 2, 2, 2, 1, 2, b, f, c, a, d, e}, ... } and I would ...
user avatar
  • 327
5 votes
1 answer
154 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$$ ...
user avatar
3 votes
0 answers
79 views

Module inside With, With inside Module, or Just Module?

In general, if one wants to define local variables and local constants, which of the following is the best programming practice in terms of performance and code "safety"? (Assume ...
user avatar
0 votes
1 answer
108 views

Is it possible to plot a 3-variable function, two variables normally, and the third one to change with color?

I have a function like $$f(x,y,z)=4 \sinh (2 y) \cosh (z-x)+5 \sin (2 x-y)-6 x+y+3 \cosh (2 z)$$ where $$0<x<4\;,\qquad-3<y<0\;,\qquad0<z<2$$ I would like to have a plot of this ...
user avatar
1 vote
0 answers
32 views

How to change expression of variable in output

I run the example: c = a - b; e^(a - b) This gives me e^(a-b). How can I do to let it output e^c
user avatar
2 votes
1 answer
60 views

shadowing problem with options of a package

So here is my problem. I am writing a software with mathematica, that uses an external package as a resource. They are some libraries for numerical integration, the CUBA libraries. http://www.feynarts....
user avatar
1 vote
2 answers
133 views

How to make a change of variable $y=x^2$ in the differential operator $\frac{d^2}{d y^2}$?

I have this differential operator $$\frac{d^2}{d y^2}\qquad (1)$$ I want to make a change of variable $y=x^2$ in $(1)$ so that I get this differential operator $$ \frac{1}{4 x^2} \frac{d^2 }{d x^...
user avatar
  • 335
0 votes
1 answer
35 views

Writing a function with a variable [closed]

trying to write this function, while b,d are known numbers and hj is the variable thank you very much
user avatar
0 votes
3 answers
109 views

Elimination of the variables

I am trying to get an equation in terms of variable z by eliminating variables g0 and g1 but Running below code is taking time forever ...
user avatar
  • 21
0 votes
3 answers
41 views

Removing terms with more than 2 variables

Say I have the variable x = a + a b + a b c + a b c d + .... What is the easiest way to remove all terms with more than 2 variables? Up until now, I have used <...
user avatar
0 votes
0 answers
33 views

Minimizing a function and plot it

I have a long expression, depended on 3 different variables say "a", "b" and "p". Just as an example, a part of this expression is: z = p * Cos[x] * Sin[y]. I'm going to ...
user avatar
-1 votes
1 answer
41 views

How to store ParametricPlot in a variable without plotting the graph?

Write separated commands for the following parametric equations using ParametricPlot and plot all of them in a single graph and show the combined graph only.
user avatar
0 votes
2 answers
73 views

Indexed variable - Function that contains summation

I have the following problem: I have a function that looks like $f(c_1 , c_2 ) = c_1 + c_2 + c_3$. The variables are $c_1$ and $c_2$, $c_3$ is a known constant. I would like to define a function in ...
user avatar
1 vote
1 answer
37 views

How can I use Table in a replacement rule? [closed]

I would like to implement the following replacement rule: $$tr[a^k]^\ell \longrightarrow t[\underbrace{k,k,...,k}_{\ell\ \text{times}}]\,. \tag{1}$$ My (naive) attempt was to write: ...
user avatar
  • 641

1
2 3 4 5
7