Questions tagged [variable-definitions]

Questions on assigning and unassigning definitions to names that represent them, including issues raised by context and localization. Use tag [assignment] for issues relating to Set versus SetDelayed.

Filter by
Sorted by
Tagged with
1
vote
1answer
30 views

Getting a stored variable from its value

Given a numerical value, is it possible to check whether that value is stored in (or defines) some variable in the notebook? Maybe if I could list all of the defined variables, then I could simply ...
2
votes
1answer
104 views

Mathematica Won't Recognize a MeshRegion

I've implemented the code in the top answer of this question on the Plateau problem in differential geometry, and it works with the example shown in Example 1, so there is nothing wrong with the code. ...
1
vote
0answers
46 views

How to define an Intermediate Variable [duplicate]

I want to find the relationship between several parameters. But I don't know how to define an Intermediate Variable. For example: I want to know the relationship between x and {y,z} which will satisfy ...
0
votes
1answer
26 views

Avoid an Error Message when Importing

Consider the following code Button["Import", file = SystemDialogInput["FileOpen"]; data = Import[file], Method -> "Queued"] which yields a button which, ...
0
votes
0answers
11 views

Min of a set defined with conditions

I would like to define this parameter inside a function: $R = \min\left\lbrace i \in \left\lbrace 1,\cdots,n \right\rbrace \; : \; ((p+i)\mod n) \; \neq a_{j} \; \forall j \in \left\lbrace 1,\cdots,m ...
1
vote
0answers
73 views

Issue with Solve, NSolve, FindRoot

I have this code that I've been trying to get working for some time. I asked some questions before which helped but still struggling! ...
0
votes
1answer
34 views

Issue with variables/functions in solving equations

I've been posting some questions all around issues with defining and using variables/functions in Mathematica. Based on the answers/comments I got I still cannot make this simple code work... Why is ...
1
vote
1answer
48 views

Table of Variables within Manipulate

Given a certain number n, I want to define n controls within Manipulate with the correct ...
3
votes
1answer
59 views

Automatically generating and labelling controls in Manipulate

Consider the following code ...
2
votes
1answer
48 views

Store boolean expression into a variable

My purpose is to use a boolean expression as a requirement that a pattern must comply. The requirement is c1 == "a", and I am using it to select a string from a ...
0
votes
0answers
21 views

Plot 2 functions, and function defining practise [duplicate]

I would like to plot the f1 and f2 functions on the same plot. The problem is that all functions are green on the plots. Is this a good practice to define the f1 and f2 functions and the rules like ...
4
votes
3answers
84 views

Is it possible to use a previously defined value in subsequent definitions of a `Block`?

Is it possible to use a previously defined value in subsequent definitions of a Block? According to syntax coloration, this should work as expected, that is, ...
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 ...
4
votes
1answer
70 views

Defining list of new variables at once (in a loop?)

I have a list of solutions Subscript[x, 1][t], i = 1,...,n (n given). I would like to use these variables to define new variables such as: ...
2
votes
2answers
40 views
3
votes
1answer
69 views

How to access all instances of a defined function

This should have a simple solution, but for some reason I cannot find how to do this. Let's say I have a "function" where I have defined values (in my actual example I have many instances of this, ...
0
votes
0answers
34 views

Series expansion of explicit functions

For the following input, zv[u_, v_] := v + zv1[ u, v]/u; mvu[u, v] := D[zv[u, v], u]; Series[mvu[u, v], {u, 0, 1}] the output is ...
1
vote
1answer
73 views

Basic Question: how should I read this instruction?

I'm very new at using Mathematica and it's not my Job. It's just something I like. ...
0
votes
1answer
36 views

unknown variable in a recursion relation

I have a code as follows ...
0
votes
1answer
45 views

Reversing the flow of the equation sign. Compacting an equation. Choosing which variables to show

Here's a simple example of what I'm trying to get at with that mysterious title. I start off with a Hermitian matrix that I derived analytically ...
0
votes
1answer
26 views

Properly defining and plotting a function that requires `NSolve`

I want to defined a function that solves some equation numerically: ...
1
vote
1answer
75 views

Variable substitution like usual maths

So... I'm trying to get some simplifications on equations using own defined variables, but the tries I gave didn't result on what I wanted. The problem: I have 2 variables defined as: ...
0
votes
1answer
109 views

Is there a way to use a subscript as variable? [duplicate]

I'm really new with Mathematica, and I could not find a previously question similar to this one. Is there a way that Mathematica can be made to recognize and treat a subscript letter as variable so ...
0
votes
0answers
40 views

Define the partial derivatives of a multivariable function

I have some vector $K = [K_1, K_2,...K_n]$ which is a function of variables $(x,y)$ i.e. $K = K(x,y)$ I want to symbolically calculate the partial derivatives e.g. $\partial_x K$, $\partial_x \...
1
vote
2answers
39 views

Generating random variates inside summation

I'd like to generate a table of sums which each a non-correlated, normally distributed random variate inside. Here is the sample code: ...
1
vote
1answer
83 views

Expectations of sums

I would like to use Mathematica to derive some bounds on empirical estimators, such as $E[Y]$ where $Y = \tfrac1n\sum_{i=1}^n (X_i - X)^2$ and $X = \tfrac1n\sum_{i=1}^n X_i$. For a moment I thought ...
6
votes
2answers
402 views

