Linked Questions

106 votes
5 answers
6k views

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
977 views

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
14 votes
2 answers
7k views

Derivative of the Absolute Value Function in Mathematica looks very different from the actual answer

Derivative of the Abs Function in Mathematica looks very different than the actual answer. Why? How to correct this? For example I entered ...
user14056's user avatar
  • 241
33 votes
2 answers
955 views

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
  • 66.2k
3 votes
3 answers
265 views

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
4 votes
1 answer
355 views

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
  • 542
3 votes
1 answer
353 views

2D Oseen equations

Background info: https://en.wikipedia.org/wiki/Oseen_equations ...
CasperYC's user avatar
  • 1,550
1 vote
1 answer
319 views

Solve PDE system with mixed parabolic–elliptic equations

I want to solve a mixed PDE Parabolic-Elliptic system, subject to initial conditions u(x,y,0)=1 and v(x,y,0)=2-0.5 cos[(Pi x)/5]. The respective code version ...
SAC's user avatar
  • 1,335
2 votes
1 answer
387 views

NDSolve for Coupled Second Order PDEs

I have the following set of equations that I have reduced down from a larger third-order partial differential equation $f(x,y,t) = p(x,y,t) - (x-y)\left(\frac{\partial}{\partial x} - \frac{\partial}{\...
Tbone Willsone's user avatar
3 votes
1 answer
276 views

Mathematica and IBVP mixing temporal and spatial derivatives

The following PDE's-system-solving code ...
dkstack's user avatar
  • 103
2 votes
1 answer
260 views

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

Consider the following sample: ...
xzczd's user avatar
  • 66.2k
3 votes
2 answers
115 views

Need more equations in PDEs by NDSolve? Bug of mma?

I am trying to solve set of pdes as below ...
sixpenny's user avatar
  • 103
1 vote
0 answers
370 views

PDE combined with ODE 1D

I try to solve the following system of PDE coupled with ODE: $$\theta_t - a\theta_{xx} + b\kappa_a(\theta^4-\varphi)=0,$$ $$-\alpha\varphi_{xx} + \kappa_a(\varphi - \theta^4) = 0,$$ $$-a\theta_x + \...
jokersobak's user avatar
2 votes
1 answer
202 views

Error in the solution of PDE with NDsolve and method of lines [closed]

I am trying to solve a system of the partial differential equation with the help of NDSolve and method of lines. Mathematica code for the above-described problem is ...
Mathematicain's user avatar
1 vote
0 answers
242 views

Solve nonlinear coupled PDE with x,y and t dependent

I am trying solve the following two coupled PDE equations. ∂f/∂t=(∂^2 f)/(∂x^2 )+(∂^2 f)/(∂y^2 )-1/f^3 [(∂B/∂x)^2+(∂B/∂y)^2 ]-f+f^3 (∂^2 B)/(∂x^2 )+(∂^2 B)/(∂y^2 )-B*f^2+2/f [(∂B/∂x)(∂f/∂x)-(∂B/∂y)(...
Man's user avatar
  • 11