Linked Questions

2
votes
1answer
2k views

What is the meaning of two square brackets in function definition? [duplicate]

I came along the following function definition f[a_, b_, c_][r_] = ... with some function on the right hand side. Is this equivalent to ...
1
vote
0answers
136 views

what is the difference between these definitions? [duplicate]

I define 2 functions: g[s_][x_,y_] := the gaussian (1) g1[s_,x_,y_] := the gaussian (2) I get the same answer using ...
0
votes
0answers
76 views

How does Wolfram Language implement for enabling symbols to receive various forms of parameters? [duplicate]

How does the official implement a list/tuple of parameters that can be different in type and quantity as a whole? After re-read @Szabolcs's and @MichaelE2's comments. Finally, I accepted the ...
1
vote
0answers
63 views

What is exactly an element a[i] in mathematica? [duplicate]

I'm confused about the logic behind mathematica programming. We can have function that will be called doing $f[x]$, thus the element $f[x]$ can be seen as the return value of a function taking an ...
453
votes
37answers
99k views

What are the most common pitfalls awaiting new users?

As you may already know, Mathematica is a wonderful piece of software. However, it has a few characteristics that tend to confuse new (and sometimes not-so-new) users. That can be clearly seen from ...
528
votes
19answers
132k 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 ...
129
votes
8answers
7k views

Can one identify the design patterns of Mathematica?

... or are they unnecessary in such a high-level language? I've been thinking about programming style, coding standards and the like quite a bit lately, the result of my current work on a mixed .Net/...
68
votes
4answers
16k views

How do I save a variable or function definition to a file?

Is it possible to save a function which was created via Interpolation of some data in such a way that I can use this function in a new Mathematica session without ...
23
votes
8answers
2k 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: ...
37
votes
5answers
7k views

Clear complains that a subscripted variable is not a symbol or a string?

Here's a small listing where I've used EscqEsc to typeset θ in the notebook: ...
36
votes
4answers
3k views

Do people actually use UpValues?

I know what they are and how to define them. They have to serve some purpose - else why include them? But I never used them and all examples on this site and the docs never show a practical use of <...
47
votes
2answers
2k views

How do you set attributes on SubValues?

SubValues, as discussed in a previous question, are declared as follows ...
19
votes
3answers
857 views

Generating assignments and transforming code inside held forms when generating code

I have been playing with slightly above trivial code manipulations in Mathematica. I thought Mathematica would be great for this kind of work because of rule replacement and expression manipulation, ...
3
votes
6answers
2k views

Defining an integer-valued function on an integer domain

This should be an easy question! I want to define a function with domain = the 12 integers {1,12}, with the values f[1]=31, <...
20
votes
2answers
630 views

SetAttributes[f,Flat]: Why the order dependence?

I'm experiencing a strange phenomenon. Here's a (quite artificial) test case: The following definition work just fine: ...
23
votes
2answers
602 views

How to implement FittedModel like objects

In the course of making some RLink wrappers I want to have some richer containers like Mathematica does with its FittedModel ...
9
votes
3answers
1k views

Why are functions called first-class objects in Mathematica?

I've heard lots of people say a function is a first-class object in Mathematica. "Everything is an expression, including function." "There is no distinction between functions and data." Having read ...
10
votes
4answers
784 views

Finding Anagrams of given length from DictionaryLookup

What I'm trying to find are the 4 letter words in the Mathematica dictionary that have the most anagrams and the amount of anagrams these have each. But I can't seem to find all the 4 letter words in ...
10
votes
2answers
1k views

How to send output of Information[] command to a text file?

I am having little hard time sending output of Information[] command to a text file. related question How to write output to an external text file in addition to ...
16
votes
3answers
318 views

Why is the first argument of the SetDelayed evaluated?

In[1]: f=g; In[2]: SetDelayed[f[x_],x^2]; In[3]: ?f Global`f f=g In[4]: ?g Global`g g[x_]:=x^2 However, SetDelayed has the ...
5
votes
3answers
1k views

recursive integration

I am trying to do multiple integrations recursively. For instance, I would like to do the following equation for arbitrary integer $n$: $\displaystyle R_n(t) = \int_0^t \mathrm dt' R_0(t-t') R_{n-1}(...
5
votes
2answers
7k views

Nested If statements

When I do this: Apply[(If[#2 == what, "yay", If[#2 == whoops, "nay"]]) &, {-5, what}] I get: yay But when I do this: <...
5
votes
2answers
6k views

How do I plot a solution of a differential equation?

I am having trouble generating a plot for a solution to my differential equations. I always end up with just blank axes. ...
0
votes
3answers
4k views

How do I show the combined plot from the do-loop?

I have a do-loop to do the calculations from a set of data and plot the graphs with different results, that was obtained from the calculations. I was able to get multiple graphs but I want to ListPlot ...
11
votes
1answer
556 views

Why does the documentation call functions “pure”?

Clearly, functions in mathematica are not pure functions according to the definition on Wikipedia (no side effects - basically implementabe with table lookups): ...
1
vote
1answer
1k views

What does the slash-colon symbol do?

I came across a bit of code that uses the syntax /: and I don't know what it does. I can't find its documentation, or maybe I'm just not looking properly. The code ...
8
votes
2answers
232 views

Keywords to find documentation for this syntax

Mathematica allows this syntax, but I cannot find any documentation (or books) that discuss the various uses/advantages of it ...
7
votes
4answers
276 views

Iteration of functions

I'm trying to define a function f, such that f[a_]:=a; f[f[a__]]:=f[a]; Then, I tried to evaluate f[x,y]. Since ...
5
votes
2answers
610 views

Assignments in ParallelDo when using indexed variables

For convenience I use an indexed variables syntax to hold results of long computations for different integer parameters: ...
7
votes
2answers
253 views

Apply ToString to a list of variables [duplicate]

I have data1 = {1, 1}; data2 = {2, 2}; datalist = {data1, data2}; I want to create a string list based on the variable names inside ...

15 30 50 per page