Questions tagged [assignment]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
90 views

Assign FindRoot output vector to a vector instead of element by element

Using FindRoot to solve a multivariate equation system, assigning the output to variables one by one works, but assigning the output vector to a vector gives the ...
0
votes
0answers
25 views

Performing operations on LHS of assignment [duplicate]

Is it possible to first perform an operation on LHS of the = symbol, evaluate that, and then assign the RHS to the new LHS as usual? The following shows the most ...
1
vote
2answers
55 views

Assigning values to multiple variables from a list

I have a solution of the following form: $F(x)= \\ \qquad c+(x_0+x_1+x_2+\ldots +x_n)- \\ \qquad (x_0\,\log(x_0+\sqrt{x_0})+x_1\,\log(x_1+\sqrt{x_1})+x_2\,\log(x_2+\sqrt{x_2})+\ldots +x_n\,\log(x_n+\...
-1
votes
0answers
32 views

What's the use of TagSet [duplicate]

I see this function definition in the file(galois.m), but I don't know how it works. ...
5
votes
1answer
84 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 ...
1
vote
2answers
24 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 <...
0
votes
1answer
44 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 ...
3
votes
2answers
137 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 ...
1
vote
1answer
47 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. ...
1
vote
1answer
36 views

Part Assignment of variables with argument

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

SetDelayed error for Derivative rule

Having a delayed assignment of the form Derivative[1][f][x_] := HoldForm[f[x]] works. But if there is a delayed assignment for f as in ...
0
votes
0answers
23 views

Approximating the density of an arbitrary set using an arbitrary Folner Sequence of its superset [duplicate]

How do we use Programming to approximate this limit where is the density of in , is the Folner Sequence of , is an interval with , and . For more information, click on this link (replace G,X,i,g ...
8
votes
1answer
137 views

Error Message when nothing should be evaluated

When I try to define this simple function getCoeff[SeriesData[_, _, coeff_, _, _, _]] := coeff[[2]] I get an error: ...
1
vote
1answer
43 views

ContourPlot a list of equations generated by the Table command

The first command below produces proper contour lines while the second command produces an empty plot. I would think that the two commands should produce the same output. What's going on? ...
0
votes
0answers
26 views

Defining a function from an evaluated function stored in a variable

I have the evaluation of a function b, stored in appo. Now I want to define a new function f ...
0
votes
2answers
57 views

Monte Carlo Method [duplicate]

How do you use a Monte Carlo method to approximate the area enclosed by the circle.
2
votes
0answers
33 views

Mathematica: Remove argument from object with flat attribute

I have an object in mathematica with the attributes Flat and OneIdentity. I also defined the following substitutions: ...
3
votes
1answer
60 views

Combining `With`, `If` and SetDelayed

I just noticed that With[{x = 1}, If[x == 0, 0, 1]] returns 1 (as I expected) but ...
1
vote
1answer
43 views

Drop-down menu to globally change definition of a function `t[x]`?

If have a function t[x_] which is used extensively in a long notebook, but which has a variety of definitions, and which is used in a variety of ways. I'm looking ...
0
votes
2answers
28 views

How to select certain numbers to assign a new value and others still keep same

For an array TestA={15,12,5,8,6}, I want to change the value of number greater than 10 into 0, as TestB={0,0,5,8,6}. When using "Select" command, I will lose some numbers. Thanks.
1
vote
1answer
33 views

Vector shape and Dimensions

I think I have not understood clearly the difference between dimension and shape. I want to construct a vector remembering recurrence of the type : ...
2
votes
0answers
32 views

Programmatically Inject Logical Vector into Manipulate Checkboxes or Vice-Versa

I am building a large Manipulate application with about 50-60 checkboxes through which the user can select entities to be drawn on a main canvas. The main drawing routine, called from within ...
1
vote
2answers
73 views

Error in Assignment

I want to create a matrix with each element updated as per the formula, whose inputs are dependent on the location of element in the matrix. ...
1
vote
0answers
29 views

Un-assign MenuCommandKey

In my StyleSheet, I would like to assign to the environment Subchapter the Key Alt+2 (via MenuCommandKey. However, this is ...
1
vote
2answers
95 views

How to assign output of `Last@Reap` to a variable? [closed]

I would like to define a variable that equals the solution of a numerical equation. Usually something like smax=zmax/.FindRoot[Exp[-zmax/2]==2,{zmax,0}] would work. ...
1
vote
1answer
44 views

Why does it fail to assign values to variable in Grid? [closed]

I have a grid such as the following, and want to assign the values in the second row to the variable in the first row, but it always fail, can you provide a solution? Thank you! ...
0
votes
1answer
43 views

I am asserting a variable in Mathematica as Real yet it is not implementing it!

Element[\[Theta], Reals]; Ga = g; Gb = g*Exp[I*\[Theta]]; {{Conjugate[Gb], Ga}, {Ga, Gb}} I have a code as such for a matrix as given above. as ...
0
votes
0answers
198 views

Assign a Derivate to a new fuction variable

I'm having a new problem. I'm trying to create a new function from a Derivate of another function, but i'm can't getting it. Someone could help me? I'm thinking that is something in the syntax of the ...
4
votes
4answers
146 views

Is it possible to create lookups on temporary symbols that still allow the symbols to be automatically removed?

Is there some way to create lookups keyed on Temporary symbols that somehow avoid the referencing of the Temporary symbols, ...
1
vote
2answers
31 views

A question about a replacement of element of set

To begin with, I'm a poor English speaker, which means it would be hard to read to natives... I was trying to memorize mRNA codons with mathematica. ...
1
vote
1answer
70 views

How to use an up-value assignment when all symbols are “too deep”?

I would like to make an up-value assignment such as a/:Conjugate[a[x]]a[x]+Conjugate[b[x]]b[x] = 1 or ...
0
votes
1answer
57 views

Replace constant in summation function using replace or If or /

Hi i how do i replace constant for k in this summation. For following: Even 2*n Even replace k by a Even 2*n+1 Odd replace k by b Here is the code ...
1
vote
0answers
55 views

Making a function definition where the right hand side is evaluated before the definition is saved [closed]

My question is about assigning the resulting expression after evaluation of a function. So what I want: FOCf[x, y] := D[f[x, y], x] such it immediately ...
3
votes
2answers
269 views

Is it possible to set values for a list of variables using a for loop? [duplicate]

Let me preface this question by noting that this is a simple example meant to clarify what I am asking. The actual context in which I want to implement this involves associations containing hundreds ...
4
votes
2answers
151 views

Scoping of pattern variables [duplicate]

I have run into a problematic behavior, and then came to find that it is a "possible issue" called out in the documentation, but I guess I am just baffled that this IS an issue, and am wondering why. ...
-1
votes
1answer
62 views

Why it is doing part assignment? [closed]

I am writing an algorithm and need to keep updating an association called "verticesAssoc". My algorithm ran perfectly at first. However now I want to use the same algorithm on another association "...
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 ...
6
votes
1answer
64 views

unexpected result from augmented assignment to association

Is the last of these results expected? If so, how? ...
3
votes
2answers
180 views

Transferring DownValues

I have a code in which I define something like this: cc[1, 2] = 1; cc[2, 6] = 12; cc[3, 7] = 3; After some manipulation I define a sort of temporary variable ...
2
votes
1answer
90 views

Reassign a value to an array element

I have a very complex code in which I assign a value to an element of an array and then I reassign to it another one. A minimal example: ...
1
vote
1answer
65 views

Evaluating the 1st argument of Set

I want to assign a certain value to an element of a tensor. This element is identified by an array obtained from some evaluations, so we fix it. Here i present an oversimplified core part of my code: ...
1
vote
1answer
540 views

Tag Times in Null is Protected [closed]

I've some problems with the error mentioned in the title. Unfortunately, my code is full of subscripts so I'll show it in a photo. In this code the central aspect is to assign a scalar value to an ...
1
vote
3answers
242 views

Assign a function within a function [duplicate]

What I'm doing wrong? 1st function works as expected but the 2nd one doesn't. What I want is to enter an algebraic expression and two numeric constants and get the same result as with the first ...
1
vote
1answer
52 views

How to use a calculated expression on left-hand-side of an assignment?

Elementary question, I guess: I have a left-hand-side something like this: ...
0
votes
0answers
56 views

Trouble with UpSet(Delayed) and IgnoringInactive

I'm having problems setting an upvalue for a symbol that is supposed to ignore Inactive: IgnoringInactive[f[g[x]]] ^:= match; ...
0
votes
2answers
76 views

Hot to single out numeric values from NMaximize

I have some problem with NMaximize. The function NMaximize gives result like this NMaximize[f[x],x] {f[xmax] ,{x -> xmax}} I've read in various answers that ...
3
votes
1answer
99 views

assignments within Manipulate

I have encountered unexpected behaviour when assigning variables in Manipulate. Consider an inverted parabola y[x_, c_] := -x^2 + c The following code finds the ...
0
votes
1answer
67 views

Symbolic variable assignment

I looked around and didn't see this question on the forum, so my apologies in advance in case this has been answered here. My question can be concisely described by the following example: ...
1
vote
2answers
95 views

How to assign values using nested Part[ ] expressions?

Why doesn't this work? Can I make it work? ...
0
votes
2answers
137 views

How to 'unassign' variables used for PlotPoints, which subsequently print as e.g. Charting`Private`pvar$727158

I have a table of four insoluble equations, fceq, in terms of unassigned variables, Subscript[fc, i], Subscript[μ, i]. I am using contour plots to visualise ...

1 2 3 4 5