Linked Questions

178 votes
8 answers

List of compilable functions

Is there somewhere a list on the functions that Compile can compile, or the cases in which a particular function can be compiled that I haven't found? I'd be glad ...
Rojo's user avatar
  • 42.5k
106 votes
5 answers

Replacement inside held expression

I wish to make a replacement inside a held expression: f[x_Real] := x^2; Hold[{2., 3.}] /. n_Real :> f[n] The desired output is ...
Alexey Popkov's user avatar
21 votes
2 answers

C compilation not working with Visual Studio 2013

I'm running Mathematica 9 on a 64 bit Windows 8.1 laptop. I'm having no luck getting C compilation to work. ...
user11990's user avatar
  • 311
21 votes
2 answers

When should I, and when should I not, set the HoldAll attribute on a function I define?

I have seen a number of examples on this site (such as in syntax highlighting and checking evaluation status) in which functions definitions are preceded with ...
Michael Underwood's user avatar
22 votes
2 answers

NDSolve uses different difference order for different spatial derivative when solving PDE

I found something this tutorial for method of line doesn't tell us. Consider the following toy example: ...
xzczd's user avatar
  • 63.8k
33 votes
2 answers

Why is CompilationTarget -> C slower than directly writing with C?

Probably a hard question, but I think it's better to cry out loud. I've hesitated for a while about whether I should post this in StackOverflow with a c tag or not, ...
xzczd's user avatar
  • 63.8k
18 votes
1 answer

How to solve the tsunami model and animate the shallow water wave?

Backslide introduced in 9.0, persisting through 13.1. Recently when I was learning differential equations, I noticed there is a shallow water wave equation to model the tsunami propagation. How to ...
LCFactorization's user avatar
13 votes
2 answers

Nonlinear dispersal equation modeling insect aggregation

I'm a newbie with Mathematica, I know it's a basic answer, but I can't solve the problem on my own. I have the following equation reflecting insect aggregation at low population densities (taken from ...
Vefhug's user avatar
  • 421
16 votes
2 answers

Conservation of area solving a PDE via finite difference scheme

I have two PDEs that describe the movement of fluid: $h_t + [h^3(1-h)^3((1+\varepsilon h)\sin \theta - \varepsilon h_\theta \cos \theta]_\theta$ = 0 $h_t - [h^3(1-h)^3 \varepsilon h_\theta]_\theta$ = ...
mch56's user avatar
  • 723
24 votes
1 answer

Getting Compile to work with Visual Studio 2017 Community Edition

The new Visual Studio is out since a week and I tried to get it to work with Mathematica (versions 11.0 and 11.1). However, the usual tricks for working with a new VS version fail here. Related ...
Sjoerd C. de Vries's user avatar
3 votes
3 answers

Apply central difference formula to a variable twice

I am working with finite difference methods analytically and I would like to be able to perform operations on subscripted variables. I would like to generate the following expression by applying a ...
Hefaestion's user avatar
2 votes
2 answers

Solving 2D+1 PDE with Pseudospectral in one direction with periodic boundary condition?

According to the documentation about the pseudospectral difference-order: It says: Following the discussion here: I found the messy behavior is always on the artificial boundary in $\omega$-...
Bob Lin's user avatar
  • 445
5 votes
3 answers

Problems with solving PDEs

I am using NDSolve to solve the two equations: ...
user55777's user avatar
  • 671
4 votes
1 answer

Is there a way to simplify this replacement rule

I have a rather big expression which contains many sums of form q x + w y. I know that y is much smaller than ...
And R's user avatar
  • 450
2 votes
1 answer

How to make the code inside Compile conciser without hurting performance?

Consider the following sample: ...
xzczd's user avatar
  • 63.8k