Linked Questions

5
votes
1answer
1k views

Very slow mathematica finite differences

I have a simple code which solves an equation by an explicit method (FTCS). It takes mathematica several minutes (mathematica 10.0.2) to finish the calculation while the same code in Fortran runs less ...
5
votes
2answers
1k views

Expression evaluation inside of FindRoot inside a Compiled Function

I'm trying to get some performance increase out of my own implicit differential equation solver using Compile[]. The uncompiled function is of the following form: ...
6
votes
3answers
602 views

Speed up derivative evaluation

I'm trying to calculate the normal vectors and the tangent vectors at the discrete points of a suface. For example: ...
6
votes
2answers
895 views

How to set the return type of a compiled function? (Compile::noinfo warning)

I have simple function I would like to compile, but I get a warning and a call to MainEvaluate. I would like to avoid both. ...
9
votes
1answer
273 views

Goto and Compile to C

When I use Goto inside compile and use CompilationTarget->"C" I get error message: ...
4
votes
1answer
1k views

How to use Compile with NDSolve function for large no of differential equations?

Matrix M[t] and and Hamiltonian of same order L^n x L^n. ...
6
votes
1answer
609 views

Why does compiling a function with ConstantArray give an error when used in parallel?

Here is a sample compiled function: ...
7
votes
3answers
534 views

Map structure of irregular list, Flatten then reconstruct list using structure

I'm trying to use Compile[] to improve the performance of an algorithm. The algorithm works on a set of matrices which are not of a similar shape. Unfortunately ...
4
votes
1answer
224 views

Can I compile a function containing ArcTanh?

Can I compile a function that contains ArcTanh[]? The following doesn't work Needs["CCodeGenerator`"] c = Compile[ {{x}}, ArcTanh[x]^2]; c[2.5] Mathematica gives ...
17
votes
1answer
390 views

Solver for COVID-19 epidemic model with the Caputo fractional derivatives

As it is known in biological system with memory it would be suitable to use fractional derivatives to describe evolution of the system. In a current version of Mathematica 12.1 there is no special ...
4
votes
2answers
336 views

How to compile this function

I want to compile my function that calculates the energy of a particle system. This is what I've tried: ...
8
votes
1answer
638 views

Trouble with shooting method for a 4th-order differential equation

I'm trying to solve the following forth-order ODE with the shooting method: $$\frac{1}{5}(y-2xy^\prime)=\frac{1}{x}\left\{\frac{xy^\prime}{y}+xy^3 \left[\frac{(xy^\prime)^\prime}{x} \right]^\prime \...
4
votes
2answers
471 views

Problem with machine number precision in compiled functions

When I compile a very big function and give it input the function returns error. I realized that this is because the value of the function becomes smaller than the smallest machine number. Is it ...
5
votes
1answer
755 views

Fast evaluation of a function in many points

I need to feed to an external program a number of points (in Complex128 format) generated from the numerical evaluation of some function, e.g. $e^{i \vec{k}\cdot\...
9
votes
1answer
573 views

Elementwise, compilable min function

I am trying to implement efficiently a transfer-matrix like algorithm. On each iteration, I have two vectors $x=\{x_1,\dots,x_n\}$, $y=\{y_1,\dots,y_n\}$ with real numbers and I need to compute the ...

15 30 50 per page
1 2 3
4
5
9