# Questions tagged [assignment]

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

295 questions
Filter by
Sorted by
Tagged with
31 views

### How to find clear solution for iterative problem by condition $<v_k ,v_n>=0$ If $k!=n$

I want to find x[n] by v[n] values without x[n] in solution by iterative below problem: <...
60 views

### Understanding SetDelayed, ":=" [closed]

Consider the example below, p = {1, 2, 3}; x = {x1,x2,x3}; fun[x_] := {{1, 0, 0}, {0, 1, 1}} . (p + x); fun2[x_] = {{1, 0, 0}, {0, 1, 1}} . (p + x); I expected <...
53 views

### Delayed evaluation of nested functions

i am new to Mathematica. Here is the situation: I have a exponential function of n,t that I want to calculate integral over t ...
1 vote
100 views

### Replacing Kronecker delta times expression with the expression with inserted index

Consider the following symbolic expression: expr = f[a,b]*g[c,d]KroneckerDelta[a,m]KroneckerDelta[d,k] + KroneckerDelta[a,p]f[x,a]+const Could you please tell me ...
131 views

### How to assign the following rule?

Consider the following object: function[x,a,b]. It is a symbol carrying one "coordinate" x and two indices a,b. I ...
107 views

### How to assign values to x1+x2, x1x2? [closed]

x1 + x2 = -((2 a^2 k m)/(b^2 + a^2 k^2)) Enter the above content and an error prompt will pop up How to assign values to x1+x2, x1x2?
107 views

### SetDelayed assignment not producing expected result when using ReplaceAll

In Mathematica, I am surprised that the following code does not do what I expect (what I expect is in comments after each evaluation). The problem seems to be due to the fact that when I define test ...
1 vote
230 views

### How can I permute two delayed variables?

Two variables with delayed expression are used for a random number generation: ...
1 vote
148 views

### Associating a string variable with a numeric variable

There is a translation operation from a numeric variable to a string variable: a[i_, j_] := Symbol["a" <> ToString[i] <> ToString[j]] How ...
205 views

### About how to speed up in assignment

I would like to know if there is a way for increasing the speed of the following computation: I have a list, let's call it list, and another list of values, val. I ...
114 views

### Conflicting variables