Is it possible to Clear (recover memory from) a specific index to a variable, while leaving other indices to the same variable untouched?

Consider the following method commonly used to clear a typical variable: ...
6
votes
1answer
438 views

Best way to write an equation with subscripts and superscripts

This post is not about a specific Mathematica problem but about to develop the best way to enter mathematical equations with subscripts and superscripts. I have a ...
2
votes
0answers
69 views

Why doesn't ClearAll[“Global'*”] remove all variables? [closed]

Consider the following code : In[19]:= a = 2; In[20]:= ClearAll["Global'*"]; In[21]:= a Out[21]= 2 As you see, the variable a hasn't been resetted. Why ? ...
1
vote
1answer
31 views

Replace series with restrictions

I am trying to implement a code where I have the following problem: Consider I have the following series, which I can express as follows: $$ \sum_{j<k} x_j^4 x_k^4 = \frac{(\sum_j x_j^4)^2 - \...
0
votes
1answer
73 views

Defining Multiple Variables with the Same Value

I know we have a := 1 b := 1 but is there some 1-liner shorthand, akin to: ...
1
vote
2answers
81 views

Collecting terms from expression with indexed functions

Say I have an expansion of terms containing functions y[j,t] and its derivatives, indexed by j with the index beginning at 0 ...
8
votes
1answer
232 views

Fitting multiple data with model and NDSolve with different initial conditions, and other shared parameters

I know that there are already questions about fitting multiple datasets and about NDSolve and about shared and non shared parameters, but I tried to apply them and some things are still not clear. ...
2
votes
0answers
28 views

Issue passing a list to last argument of ImplicitRegion (Scope issue?) [duplicate]

This is a very strange issue I'm having trying to pass a list as an argument to Mathematica's "ImplicitRegion" function. Here's the issue: ...
0
votes
0answers
37 views

Defining a function through an ODE containing unspecified operators

I want to do some algebra using a function only defined through a DE containing unspecified operators. The DE is $$ \partial_zu(z) = \left[\hat{D}+\hat{N}(z,u)\right] u(z). $$ Here $u$ lives in ...
0
votes
0answers
32 views

List of all items stored in kernel

In Matlab, there is a window on the side that contains all of the variables stored in the workspace. Is there something equivalent in Mathematica? I am imagining a command kind of like DownValues or ...
1
vote
1answer
56 views

Mistake in calculating a variable from a plot

I have data from a knife-edge measurement technique, Power vs. knife position, and I want to obtain the beam radius. ...
2
votes
1answer
137 views

How do I create a variable that uses I?

I'm planning on working with a set of non-linear differential equations. A few of the equations look like: Mathematica tells me that I is protected. Is there any ...
0
votes
1answer
44 views

Save nested Solve results into variables (edited)

I have some solve results stored in the ptes variable: ...
1
vote
1answer
29 views

Use ChoiceDialog to assign value to a variable within a function

This may be a routine answer that I have overlooked, but I am stumped... If I want to write a function using ChoiceDialog, how can I use what ChoiceDialog returns (true or false) to either set a ...
1
vote
1answer
42 views

Defining a function that outputs a matrix, and later finding its eigenvalues

I am trying to do the following: I have a simple 2x2 matrix that depends on three parameters (physically -- momentum coordinates kx, ky, kz). Then I want to replace each of these parameters by a ...
2
votes
1answer
165 views

How to define a complex function with assumptions?

I'm trying to define a complex function to be able to do analytic calculations. Specifically, I want to define a function $A(x,t)$ in the complex plane with argument $\theta(x,t)$ and modulus $R(x,t)&...
2
votes
1answer
72 views

Problem with defining a simple linear operator

I need to define a linear operator, which should have very simple linearity: myOp[Plus[f_, g_]] := myOp[f] + myOp[g] myOp[a_ f_[x_, t_]] := a myOp[f[x, t]] where ...
1
vote
2answers
57 views

How to define multivariable vector funtion? [closed]

I would like to define a function of variables having two components as $u(x,y) = (f(x,y),g(x,y))$. I defined such a function as u[x_, y_] := {f[x, y], g[x, y]} ...
11
votes
2answers
442 views

How can I make assignments persist across sessions?

Yesterday, I imported a large set of data into a Mathematica notebook and stored each imported list of numbers in a function. For example, I would map a list like ...
1
vote
2answers
447 views

Can one define 0 Log[0] = 0?

With reference to this post, can one define 0 Log[0] = 0 in Mathemtica?
1
vote
2answers
117 views

VectorDensityPlot, [closed]

I'm trying to plot the following function for two different values of variable m. However, it seems the second figure never appears. Weirdly, I noticed that real numbers are being attributed to ...
0
votes
2answers
38 views

How can you define a function with variables and put it equal to a function that is already defined? [closed]

Lets say you have a function: f = x^2 + y^2 Now I want to define a new function of x and ...
0
votes
0answers
34 views

Is there a difference between these two ways to define a function? [duplicate]

(I took this example from another question) f[0] = 0; f[n_] := f[n] = DigitCount[n, 10, 1] + f[n - 1]; f[1016] I notice that this example defines f(n) in a ...
1
vote
1answer
44 views

Plotting a complicated function defined in terms of other defined quantities

Perhaps this question will be too broad or poorly asked since it is about some very simple problems and I apologize if that is the case. So, I'm just trying to plot the curve of a complicated and ...

1
2 3 4 5
8