# Questions tagged [assignment]

For questions relating to assignments to symbols, patterns, or expressions.

256 questions
Filter by
Sorted by
Tagged with
31 views

### any way to store the values of the controls of a Manipulate so that one can reuse them in the future excutions

I’m using Manipulate[] to adjust several parameters, which will eventually generate some figures. After I get the desired view, I’d like to store the set of control parameters so that I can reuse them ...
48 views

### Block Behavior, but for Function Assignment instead of Variable Assignment

We can define a function using a variable b that does not appear as an argument, and then using Block, change the output of the ...
112 views

### Cannot assign variable value inside Do Loop

This is more of a conceptual problem. Suppose I have three lists. x1 = {1, 2, 9, 10}; x2 = {5, 6, 7}; x3 = {9, 10, 13}; Now, I wish to keep only the first two ...
60 views

### Avoiding For loops to perform an assignment to a variable with indices of user-choice [duplicate]

I am looking for an efficient way to perform the following operation without For loops ...
29 views

### Going between assignment rules and functions

I am trying to develop a model using Mathematica, and continuously run into difficulties going between the outputs of various functions (Solve, Differentiate, etc.) and back to functions (in the ...
79 views

### Assignment with Span to Indexed Variable

If I use span to assign a value to every element in a "column", it miraculously works: ...
126 views

### How can I list the common elements of two lists?

The elements of both lists are given as A={9,5,9,3}, B={9,9,5,5} In this case, how can I list the list {9,5,9} of the common elements of the two lists? (The order does not matter.)
95 views

### pure function assignment

I do not understand this statement from the Introduction to Dynamic tutorial: ...
56 views

### Certain plotting functions are setting variables unwantedly

I came across the following problem. Certain plotting functions set variables to values, which I do not want. For example, if I run SliceVectorPlot3D with an ...
52 views

### How can I transform equation results into an array of values? [closed]

I would like some help. I executed the following code: Solve[Det[(s IdentityMatrix) - A] == 0] which yielded the following results at the output: ...
53 views

### Proper way to construct a function that takes too long to plot and integrate

Consider the functions phi[t_] and psi[t_] defined in the code below. These are used as basis functions for interpolation ...
77 views

### Fast definition of sparse tensor

I'm defining a sparse array through ...
25 views

### Extract actual result from equivalence [duplicate]

When I get a result like this {x -> -0.5 - 0.866025 I}, how do extract just the number: -0.5 - 0.866025 I. I can do this with the .rhs() method in Sagemath but I can't find the function in ...
50 views

### Why does the delayed functional assignment evaluate to 5=6? [closed]

Why is it that x=5 x=x+1 nicely evaluates to 6, but the following ...
56 views

### Referring to matrices with index [closed]

For exampe I have two matrices, with index 1 and 2 Mat = ConstantArray[0, {2, 2}] Mat = ConstantArray[0, {2, 2}] I wanna assign new value with ...
100 views

### How can I get output from Reduce assigned to a variable? [closed]

I use Reduce to solve an 3rd order equation, and the output is given as the OR'd combination the solution variable. Normally, I can do a replacement to assign the value to a variable, but that doesn'...
45 views

### How to list automorphisms on a finite set and analyze them

Let s be a finite set of integer lattice points, for example s = { {0,0} , {0,3} , {1,1} , {0,2} }. I am trying to do two things:...
65 views

### Only Reals Rules

I have a huge array of rules with many variables, such as ...
50 views

### Errors with assigment and no errors with replacement rule, why? [closed]

So I have an expression, let's call it f11 which is a function of t of this form f11= a1*t^(-4)+ a3*t^(-3)+... and so on up until a finite positive power of t. In ...
34 views

### Using results from Nmaximize in loop

I try to Append the vector S by z+x whereby z and ...
63 views

### Assign value to the symbol returned by function

Ok, so here is example code: Clear[p, flag, k]; p = 2; k = 1; flag = True; If[flag, p, k] = 0; p After that I get the message ...
124 views

### Set value in a list at given position

Consider r = Array[Total[{##}] &, {3, 3}] (*{{2, 3, 4}, {3, 4, 5}, {4, 5, 6}}*) pos = {{1, 1}, {2, 2}}; vals={100,200} This ...
75 views

### Using a list as arguments in a function

This might sound a little silly question but I cannot get my code work. Here is the problem: I have quite a few lists of data which are basically beam profiles. I am using ...
55 views

### Number of values stored in a function

Suppose I run this: f = 1; f[n_] := f[n] = 2 f[n - 1]; f Now there will be 1001 values stored in f, and ...
41 views

### How can I use Part Assignment to change sublists into other sublists (without changing levels)?

Here's a 5x5 grid. Using predefined starting points, I'd like to change some sublists into something else (e.g., the values for a color, "drawing an opaque box"). ...
415 views

114 views

### Setting options of object after defining it

Is it possible to edit the options of an object like Plot or Graphics after I store it as a variable? For example, consider the ...
73 views

### Assign numerical values to symbolic variables in a vector inside a do loop

I have vector k = {k1, k2, k3, k4, k5, k6}. I would like to assign numerical values to the elements of k in each step of a <...
114 views

### How to turn a matrix into a 'function'? [duplicate]

I have some codes to turn a set of equations into a matrix. Suppose the matrix Lis expressed in terms of variables $\epsilon$, $K$, $M$, and I want to make a ...
280 views

### What is the point of tagset /:? [duplicate]

I'm teaching myself Mathematica and came across tagset. So I followed the example in the link, but seem to be missing the point. All of the below give me the same answer after assignment: that ...
53 views

### TagSetDelayed for spotting zero derivatives

I am trying to implement my own differential operator, d[arg_, var_], that computes the derivative of arg w.r.t. ...
54 views

### Part Assignment of variables with argument

I do not really understand why this: a = {1, 2, 3}; a[] = 3; a {3,2,3} works as desired, but this does not: ...