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
0
votes
0answers
36 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
64 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: ...
1
vote
2answers
27 views
3
votes
1answer
62 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
30 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
71 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
35 views

unknown variable in a recursion relation

I have a code as follows ...
0
votes
1answer
42 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
20 views

Properly defining and plotting a function that requires `NSolve`

I want to defined a function that solves some equation numerically: ...
1
vote
1answer
72 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
100 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
32 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
38 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
77 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
391 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
315 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
59 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
30 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
66 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
73 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
211 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
36 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
28 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
129 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
42 views

Save nested Solve results into variables (edited)

I have some solve results stored in the ptes variable: ...
1
vote
1answer
27 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
38 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
118 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
51 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
53 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
415 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
303 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
116 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 ...
0
votes
0answers
20 views

Seeing definitions of built-in functions [duplicate]

Possibly a very amateur question, so I'll apologise in advance. I'm reasonably new. I'm trying to write a Dot equivalent of ...
2
votes
3answers
102 views

Globally Defining a Variable that Depends on Arguments of Functions [duplicate]

I have many delayed-defined functions of many variables, and all the functions share a term containing some of these variables. Thus, I would like to just call the term ...
3
votes
2answers
79 views

Changing the values of variables throughout a notebook

I have a model with many parameters, and I'd like to see how the model changes when some of those parameters change. Right now many of those parameters are set to prescribed values, i.e., ...
0
votes
1answer
41 views

Factoring out a parameter

I have some function: f[a_,b_,c_]:=Sqrt[a^2+b^2+c^2] Is there a way that I can factor out parameter (variable) b like this: <...
0
votes
1answer
41 views

Relations between Function Variables in Computations

I have the relation λ=c/f, respectively f=c/λ and a simple function n[λ_]:=λ²+1. I'd like to differentiate the function with respect to f, then plot it as a function of λ again. For this, I can define ...
1
vote
1answer
73 views

How to define a variable to be a function of all the arguments but one?

I have several variables (coordinates) $x_1, x_2, x_3, x_4, z$ and a lot (21, to be precise) functions $g_i$ which are assumed to depend on $x_1, x_2,x_3, x_4$, but not on $z$. I also have a ...
1
vote
1answer
47 views

Why does LinearModelFit give me an equation in $z$ rather than $x$?

I am working on a Mathematica notebook and making graphs for my lab. I can't make a graph for my linearized data as LinearModelFit gives equation in ...
1
vote
1answer
49 views

Using both subscripted and non-subscripted variables in an equation

I'm getting started with Mathematica, as I have been using Maple in the past. Is it possible to define two variables $\alpha_1, \alpha_2$ and then still use $\alpha$ as a parameter of a function and, ...
1
vote
1answer
51 views

Question about ListPlot of variables [closed]

My question is trivial but I don't seem to be able to get the answer. Suppose that I do a numerical computation (division of some numbers that come from the numerical solution of an NDSolve or ...
2
votes
1answer
88 views

Get the name of symbol inside a function [duplicate]

I have a list t1Funcsv0={0.10000000000, 1.00000*10^-7} and I have a function ...
1
vote
1answer
31 views

Evaluation of parameter inside FindMaximum

Why does this work: Table[ FindMaximum[x^2 - y^2, {y, 1}][[1]], {x, 1}] While this does not: ...
4
votes
2answers
161 views

How to use a variable in a function that can't be clobbered by variable name collision?

Not really sure what the right question to ask is. But here's what I'm having trouble with: ...