# Numerics

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

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

**Page:** 22

---

## [Is there a shortcut to construct derivatives of a product using Symbolics?](https://discourse.julialang.org/t/is-there-a-shortcut-to-construct-derivatives-of-a-product-using-symbolics/79144)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 1\
**Last updated:** [April 7, 2022, 11:47am UTC](https://discourse.julialang.org/t/is-there-a-shortcut-to-construct-derivatives-of-a-product-using-symbolics/79144 "2022-04-07T11:47:53Z")

</div>

This is a rather basic question, as I’ve just started using Symbolics.jl and couldn’t find this in the docs after a brief glance. What I want to do is evaluate f -\> (d/dx)(x \* f). I have figured out one way to achieve th…

---

## [Linear problem with multiple shifts](https://discourse.julialang.org/t/linear-problem-with-multiple-shifts/69086)

<div class="topic-metadata">

**Author:** [@Jae-Mo\_Lihm](https://discourse.julialang.org/u/Jae-Mo_Lihm)\
**Replies:** 8\
**Last updated:** [April 6, 2022, 9:49am UTC](https://discourse.julialang.org/t/linear-problem-with-multiple-shifts/69086 "2022-04-06T09:49:58Z")

</div>

I want to solve (A - c\_i) \* x = b for multiple shifts c\_i. A is a Hermitian matrix, where A\*x is efficient than obtaining A directly. A - c\_i \* I is positive definite. I know that one can use Krylov subspace methods (Lan…

---

## [Periodic boundary conditions for PDE system using MethodOfLines.jl](https://discourse.julialang.org/t/periodic-boundary-conditions-for-pde-system-using-methodoflines-jl/78761)

<div class="topic-metadata">

**Author:** [@Wayne\_Wang](https://discourse.julialang.org/u/Wayne_Wang)\
**Replies:** 7\
**Last updated:** [March 30, 2022, 7:19pm UTC](https://discourse.julialang.org/t/periodic-boundary-conditions-for-pde-system-using-methodoflines-jl/78761 "2022-03-30T19:19:23Z")

</div>

Hi all! I’m working with ModellingToolkit and DiffEqOperators to solve a set of PDEs. In particular, I wanted to test out a 1D Kuramoto-Sivashinsky type of equation with periodic boundary conditions, but I’m having some …

---

## [Solving a symmetric block tridiagonal system](https://discourse.julialang.org/t/solving-a-symmetric-block-tridiagonal-system/78623)

<div class="topic-metadata">

**Author:** [@jinml](https://discourse.julialang.org/u/jinml)\
**Replies:** 3\
**Last updated:** [March 29, 2022, 9:13am UTC](https://discourse.julialang.org/t/solving-a-symmetric-block-tridiagonal-system/78623 "2022-03-29T09:13:30Z")

</div>

I have a linear system in a symmetric block tridiagonal form, where each diagonal block is symmetric and invertible, but may be of varying sizes. There is no other structural advantage to make use of as far as I can see …

---

## [DifferentialEquations.jl treat complex different than float](https://discourse.julialang.org/t/differentialequations-jl-treat-complex-different-than-float/78412)

<div class="topic-metadata">

**Author:** [@Elyco](https://discourse.julialang.org/u/Elyco)\
**Replies:** 7\
**Last updated:** [March 28, 2022, 7:06am UTC](https://discourse.julialang.org/t/differentialequations-jl-treat-complex-different-than-float/78412 "2022-03-28T07:06:17Z")

</div>

Hi, I encountered something weird when I was trying to solve a system of ODEs in two equivalent (if I don’t miss something very basic) ways. Here is two ODE, that should be mathematically the same C = -0.01+2im functi…

---

## [ForwardDiff and Zygote cannot automatically differentiate (AD) function from C^n to R that uses FFT](https://discourse.julialang.org/t/forwarddiff-and-zygote-cannot-automatically-differentiate-ad-function-from-c-n-to-r-that-uses-fft/52440)

<div class="topic-metadata">

**Author:** [@tholdem](https://discourse.julialang.org/u/tholdem)\
**Replies:** 23\
**Last updated:** [March 25, 2022, 6:28pm UTC](https://discourse.julialang.org/t/forwarddiff-and-zygote-cannot-automatically-differentiate-ad-function-from-c-n-to-r-that-uses-fft/52440 "2022-03-25T18:28:24Z")

</div>

I’ve encountered so many bugs using ForwardDiff and Zygote to do automatic differentiation for my objective function that takes complex vector as input and outputs a real number. I don’t think I have the expertise to deb…

---

## [ForwardDiff and Zygote return wrong jacobian for log(det(L))](https://discourse.julialang.org/t/forwarddiff-and-zygote-return-wrong-jacobian-for-log-det-l/77961)

<div class="topic-metadata">

**Author:** [@spinkney](https://discourse.julialang.org/u/spinkney)\
**Replies:** 9\
**Last updated:** [March 22, 2022, 6:51pm UTC](https://discourse.julialang.org/t/forwarddiff-and-zygote-return-wrong-jacobian-for-log-det-l/77961 "2022-03-22T18:51:43Z")

</div>

I’m no expert in matrix derivatives so I may have made a mistake. The derivative of the log determinant of a Cholesky factor is \\frac{\\partial \\log|L|}{\\partial L} = L^{-T} using a toy example in Julia using Zygote S…

---

## [Second order 2D differentiation DiffEqOperators.jl](https://discourse.julialang.org/t/second-order-2d-differentiation-diffeqoperators-jl/77239)

<div class="topic-metadata">

**Author:** [@Siempie](https://discourse.julialang.org/u/Siempie)\
**Replies:** 5\
**Last updated:** [March 17, 2022, 11:42pm UTC](https://discourse.julialang.org/t/second-order-2d-differentiation-diffeqoperators-jl/77239 "2022-03-17T23:42:18Z")

</div>

Hello i am trying to calculate the laplacian of a 2D array for the use in diffeq.jl And expand later to 3D hopefully. I am currently implementing it using DiffEqOperators.jl with centereddifference() and neuman0BC() H…

---

## [LoopVectorization multithreading for multidimensional arrays](https://discourse.julialang.org/t/loopvectorization-multithreading-for-multidimensional-arrays/77064)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 24\
**Last updated:** [March 17, 2022, 1:04pm UTC](https://discourse.julialang.org/t/loopvectorization-multithreading-for-multidimensional-arrays/77064 "2022-03-17T13:04:00Z")

</div>

What is the correct way to use @tturbo to parallelize iteration over multidimensional array? I can think of several variants: Parallelize the iteration over cartesian indices: @tturbo for I in eachindex(a) Paralleliz…

---

## [Numerical computation of continuous Fourier transforms](https://discourse.julialang.org/t/numerical-computation-of-continuous-fourier-transforms/77999)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 3\
**Last updated:** [March 17, 2022, 10:05am UTC](https://discourse.julialang.org/t/numerical-computation-of-continuous-fourier-transforms/77999 "2022-03-17T10:05:45Z")

</div>

Are there any packages available for computation of Fourier transforms of the form F(x\_k) = \\int\_{-\\infty}^\\infty f(t)\\mathrm{e}^{-\\mathrm{i}tx\_k}\\,\\mathrm{d}t? e.g. the method developed by DBailey and Swarztrauber (The …

---

## [Julia implementation of the Interpolate, Truncate, Project (ITP) root finding algorithm](https://discourse.julialang.org/t/julia-implementation-of-the-interpolate-truncate-project-itp-root-finding-algorithm/77739)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 7\
**Last updated:** [March 11, 2022, 7:23pm UTC](https://discourse.julialang.org/t/julia-implementation-of-the-interpolate-truncate-project-itp-root-finding-algorithm/77739 "2022-03-11T19:23:25Z")

</div>

I have been unable to find any real code implementation of ITP method - Wikipedia. However, it claims to be the bee’s knees - just read the first paragraph of the Wikipedia article: “In numerical analysis, the ITP metho…

---

## [How to promote a factorization?](https://discourse.julialang.org/t/how-to-promote-a-factorization/77715)

<div class="topic-metadata">

**Author:** [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Replies:** 5\
**Last updated:** [March 10, 2022, 10:12pm UTC](https://discourse.julialang.org/t/how-to-promote-a-factorization/77715 "2022-03-10T22:12:29Z")

</div>

I’m trying to promote an LU factorization in one precision to a higher precision. The permutation vector does not map correctly and I can’t figure out why. Any ideas? MWE: julia\> A=rand(Float32,3,3); julia\> AF=lu!(…

---

## [Lanczos tridiagonalization algorithm in Julia?](https://discourse.julialang.org/t/lanczos-tridiagonalization-algorithm-in-julia/77085)

<div class="topic-metadata">

**Author:** [@falbarelli](https://discourse.julialang.org/u/falbarelli)\
**Replies:** 19\
**Last updated:** [March 10, 2022, 7:15am UTC](https://discourse.julialang.org/t/lanczos-tridiagonalization-algorithm-in-julia/77085 "2022-03-10T07:15:29Z")

</div>

Hi everyone! I have been looking for an implementation of Lanczos algorithm in Julia, but to my surprise I haven’t found anything obvious! I need the actual tridiagonalization, i.e. the tridiagonal matrix T and the uni…

---

## [Eigenvectors of a symmetric tensor and a matrix](https://discourse.julialang.org/t/eigenvectors-of-a-symmetric-tensor-and-a-matrix/77604)

<div class="topic-metadata">

**Author:** [@FrootLoops](https://discourse.julialang.org/u/FrootLoops)\
**Replies:** 2\
**Last updated:** [March 8, 2022, 8:09pm UTC](https://discourse.julialang.org/t/eigenvectors-of-a-symmetric-tensor-and-a-matrix/77604 "2022-03-08T20:09:35Z")

</div>

Hi, I have a problem calculating the eigenvectors of a matrix/tensor. Maybe someone can explain why the outputs differ from each other. using LinearAlgebra, Tensors A = \[-24.978551803697826 -51.42238499537693 0.0; -51…

---

## [Solving KKT linear system (which solver for LDLᵀ factorization?)](https://discourse.julialang.org/t/solving-kkt-linear-system-which-solver-for-ldl-factorization/77544)

<div class="topic-metadata">

**Author:** [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Replies:** 3\
**Last updated:** [March 8, 2022, 8:47am UTC](https://discourse.julialang.org/t/solving-kkt-linear-system-which-solver-for-ldl-factorization/77544 "2022-03-08T08:47:48Z")

</div>

I would like to solve a system of linear equations given in a vector form as \\begin{bmatrix} Q & A^\\top \\\\ A & 0\\end{bmatrix}\\begin{bmatrix}x\\\\ \\lambda\\end{bmatrix} = \\begin{bmatrix} c \\\\ -b \\end{bmatrix} The matrix Q…

---

## [Start using Molly.jl: place\_atoms not defined in module Molly?](https://discourse.julialang.org/t/start-using-molly-jl-place-atoms-not-defined-in-module-molly/77521)

<div class="topic-metadata">

**Author:** [@ziolai](https://discourse.julialang.org/u/ziolai)\
**Replies:** 3\
**Last updated:** [March 7, 2022, 4:14pm UTC](https://discourse.julialang.org/t/start-using-molly-jl-place-atoms-not-defined-in-module-molly/77521 "2022-03-07T16:14:53Z")

</div>

I started looking into Molly.jl and attempting to run one its examples. I get the error described below. Insight would be nice to receive. Thx! julia\> using Molly julia\> n\_atoms = 100 100 julia\> atom\_mass = 10.0u"u" …

---

## [Concrete Operators in DiffEqOperators.jl for time-indepedent problems](https://discourse.julialang.org/t/concrete-operators-in-diffeqoperators-jl-for-time-indepedent-problems/77415)

<div class="topic-metadata">

**Author:** [@ziolai](https://discourse.julialang.org/u/ziolai)\
**Replies:** 9\
**Last updated:** [March 7, 2022, 3:31pm UTC](https://discourse.julialang.org/t/concrete-operators-in-diffeqoperators-jl-for-time-indepedent-problems/77415 "2022-03-07T15:31:59Z")

</div>

We are looking into the use of DiffEqOperators for time-independent problems. We are considering the Poisson equation on the unit interval and unit square. First a 1D implementation was made to figure out how to use it. …

---

## [Stencil operations and Symbolics.jl](https://discourse.julialang.org/t/stencil-operations-and-symbolics-jl/75685)

<div class="topic-metadata">

**Author:** [@vlc](https://discourse.julialang.org/u/vlc)\
**Replies:** 1\
**Last updated:** [March 7, 2022, 3:11pm UTC](https://discourse.julialang.org/t/stencil-operations-and-symbolics-jl/75685 "2022-03-07T15:11:36Z")

</div>

Hi there, I’m writing a little package that solves classical PDEs on Cartesian grids, and am seeking advice on how to leverage Symbolics.jl to speed up operations such as matrix-vector products. As a MWE, I’ll focus on…

---

## [How to extend SecondOrderODEProblem in DifferentialEquations.jl?](https://discourse.julialang.org/t/how-to-extend-secondorderodeproblem-in-differentialequations-jl/73831)

<div class="topic-metadata">

**Author:** [@ziolai](https://discourse.julialang.org/u/ziolai)\
**Replies:** 14\
**Last updated:** [March 1, 2022, 12:55pm UTC](https://discourse.julialang.org/t/how-to-extend-secondorderodeproblem-in-differentialequations-jl/73831 "2022-03-01T12:55:52Z")

</div>

Greetings. SecondOrderODEProblem in DifferentialEquations solves u\_{tt} = f(u\_t,u,p,t), see Dynamical, Hamiltonian and 2nd Order ODE Problems · DifferentialEquations.jl . Please suggest how to extend this to include (u…

---

## [Numeric integration](https://discourse.julialang.org/t/numeric-integration/77134)

<div class="topic-metadata">

**Author:** [@rsimic](https://discourse.julialang.org/u/rsimic)\
**Replies:** 1\
**Last updated:** [February 26, 2022, 7:54pm UTC](https://discourse.julialang.org/t/numeric-integration/77134 "2022-02-26T19:54:17Z")

</div>

begin using HCubature z(x, y) = exp(-x^2) a = (0, 0) b = (3, 3) hcubature(z, a, b) end code above returns error MethodError: no method matching z(::StaticArrays.SVector{2, Float64}) Closest candidates are: z(::…

---

## [Differentiate spherical harmonics FastTransforms.jl](https://discourse.julialang.org/t/differentiate-spherical-harmonics-fasttransforms-jl/77038)

<div class="topic-metadata">

**Author:** [@zhiwei](https://discourse.julialang.org/u/zhiwei)\
**Replies:** 0\
**Last updated:** [February 24, 2022, 8:07pm UTC](https://discourse.julialang.org/t/differentiate-spherical-harmonics-fasttransforms-jl/77038 "2022-02-24T20:07:29Z")

</div>

Hello, I am trying to differentiate spherical harmonic expansion by first converting to bivariate Fourier series using the package FastTransforms.jl. Here’s what I have so far: julia\> N=15; julia\> M=2\*N-1; julia\> C=…

---

## [Cholesky promotes Float16](https://discourse.julialang.org/t/cholesky-promotes-float16/76772)

<div class="topic-metadata">

**Author:** [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Replies:** 16\
**Last updated:** [February 21, 2022, 5:24am UTC](https://discourse.julialang.org/t/cholesky-promotes-float16/76772 "2022-02-21T05:24:53Z")

</div>

I’m seeing Cholesky promote half precision to single on its own. Is this supposed to happen? lu does not do this. Running 1.7.2 on an M1 Macbook. Same results on Intel Mac with MKL Blas. Bug or feature? julia\> R=rand…

---

## [A question on broadcasting fft for vectors of matrices](https://discourse.julialang.org/t/a-question-on-broadcasting-fft-for-vectors-of-matrices/76806)

<div class="topic-metadata">

**Author:** [@andreasvarga](https://discourse.julialang.org/u/andreasvarga)\
**Replies:** 9\
**Last updated:** [February 20, 2022, 7:36pm UTC](https://discourse.julialang.org/t/a-question-on-broadcasting-fft-for-vectors-of-matrices/76806 "2022-02-20T19:36:18Z")

</div>

In the following I am creating a 3-vector of 2x2 matrices M: M = \[ rand(2,2) for i in 1:3\] Is it any easy compact way to extract/view (e.g., for the purpose of broadcasting), say, the vector of \[1,1\] elements of the th…

---

## [Consistency checks missing when constructing linear algebra objects](https://discourse.julialang.org/t/consistency-checks-missing-when-constructing-linear-algebra-objects/76419)

<div class="topic-metadata">

**Author:** [@andreasvarga](https://discourse.julialang.org/u/andreasvarga)\
**Replies:** 3\
**Last updated:** [February 15, 2022, 7:22pm UTC](https://discourse.julialang.org/t/consistency-checks-missing-when-constructing-linear-algebra-objects/76419 "2022-02-15T19:22:14Z")

</div>

I have the following question which virtually applies to all defined linear algebra objects in Julia/LinearAlgebra: Why there are no consistency checks when constructing linear algebra objects? As an example, let’s con…

---

## [How to use ApproxFun to multiply differential operators without running into incompatible space issues?](https://discourse.julialang.org/t/how-to-use-approxfun-to-multiply-differential-operators-without-running-into-incompatible-space-issues/76481)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 2\
**Last updated:** [February 15, 2022, 12:54pm UTC](https://discourse.julialang.org/t/how-to-use-approxfun-to-multiply-differential-operators-without-running-into-incompatible-space-issues/76481 "2022-02-15T12:54:54Z")

</div>

I’m trying to compute (D + x)^2, where D is the derivative operator. julia\> x = Fun(identity) Fun(Chebyshev(),\[0.0, 1.0\]) julia\> D = Derivative(Chebyshev()) ConcreteDerivative : Chebyshev() → Ultraspherical(1) ⋅ 1.0 …

---

## [Trying to understand what FFT returns to me](https://discourse.julialang.org/t/trying-to-understand-what-fft-returns-to-me/76331)

<div class="topic-metadata">

**Author:** [@Abhijit\_Chowdhary](https://discourse.julialang.org/u/Abhijit_Chowdhary)\
**Replies:** 4\
**Last updated:** [February 13, 2022, 4:12pm UTC](https://discourse.julialang.org/t/trying-to-understand-what-fft-returns-to-me/76331 "2022-02-13T16:12:18Z")

</div>

Hello all, I’ve been working with the FFTW library over the past few days and am struggling to understand what exactly I have when I take the fft of some array. In particular, taking f to be some function defined over \[…

---

## [OutOfMemoryError() when calculating Fibonacci numbers of the order of 10^20 using the \`fibonaccinum\` function](https://discourse.julialang.org/t/outofmemoryerror-when-calculating-fibonacci-numbers-of-the-order-of-10-20-using-the-fibonaccinum-function/76268)

<div class="topic-metadata">

**Author:** [@jriveraa](https://discourse.julialang.org/u/jriveraa)\
**Replies:** 17\
**Last updated:** [February 13, 2022, 5:45pm UTC](https://discourse.julialang.org/t/outofmemoryerror-when-calculating-fibonacci-numbers-of-the-order-of-10-20-using-the-fibonaccinum-function/76268 "2022-02-13T17:45:22Z")

</div>

Using the fibonaccinum function of the Combinatorics library - installed in its latest version - on an HPC using a Linux distribution, I get an OutOfMemoryError(). The code is: using Combinatorics fibonaccinum(BigInt(1…

---

## [Can't differentiate foreigncall expression](https://discourse.julialang.org/t/cant-differentiate-foreigncall-expression/56336)

<div class="topic-metadata">

**Author:** [@tzr7mm](https://discourse.julialang.org/u/tzr7mm)\
**Replies:** 1\
**Last updated:** [February 13, 2022, 1:57am UTC](https://discourse.julialang.org/t/cant-differentiate-foreigncall-expression/56336 "2022-02-13T01:57:47Z")

</div>

Trying to use Flux’s automatic differentiation to solve a toy PINN problem below but keep getting the following error and its traceback. When using manually differentiated field term it works fine but not with auto-diff. …

---

## [How to work around this error in expint?](https://discourse.julialang.org/t/how-to-work-around-this-error-in-expint/76133)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 1\
**Last updated:** [February 11, 2022, 8:28pm UTC](https://discourse.julialang.org/t/how-to-work-around-this-error-in-expint/76133 "2022-02-11T20:28:16Z")

</div>

I ran into this error while evaluating the Gamma function from SpecialFunctions: julia\> using SpecialFunctions julia\> gamma(exp(19.39)+1, 0.0125\*0.6) ERROR: ArgumentError: Unsupported order |ν| \> 50 off the positive re…

---

## [Unconditionally stable numerical solution of advection equation](https://discourse.julialang.org/t/unconditionally-stable-numerical-solution-of-advection-equation/75935)

<div class="topic-metadata">

**Author:** [@fedoroff](https://discourse.julialang.org/u/fedoroff)\
**Replies:** 8\
**Last updated:** [February 9, 2022, 6:58am UTC](https://discourse.julialang.org/t/unconditionally-stable-numerical-solution-of-advection-equation/75935 "2022-02-09T06:58:58Z")

</div>

Hello, Can you please recommend me some method (preferably unconditionally stable) of solving an advection equation of the following type: \\displaystyle \\frac{\\partial u}{\\partial t} + a(x,t) \\frac{\\partial u}{\\partial…

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

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