Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 6358

Questions on writing non-trivial programs in Mathematica. Do not use this tag for questions on plotting/graphics or for questions on doing mathematics with Mathematica, where the focus is more on the math than the program.

7 votes
Accepted

Where should global variables be defined in a package?

You could explicitly use Global`b in the definition of MyLagrange: ClearAll["MyP`*"]; BeginPackage["MyP`"]; MyLagrange; Begin["`Private`"]; MyLagrange[f_, var_] := Module[{a}, a = D[f, var] + Globa …
Chris K's user avatar
  • 20.4k
7 votes

Sisyphus Random Walk

Another approach would be to formulate this as a DiscreteMarkovProcess. Since DiscreteMarkovProcess only allows a finite state space, we need to truncate at some large distance xmax. Also note that …
Chris K's user avatar
  • 20.4k
93 votes
5 answers
15k views

What does the construct f[x_] := f[x] = ... mean?

This question mentions "x := x = trickery". What does defining a function as f[x_] := f[x] = ... do and what is it good for?
Chris K's user avatar
  • 20.4k