# Numerics

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

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

**Page:** 16

---

## [How to efficiently differentiate backslash operator for sparse matrix?](https://discourse.julialang.org/t/how-to-efficiently-differentiate-backslash-operator-for-sparse-matrix/43778)

<div class="topic-metadata">

**Author:** [@Liang\_Chen](https://discourse.julialang.org/u/Liang_Chen)\
**Replies:** 23\
**Last updated:** [May 1, 2023, 4:21pm UTC](https://discourse.julialang.org/t/how-to-efficiently-differentiate-backslash-operator-for-sparse-matrix/43778 "2023-05-01T16:21:24Z")

</div>

My problem is to calculate the gradient, dL(u)/dp, where L() is a loss function which takes a vector u as the input and outputs a scalar value. The vector p are parameters that defines a large sparse matrix K, such that K…

---

## [Compressed svd algorithm implementation](https://discourse.julialang.org/t/compressed-svd-algorithm-implementation/97837)

<div class="topic-metadata">

**Author:** [@Desmond](https://discourse.julialang.org/u/Desmond)\
**Replies:** 4\
**Last updated:** [April 25, 2023, 11:34pm UTC](https://discourse.julialang.org/t/compressed-svd-algorithm-implementation/97837 "2023-04-25T23:34:32Z")

</div>

I am trying to implement the compressed SVD in this \[https://openaccess.thecvf.com/content\_ICCV\_2017\_workshops/papers/w25/Erichson\_Compressed\_Singular\_Value\_ICCV\_2017\_paper.pdf\]. Attached is the algorithm. I have proble…

---

## [Parallell TensorKit](https://discourse.julialang.org/t/parallell-tensorkit/97410)

<div class="topic-metadata">

**Author:** [@Nellatur](https://discourse.julialang.org/u/Nellatur)\
**Replies:** 5\
**Last updated:** [April 20, 2023, 6:48am UTC](https://discourse.julialang.org/t/parallell-tensorkit/97410 "2023-04-20T06:48:27Z")

</div>

Based on Please read: make it easier to help you - #2 Avoid extending the original question that has already been answered with many new questions. It is better to start a new thread. Let me start a new thread than f…

---

## [How to use DifferentialEquations.jl to do a Monte Carlo](https://discourse.julialang.org/t/how-to-use-differentialequations-jl-to-do-a-monte-carlo/97450)

<div class="topic-metadata">

**Author:** [@marcofrancis](https://discourse.julialang.org/u/marcofrancis)\
**Replies:** 1\
**Last updated:** [April 14, 2023, 10:51am UTC](https://discourse.julialang.org/t/how-to-use-differentialequations-jl-to-do-a-monte-carlo/97450 "2023-04-14T10:51:07Z")

</div>

Hi, I managed to simulate (with EnsembleProblem ) 1000 paths of a 2-dimensional SDE. Let’s call the one dimensional components x(t) and y(t). I have some problems handling the solution to the problem: the paths are of d…

---

## [\[Help\] Nested ForwardDiff.jacobian of an Integrals.IntegralProblem](https://discourse.julialang.org/t/help-nested-forwarddiff-jacobian-of-an-integrals-integralproblem/97430)

<div class="topic-metadata">

**Author:** [@aafsar](https://discourse.julialang.org/u/aafsar)\
**Replies:** 2\
**Last updated:** [April 13, 2023, 5:36pm UTC](https://discourse.julialang.org/t/help-nested-forwarddiff-jacobian-of-an-integrals-integralproblem/97430 "2023-04-13T17:36:03Z")

</div>

I have an integration problem (actually vector-valued, but problem here applies to scalar-valued ones as well) as a part of my model which it might be helpful to calculate its Hessian. I follow the documentation of Integ…

---

## [TensorKit efficiency](https://discourse.julialang.org/t/tensorkit-efficiency/59559)

<div class="topic-metadata">

**Author:** [@Nellatur](https://discourse.julialang.org/u/Nellatur)\
**Replies:** 11\
**Last updated:** [April 12, 2023, 5:40am UTC](https://discourse.julialang.org/t/tensorkit-efficiency/59559 "2023-04-12T05:40:20Z")

</div>

I tried to run a contraction A\[a,b\]\*B\[b,c,d\] = C\[a,c,d\], assume repeated index b as summation using TensorKit. By the following code, it seems TensorKit is even slower than nested loops. Does TensorKit use BLAS? or is…

---

## [Obtain Power Spectrum from Voltage Timeseries](https://discourse.julialang.org/t/obtain-power-spectrum-from-voltage-timeseries/97064)

<div class="topic-metadata">

**Author:** [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Replies:** 7\
**Last updated:** [April 8, 2023, 5:20pm UTC](https://discourse.julialang.org/t/obtain-power-spectrum-from-voltage-timeseries/97064 "2023-04-08T17:20:38Z")

</div>

I want to obtain Power spectrum of the Voltage Timeseries of Vela Pulsar data given in picture below :thinking: How should i implement FFTW ?

---

## [Weird behavior of ArbNumerics returning nan](https://discourse.julialang.org/t/weird-behavior-of-arbnumerics-returning-nan/97114)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 11\
**Last updated:** [April 8, 2023, 12:30pm UTC](https://discourse.julialang.org/t/weird-behavior-of-arbnumerics-returning-nan/97114 "2023-04-08T12:30:41Z")

</div>

I want to use elliptic integrals with complex arguments, and for that, I am using ArbNumerics.jl (as suggested in this post). The issue is that I get nan for a reason I do not understand. This code works great: ArbNum…

---

## [KrylovKit convergence](https://discourse.julialang.org/t/krylovkit-convergence/97078)

<div class="topic-metadata">

**Author:** [@alfredmallet](https://discourse.julialang.org/u/alfredmallet)\
**Replies:** 6\
**Last updated:** [April 5, 2023, 9:56pm UTC](https://discourse.julialang.org/t/krylovkit-convergence/97078 "2023-04-05T21:56:03Z")

</div>

Hello, I have just started learning Julia, and I am attempting to use it to solve a one-dimensional eigenvalue problem in my field, plasma physics (specifically, the tearing mode, if anyone is interested). The problem i…

---

## [Higher accuracy in numerical cumulative integration](https://discourse.julialang.org/t/higher-accuracy-in-numerical-cumulative-integration/96898)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 15\
**Last updated:** [April 1, 2023, 7:35pm UTC](https://discourse.julialang.org/t/higher-accuracy-in-numerical-cumulative-integration/96898 "2023-04-01T19:35:42Z")

</div>

There are some threads about numerical cumulative integration like this and this. However, I have a more basic question. I am interested in performing the integral S(x; a) = \\int\_a^x f(x') dx' where x \\le b. Note that f…

---

## [Approximate inverse of a definite integral](https://discourse.julialang.org/t/approximate-inverse-of-a-definite-integral/83181)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 8\
**Last updated:** [March 31, 2023, 3:09pm UTC](https://discourse.julialang.org/t/approximate-inverse-of-a-definite-integral/83181 "2023-03-31T15:09:41Z")

</div>

For a given (fixed) function f: \[0,1\] \\to \[0, \\infty), let g(x) = \\int\_0^x f(x) dx and h(x) = \\frac{g(x)}{g(1)} h is then, by construction, \[0,1\] \\to \[0,1\]. I need a fast approximation of its inverse: I am OK with …

---

## [What is the best way to calculate the numerical gradient of a matrix, representing multiple points in 3D space?](https://discourse.julialang.org/t/what-is-the-best-way-to-calculate-the-numerical-gradient-of-a-matrix-representing-multiple-points-in-3d-space/96727)

<div class="topic-metadata">

**Author:** [@Dale\_James\_Black](https://discourse.julialang.org/u/Dale_James_Black)\
**Replies:** 10\
**Last updated:** [March 28, 2023, 10:04pm UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-calculate-the-numerical-gradient-of-a-matrix-representing-multiple-points-in-3d-space/96727 "2023-03-28T22:04:10Z")

</div>

Given a matrix, where each row represents a point in 3D space and each column represents the x, y, and z location. What is the recommended way to calculate the gradient at each point (at each row)? points = \[ 202 2…

---

## [Best practices](https://discourse.julialang.org/t/best-practices/85138)

<div class="topic-metadata">

**Author:** [@Dario-Rosa85](https://discourse.julialang.org/u/Dario-Rosa85)\
**Replies:** 24\
**Last updated:** [March 25, 2023, 9:31am UTC](https://discourse.julialang.org/t/best-practices/85138 "2023-03-25T09:31:28Z")

</div>

I am running a code which is diagonalizing very large matrices, hence I need to reach the best possible performance. when scanning a vector I was using the following syntax for i in 1:length(vec) which works fine. How…

---

## [Surprisingly inaccurate sparse Cholesky factorization](https://discourse.julialang.org/t/surprisingly-inaccurate-sparse-cholesky-factorization/96410)

<div class="topic-metadata">

**Author:** [@jarapo](https://discourse.julialang.org/u/jarapo)\
**Replies:** 2\
**Last updated:** [March 21, 2023, 6:01pm UTC](https://discourse.julialang.org/t/surprisingly-inaccurate-sparse-cholesky-factorization/96410 "2023-03-21T18:01:41Z")

</div>

I am surprised by how inaccurate cholesky() can be for sparse matrices; so much so it me wonder if I am not using it correctly. Define a finite different matrix A: L=2; dvec=-2\*ones(2^L);restvec=ones(2^L-1); A =sparse(…

---

## [Dierckx to perform a derivative over a 2d spline](https://discourse.julialang.org/t/dierckx-to-perform-a-derivative-over-a-2d-spline/96101)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 8\
**Last updated:** [March 20, 2023, 11:24am UTC](https://discourse.julialang.org/t/dierckx-to-perform-a-derivative-over-a-2d-spline/96101 "2023-03-20T11:24:08Z")

</div>

I cannot use Dierckx.jl to perform a derivative over a 2d spline even though from the documentation it seems like it should work. The help of the function derivative gives: Dierckx.derivative is a Function. # 10 metho…

---

## [Error in DiffEqSensitivity: no method for similar of Duals](https://discourse.julialang.org/t/error-in-diffeqsensitivity-no-method-for-similar-of-duals/92457)

<div class="topic-metadata">

**Author:** [@AndreaRH](https://discourse.julialang.org/u/AndreaRH)\
**Replies:** 5\
**Last updated:** [March 17, 2023, 8:55pm UTC](https://discourse.julialang.org/t/error-in-diffeqsensitivity-no-method-for-similar-of-duals/92457 "2023-03-17T20:55:10Z")

</div>

Hello! I’m trying to understand how to use DiffEqSensitivity.jl and started with a toy example but ran into trouble when defining a ODEForwardSensitivityProblem. My cost functional is the average of a filtered (low-pass…

---

## [How to find equation when i have points?](https://discourse.julialang.org/t/how-to-find-equation-when-i-have-points/96240)

<div class="topic-metadata">

**Author:** [@Sergey\_Novak](https://discourse.julialang.org/u/Sergey_Novak)\
**Replies:** 7\
**Last updated:** [March 17, 2023, 2:31pm UTC](https://discourse.julialang.org/t/how-to-find-equation-when-i-have-points/96240 "2023-03-17T14:31:51Z")

</div>

I have points and need to get equation of these points. I try to use wolfram and another online services and all result is bad.

---

## [Integrating Hamilton's equations](https://discourse.julialang.org/t/integrating-hamiltons-equations/96147)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 4\
**Last updated:** [March 16, 2023, 1:24pm UTC](https://discourse.julialang.org/t/integrating-hamiltons-equations/96147 "2023-03-16T13:24:13Z")

</div>

I want to integrate the equations of motion of a classical physical system. My Hamiltonian is changing in time, and actually, I am interested in considering the general case where it is not necessarily of the form H(q, …

---

## [Matrix-Free/Function-Only Linear Solves](https://discourse.julialang.org/t/matrix-free-function-only-linear-solves/95411)

<div class="topic-metadata">

**Author:** [@leespen1](https://discourse.julialang.org/u/leespen1)\
**Replies:** 5\
**Last updated:** [March 14, 2023, 7:26pm UTC](https://discourse.julialang.org/t/matrix-free-function-only-linear-solves/95411 "2023-03-14T19:26:08Z")

</div>

Suppose I want to solve a system of equations A\*x = b, and I have a function A\_func such that A\_func(x) = A\*x. How could I go about solving the system of equations without constructing the matrix A? I could construct th…

---

## [Best practice for element-wise vector value update without memory allocation](https://discourse.julialang.org/t/best-practice-for-element-wise-vector-value-update-without-memory-allocation/94864)

<div class="topic-metadata">

**Author:** [@Charles](https://discourse.julialang.org/u/Charles)\
**Replies:** 3\
**Last updated:** [March 12, 2023, 10:14am UTC](https://discourse.julialang.org/t/best-practice-for-element-wise-vector-value-update-without-memory-allocation/94864 "2023-03-12T10:14:12Z")

</div>

I am implementing Gaussian Elimination using Julia. The important thing is, when doing the elimination the row vectors are kept updating row by row. While writing a for loop to iterate over the row vector and assigning n…

---

## [Interpolations of a function that has NaN](https://discourse.julialang.org/t/interpolations-of-a-function-that-has-nan/95704)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 9\
**Last updated:** [March 11, 2023, 1:29am UTC](https://discourse.julialang.org/t/interpolations-of-a-function-that-has-nan/95704 "2023-03-11T01:29:11Z")

</div>

I am trying to interpolate a 2d function that is defined only on a partial set of my parameters. Where it is not defined, my 2d array has NaNs. Note that in my example the range of where the function is defined is not a…

---

## [Cannot show that the matrix form of my SPD preconditioner is SPD](https://discourse.julialang.org/t/cannot-show-that-the-matrix-form-of-my-spd-preconditioner-is-spd/95869)

<div class="topic-metadata">

**Author:** [@nvenkov1](https://discourse.julialang.org/u/nvenkov1)\
**Replies:** 4\
**Last updated:** [March 10, 2023, 4:12pm UTC](https://discourse.julialang.org/t/cannot-show-that-the-matrix-form-of-my-spd-preconditioner-is-spd/95869 "2023-03-10T16:12:50Z")

</div>

I define a symmetric positive definite (SPD) matrix A. Then, based on this matrix, I define two preconditioners, which should also be SPD, namely an AMG and a Cholesky factorization. Both preconditioners are matrix-free.…

---

## [Simultaneous diagonalization of commuting Hermitian matrices](https://discourse.julialang.org/t/simultaneous-diagonalization-of-commuting-hermitian-matrices/95495)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 4\
**Last updated:** [March 7, 2023, 3:50pm UTC](https://discourse.julialang.org/t/simultaneous-diagonalization-of-commuting-hermitian-matrices/95495 "2023-03-07T15:50:25Z")

</div>

I have two Hermitian matrices, one of which is positive definite, and the matrices commute. Is there a standard implementation for the simultaneous diagonalization of such two matrices? To be precise, I have a Hamilton…

---

## [Find/Implement Leapfrog method in DifferentialEquations/OrdinaryDiffEq](https://discourse.julialang.org/t/find-implement-leapfrog-method-in-differentialequations-ordinarydiffeq/95595)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 2\
**Last updated:** [March 6, 2023, 11:23am UTC](https://discourse.julialang.org/t/find-implement-leapfrog-method-in-differentialequations-ordinarydiffeq/95595 "2023-03-06T11:23:59Z")

</div>

I am taking a class on computational physics. Instead of implementing everything myself, I figured I should use (and learn to use) existing frameworks. One of the class problems involves using Leapfrog integration (Wiki…

---

## [Order of parameters in a vector differential equation function](https://discourse.julialang.org/t/order-of-parameters-in-a-vector-differential-equation-function/95114)

<div class="topic-metadata">

**Author:** [@shaurya](https://discourse.julialang.org/u/shaurya)\
**Replies:** 6\
**Last updated:** [February 25, 2023, 1:02am UTC](https://discourse.julialang.org/t/order-of-parameters-in-a-vector-differential-equation-function/95114 "2023-02-25T01:02:22Z")

</div>

What is the correct format for a differential equation function? My understanding is that when the function doesn’t take any parameters, it should be like the following: function F!(t,dx,x) dx.=\[x\[1\]+x\[2\];x\[2\]\]; end…

---

## [LinearSolve is changing their solutions](https://discourse.julialang.org/t/linearsolve-is-changing-their-solutions/95028)

<div class="topic-metadata">

**Author:** [@Noel\_Araujo](https://discourse.julialang.org/u/Noel_Araujo)\
**Replies:** 3\
**Last updated:** [February 22, 2023, 7:06pm UTC](https://discourse.julialang.org/t/linearsolve-is-changing-their-solutions/95028 "2023-02-22T19:06:52Z")

</div>

I am solving some Linear Systems using LinearSolve.jl and its caching system. I was fine doing fine with this example using LinearSolve n = 4 A = rand(n, n) b = \[rand(n) for i ∈ 1:3\] ## everything is 'true' let lin…

---

## [Implementing Cuthill-McKee](https://discourse.julialang.org/t/implementing-cuthill-mckee/9268)

<div class="topic-metadata">

**Author:** [@Juser](https://discourse.julialang.org/u/Juser)\
**Replies:** 31\
**Last updated:** [February 18, 2023, 4:17am UTC](https://discourse.julialang.org/t/implementing-cuthill-mckee/9268 "2023-02-18T04:17:40Z")

</div>

I am trying to implement Cuthill McKee on a number of large, sparse matrices. In particular, I would like to get the mapping from original row order to post-CM (or post-reverseCM) row order. The only package that I can …

---

## [ScatteredInterpolation - basic example from docs not working](https://discourse.julialang.org/t/scatteredinterpolation-basic-example-from-docs-not-working/94726)

<div class="topic-metadata">

**Author:** [@wave\_and\_matter](https://discourse.julialang.org/u/wave_and_matter)\
**Replies:** 2\
**Last updated:** [February 17, 2023, 8:32am UTC](https://discourse.julialang.org/t/scatteredinterpolation-basic-example-from-docs-not-working/94726 "2023-02-17T08:32:08Z")

</div>

I have tried to use the ScatteredInterpolation package. When i duplicate the first simple example from the documentation Home · ScatteredInterpolation.jl using ScatteredInterpolation samples = \[0.0; 0.5; 0.5; 0.5; 1.0\]…

---

## [Integration of arbitrarily-spaced data](https://discourse.julialang.org/t/integration-of-arbitrarily-spaced-data/94533)

<div class="topic-metadata">

**Author:** [@SantiagoOrtiz](https://discourse.julialang.org/u/SantiagoOrtiz)\
**Replies:** 2\
**Last updated:** [February 13, 2023, 7:25am UTC](https://discourse.julialang.org/t/integration-of-arbitrarily-spaced-data/94533 "2023-02-13T07:25:22Z")

</div>

Hello all, Is there any function/package in Julia that I could use to integrate one-dimensional arbitrarily-spaced data? NumericalIntegration has several options, but they require evenly spaced data. Best, Santiago

---

## [Surprising benchmark results for a basic mixed precision example](https://discourse.julialang.org/t/surprising-benchmark-results-for-a-basic-mixed-precision-example/94410)

<div class="topic-metadata">

**Author:** [@nvenkov1](https://discourse.julialang.org/u/nvenkov1)\
**Replies:** 1\
**Last updated:** [February 10, 2023, 1:47pm UTC](https://discourse.julialang.org/t/surprising-benchmark-results-for-a-basic-mixed-precision-example/94410 "2023-02-10T13:47:57Z")

</div>

I started to experiment with mixed precision and I benchmarked a basic example as follows: using BenchmarkTools using Quadmath using LinearAlgebra a16 = Vector{Float16}(undef, 100\_000\_000); a32 = Vector{Float32}(undef, …

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

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