# Numerics

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

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

**Page:** 26

---

## [MKLSparse: how to control thread affinity and the number of threads?](https://discourse.julialang.org/t/mklsparse-how-to-control-thread-affinity-and-the-number-of-threads/65601)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 0\
**Last updated:** [July 31, 2021, 2:14pm UTC](https://discourse.julialang.org/t/mklsparse-how-to-control-thread-affinity-and-the-number-of-threads/65601 "2021-07-31T14:14:17Z")

</div>

As far as I understand, currently the go-to way if you need multithreaded Sparse Matrix operations is to interface with MKL using MKLSparse.jl. Now, imagine I have a machine with several NUMA nodes and want to run multi…

---

## [PDE heat equation](https://discourse.julialang.org/t/pde-heat-equation/64428)

<div class="topic-metadata">

**Author:** [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Replies:** 24\
**Last updated:** [July 20, 2021, 3:15pm UTC](https://discourse.julialang.org/t/pde-heat-equation/64428 "2021-07-20T15:15:00Z")

</div>

i want to solve the matrix ,but i can’t do it. i am new to Julia. please help me in finding error .i have to plot the last equation given in picture below. what is MethodError i am making?

---

## [Cond() error: LinearAlgebra and BigFloats incompatible?](https://discourse.julialang.org/t/cond-error-linearalgebra-and-bigfloats-incompatible/64924)

<div class="topic-metadata">

**Author:** [@damonturney](https://discourse.julialang.org/u/damonturney)\
**Replies:** 3\
**Last updated:** [July 19, 2021, 5:46pm UTC](https://discourse.julialang.org/t/cond-error-linearalgebra-and-bigfloats-incompatible/64924 "2021-07-19T17:46:57Z")

</div>

In the course of building my simulation of chemicals in an operating battery, I need to invert matrices that are ill-conditioned (condition number near 1E15). My strategy was to use a matrix of BigFloats because they ca…

---

## [DP5() algorithm failing to solve simple SIR problem?](https://discourse.julialang.org/t/dp5-algorithm-failing-to-solve-simple-sir-problem/64835)

<div class="topic-metadata">

**Author:** [@Michael\_Barmann](https://discourse.julialang.org/u/Michael_Barmann)\
**Replies:** 1\
**Last updated:** [July 17, 2021, 11:34pm UTC](https://discourse.julialang.org/t/dp5-algorithm-failing-to-solve-simple-sir-problem/64835 "2021-07-17T23:34:05Z")

</div>

While testing out different ODE solvers, I found that DP5() completely fails when given a simple SIR model (while other solvers handle it perfectly fine): function SIR!(du,u,pars,t) β, γ = pars S, I, R = u …

---

## [Allowed types for \`fft()\` and \`ifft()\` when using sparse arrays](https://discourse.julialang.org/t/allowed-types-for-fft-and-ifft-when-using-sparse-arrays/64481)

<div class="topic-metadata">

**Author:** [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Replies:** 0\
**Last updated:** [July 12, 2021, 1:56am UTC](https://discourse.julialang.org/t/allowed-types-for-fft-and-ifft-when-using-sparse-arrays/64481 "2021-07-12T01:56:03Z")

</div>

In the following code, I have commented out all the lines that produce a MethodError: using FFTW, SparseArrays fft(rand(Float64, 50, 50)) fft(rand(ComplexF64, 50, 50)) fft(rand(Float32, 50, 50)) fft(rand(ComplexF32, 50…

---

## [Scientific notation + sum() function](https://discourse.julialang.org/t/scientific-notation-sum-function/64368)

<div class="topic-metadata">

**Author:** [@Alex\_Tantos](https://discourse.julialang.org/u/Alex_Tantos)\
**Replies:** 3\
**Last updated:** [July 9, 2021, 6:08pm UTC](https://discourse.julialang.org/t/scientific-notation-sum-function/64368 "2021-07-09T18:08:58Z")

</div>

Hi there! As part of getting to know the language I am preparing the code for the softmax function and I just found out that the sum() function does not return the expected result when some of the numbers of a vector are…

---

## [Handling events in DifferentialEquations.jl that take place over a time interval](https://discourse.julialang.org/t/handling-events-in-differentialequations-jl-that-take-place-over-a-time-interval/64262)

<div class="topic-metadata">

**Author:** [@yuvalw](https://discourse.julialang.org/u/yuvalw)\
**Replies:** 1\
**Last updated:** [July 8, 2021, 10:06am UTC](https://discourse.julialang.org/t/handling-events-in-differentialequations-jl-that-take-place-over-a-time-interval/64262 "2021-07-08T10:06:16Z")

</div>

Hello, I am wondering what is the best way to implement events that happen during a time interval that affect an element of the derivative. Currently my code is of the form: intervals = \[1.0 2.0; 5.0 6.0; 9.0 10.0\] # e…

---

## [Do FFTW.jl and Quadmath.jl work together automatically?](https://discourse.julialang.org/t/do-fftw-jl-and-quadmath-jl-work-together-automatically/64237)

<div class="topic-metadata">

**Author:** [@johnomotani](https://discourse.julialang.org/u/johnomotani)\
**Replies:** 3\
**Last updated:** [July 8, 2021, 6:38am UTC](https://discourse.julialang.org/t/do-fftw-jl-and-quadmath-jl-work-together-automatically/64237 "2021-07-08T06:38:59Z")

</div>

If some Arrays (or whatever) are defined using the Float128 type from Quadmath.jl, will operations from FFTW.jl be done in quad precision? The FFTW library itself supports quad-precision (Precision (FFTW 3.3.10)), but I …

---

## [How to calculate sum of a matrix by row and store in pre-allocated diagnoal matrix](https://discourse.julialang.org/t/how-to-calculate-sum-of-a-matrix-by-row-and-store-in-pre-allocated-diagnoal-matrix/64160)

<div class="topic-metadata">

**Author:** [@Fred\_He](https://discourse.julialang.org/u/Fred_He)\
**Replies:** 6\
**Last updated:** [July 7, 2021, 7:50am UTC](https://discourse.julialang.org/t/how-to-calculate-sum-of-a-matrix-by-row-and-store-in-pre-allocated-diagnoal-matrix/64160 "2021-07-07T07:50:27Z")

</div>

basically what I want to do is calculate the sum of a matrix, say u, by column and store it in a pre-allocated diagonal matrix, say du, in a more efficient way than vi = sum(u, dims=2) for i = 1:length(vi) du\[i, i\] …

---

## [ODE solver fails with ForwardDiff, but works with central differences for first derivative of an input function](https://discourse.julialang.org/t/ode-solver-fails-with-forwarddiff-but-works-with-central-differences-for-first-derivative-of-an-input-function/63033)

<div class="topic-metadata">

**Author:** [@TS-CUBED](https://discourse.julialang.org/u/TS-CUBED)\
**Replies:** 10\
**Last updated:** [July 6, 2021, 9:17pm UTC](https://discourse.julialang.org/t/ode-solver-fails-with-forwarddiff-but-works-with-central-differences-for-first-derivative-of-an-input-function/63033 "2021-07-06T21:17:35Z")

</div>

I am modelling the human cardiovascular system and solve equations similar to the windkessel equation in the example: # The 5-element WK formulation, also 4-element parallel for Ls = 0.0 function wk5(dP,…

---

## [Solving two sparse linear systems one is the transpose of the other](https://discourse.julialang.org/t/solving-two-sparse-linear-systems-one-is-the-transpose-of-the-other/63984)

<div class="topic-metadata">

**Author:** [@Mohamed\_AbdElrahman](https://discourse.julialang.org/u/Mohamed_AbdElrahman)\
**Replies:** 2\
**Last updated:** [July 3, 2021, 7:02pm UTC](https://discourse.julialang.org/t/solving-two-sparse-linear-systems-one-is-the-transpose-of-the-other/63984 "2021-07-03T19:02:59Z")

</div>

I’m solving two sparse linear systems (A^T) \* x\_1 = b\_1 and A \* x\_2 = b\_2. where A^T is the transpose of A and b\_1, b\_2 are different. With a direct LU solver. How can I factorize once and use it to solve the two li…

---

## [Why do bigfloats allocate that much ? Could a native rewrite solve the problem?](https://discourse.julialang.org/t/why-do-bigfloats-allocate-that-much-could-a-native-rewrite-solve-the-problem/63809)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 4\
**Last updated:** [June 30, 2021, 1:40pm UTC](https://discourse.julialang.org/t/why-do-bigfloats-allocate-that-much-could-a-native-rewrite-solve-the-problem/63809 "2021-06-30T13:40:29Z")

</div>

Hi. Everything is in the title: I dont think I understood why BigFloats allocate that much, and why nothing could be done about it. Is there some source, article or doc that explains this ? As @JeffreySarnoff showed in…

---

## [Hypergeometric functions](https://discourse.julialang.org/t/hypergeometric-functions/63621)

<div class="topic-metadata">

**Author:** [@marcobonici](https://discourse.julialang.org/u/marcobonici)\
**Replies:** 6\
**Last updated:** [June 29, 2021, 9:48am UTC](https://discourse.julialang.org/t/hypergeometric-functions/63621 "2021-06-29T09:48:29Z")

</div>

Hello, I need to evaluate the Gauss Hypergeometric functions \_2F\_1(a,b;c;z). Here are some specifications for the arguments of this function a has compex values. The real part is \\sim2 (and is strictly positive), whi…

---

## [Solving A X = B equation with ITensor](https://discourse.julialang.org/t/solving-a-x-b-equation-with-itensor/60332)

<div class="topic-metadata">

**Author:** [@fastwave](https://discourse.julialang.org/u/fastwave)\
**Replies:** 1\
**Last updated:** [June 23, 2021, 12:30pm UTC](https://discourse.julialang.org/t/solving-a-x-b-equation-with-itensor/60332 "2021-06-23T12:30:44Z")

</div>

I am wondering of one can use ITensors to solve linear equations in the form of A X = B where all of the components are tensor networks or high order tensors in some compressed format? Or if not does anybody know a pac…

---

## [Problem with ODELocalSensitivityProblem](https://discourse.julialang.org/t/problem-with-odelocalsensitivityproblem/63320)

<div class="topic-metadata">

**Author:** [@ap2013](https://discourse.julialang.org/u/ap2013)\
**Replies:** 4\
**Last updated:** [June 22, 2021, 10:14am UTC](https://discourse.julialang.org/t/problem-with-odelocalsensitivityproblem/63320 "2021-06-22T10:14:55Z")

</div>

I am looking to use ODELocalSensitivityProblem to get the sensitivities of an ODE problem. I define two different problems from the same system (defined with ModellingToolkit) as follows probSens = ODELocalSensitivityP…

---

## [Factorize changes the float type from Float32 to Float64](https://discourse.julialang.org/t/factorize-changes-the-float-type-from-float32-to-float64/63308)

<div class="topic-metadata">

**Author:** [@Mohamed\_AbdElrahman](https://discourse.julialang.org/u/Mohamed_AbdElrahman)\
**Replies:** 3\
**Last updated:** [June 22, 2021, 10:10am UTC](https://discourse.julialang.org/t/factorize-changes-the-float-type-from-float32-to-float64/63308 "2021-06-22T10:10:13Z")

</div>

I’m solving a sparse linear system with Float32 precision for speed. The problem is the function factorize when taken input a ComplexF32 sparse matrix, the lu factors are ComplexF64. julia\> factorize(sprand(ComplexF3…

---

## [How to Interpolate and Extrapolate with unevenly spaced data?](https://discourse.julialang.org/t/how-to-interpolate-and-extrapolate-with-unevenly-spaced-data/62812)

<div class="topic-metadata">

**Author:** [@CosmoProf](https://discourse.julialang.org/u/CosmoProf)\
**Replies:** 6\
**Last updated:** [June 20, 2021, 3:33am UTC](https://discourse.julialang.org/t/how-to-interpolate-and-extrapolate-with-unevenly-spaced-data/62812 "2021-06-20T03:33:23Z")

</div>

Hi, I’ve been using BSplineKit to interpolate within my data that is unevenly sampled. But now I need to extrapolate somewhat past the edges of the data on either side, and that package sets the interpolation exactly to…

---

## [ODE solvers - why is Matlab ode45 uncannily stable?](https://discourse.julialang.org/t/ode-solvers-why-is-matlab-ode45-uncannily-stable/63052)

<div class="topic-metadata">

**Author:** [@TS-CUBED](https://discourse.julialang.org/u/TS-CUBED)\
**Replies:** 33\
**Last updated:** [June 19, 2021, 1:19pm UTC](https://discourse.julialang.org/t/ode-solvers-why-is-matlab-ode45-uncannily-stable/63052 "2021-06-19T13:19:02Z")

</div>

EDIT: Turns out I was being stupid and the reason for the discrepancies in this case was indeed a trivial tolerance setting. However, I learned a lot in this thread, so thank you to all the contributors and especially to…

---

## [ModellingToolkit ODESystem definition throwing error](https://discourse.julialang.org/t/modellingtoolkit-odesystem-definition-throwing-error/63002)

<div class="topic-metadata">

**Author:** [@ap2013](https://discourse.julialang.org/u/ap2013)\
**Replies:** 5\
**Last updated:** [June 17, 2021, 8:45am UTC](https://discourse.julialang.org/t/modellingtoolkit-odesystem-definition-throwing-error/63002 "2021-06-17T08:45:14Z")

</div>

I am defining and ODESystem using ModellingToolkit and I am running into a problem in the definition of the equations. The code below is the function to define the ODESystem function connectFFFB\_Grad(plant, ref, pid, m…

---

## [LinearAlgebra eigensolver convergence issues around nearby eigenvalues](https://discourse.julialang.org/t/linearalgebra-eigensolver-convergence-issues-around-nearby-eigenvalues/62775)

<div class="topic-metadata">

**Author:** [@vivian-rogers](https://discourse.julialang.org/u/vivian-rogers)\
**Replies:** 5\
**Last updated:** [June 14, 2021, 9:49am UTC](https://discourse.julialang.org/t/linearalgebra-eigensolver-convergence-issues-around-nearby-eigenvalues/62775 "2021-06-14T09:49:37Z")

</div>

(Plotted above is the eigenvalues of a matrix A(k), with k being momentum on the x axis). Hi, So I am trying to get the eigenvalues and eigenvectors of a hermitian matrix that continuously depends on a parameter k, w…

---

## [How to tackle 2D reaction-diffusion equation?](https://discourse.julialang.org/t/how-to-tackle-2d-reaction-diffusion-equation/54110)

<div class="topic-metadata">

**Author:** [@gedankenexperiment](https://discourse.julialang.org/u/gedankenexperiment)\
**Replies:** 19\
**Last updated:** [June 13, 2021, 8:16pm UTC](https://discourse.julialang.org/t/how-to-tackle-2d-reaction-diffusion-equation/54110 "2021-06-13T20:16:40Z")

</div>

Can anyone point me in the right direction of how to solve a 2D reaction-diffusion equation of the following kind: p-d\*c=-D \* (d^2/dx^2 + d^2/dy^2) \* c, where p is the production rate, d the degradation rate, c the con…

---

## [How to avoid instability in DifferentialEquations?](https://discourse.julialang.org/t/how-to-avoid-instability-in-differentialequations/62739)

<div class="topic-metadata">

**Author:** [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Replies:** 3\
**Last updated:** [June 12, 2021, 12:06pm UTC](https://discourse.julialang.org/t/how-to-avoid-instability-in-differentialequations/62739 "2021-06-12T12:06:01Z")

</div>

Hello, I am trying to model the interaction between bacteria and phages but using certain combinations of parameters (namely the time and amount of phage inoculum) I get instability and the integrator aborts the session…

---

## [Computing sparse orthogonal projections](https://discourse.julialang.org/t/computing-sparse-orthogonal-projections/62652)

<div class="topic-metadata">

**Author:** [@Thomas](https://discourse.julialang.org/u/Thomas)\
**Replies:** 6\
**Last updated:** [June 10, 2021, 4:01pm UTC](https://discourse.julialang.org/t/computing-sparse-orthogonal-projections/62652 "2021-06-10T16:01:44Z")

</div>

Follow up question: since this is part of my implementation of the projection matrix A\*inv(A'A)\*A' do you see a fast way to stay within SparseMatrixCSC? Working implementation but not sparse project(A::SparseMatrixCSC,…

---

## [Inverse of a boolean (or integer) matrix vs factorization](https://discourse.julialang.org/t/inverse-of-a-boolean-or-integer-matrix-vs-factorization/62554)

<div class="topic-metadata">

**Author:** [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Replies:** 7\
**Last updated:** [June 8, 2021, 7:28am UTC](https://discourse.julialang.org/t/inverse-of-a-boolean-or-integer-matrix-vs-factorization/62554 "2021-06-08T07:28:46Z")

</div>

My understanding is that factorization is almost always better than explicit inversion for a matrix of real (or complex) numbers (because usually you do not actually need the explicit inverse, rather some other operation…

---

## [DiffEqOperators symbolic tutorial throwing error](https://discourse.julialang.org/t/diffeqoperators-symbolic-tutorial-throwing-error/62468)

<div class="topic-metadata">

**Author:** [@gbrunkhorst](https://discourse.julialang.org/u/gbrunkhorst)\
**Replies:** 4\
**Last updated:** [June 6, 2021, 6:09pm UTC](https://discourse.julialang.org/t/diffeqoperators-symbolic-tutorial-throwing-error/62468 "2021-06-06T18:09:30Z")

</div>

Hi Everyone: the SciML ecosystem looks amazing. I’m just getting started with both Julia and these packages. The tutorial DiffEqOperators gives the following error: Lines # Method of lines discretization dx = 0.1 ord…

---

## [Numerical integration using hcubature\\](https://discourse.julialang.org/t/numerical-integration-using-hcubature/62221)

<div class="topic-metadata">

**Author:** [@danrib07](https://discourse.julialang.org/u/danrib07)\
**Replies:** 2\
**Last updated:** [June 1, 2021, 8:11pm UTC](https://discourse.julialang.org/t/numerical-integration-using-hcubature/62221 "2021-06-01T20:11:10Z")

</div>

Hello everyone, I’m transitioning from python to Julia and I’m trying to compute some integrals using hcubature I’m trying to compute the following integral, for which the constant \\beta is equal to 1 As seen from …

---

## [IterativeSolvers.jl and DistributedArrays.jl](https://discourse.julialang.org/t/iterativesolvers-jl-and-distributedarrays-jl/62175)

<div class="topic-metadata">

**Author:** [@vlc](https://discourse.julialang.org/u/vlc)\
**Replies:** 3\
**Last updated:** [June 1, 2021, 3:24pm UTC](https://discourse.julialang.org/t/iterativesolvers-jl-and-distributedarrays-jl/62175 "2021-06-01T15:24:41Z")

</div>

I would like to use the iterative solvers from IterativeSolvers.jl with DistributedArrays.jl, with no luck for now. Here is a MWE, where I try to invert a diagonal positive definite matrix using the CG algorithm : usin…

---

## [Sensitivities with respect to initial conditions in DifferentialEquations.jl](https://discourse.julialang.org/t/sensitivities-with-respect-to-initial-conditions-in-differentialequations-jl/25555)

<div class="topic-metadata">

**Author:** [@rjpower4](https://discourse.julialang.org/u/rjpower4)\
**Replies:** 17\
**Last updated:** [May 26, 2021, 10:36am UTC](https://discourse.julialang.org/t/sensitivities-with-respect-to-initial-conditions-in-differentialequations-jl/25555 "2021-05-26T10:36:11Z")

</div>

For my research, I perform many differential corrections processes. Often times, for these processes I want the transition matrix, \\Phi(t\_1, t\_0), which is obtained by propagating the linearization of the system alongsid…

---

## [Solving System of nonlinear Equations using ModelingToolkit.jl and NonlinearSolve.jl](https://discourse.julialang.org/t/solving-system-of-nonlinear-equations-using-modelingtoolkit-jl-and-nonlinearsolve-jl/59096)

<div class="topic-metadata">

**Author:** [@wst](https://discourse.julialang.org/u/wst)\
**Replies:** 7\
**Last updated:** [May 16, 2021, 10:14am UTC](https://discourse.julialang.org/t/solving-system-of-nonlinear-equations-using-modelingtoolkit-jl-and-nonlinearsolve-jl/59096 "2021-05-16T10:14:18Z")

</div>

Hey there, I’m fairly new to Julia and this forum (in fact my first post here). About my problem: I’m currently trying to solve a system of 3 nonlinear equations that emerged as the solution of the hanging chain probl…

---

## [Linsolve on SparseMatrixCSC{BigFloat}](https://discourse.julialang.org/t/linsolve-on-sparsematrixcsc-bigfloat/60742)

<div class="topic-metadata">

**Author:** [@MatFi](https://discourse.julialang.org/u/MatFi)\
**Replies:** 2\
**Last updated:** [May 14, 2021, 7:50am UTC](https://discourse.julialang.org/t/linsolve-on-sparsematrixcsc-bigfloat/60742 "2021-05-14T07:50:13Z")

</div>

I want to solve a quite large but sparse DAE system using DifferentialEquaitions.jl I can do it with decent efficiency when using Float64’s Now I would like to do the same thing with higher precision numbers (Double64,…

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

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