All Questions

Tagged with
Filter by
Sorted by
Tagged with
4
votes
2answers
125 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. ...
3
votes
1answer
80 views

Why does syntax highlighting in `Set` and `Rule` not color pattern names on the RHS?

The mathematica front-end colors x on the right hand side of x_ :> x and f[x_] := x but ...
1
vote
2answers
627 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 ...
5
votes
1answer
125 views

Using delayed evaluation on module variables called through an association

I came up with a construct that works well enough for my current use case but has some flaws (at least I suspect it does). Say we have a function that calculates some stuff that takes a while to ...
3
votes
1answer
267 views

Is there any way to implement a “sequential” With[] in Mathematica? [duplicate]

I want the equivalent of Scheme's let*, or basically, a sequential With that works like this: ...
5
votes
3answers
587 views

Turning an expression into a function inside another function

Say I have an expression g=Sin[q]; It is easy to turn it into a function, and to perform manipulations on this function (this and variants of this were discussed ...
1
vote
2answers
111 views

Assigning to the “local” version of a symbol

Compare Manipulate[c[1] = 1; c[1], {c[1], 0, 1}] with Manipulate[Do[c[i] = 1, {i, 1}]; c[1], {c[1], 0, 1}] The first case ...
4
votes
3answers
609 views

Altering values in Manipulate with dynamically generated controls

I have a Manipulate whose controls are generated based on a parameter in a containing Manipulate: ...
4
votes
0answers
214 views

Why is it not allowed to define vectors of variables in a scoping construct?

The following command assigns 1 to a, 2 to b and 3 to c: ...
1
vote
1answer
109 views

Circumventing the default scoping: Assign a variable inside a function [duplicate]

I'm currently trying very hard to assign a variable inside a function. Therefore I'm using a function like this, which should reassign a predefined variable. ...
23
votes
3answers
742 views

Nested definition: How can I define a function with a passed-in expression?

Here's a simplified version of what I'm trying to do: ...
13
votes
2answers
2k views

Scoping in assigning a derivative

While answering another question, I stumbled upon a problem I cannot easily resolve. To assign the derivative of a function to another function, typically one can do this with a ...