# Numerics

**URL:** https://discourse.julialang.org/c/domain/numerics/20.md?page=9

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 10

---

## [Matrix exponential \* vector for various scales](https://discourse.julialang.org/t/matrix-exponential-vector-for-various-scales/112022)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 38\
**Last updated:** [April 9, 2024, 2:43pm UTC](https://discourse.julialang.org/t/matrix-exponential-vector-for-various-scales/112022 "2024-04-09T14:43:13Z")

</div>

Given a matrix Q which is a continuous-time transition matrix, ie Q\_{i,j} \\ge 0 for j \\ne i, \\sum\_j Q\_{i,j} = 0 \\ \\forall i I would like to calculate \\exp(Qt)v for multiple t's (fixed v, Q). Potentially Q is around 5…

---

## [Improving performance of calculating Symbolics Jacobians?](https://discourse.julialang.org/t/improving-performance-of-calculating-symbolics-jacobians/112681)

<div class="topic-metadata">

**Author:** [@Undermine28](https://discourse.julialang.org/u/Undermine28)\
**Replies:** 7\
**Last updated:** [April 8, 2024, 1:47pm UTC](https://discourse.julialang.org/t/improving-performance-of-calculating-symbolics-jacobians/112681 "2024-04-08T13:47:41Z")

</div>

I am trying to calculate the Observation Matrix of a non-linear system. To do this I need to find more and more difficult Lie derivatives. This requires calculating recursive Jacobians. Very quickly, Symbolics seems to …

---

## [Preconditioner for Sundials IDA solver in DifferentialEquations.jl](https://discourse.julialang.org/t/preconditioner-for-sundials-ida-solver-in-differentialequations-jl/105124)

<div class="topic-metadata">

**Author:** [@jespfra](https://discourse.julialang.org/u/jespfra)\
**Replies:** 4\
**Last updated:** [April 6, 2024, 10:11pm UTC](https://discourse.julialang.org/t/preconditioner-for-sundials-ida-solver-in-differentialequations-jl/105124 "2024-04-06T22:11:24Z")

</div>

Hello Everyone, In DifferentialEquations.jl, I have not found an example of how to should set a preconditioner for the Sundials IDA solver. I have found examples of how to set it up for ODE systems for the CVODE\_BDF sol…

---

## [Inconsistency when solving system of SDE with diagonal noise](https://discourse.julialang.org/t/inconsistency-when-solving-system-of-sde-with-diagonal-noise/111608)

<div class="topic-metadata">

**Author:** [@matt1](https://discourse.julialang.org/u/matt1)\
**Replies:** 1\
**Last updated:** [April 6, 2024, 9:49pm UTC](https://discourse.julialang.org/t/inconsistency-when-solving-system-of-sde-with-diagonal-noise/111608 "2024-04-06T21:49:05Z")

</div>

Hello, I noticed a strange behaviour of Julia when trying to solve the following system of SDE: \\begin{align} du\_1 &= \\left(\\frac{1}{1+c^2}\\right) \\left( -\\frac{u\_4 - 2u\_3+ u\_4}{2d^2} + (u\_1^2 + u\_3^2)u\_3 - c \\left( -…

---

## [Method error composing quadqk and forwarddiff](https://discourse.julialang.org/t/method-error-composing-quadqk-and-forwarddiff/112461)

<div class="topic-metadata">

**Author:** [@Domenico\_Lahaye](https://discourse.julialang.org/u/Domenico_Lahaye)\
**Replies:** 8\
**Last updated:** [April 3, 2024, 10:51am UTC](https://discourse.julialang.org/t/method-error-composing-quadqk-and-forwarddiff/112461 "2024-04-03T10:51:26Z")

</div>

Greetings! Listed below is a small piece of code that composes QuadGK and ForwardDiff and that fails. Including the resulting method error message for the function extract\_derivative(). I have two questions regarding thi…

---

## [Are Enzyme's custom rules for sparse arrays different from regular Matrix?](https://discourse.julialang.org/t/are-enzymes-custom-rules-for-sparse-arrays-different-from-regular-matrix/112352)

<div class="topic-metadata">

**Author:** [@ToPo](https://discourse.julialang.org/u/ToPo)\
**Replies:** 3\
**Last updated:** [April 1, 2024, 6:14am UTC](https://discourse.julialang.org/t/are-enzymes-custom-rules-for-sparse-arrays-different-from-regular-matrix/112352 "2024-04-01T06:14:00Z")

</div>

I am creating custom rules for sparse arrays in Enzyme, an automatic differentiation package. The following program is a custom rule for the computation of matrix adds of type SparseMatrixCSC. using SparseArrays #-----…

---

## [Smooth approximation to max(0, x)](https://discourse.julialang.org/t/smooth-approximation-to-max-0-x/109383)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 13\
**Last updated:** [March 31, 2024, 1:43am UTC](https://discourse.julialang.org/t/smooth-approximation-to-max-0-x/109383 "2024-03-31T01:43:42Z")

</div>

I need a “smooth” approximation f to x \\to \\max(0, x), such that \\lim\_{x \\to -\\infty} f(x) = 0, \\lim\_{x \\to \\infty} f(x) = x, f(x) \> 0, f'(x) \> 0, both continuous; ideally continuous higher derivatives not too expensiv…

---

## [Fast implementation of incomplete extended gamma function, QuadGK?](https://discourse.julialang.org/t/fast-implementation-of-incomplete-extended-gamma-function-quadgk/112239)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 4\
**Last updated:** [March 29, 2024, 3:10am UTC](https://discourse.julialang.org/t/fast-implementation-of-incomplete-extended-gamma-function-quadgk/112239 "2024-03-29T03:10:42Z")

</div>

Hello, I am interested in developing a fast routine to compute the following extended incomplete gamma function for various pairs (x, q). \\gamma(\\alpha, \\kappa, p, q)(x) = \\int\_{0}^x t^{\\alpha-1} \\exp( -\\frac{t^\\kappa}…

---

## [How can we create more basic Enzyme custom rules?](https://discourse.julialang.org/t/how-can-we-create-more-basic-enzyme-custom-rules/112174)

<div class="topic-metadata">

**Author:** [@ToPo](https://discourse.julialang.org/u/ToPo)\
**Replies:** 3\
**Last updated:** [March 27, 2024, 3:37pm UTC](https://discourse.julialang.org/t/how-can-we-create-more-basic-enzyme-custom-rules/112174 "2024-03-27T15:37:37Z")

</div>

I am trying to create custom rules for Enzyme. I looked at the examples on Enzyme’s official website, but unfortunately could not fully understand them due to difficulty. As a very simple example to try, I created a pr…

---

## [What are IFFxM methods is StochasticDiffEq.jl?](https://discourse.julialang.org/t/what-are-iffxm-methods-is-stochasticdiffeq-jl/111899)

<div class="topic-metadata">

**Author:** [@homocomputeris](https://discourse.julialang.org/u/homocomputeris)\
**Replies:** 1\
**Last updated:** [March 27, 2024, 9:12am UTC](https://discourse.julialang.org/t/what-are-iffxm-methods-is-stochasticdiffeq-jl/111899 "2024-03-27T09:12:34Z")

</div>

What are these methods in StochasticDiffEq.jl and in which papers are they described? They are declared and implemented, but they seem to be undocumented. Or have a different name.

---

## [Insight on QuadGK instability on backwards integration](https://discourse.julialang.org/t/insight-on-quadgk-instability-on-backwards-integration/112090)

<div class="topic-metadata">

**Author:** [@aner-sanchez](https://discourse.julialang.org/u/aner-sanchez)\
**Replies:** 2\
**Last updated:** [March 25, 2024, 5:58pm UTC](https://discourse.julialang.org/t/insight-on-quadgk-instability-on-backwards-integration/112090 "2024-03-25T17:58:00Z")

</div>

Has someone an insight on why julia\> quadgk(s-\>(1-s)^(-0.9),0,1,rtol=1e-6,atol=1e-8,maxevals=10^10) (9.772220920299885, 0.011179284983380677) julia\> quadgk(s-\>s^(-0.9),0,1) (9.999999279144092, 1.4665863410199572e-7) c…

---

## [How do you speed up the linear sparse solver in Zygote?](https://discourse.julialang.org/t/how-do-you-speed-up-the-linear-sparse-solver-in-zygote/111801)

<div class="topic-metadata">

**Author:** [@ToPo](https://discourse.julialang.org/u/ToPo)\
**Replies:** 44\
**Last updated:** [March 24, 2024, 7:18am UTC](https://discourse.julialang.org/t/how-do-you-speed-up-the-linear-sparse-solver-in-zygote/111801 "2024-03-24T07:18:47Z")

</div>

I have confirmed that the standard Julia solver (backslash) can be used in the automatic differentiation of Zygote. Below is a sample program. (This program calculates the gradient.) However, while the forward computat…

---

## [Looking for a quadrature rule](https://discourse.julialang.org/t/looking-for-a-quadrature-rule/111923)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 17\
**Last updated:** [March 22, 2024, 4:52pm UTC](https://discourse.julialang.org/t/looking-for-a-quadrature-rule/111923 "2024-03-22T16:52:48Z")

</div>

Hi, I need compute thousands of integrals of the form \\int\_{0}^{t} \\frac{e^{at}}{\\sum\_{i=1}^n b\_i e^{c\_i t}} dt. I know that : the time frame \[0,t\] is typically small (say t \\le 1) rates a,c\_1,...c\_n are of order 1e…

---

## [Solving a Fokker-Plank PDE](https://discourse.julialang.org/t/solving-a-fokker-plank-pde/109101)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 5\
**Last updated:** [March 22, 2024, 1:45pm UTC](https://discourse.julialang.org/t/solving-a-fokker-plank-pde/109101 "2024-03-22T13:45:46Z")

</div>

I have a Wiener process in 3 dimensions, with time-independent drift and diffusion, ie x \\in \\mathbb{R}^3, dx\_t = \\mu(x) dt + \\sigma(x) dw where \\sigma(x) is diagonal. I also have an initial distribution/density p\_0(x…

---

## [A question about implementing double integral](https://discourse.julialang.org/t/a-question-about-implementing-double-integral/111914)

<div class="topic-metadata">

**Author:** [@swsw](https://discourse.julialang.org/u/swsw)\
**Replies:** 3\
**Last updated:** [March 22, 2024, 3:59am UTC](https://discourse.julialang.org/t/a-question-about-implementing-double-integral/111914 "2024-03-22T03:59:37Z")

</div>

I’d like to calculate the following double integral Integrate\[exp(-x)Integrate\[exp(-y),{y,0,x}\],{x,0,∞}\] I try the following in julia but i think i probably get it wrong. using QuadGK inner\_function(y) = exp(-y) …

---

## [Pkg DoubleFloats, some consts flawed](https://discourse.julialang.org/t/pkg-doublefloats-some-consts-flawed/111917)

<div class="topic-metadata">

**Author:** [@derSchorsch](https://discourse.julialang.org/u/derSchorsch)\
**Replies:** 1\
**Last updated:** [March 21, 2024, 9:19am UTC](https://discourse.julialang.org/t/pkg-doublefloats-some-consts-flawed/111917 "2024-03-21T09:19:45Z")

</div>

Hi all, I have noticed that many of the constants related to pi in the file sequences.jl of pkg DoubleFloats are flawed. For example, the DD values for (15/32)\*%pi read: "Double64(1.4726215563702156, -5.3616983752483455…

---

## [Solver for Elliptic PDE with Dirichlet and Neumann BCs](https://discourse.julialang.org/t/solver-for-elliptic-pde-with-dirichlet-and-neumann-bcs/111668)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 0\
**Last updated:** [March 15, 2024, 3:38pm UTC](https://discourse.julialang.org/t/solver-for-elliptic-pde-with-dirichlet-and-neumann-bcs/111668 "2024-03-15T15:38:43Z")

</div>

Hello, I am interested in developing a finite difference solver for a 2D elliptic PDE (~ Darcy flow) from (https://arxiv.org/pdf/2205.09322.pdf). Do you have recommended packages to solve this PDE? The PDE is given by: …

---

## [NoiseProcess for stochastic differential equation always returns 0.0](https://discourse.julialang.org/t/noiseprocess-for-stochastic-differential-equation-always-returns-0-0/111572)

<div class="topic-metadata">

**Author:** [@Johncowk](https://discourse.julialang.org/u/Johncowk)\
**Replies:** 3\
**Last updated:** [March 14, 2024, 8:35am UTC](https://discourse.julialang.org/t/noiseprocess-for-stochastic-differential-equation-always-returns-0-0/111572 "2024-03-14T08:35:58Z")

</div>

I am trying to implement a stochastic differential equation for an SDE representing a biological system, so the variable (concentration) should not be negative. In order to modelize a noise process that cannot be negati…

---

## [What range of LinearAlgebra does Enzyme support?](https://discourse.julialang.org/t/what-range-of-linearalgebra-does-enzyme-support/111552)

<div class="topic-metadata">

**Author:** [@ToPo](https://discourse.julialang.org/u/ToPo)\
**Replies:** 6\
**Last updated:** [March 14, 2024, 3:08am UTC](https://discourse.julialang.org/t/what-range-of-linearalgebra-does-enzyme-support/111552 "2024-03-14T03:08:21Z")

</div>

Hi all, I would like to use the LinearAlgebra package in Enzyme. Since Julia’s sparse matrix package, SparseArrays, did not seem to be available, I created my own sparse-matrix library. When I looked at the Enzyme tes…

---

## [Symbolic Eigenvalues](https://discourse.julialang.org/t/symbolic-eigenvalues/111376)

<div class="topic-metadata">

**Author:** [@Andy2K11](https://discourse.julialang.org/u/Andy2K11)\
**Replies:** 2\
**Last updated:** [March 13, 2024, 9:26am UTC](https://discourse.julialang.org/t/symbolic-eigenvalues/111376 "2024-03-13T09:26:41Z")

</div>

While completing a course assignment recently I needed to calculate symbolically the eigenvalues of a Jacobian. I was trying to use the Symbolics.jl package but it didn’t seem able to solve this kind of problem. When I …

---

## [SpecialFunctions.jl's besselk() is ~10X slower than MATLAB's](https://discourse.julialang.org/t/specialfunctions-jls-besselk-is-10x-slower-than-matlabs/111536)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 5\
**Last updated:** [March 12, 2024, 9:04pm UTC](https://discourse.julialang.org/t/specialfunctions-jls-besselk-is-10x-slower-than-matlabs/111536 "2024-03-12T21:04:48Z")

</div>

I find that SpecialFunctions.jl’s besselk() is ~10X slower than MATLAB’s. In MATLAB, \>\> N = 10^6; v = rand(N,1); \>\> tic; for x = v; besselk(1, x); end; toc Elapsed time is 0.017116 seconds. \>\> tic; for x = v; besselk(1…

---

## [Conserve integral in a PINN](https://discourse.julialang.org/t/conserve-integral-in-a-pinn/111496)

<div class="topic-metadata">

**Author:** [@ste](https://discourse.julialang.org/u/ste)\
**Replies:** 1\
**Last updated:** [March 12, 2024, 6:29pm UTC](https://discourse.julialang.org/t/conserve-integral-in-a-pinn/111496 "2024-03-12T18:29:27Z")

</div>

I have the following code where I try to solve a little toy system of PDEs: using ModelingToolkit, NeuralPDE, Flux, Optim, GalacticOptim, Plots, DiffEqSensitivity, OptimizationOptimisers, OptimizationOptimJL import Mod…

---

## [Matrix Factorials](https://discourse.julialang.org/t/matrix-factorials/111515)

<div class="topic-metadata">

**Author:** [@ZekeMarshall](https://discourse.julialang.org/u/ZekeMarshall)\
**Replies:** 4\
**Last updated:** [March 12, 2024, 2:05pm UTC](https://discourse.julialang.org/t/matrix-factorials/111515 "2024-03-12T14:05:12Z")

</div>

Hi, I’ve been looking for a function to calculate the factorial of a matrix, but haven’t had any luck. I was wondering whether someone could point me in the right direction? Apologies if i have missed something obviou…

---

## [Faster matmul](https://discourse.julialang.org/t/faster-matmul/111389)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 3\
**Last updated:** [March 9, 2024, 10:54am UTC](https://discourse.julialang.org/t/faster-matmul/111389 "2024-03-09T10:54:22Z")

</div>

https://arstechnica.com/information-technology/2024/03/matrix-multiplication-breakthrough-could-lead-to-faster-more-efficient-ai-models/ Would Julia implement new matmul algo like above?

---

## [Numerical computation density function from distribution with autodifferentiation](https://discourse.julialang.org/t/numerical-computation-density-function-from-distribution-with-autodifferentiation/111302)

<div class="topic-metadata">

**Author:** [@Kieran\_Marray](https://discourse.julialang.org/u/Kieran_Marray)\
**Replies:** 16\
**Last updated:** [March 8, 2024, 10:44am UTC](https://discourse.julialang.org/t/numerical-computation-density-function-from-distribution-with-autodifferentiation/111302 "2024-03-08T10:44:13Z")

</div>

I have a non-standard multivariate distribution function/copula (here, a copula in the MWE). I am trying to compute the density function by taking the cross-partial derivatives of the distribution/copula with respect to …

---

## [LinearAlgebra help](https://discourse.julialang.org/t/linearalgebra-help/110964)

<div class="topic-metadata">

**Author:** [@tushargayan2324](https://discourse.julialang.org/u/tushargayan2324)\
**Replies:** 4\
**Last updated:** [February 29, 2024, 6:23pm UTC](https://discourse.julialang.org/t/linearalgebra-help/110964 "2024-02-29T18:23:36Z")

</div>

I am trying to solve a certain question; Question: There is a 2-d square grid of nodes, with resistors placed randomly to connect those nodes. And eventually, those connections may extend from one end to the other end. …

---

## [Efficient ways to implement a (distributed) matrix-matrix product?](https://discourse.julialang.org/t/efficient-ways-to-implement-a-distributed-matrix-matrix-product/79466)

<div class="topic-metadata">

**Author:** [@Neo](https://discourse.julialang.org/u/Neo)\
**Replies:** 2\
**Last updated:** [February 27, 2024, 4:30pm UTC](https://discourse.julialang.org/t/efficient-ways-to-implement-a-distributed-matrix-matrix-product/79466 "2024-02-27T16:30:46Z")

</div>

There are a huge sparse matrix A and a tall-and-skinny matrix B (a set of multiple vectors). I want partition them into pieces for parallel distributed-memory matrix-matrix (matrix-vectors) multiplication. Is there any w…

---

## [Nullspace Function Vs QR decomposition](https://discourse.julialang.org/t/nullspace-function-vs-qr-decomposition/110656)

<div class="topic-metadata">

**Author:** [@fimiller](https://discourse.julialang.org/u/fimiller)\
**Replies:** 8\
**Last updated:** [February 24, 2024, 7:16pm UTC](https://discourse.julialang.org/t/nullspace-function-vs-qr-decomposition/110656 "2024-02-24T19:16:54Z")

</div>

I am attempting to compute a nullspace for a matrix A. I have two potential techniques of doing this. One is to use a permuted QR decomposition, and the other is to use the nullspace function. These two approaches give…

---

## [Finite difference Laplacian with five-point stencil](https://discourse.julialang.org/t/finite-difference-laplacian-with-five-point-stencil/25014)

<div class="topic-metadata">

**Author:** [@Vortico](https://discourse.julialang.org/u/Vortico)\
**Replies:** 8\
**Last updated:** [February 21, 2024, 7:23pm UTC](https://discourse.julialang.org/t/finite-difference-laplacian-with-five-point-stencil/25014 "2024-02-21T19:23:31Z")

</div>

This is my first day learning Julia, and I’m not sure of an elegant way to compute the finite difference Laplacian on an NxM Float32 array. \\Delta f(x,y) \\approx f(x-1,y) + f(x+1,y) + f(x,y-1) + f(x,y+1) - 4f(x,y) Base…

---

## [Help to find package for DSA (Discrete Stochastic Arithmetic) implementation](https://discourse.julialang.org/t/help-to-find-package-for-dsa-discrete-stochastic-arithmetic-implementation/110391)

<div class="topic-metadata">

**Author:** [@hungpham3112](https://discourse.julialang.org/u/hungpham3112)\
**Replies:** 5\
**Last updated:** [February 21, 2024, 4:30pm UTC](https://discourse.julialang.org/t/help-to-find-package-for-dsa-discrete-stochastic-arithmetic-implementation/110391 "2024-02-21T16:30:44Z")

</div>

Hi, I’m working in a project where we use DSA method (based-on CESTAC) to validate results of numerical software. Currently, I’m using Cadna (written in C) to solve this problem. The advantage of Cadna is it has example …

[Previous page](https://discourse.julialang.org/c/domain/numerics/20.md?page=8)

[Next page](https://discourse.julialang.org/c/domain/numerics/20.md?page=10)
