107k 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 ...
139k 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 ...
12k views

Turn expression into function

I'm new to Mathematica and I spent the last hour trying to make the expression ...
3k views

Scoping in assigning a derivative

While answering another question, I stumbled upon a problem I cannot easily resolve. To assign the derivative of a function to another function, typically one can do this with a ...
7k views

How to plot Fit functions?

If I do something like this f[x_]:=x^2 Plot[f[x],{x,1,10}] Mathematica plots the function $f(x)=x^2$, as expected. However, ...
2k views

How is it possible to check if a function is even or odd?

I tried it like this: ...
226 views

How to scope Pattern labels in rules/set?

Module[{x}, f@x_ = x; p@x_ := x; {x, x_, x_ -> x, x_ :> x} ] ?f ?p gives ...
406 views

How to use Solve rules as a function body?

Solve gives me an expression which I want to use as the body of a function. Rather than run Solve every time inside my function ...
161 views

How to create Functions that have Compiled functions effectively

I'm about to build a package that will provide lots of simple functions. I want these functions to run as fast as possible when evaluating numerically but still provide symbolic results when needed. ...
246 views

Two seemingly equivalent formulas for bilinear interpolation yield different results

Suppose that I have a function $f:[0,1]^2 \to \mathbb{R}$ and I would like to approximate it from its values in the corners of the domain by the well-known formula  f(s,t) \approx (1-s,s) \begin{...
125 views

How to protect function variables [duplicate]

I am sure this has been asked before, but I can't seem to find the right solution. I want a function to be the solution to a differential equation ...
I am trying to do a seemingly simple thing: f[x_, y_] := x + 3 y /. {x -> -x y} the output for $x=1$ and $y=2$ is 7, so it doesn't make a substitution. How ...