Linked Questions

0
votes
0answers
117 views

How to evaluate only arguments, but leave topmost expression unevaluated? [duplicate]

I want to represent expressions mostly in unevaluated form, but being able to evaluate it's subparts. For example, how to evaluate only arguments, but leave topmost expression unevaluated? For ...
315
votes
12answers
61k 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 ...
30
votes
7answers
2k views

How to apply or map a list of functions to a list of data?

Say I have a group of functions: f1[a_] := a * -1; f2[a_] := a * 100; f3[a_] := a / 10.0; and some data in a list: ...
17
votes
9answers
1k views

How do you check if there are any equal arguments(even sublist) in a list?

I would like to set up a function which has to return True if at least two arguments of a given List are equal. So if I give {1,4,6,2} to the function it has to ...
28
votes
4answers
1k views

Compiling more functions that don't call MainEvaluate

I would like to use Compile with functions defined outside Compile. For example if I have the two basic functions F and G F[x_] := x + 2 G[x_] := x And I want ...
12
votes
6answers
634 views

Elegantly split a matrix into positive and negative parts?

I have a matrix $M$ of real components, and I want to split it into two matrices $M^+$ and $M^-$ of the same dimensions as $M$, where $M^+$ contains the positive components of $M$ (the remaining ...
14
votes
6answers
536 views

How can I evaluate only a single step of a recursive function?

Let's say have a simple recursive function for the Fibonacci sequence f[0] := 1 f[1] := 1 f[n_] := f[n - 1] + f[n - 2] but I want to see how it will expand in a ...
40
votes
1answer
702 views

Is it possible to define new PlotTheme?

In version 10 one can define, say, $PlotTheme = "Scientific" Which changes the appearance of all plots. This is fantastic because on the one hand, I can have ...
6
votes
4answers
582 views

Convert head Times to List

I can convert an expression with the head of Times,for example, 12*12.5*13*13.5*14*14.5 to {12, 12.5, 13, 13.5, 14, 14.5} by ...
19
votes
2answers
901 views

How to access new colour schemes in version 10?

Many colour schemes and colour functions can be accessed using ColorData. Version 10 introduced new default colour schemes, and a new customization option using ...
18
votes
2answers
468 views

Implementing a safe ValueQ that does not evaluate its argument

Mathematica has a built-in function ValueQ. Quoting the docs, ValueQ[expr] gives True if ...
10
votes
3answers
207 views

Find all heads a function is defined on

So say I've got a function g defined as follows: g[x_Integer] := x + 1 g[s_String] := s <> "!!!" How would I write a ...
3
votes
4answers
751 views

Extract function arguments

Is there a way to extract the arguments of a function? Consider the following example: I have this sum ...
15
votes
2answers
204 views

Why Infinity /. _?(# < 6 &) -> 0 replaces Infinity with ComplexInfinity?

Suppose I define a matrix: mat = { {Infinity, 4, 9}, {6, Infinity, 10}, {8, 9, Infinity} }; Now I want to replace all values smaller than ...
5
votes
4answers
526 views

Join lists in a list of lists

What's the best way to join two consecutive lists in a list of lists ? For example if I have the list x = {{1}, {2}, {3}, {4}} and I want to get in x ...

15 30 50 per page