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.

24 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
1answer
34 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$....
3
votes
0answers
483 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: ...
3
votes
0answers
52 views

Variable assignment/replacement issues

I have three questions about variable assignment. Module[{z}, z = y; p'[y] /. p -> Function[y, Evaluate[z]]] When I run the above code, it outputs 0. 1) If I ...
1
vote
0answers
33 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 ...
1
vote
0answers
62 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 ...
1
vote
0answers
397 views

How to declare variables with plus/minus sign as subscript/superscript?

I am pretty new to mathematica, so please forgive me if I ask any stupid questions. I want to create a vector $a^{+}=[a^+_{k-2},a^+_{k-1},a^+_{k},a^+_{k+1},a^+_{k+2}]$ and then do some symbolic ...
1
vote
0answers
51 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 that?...
1
vote
0answers
68 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
0answers
34 views

Variables for multiple data files plotting using same Mathematica notebook

I am not an expert in mathematica, I have this following code. As you see I import a text file under the name "MyPoint1", plot with "pAll" then I do some more calculation with more variables and ...
0
votes
0answers
30 views

ReplaceAll Not Working Correctly

I'm trying to use replaceall to redefine my expression in terms of a separate variable.. ...
0
votes
0answers
33 views

Saving variable inside Manipulate command

I have been working in a plotter using "manipulate", I let the code below. However, I would like change between different kind of "options" that I will add them after, the problem is when I change to ...
0
votes
0answers
86 views

Problem with fitting

So I have a very simple question related to a simple topic, but also directly related to a fitting problem. I see that my question is related to this question but I don't manage to make the bridge ...
0
votes
0answers
32 views

Bounding Solve results to named variables

How can i bound results of my Solve function to variables properly? This metod works but causes unexpected troubles i struggle to resolve ...
0
votes
0answers
43 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
182 views

What are the valid symbol names for packages?

Regarding to the message: ...
0
votes
0answers
66 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
54 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
409 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
45 views

Similar Variable Names

I have variables $X1,...,X10$ and $X1hat,..., X10hat$ in a system of equations. How can I refer to these variables in a summation? I am looking for something like: ...
0
votes
0answers
175 views

Colors of variable mathematica

Suppose that I have an equation which goes like this: x = 2; yp = 2; y_p= 2; a = x + yp + y_p; Usually, once the variable is defined it will be of blue color and ...
0
votes
0answers
70 views

Using sub-scripted variables in functions

Is it possible to use subscripts in Mathematica functions, for example f[Subscript[x, a] _] := x^2 However this doesn't seem to work, is there a way to allow ...
0
votes
0answers
84 views

Best practice for passing variables to many functions?

I am rewriting an application in Mathematica. The previous version used global variables, which I find distasteful, but to avoid it I am needing to pass several static Datasets and Associations around ...
0
votes
0answers
104 views

How to provide input as a set and get a set as output too?

Friends here is the code given to a problem which i have been trying to solve lately but in the first equation i want value of 'k' to be [-1,1] or it should take every value from -1 to 1. And i know ...
-1
votes
1answer
112 views

Symbolic representation of Class Conditional Probablity as a variable

What is the best way to a create a symbolic variable to represent Class Conditional Probability in Mathematica e.g. $p(A|B)$