Linked Questions

2
votes
2answers
1k views

Returning a function from a Module [duplicate]

I'm having problems working with the output from DSolve whilst in a module. To handle the result outside a module typically I would do something like ...
5
votes
1answer
146 views

Problem with With [duplicate]

I am puzzled byWith. it does not seem to work. Please see example below (I have also used Evaluate and ...
1
vote
1answer
123 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 ...
3
votes
0answers
131 views

What is the difference between Block and Module? [duplicate]

Possible Duplicate: What are the use cases for different scoping constructs? I don't understand the difference between the Matheamtica functions Block ...
0
votes
0answers
46 views

Block, With, Module, can anyone help me understand the distinction? [duplicate]

I've been working heavily with Block[] for months in my research so I've read the documentation for the seemingly similar commands With[], Block[], and Module[]. Personally, I've had by far the ...
0
votes
0answers
31 views

RandomReal behavior in Block environment [duplicate]

I ran into an unexpected behavior of RandomReal function inside the Block environment. If I simplify my problem: I wanted to use two random local variables, such that the second one would be less that ...
360
votes
13answers
76k views

Where can I find examples of good Mathematica programming practice?

I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
67
votes
7answers
3k views

Functional style using lazy lists?

Let's say I want to answer the question "what are the first 400 palindromic prime numbers?" The first approach that comes to my mind from the set of languages that I know is to use some sort of lazy ...
20
votes
8answers
1k views

Selectively Mapping over elements in a List

I am using the following code to easily generate a row of images of all eight planets of our Solar System: ...
35
votes
3answers
1k views

Why modules with no variables?

I was reading some code, in particular, recipe 4.13 on unification pattern-matching in Sal Mangano's Mathematica Cookbook, and there were many instances of Modules with no variables in them, such as ...
22
votes
2answers
1k views

What are some advanced uses for Block?

I read the answers to this question (What are the use cases for different scoping constructs?) and this one (Condition, Block, Module - which way is the most memory and computationally efficient?). ...
15
votes
5answers
953 views

Using DynamicModule variables outside the DynamicModule

Take the following example for hiding/showing a notebook through a Checkbox: ...
25
votes
3answers
2k views

Extracting values from nested rules in JSON data

I have been using Mathematica to analyse some data from the StackExchange API. It is conveniently available in JSON form, which Mathematica interprets as replacement rules. However, some of the rules ...
-2
votes
3answers
1k views

Problem with Compile Function

I am attempting to Compile this function which is used to calculate a elastic collision in two dimensions. The two first coordinates of each list are the position ...
9
votes
5answers
636 views

How to display equations without Mathematica simplifying them?

Say I'm trying to make a simple multiplication table and used Table[i"x"j"="i*j,{i,1,9},{j,1,9}] I'm trying to make it so that I can get a table of equations, ...

15 30 50 per page