# Numerics

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

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

**Page:** 33

---

## [Problem with DifferentialEquations & StaticArrays](https://discourse.julialang.org/t/problem-with-differentialequations-staticarrays/39129)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 4\
**Last updated:** [May 8, 2020, 8:18pm UTC](https://discourse.julialang.org/t/problem-with-differentialequations-staticarrays/39129 "2020-05-08T20:18:24Z")

</div>

Hello, I would like to solve the Lorenz-96 problem with static arrays. The state size is 40. I have followed the tutorial Optimizing DiffEq Code but I have the following error message: using StaticArrays using Differe…

---

## [Boolean matrix factorization in julia?](https://discourse.julialang.org/t/boolean-matrix-factorization-in-julia/38668)

<div class="topic-metadata">

**Author:** [@Ken-B](https://discourse.julialang.org/u/Ken-B)\
**Replies:** 2\
**Last updated:** [May 3, 2020, 9:29pm UTC](https://discourse.julialang.org/t/boolean-matrix-factorization-in-julia/38668 "2020-05-03T21:29:10Z")

</div>

Anyone know of a package that can do Boolean Matrix Factorization (BMF) in julia? Basically for a boolean matrix A {m x n} and a rank k, find boolean matrix X {m x k} and boolean matrix Y {k x n} such that A = X \* Y (ap…

---

## [Number of integration steps used in DifferentialEquations.jl with save\_everystep=false](https://discourse.julialang.org/t/number-of-integration-steps-used-in-differentialequations-jl-with-save-everystep-false/38575)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 1\
**Last updated:** [May 1, 2020, 10:27pm UTC](https://discourse.julialang.org/t/number-of-integration-steps-used-in-differentialequations-jl-with-save-everystep-false/38575 "2020-05-01T22:27:13Z")

</div>

Do solvers in DifferentialEquations.jl count the number of integration steps they used? length(sol) is close because it returns the number of recorded solutions, but if I use save\_everystep=false for speedup, length(sol…

---

## [Controlling save behavior and performance of DiffEqBiological](https://discourse.julialang.org/t/controlling-save-behavior-and-performance-of-diffeqbiological/38387)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 6\
**Last updated:** [April 29, 2020, 2:53pm UTC](https://discourse.julialang.org/t/controlling-save-behavior-and-performance-of-diffeqbiological/38387 "2020-04-29T14:53:57Z")

</div>

I’m interested in the bistable Schlogl model, which, under resevoir assumptions on species A and B, can be represented inside of DiffEqBiological as schlogl = @reaction\_network begin c1 \* a/ V, 2\*S --\> 3\*S c2 / …

---

## [Custom width intergers in Clang/LLVM](https://discourse.julialang.org/t/custom-width-intergers-in-clang-llvm/38141)

<div class="topic-metadata">

**Author:** [@johnh](https://discourse.julialang.org/u/johnh)\
**Replies:** 2\
**Last updated:** [April 28, 2020, 9:33pm UTC](https://discourse.julialang.org/t/custom-width-intergers-in-clang-llvm/38141 "2020-04-28T21:33:26Z")

</div>

Specialised types for different problems? Now there is a thought!

---

## [Block sparse matrix multiplication with repeated blocks](https://discourse.julialang.org/t/block-sparse-matrix-multiplication-with-repeated-blocks/38107)

<div class="topic-metadata">

**Author:** [@jlchan](https://discourse.julialang.org/u/jlchan)\
**Replies:** 4\
**Last updated:** [April 26, 2020, 6:51pm UTC](https://discourse.julialang.org/t/block-sparse-matrix-multiplication-with-repeated-blocks/38107 "2020-04-26T18:51:09Z")

</div>

I’m trying to find a good way to compute V^TAV where A is a sparse CSC matrix A and V = I \\otimes B is a block diagonal matrix with repeating dense blocks (size of B is around \\mathbb{R}^{20 \\times 10}). Looping through…

---

## [Underdetermined Linear System General Solution](https://discourse.julialang.org/t/underdetermined-linear-system-general-solution/37865)

<div class="topic-metadata">

**Author:** [@Alex\_Ellison](https://discourse.julialang.org/u/Alex_Ellison)\
**Replies:** 7\
**Last updated:** [April 21, 2020, 12:24am UTC](https://discourse.julialang.org/t/underdetermined-linear-system-general-solution/37865 "2020-04-21T00:24:54Z")

</div>

Hey all, this may be more of a question about linear algebra than it is about Julia. Given an underdetermined linear system A x = b, where A has dimensions (m, n) we expect there to be a vector space of dimension (m - n)…

---

## [Minkowski sum in julia](https://discourse.julialang.org/t/minkowski-sum-in-julia/7004)

<div class="topic-metadata">

**Author:** [@Sharabh\_Shukla](https://discourse.julialang.org/u/Sharabh_Shukla)\
**Replies:** 1\
**Last updated:** [April 17, 2020, 12:52pm UTC](https://discourse.julialang.org/t/minkowski-sum-in-julia/7004 "2020-04-17T12:52:12Z")

</div>

I have new hundred polytopes in H representation. I would like to find the Minkowski sum of all these polytopes, I am aware that the problem is difficult I was looking for an approximate algorithm in julia that can do t…

---

## [Any suggestions for starting doing this kind of neighbour list?](https://discourse.julialang.org/t/any-suggestions-for-starting-doing-this-kind-of-neighbour-list/37436)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 12\
**Last updated:** [April 16, 2020, 9:59pm UTC](https://discourse.julialang.org/t/any-suggestions-for-starting-doing-this-kind-of-neighbour-list/37436 "2020-04-16T21:59:37Z")

</div>

Hello! I am trying to make a neighbour list like this, where one has N number of particles. Overlayed on top of these particles is a square grid with equal sizes. The goal is then output a structure/array/something else…

---

## [Eigensolver for Complex Companion Matrix](https://discourse.julialang.org/t/eigensolver-for-complex-companion-matrix/37587)

<div class="topic-metadata">

**Author:** [@Arrigo\_Benedetti](https://discourse.julialang.org/u/Arrigo_Benedetti)\
**Replies:** 10\
**Last updated:** [April 14, 2020, 9:22pm UTC](https://discourse.julialang.org/t/eigensolver-for-complex-companion-matrix/37587 "2020-04-14T21:22:01Z")

</div>

I’m wondering if there is any Julia eigensolver specialized for complex companion matrices of moderate size, say up to 30x30. Thanks, -Arrigo

---

## [Specific help regarding allocations and performance](https://discourse.julialang.org/t/specific-help-regarding-allocations-and-performance/37572)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 15\
**Last updated:** [April 14, 2020, 8:42pm UTC](https://discourse.julialang.org/t/specific-help-regarding-allocations-and-performance/37572 "2020-04-14T20:42:20Z")

</div>

Hello! I am working on a tool in Julia which allows one to redistribute an initial set of particles inside a profile based on SPH (smoothed particle hydrodynamics), to get a more uniform distribution. The algorithm is b…

---

## [Sparse Cholesky of Gram Matrix (SuiteSparse?)](https://discourse.julialang.org/t/sparse-cholesky-of-gram-matrix-suitesparse/37303)

<div class="topic-metadata">

**Author:** [@guille](https://discourse.julialang.org/u/guille)\
**Replies:** 25\
**Last updated:** [April 11, 2020, 3:07pm UTC](https://discourse.julialang.org/t/sparse-cholesky-of-gram-matrix-suitesparse/37303 "2020-04-11T15:07:47Z")

</div>

Hey all! I have a quick question, which I saw was referenced here some time ago. I was wondering if there was a standard way of factorizing A^TA (i.e. the Gram matrix of A) without actively computing the Gram matrix? Th…

---

## [Calculating the analytical solution of an Ornstein-Uhlenbeck SDE](https://discourse.julialang.org/t/calculating-the-analytical-solution-of-an-ornstein-uhlenbeck-sde/37359)

<div class="topic-metadata">

**Author:** [@williamjsdavis](https://discourse.julialang.org/u/williamjsdavis)\
**Replies:** 2\
**Last updated:** [April 10, 2020, 6:04pm UTC](https://discourse.julialang.org/t/calculating-the-analytical-solution-of-an-ornstein-uhlenbeck-sde/37359 "2020-04-10T18:04:25Z")

</div>

I want to compare different SDE solvers against the analytical solution for the Ornstein-Uhlenbeck process. Currently I am doing this by solving numerically first (e.g. Euler-Maruyama), saving the noise, and calculating …

---

## [Strange behavior of integrator interface DiffEq.jl](https://discourse.julialang.org/t/strange-behavior-of-integrator-interface-diffeq-jl/37146)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 3\
**Last updated:** [April 7, 2020, 5:02pm UTC](https://discourse.julialang.org/t/strange-behavior-of-integrator-interface-diffeq-jl/37146 "2020-04-07T17:02:27Z")

</div>

Hello, I would like to use the integrator interface of DifferentialEquations.jl for an ensemble, i.e. loop over the different ensemble members and advance forward in time by one time step each of them. However, if I in…

---

## [Solve a system of linear equations many times without allocating memory](https://discourse.julialang.org/t/solve-a-system-of-linear-equations-many-times-without-allocating-memory/36228)

<div class="topic-metadata">

**Author:** [@MartinOtter](https://discourse.julialang.org/u/MartinOtter)\
**Replies:** 18\
**Last updated:** [April 7, 2020, 11:28am UTC](https://discourse.julialang.org/t/solve-a-system-of-linear-equations-many-times-without-allocating-memory/36228 "2020-04-07T11:28:34Z")

</div>

I have the problem that during simulation a linear equation system A\*x=b is solved many times. The desired solution is to allocate memory for all arrays involved in the operation once before simulation starts and during …

---

## [floor(BigFloat(27)^(1/3)) = 2.0; Bug in BigFloat?](https://discourse.julialang.org/t/floor-bigfloat-27-1-3-2-0-bug-in-bigfloat/37123)

<div class="topic-metadata">

**Author:** [@Syam](https://discourse.julialang.org/u/Syam)\
**Replies:** 4\
**Last updated:** [April 6, 2020, 8:42pm UTC](https://discourse.julialang.org/t/floor-bigfloat-27-1-3-2-0-bug-in-bigfloat/37123 "2020-04-06T20:42:49Z")

</div>

I encountered a bug in my code while using floor. With further debugging, I realized that the issue is with BigFloat. See below. julia\> floor(BigFloat(27)^(1/3)) 2.0 julia\> floor(Float64(27)^(1/3)) 3.0 julia\> ceil(Big…

---

## [Question about computing the partial derivatives of a multivariate polynomial](https://discourse.julialang.org/t/question-about-computing-the-partial-derivatives-of-a-multivariate-polynomial/36835)

<div class="topic-metadata">

**Author:** [@Yusen\_Liu](https://discourse.julialang.org/u/Yusen_Liu)\
**Replies:** 5\
**Last updated:** [April 6, 2020, 8:03am UTC](https://discourse.julialang.org/t/question-about-computing-the-partial-derivatives-of-a-multivariate-polynomial/36835 "2020-04-06T08:03:03Z")

</div>

Hi all, I got stuck on computing the partial derivatives of a multivariate polynomial. The following is my code: using TypedPolynomials using LinearAlgebra @polyvar p1 p2 p3 p4 p5 p6 p11 p12 p13 p21 p22 p23 p31 p32 p3…

---

## [Question about computing the determinant of matrix of indeterminate variables](https://discourse.julialang.org/t/question-about-computing-the-determinant-of-matrix-of-indeterminate-variables/36818)

<div class="topic-metadata">

**Author:** [@Yusen\_Liu](https://discourse.julialang.org/u/Yusen_Liu)\
**Replies:** 4\
**Last updated:** [April 6, 2020, 7:01am UTC](https://discourse.julialang.org/t/question-about-computing-the-determinant-of-matrix-of-indeterminate-variables/36818 "2020-04-06T07:01:45Z")

</div>

Hi all, I’ve been struggling with computing the determinant of the matrix of indeterminate variables. My code is as follows: using TypedPolynomials using LinearAlgebra @polyvar p1 p2 p3 p4 p5 p6 A = \[p1 p2 p3\] AT=t…

---

## [Numerical differentiation for functions of complex numbers](https://discourse.julialang.org/t/numerical-differentiation-for-functions-of-complex-numbers/341)

<div class="topic-metadata">

**Author:** [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Replies:** 15\
**Last updated:** [April 2, 2020, 4:09am UTC](https://discourse.julialang.org/t/numerical-differentiation-for-functions-of-complex-numbers/341 "2020-04-02T04:09:55Z")

</div>

Does anyone know of an available package which supports differentiating complex numbers? This has come up when trying to make stiff solvers for ODEs compatible with complex numbers since numerical Jacobians usually need …

---

## [Two-point boundary value problem in Julia DiffEq: "control hamiltonian"](https://discourse.julialang.org/t/two-point-boundary-value-problem-in-julia-diffeq-control-hamiltonian/36477)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 10\
**Last updated:** [March 25, 2020, 4:53pm UTC](https://discourse.julialang.org/t/two-point-boundary-value-problem-in-julia-diffeq-control-hamiltonian/36477 "2020-03-25T16:53:30Z")

</div>

I’m interested in solving Hamilton’s equations of motion in DiffEq with two boundary conditions, an initial condition on the state variables and a terminal condition on the momentum variables. First I tried setting up a …

---

## [Find simplex that contains point in triangulation](https://discourse.julialang.org/t/find-simplex-that-contains-point-in-triangulation/36181)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 3\
**Last updated:** [March 19, 2020, 4:43pm UTC](https://discourse.julialang.org/t/find-simplex-that-contains-point-in-triangulation/36181 "2020-03-19T16:43:58Z")

</div>

Suppose I have a triangulation on a domain in \\mathbb{R}^n, where the element simplexes are given by their vertices. What is the recommended approach for finding which simplex contains a given point? Naively, I would ju…

---

## [Mesh/grid over convex polytope](https://discourse.julialang.org/t/mesh-grid-over-convex-polytope/36047)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 19\
**Last updated:** [March 19, 2020, 10:47am UTC](https://discourse.julialang.org/t/mesh-grid-over-convex-polytope/36047 "2020-03-19T10:47:31Z")

</div>

I have x\_1, \\dots, x\_m points in \\mathbb{R}^n defining a polytope as their convex hull, m \> n. Typically n = 2 or 3 and m = 4 or 5. I would like to make a more or less equispaced (adjusted when necessary) grid \\{ z\_j…

---

## [What is the best way to factorize/decompose a covariance matrix?](https://discourse.julialang.org/t/what-is-the-best-way-to-factorize-decompose-a-covariance-matrix/35316)

<div class="topic-metadata">

**Author:** [@zxjroger](https://discourse.julialang.org/u/zxjroger)\
**Replies:** 21\
**Last updated:** [March 9, 2020, 2:08am UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-factorize-decompose-a-covariance-matrix/35316 "2020-03-09T02:08:58Z")

</div>

I need to draw from a certain multivariate normal distribution. To do so, I draw from standard normal distribution, then transform them to draws from multivariate normal distribution. Because the covariance matrix is onl…

---

## [Generalized eigenvalues with Diagonal B](https://discourse.julialang.org/t/generalized-eigenvalues-with-diagonal-b/35372)

<div class="topic-metadata">

**Author:** [@tobydriscoll](https://discourse.julialang.org/u/tobydriscoll)\
**Replies:** 4\
**Last updated:** [March 6, 2020, 5:45pm UTC](https://discourse.julialang.org/t/generalized-eigenvalues-with-diagonal-b/35372 "2020-03-06T17:45:13Z")

</div>

Looking to solve a generalized eigenproblem. All is well here: julia\> A = rand(4,4); julia\> B = rand(4,4); julia\> eigen(A,B) GeneralizedEigen{Complex{Float64},Complex{Float64},Array{Complex{Float64},2},Array{Complex{Flo…

---

## [Numerical Stability](https://discourse.julialang.org/t/numerical-stability/35617)

<div class="topic-metadata">

**Author:** [@hytonwons](https://discourse.julialang.org/u/hytonwons)\
**Replies:** 1\
**Last updated:** [March 6, 2020, 2:23am UTC](https://discourse.julialang.org/t/numerical-stability/35617 "2020-03-06T02:23:53Z")

</div>

Hi, recently I’ve been testing the numerical stability of my algorithms. Let me just use QR decomposition as an example. I tried to test the orthogonality (relative backward error) of the computed Q following this formu…

---

## [Difficulties to convert Matlab (ODE45) -\> Julia](https://discourse.julialang.org/t/difficulties-to-convert-matlab-ode45-julia/34828)

<div class="topic-metadata">

**Author:** [@Noel\_Araujo](https://discourse.julialang.org/u/Noel_Araujo)\
**Replies:** 7\
**Last updated:** [March 3, 2020, 5:27pm UTC](https://discourse.julialang.org/t/difficulties-to-convert-matlab-ode45-julia/34828 "2020-03-03T17:27:22Z")

</div>

I’m sorry to interrupt your morning/afternoon/evenning, but I need some help to convert a code written in Matlab into Julia. However, I cannot figure out where/why/how is going wrong :sob: I have a code to my research w…

---

## [Understand apply! of JuAFEM](https://discourse.julialang.org/t/understand-apply-of-juafem/35325)

<div class="topic-metadata">

**Author:** [@koehlerson](https://discourse.julialang.org/u/koehlerson)\
**Replies:** 9\
**Last updated:** [February 29, 2020, 5:44pm UTC](https://discourse.julialang.org/t/understand-apply-of-juafem/35325 "2020-02-29T17:44:05Z")

</div>

Hey there, I’m new to Julia and I wanted to transport my existing FEM Code written with FEniCS in C++ to JuAFEM code. First of all thanks to the developers of the package! My problem is a SUPG stabilized advection diff…

---

## [Trying to run DiffEqTutorials in a notebook](https://discourse.julialang.org/t/trying-to-run-diffeqtutorials-in-a-notebook/35124)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 0\
**Last updated:** [February 25, 2020, 5:18pm UTC](https://discourse.julialang.org/t/trying-to-run-diffeqtutorials-in-a-notebook/35124 "2020-02-25T17:18:00Z")

</div>

Hi, I am trying to run the Differential Equation Tutorials from within the notebook. So I execute: (v1.3) pkg\> add GitHub - SciML/SciMLTutorials.jl: Tutorials for doing scientific machine learning (SciML) and high-per…

---

## [How can I get the CS decomposition of a matrix?](https://discourse.julialang.org/t/how-can-i-get-the-cs-decomposition-of-a-matrix/34499)

<div class="topic-metadata">

**Author:** [@Deniz](https://discourse.julialang.org/u/Deniz)\
**Replies:** 6\
**Last updated:** [February 12, 2020, 10:16am UTC](https://discourse.julialang.org/t/how-can-i-get-the-cs-decomposition-of-a-matrix/34499 "2020-02-12T10:16:16Z")

</div>

There seems to be no function in any well-known Julia library to obtain the CS decomposition of a matrix. There is a function CUNCSD in LAPACK, but it is not available in Julia by default. Maybe I can call that function…

---

## [About NaN, 0/0 and false](https://discourse.julialang.org/t/about-nan-0-0-and-false/34272)

<div class="topic-metadata">

**Author:** [@aerdely](https://discourse.julialang.org/u/aerdely)\
**Replies:** 21\
**Last updated:** [February 8, 2020, 8:12am UTC](https://discourse.julialang.org/t/about-nan-0-0-and-false/34272 "2020-02-08T08:12:57Z")

</div>

Why… NaN\*(0/0)\*false gives 0.0, (0/0)\*NaN\*false gives -0.0, and: false\*(0/0)\*NaN false\*NaN\*(0/0) NaN\*false\*(0/0) (0/0)\*false\*NaN all give NaN? :thinking: Because changing false by true we get always the same …

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

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