Linked Questions

11
votes
2answers
1k views

Dynamic Programming with delayed evaluation

By using dynamical programming, we can save intermediate steps for recursive relations, as in f[n_]:= f[n] = f[n-1] + f[n-2] However, this only stores ...
0
votes
1answer
183 views

Using sublists returned from a function as elements of a list argument to an other function

This is a contrived example, but it gets the point across. I am looking to use the following as inputs: ...
3
votes
3answers
352 views

HoldForm: how does it interact with nested evaluations?

Here's an example to illustrate the issue I'm having. right = 8 - y; left = y^2 + 6; integrand = HoldForm[Evaluate[right]] - HoldForm[Evaluate[left]] (I ...
5
votes
2answers
331 views

Overlapping pure functions

Let say I need and option for Plot: RegionFunction -> (-6 < #2 < 6 &) But I also want those ...
4
votes
2answers
120 views

Choosing an initializer list in With

I'm trying to have several initializer lists in a With function and choose which one I want to use. So far I have this: ...
25
votes
5answers
5k views

How to pass a symbol name to a function with any of the Hold attributes?

Given a function with the attribute HoldFirst, HoldAll or similar, and a variable, list, how ...
4
votes
4answers
12k views

How can I create a list of functions?

Can anyone tell me, how to create a list of functions? I've tried the following code, but it doesn't work. ...
14
votes
2answers
842 views

How can I compile this function

I want to simplify my function f1 to f2, but f2 can't be compiled. How can I make it ...
4
votes
2answers
247 views

why set values in this way doesn't work?

question is as follows define a list ttt={1,2}; and if I set values in this way {ttt[[1]],ttt[[2]]}={3,4} then the value ...
14
votes
3answers
959 views

Pass by reference for an option argument

Pass by reference can be faked by using HoldAll or something similar in the definition of a "Function". But can pass by reference be faked for symbols passed as ...
32
votes
3answers
2k views

Consistent Plot Styles across multiple MMA files and data sets

I am starting to write a thesis for which I want to use MMA for all my plotting needs, mostly because a lot of the basic analysis has been done there. To ensure that I am applying styles consistently (...
12
votes
4answers
814 views

How to pass a list of arguments into HoldAll

I have a list of arguments (which in reality is lengthy): arguments = {a, b, c} arguments2 = {a_, b_, c_} f[Sequence@@arguments2] := a + b + c Note: It seems ...
1
vote
1answer
160 views

Using With in combination with Graphics [duplicate]

Assume that we are given a symbol p={x,y} which should represent a 2D point. If x and y have ...
10
votes
3answers
3k views

Keep function range as a variable

Plot[2*x^2 - x + 2, {x, -1, 1}] plots a function of x from -1 to 1. As far as I can see, I cannot "save" this range in a variable: ...
7
votes
2answers
164 views

Method that can be used to collect the variables of a function

Suppose we have a function f[x, y, z] and we want to get all its variables Sequence[x,y,z], what method can we use then? The ...

15 30 50 per page