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.

learn more… | top users | synonyms

-3
votes
0answers
37 views

The definition of variables [on hold]

how to define some variable according photo attached.
1
vote
0answers
45 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 ...
0
votes
0answers
130 views

How can I define a derivative with respect to implicit parameterized variables?

I know how to define derivatives for explicit single variables: Derivative[n_, 1][p][x_, v_] := D[p[x, v], {x, n + 2}]/2; D[p[x, v], {x, 3}, {v, 4}] Output: $\...
0
votes
2answers
46 views

Can you unpack a list of values into variables in a With expression?

For instance, if I am trying to draw a graph with 5 vertices labeled a through e, and I want to draw edges connecting a and b, a and c, a and d, a and e, b and c, b and d, and c and e, I would run the ...
9
votes
1answer
190 views

How do I insert OwnValues inside a held expression without evaluating it?

Here is a very long and complicated expression, which we abbreviate as a. I store it using SetDelayed because I want to perform ...
0
votes
1answer
55 views

function definition, $ symbol apparition after variables [closed]

I have a proble with a system of two differential equations ...
0
votes
0answers
21 views

domain of an input variable

Suppose I have a function called Exercise which is called in this way: Exercise[Gamma[x]+x*n,x] How can I indicate that n is a positive integer?
8
votes
1answer
198 views

Why does the global variable exist here, where it was declared only in Module?

Why does Mathematica choose the mechanism that makes the global variable a here while parsing? In ...
0
votes
1answer
31 views

This vector definition with index in subscript is incorrect [closed]

I am trying to define a vector of values. Here is an example n = 8; Table[Subscript[ω, i], {i, 1, n - 1}] = Table[Sqrt[2], {i, 1, n - 1}] Yet this leaves me ...
0
votes
1answer
29 views

Series Soln False error [closed]

When I try to define my equation : sys3 = {y'[x] == 2 y[x]/(1 + y[x]^2) - Exp[y[x]]/(1 + Exp[y[x]]), y (0) == 1} OR ...
1
vote
0answers
33 views

How to define a variable describing several options? [duplicate]

Plot[y=x, {x, -1, 1}, PlotPoints -> 24, MaxRecursion -> 0, ColorFunctionScaling -> False, BoundaryStyle -> None, MaxRecursion -> 0] I will ...
1
vote
1answer
84 views

`Quit` vs `ClearAll[“Global`*”]`

Quit erases all the definitions (by quitting the kernel), but so does ClearAll["Global`*"] (or other contexts). What's the ...
1
vote
1answer
68 views

How to extract all necessarily code for a function?

Many times when someone pastes a piece of code into SE there are missing values and symbols that the user left out. To prevent this I'm looking for a function that uproots other functions (extract ...
8
votes
2answers
535 views

Character to replace _ in symbol names?

In C, _ comes in handy when naming variables and functions, as a replacement for space. For example: ...
3
votes
0answers
79 views
4
votes
2answers
303 views

How can I define variables that follow a naming pattern?

Let's say I have this enormous list of a million elements, and I want to access this list piecemeal in non-intersecting sublists of length ten. If ...
1
vote
2answers
54 views

How do I tell if a function definition “contains” a symbolic expression?

Consider a definition like f[x_] := x[[1]] + x[[3]] + x[[1 + 2]] I want a "ContainsExpression" which I can use similarly to ...
0
votes
1answer
47 views

How to erase definition introduced by using Set instead of Equal in Solve [duplicate]

When trying to solve a set of equations, I made a mistake by using = instead of ==. Now when I fixed the mistake, the equation ...
3
votes
1answer
74 views

plotting after solve does not display anything

I'm quite new to Mathematica language, I am trying to figure out where I am making mistakes in Plotting a specific function that depends to other variables: I want to plot ...
18
votes
5answers
491 views

How can one manually change the rule ordering

I have a function which has some general behaviour, but that should act on some specific kinds of objects in some other way. I know that Mathematica is supposed to automatically order the rules so ...
1
vote
1answer
48 views

How to unshadow a chosen definition for a function

I want to use the package NCAlgebra. However after successfully installing the package and trying to write some code, basic functions like SetNonCommutative[...] ...
2
votes
3answers
74 views

How to make a list (of data points) whose name is the same as the file name from which the data is imported [duplicate]

I have a set of files, e.g. file1.dat, file2.dat,... containing data (list of data points to plot, manipulate...) I want to do the following ...
2
votes
1answer
104 views

Clearing a global variable from inside a Module

This is a highly simplified version of a initialization problem I have with a complicated program with many (about 100) modules. If one enters: X=42; Clear[X]; the ...
2
votes
0answers
48 views

Share variables among notebooks with different Kernels

So I have a server running in another notebook with a secondary kernel. I run my main notebook and launch the server notebook, but I have configured the variables in my main one, and can't find a way ...
2
votes
0answers
60 views

Changing variables in a series expansion

