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.

29 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
59 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 ...
2
votes
1answer
53 views

Why some variables get substituted and others don't

I was running into some trouble with my math and I whittled it down to this nugget: ...
2
votes
0answers
48 views

Issue with calling one notebook from inside another one

I am calling one notebook (N2) from inside another notebook (N1). The results are transferred correctly from the second notebook to the first one. But when I try to compare the results from the two ...
2
votes
0answers
516 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
35 views

How to return a variable name and value from within a self-contained function block?

Abstract: I have viewed other solutions on StackExchange but none actually address using a fully self-contained function to return name and value of a variable. The only function that works requires ...
1
vote
0answers
36 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
82 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
52 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
75 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
33 views

Assign Variable to NSolve

I'm looking to create an interactive region plot in Mathematica, and it's quite a complicated region (seen below).. The variable p is actually a function of y, and it's too hard to solve analytically. ...
0
votes
0answers
29 views

Replace the output of a module containing local variables by their actual value

I want to construct a function as the output of a Module, but I obtain the local variables as part of the output. This is a problem when I try to construct many of these functions in a parallel table, ...
0
votes
0answers
76 views

Issue with several replacements in a function under certain conditions

I am trying to define a function (reduce[x]) which does several substitutions, depending on the values of certain parameters. Concretely, consider an expression x, which contains an arbitrary number ...
0
votes
0answers
66 views

Using an if statement to assign a value to a variable

New Mathematica user here. I'm using some code from a colleague and editing it to give me more specific results in finding the zeros of a complex polynomial. I am attempting to find a way to assign a ...
0
votes
0answers
23 views

How to retrieve variables in the Manipulate's 'dynamic' controller environment

I'm trying to code to generate 'dynamic' controllers and to set initial values (initStart and initEnd): ...
0
votes
1answer
81 views

How to get a function from a numerical integration?

I wold like to know how to get a function from a numerical integration. Here is an example: h[y_?NumericQ] := NIntegrate[y*Sin[Sin[x]], {x, 1, 2}] h[2] Then my ...
0
votes
0answers
50 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
47 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

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
50 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
274 views

What are the valid symbol names for packages?

Regarding to the message: ...
0
votes
0answers
82 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
59 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
526 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
338 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
71 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
86 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
110 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
122 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)$