So, I read a set of variables and respective values from a file and store them in a variable specs = {{"Type", "KP", "fp"}, {"LP1", 2, 2000}, {"Type", ...
1 vote
34 views

### Hold around SetDelayed with Graphics [duplicate]

Minimum Working Example I've defined my own plot function, which does a lot of stuff to the inputs before passing it into the Graphics function. Because of that, I'...
56 views

### Define a function using output of another function [duplicate]

I am away from my computer and therefore unable to experiment, but I am keen to scribble down a few Mathematica operations in note form ready for my return. So, forgive the simplistic question… Say I ...
1 vote
33 views

### Using plot on named expression and explicit expression produces different results

There is some strange behaviour in Mathematica which I don't understand. If you call a function like ContourPlot on two identical expressions (one a named expression, and the other the same expression ...
61 views

### How to assign a value for specific Indeterminate expressions?

I wanted to form a list as follows j=1; Table[(i-1-j)^k, {i,2j+1}, {k,-j,j}] However, an error message occurred since the list included none positive powers of ...
57 views

### Strange behavior with setting multiple values simultaneously

I'm having some strange behavior when trying to set multiple variables using {x,y,z} = {1,2,3}. When I enter "{a,b,c,a',b',c'} = {1,2,3,4,5,6}", it sets a,b,c,a',b',c' to 1,2,3,4,5,6 as ...
52 views

### Error: Invalid integration variable or limit(s) in {-6.28293,0,\[Pi]/2}

When i try to evaulate h at vaule (for example 0), i get a result. When i directly plot the output of h, it also works, but when ...
451 views

### Define a delayed function depending on a global variable as though the variable's contents was pasted

Problem Say I previously defined a variable (maybe through some extensive calculation) thing = (a+x)y Then, I want to use that expression elsewhere. In general, I ...
243 views

### How to assign a value to something inside a module globally? [closed]

Let's say I created a function that calculates something inside a module. How do I assign that result to a global value? Let's say I have this: ...
1 vote
86 views

### Why =. is not clearing the value of a variable in this case? [closed]

I am reading "Mathematics and Algorithms" as part of the Wolfram Tutorial series. In "Values for symbols" section of the "Algebraic Calculations" chapter it is described ...
35 views

### ToExpression in nested Set/SetDelayed

Suppose we have the following definitions. ...
1 vote
46 views

### Manipulating the list with variables

I am trying to find the maximum element of the list for a given value of variable $c$. The example of the list is as follows: ...
59 views

### Symbolic re-assignment of products

Suppose I have some symbolic tensors $X,Y$ and I want to assign X.Y into something else without specifying what $Y$ is. For example, I may want $Y$ to serve as ...
97 views

### Problem with parametric integral with variable bounds

d[p_, B_] := \!$$\*SubsuperscriptBox[\(\[Integral]$$, $$-B$$, $$+B$$]$$Cos[ p\ x] \[DifferentialD]x$$\) Plot[d[x, 2], {x, -10, 10}, PlotRange -> Full] I ...
1 vote
47 views

### The assignment problem in Plot function [closed]

I used Mathematica to plot a system of equations: Plot[{y = 2 x - 3, y = x/2}, {x, -5, 5}, Axes -> True, AxesLabel -> {"x", "y"}, PlotLabels -> {"2x-y=3", "...
29 views

### Set keeps RHS unevaluated when RHS is a Module variable [duplicate]

Consider the simple code ...
58 views

### Assign different type of balls into output containers with constraints

The problem is to asssign all differend kind inputs to outputs. For example colored balls. On the input we can receive max 5 different type of colored balls any with amount. The amounts for the inputs ...
1 vote
37 views

### Delay evaluation of Chop until its argument has no symbols? (== has this behavior, Chop does not)

With Equal (==), if a and b are undefined symbols, a==b does not evaluate. This way we can ...
1 vote
93 views

### several actions inside If condition [closed]

Trying to write code with If, if it is correct to perform a number of actions. I am a beginner user in mathematica and not sure the form of writing are correct. What I'm asking in simple, this is the ...
93 views

### Error message not reproduced at reevaluation, SetDelayed cache?

Mathematica v13.0: nr:=HoldForm@Evaluate@Function[t,x@t][] then evaluate ...
392 views

### Defining a function iteratively without Mathematica getting stuck in a recursion loop

I have the following code: ...
1 vote
45 views

### How can I access to the needed part of this expression? [duplicate]

I have defined a list like this: F[t] = ConstantArray[a1, 10] Now I want to assign to some of the elements the value 1; I ...
54 views

### Program works, but then fails when I write it inside Module [duplicate]

I'm new to Wolfram Language; I'm trying to get used to it by writing a bunch of code and programs, being one of them the algorithm for the bisection method. When I write the algorithm outside of a ...
146 views

### How to make c[n_, x_, y_] := ToExpression["p" <> ToString[n]] = {x, y} work?

I am trying to do the following: c[n_, x_, y_] := ToExpression["p" <> ToString[n]] = {x, y} That is: Evaluating ...
114 views

### Forcing mathematica not to substitute some terms in an expression

I have an expression c which should be defined before the function and a function f defined as follows: ...
1 vote
145 views

### Extracting expressions from LHS of an assignment

I need to list all variables in a notebook containing several Set assignments, lhs=rhs, and equations, ...
87 views

### NIntegrate seems to not recognize multiplication of Piecewise function and f[t_]:= function, Why?

Considering inputs: vti={0, 1.5, 2.4, 5.0675, 7.735, 10}; Vscc=1.5; PSA=0.025; f=0.6; m=10; I defined a function "pwtemp2", using "FC1" and &...
112 views

### Can't create matrix function of symbolic functions and assign values to elements

So I have a problem regarding the symbolic matrix value assignment. Say I create a matrix function as: P[t_]:= {{P1[t]}, {P2[t]}, {P3[t]}}; Then I want to assign ...
55 views

### How to use Mathematica to return value from for-loop [duplicate]

I tried to use Mathematica to implement random generator. The pseudo code I use is as following: ...
67 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 ...
56 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 ...
284 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 ...
75 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 ...
51 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 ...
127 views

### Assignment with Span to Indexed Variable

If I use span to assign a value to every element in a "column", it miraculously works: ...
490 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.)
1 vote
114 views

### pure function assignment

I do not understand this statement from the Introduction to Dynamic tutorial: ...
59 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 ...