I want to compute the Taylor expansion of some pure function f[x_], but then perform a change of variables in the resulting expression. So, for example, the output ...
1
vote
0answers
68 views

Binding a variable to an unbound variable [closed]

I'm trying to do something like the following: (minimal example, f2 unbound) ...
1
vote
2answers
72 views
3
votes
1answer
59 views

Setting a One Dimensional Function Equal to a Constant over a Specific Range

I am trying to take the output from NDSolve and create a variable equal to the solution except for a certain range of values. Here is the code I am trying to use ...
0
votes
1answer
82 views

How to implement the for loop to replace text strings or texts?

I wonder define a bunch variables named like $X_1$, $X_2$, $...$, $X_n$. Is there some smart way to declare them instead of by pure typing. One trick I can image is to use the for loop,...
2
votes
0answers
61 views

Follow-up to “How to differentiate formally?”: Efficiency concern

In link to "how to differentiate formally?" and particularly to the answer by @Jens, I want to do something like this: ...
1
vote
1answer
109 views

Converting the subscript of matrix name to a variable

I want to change indices of matrix name during loop for creating different matrices. For example; ...
1
vote
1answer
57 views

Create a list of variables of a function

How can I create a list of variables of simple functions with arguments? These functions will be defined by the user, to be manipulated with some code later. ...
2
votes
1answer
47 views

Definition of a function depending on a sequence

let $a_{n}$ is a given fixed sequence, say $a_{n}:=1/n$. I would like to define something like $$D_{j}:=\sum_{k=1}^{j}\frac{1}{j!}BellY[j,k,\{a_1,a_2,\dots,a_{j-k+1}\}].$$ Function BellY is ...
2
votes
4answers
322 views

Defining a General Complex Number

I am trying to compute the Complex conjugate of two complex numbers multiplied together. However, when I go to define my complex numbers as $a+b I$ and $c+dI$ it does not like $b$ and $d$ because they ...
3
votes
2answers
112 views

Module, local variable

Lets say I define a Module, that internally use iterating in a Table or Do, say something ...
6
votes
2answers
122 views

Force evaluation of the right-hand side of a local variable definition

One can do expression = a + 1; f[a_] := Evaluate[expression] but how would one do something like this ...
0
votes
1answer
37 views

Variable Definitions and Random Numbers [closed]

I have currently created the following matrix: m={{RandomReal[{0,1}],RandomReal[{0,1}]},{RandomReal[{0,1}],RandomReal[{0,1}]}} In other words, a $2 \times 2$ ...
3
votes
2answers
110 views

Sections with unidirectionally shared variables

I have 2 sections is my notebook: ...
3
votes
2answers
80 views

How can I adjust the global input variable of a function to the value of a local variable within the function

I am trying to define a function f[l_] that will perform an operation on whatever input variable I use (normally I use l which ...
1
vote
5answers
179 views

Do not expand matrices in Mathematica calculation

Here is an example of a problem I'm having. Consider that I have defined: omega={{p[t]},{q[t]},{r[t]}} x={{a},{b},{c}} R={{1,2,3},{4,5,6},{7,8,d}} What I would ...
0
votes
1answer
122 views

Variable dependency…easy one

I'm brand new to Mathematica...should be an easy one. Instead of writing u[x] everywhere in the code, how do I assign the dependency early on like this: u=u[x] ...
3
votes
2answers
133 views

How to use locally scoped dynamic variables in Manipulate for expression and control parameters

I have a Manipulate that has dynamic variables that I want to use in the displayed expression and use in the parameters for the manipulate controls. I only ...
1
vote
1answer
174 views

Adding letters and numbers to create a variable name [duplicate]

Let's say I have several variables, named R1, R2 and R3. I wanted to have a function ...
0
votes
2answers
88 views

How to define $x^n$ where $x=\pm 1$ and $n\in\mathbb{Z}^{+}$?

I do not know how I can define $x^{n}$ in Mathematica, where $x=\pm 1$ and $n=1,2,3,\ldots$. For even values of $n$ we simply have that $x^{n}=1$. While for odd values of $n$ we have that $x^{n}=x$. ...
1
vote
1answer
72 views

Define operator with special characters [duplicate]

I have looked here which describes how to define operators. I was wondering whether there was a way to assign thes operators to special characters? eg Let $\odot:=(a+b)(ab),$ so ...
1
vote
3answers
285 views

How to replace element of list by index

I'd simply like to replace the value x at index [[j,i]] in a two dimensional table with the value ...
2
votes
1answer
51 views

Strange behavior when defining a symbol/function pointwise

I am well aware of the fact that floating point number have finite precision, so one needs to be careful when comparing them. Still, I find it disturbing/surprising that the following input into ...
5
votes
1answer
104 views

Naming conflicts with Dummy variables in several packages conflicts

I'm using several packages in a notebook. In each packages there is functions defined with dummy variables. When I load the several packages in my session, i've got a warning message: ...