# Numerics

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

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

**Page:** 27

---

## [ODEFunction throwing "ERROR: LoadError: mul\_float: types of a and b must match"](https://discourse.julialang.org/t/odefunction-throwing-error-loaderror-mul-float-types-of-a-and-b-must-match/61024)

<div class="topic-metadata">

**Author:** [@ap2013](https://discourse.julialang.org/u/ap2013)\
**Replies:** 5\
**Last updated:** [May 13, 2021, 12:04pm UTC](https://discourse.julialang.org/t/odefunction-throwing-error-loaderror-mul-float-types-of-a-and-b-must-match/61024 "2021-05-13T12:04:38Z")

</div>

What does the following error mean: “ERROR: LoadError: mul\_float: types of a and b must match”? I am running a code that repeatedly calls a function that creates an ODE problem and solves it. The function is called in a…

---

## [Multithreading with sparse arrays](https://discourse.julialang.org/t/multithreading-with-sparse-arrays/30844)

<div class="topic-metadata">

**Author:** [@thehalfspace](https://discourse.julialang.org/u/thehalfspace)\
**Replies:** 3\
**Last updated:** [May 6, 2021, 2:53am UTC](https://discourse.julialang.org/t/multithreading-with-sparse-arrays/30844 "2021-05-06T02:53:25Z")

</div>

I am solving a 2D earthquake rupture dynamics problem using a spectral element method. Over the last few months, I have translated a matlab code into Julia, made some changes in the serial part of the code (changing lin…

---

## [Sparse Jacobian with dense blocks in differentialEquations.jl or otherwise](https://discourse.julialang.org/t/sparse-jacobian-with-dense-blocks-in-differentialequations-jl-or-otherwise/60430)

<div class="topic-metadata">

**Author:** [@ziolai](https://discourse.julialang.org/u/ziolai)\
**Replies:** 2\
**Last updated:** [May 3, 2021, 8:26am UTC](https://discourse.julialang.org/t/sparse-jacobian-with-dense-blocks-in-differentialequations-jl-or-otherwise/60430 "2021-05-03T08:26:13Z")

</div>

Dear all, I am planning to use differentialEquations.jl to solve a stiff system of ordinary differential equations in which the Jacobian is sparse with dense blocks. Such systems are well known in this community as they…

---

## [Status of integration, optimization, and nl solvers](https://discourse.julialang.org/t/status-of-integration-optimization-and-nl-solvers/60025)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 22\
**Last updated:** [May 2, 2021, 3:27am UTC](https://discourse.julialang.org/t/status-of-integration-optimization-and-nl-solvers/60025 "2021-05-02T03:27:22Z")

</div>

I’m working on a project in which, given a vector of parameters θ, I have to solve a nonlinear system of equations that involve some integrals. After solving the system, I need to optimize with respect to θ to obtain opt…

---

## [Nonlinear PDE with neural network](https://discourse.julialang.org/t/nonlinear-pde-with-neural-network/60358)

<div class="topic-metadata">

**Author:** [@narayan](https://discourse.julialang.org/u/narayan)\
**Replies:** 1\
**Last updated:** [May 1, 2021, 11:10am UTC](https://discourse.julialang.org/t/nonlinear-pde-with-neural-network/60358 "2021-05-01T11:10:09Z")

</div>

can we solve nonlinear PDE with the package NeuralPDE.jl? If yes, then how?

---

## [How to pass constraints in NLsolve?](https://discourse.julialang.org/t/how-to-pass-constraints-in-nlsolve/60219)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 5\
**Last updated:** [April 30, 2021, 10:49am UTC](https://discourse.julialang.org/t/how-to-pass-constraints-in-nlsolve/60219 "2021-04-30T10:49:50Z")

</div>

I am solving 2-variable system of first order conditions for an optimization problem with NLsolve. I know that the optimal values of the optimization problem satisfy some conditions. For example, the optimal values shoul…

---

## [\`x==y\` is true but \`π^x == π^y\` is false](https://discourse.julialang.org/t/x-y-is-true-but-x-y-is-false/59976)

<div class="topic-metadata">

**Author:** [@HJW019](https://discourse.julialang.org/u/HJW019)\
**Replies:** 8\
**Last updated:** [April 25, 2021, 5:58pm UTC](https://discourse.julialang.org/t/x-y-is-true-but-x-y-is-false/59976 "2021-04-25T17:58:25Z")

</div>

A simple question for you CS experts: function foo() x::Float32 = 0.5 y::Float64 = 0.5 return x==y, π^x == π^y end julia\> foo() (true, false) Why x==y is true given the different numeric types? And if x==y …

---

## [Why the dimension of V1 = ℤ₂Space(0=\>3,1=\>2) is 5?](https://discourse.julialang.org/t/why-the-dimension-of-v1-space-0-3-1-2-is-5/59960)

<div class="topic-metadata">

**Author:** [@Nellatur](https://discourse.julialang.org/u/Nellatur)\
**Replies:** 0\
**Last updated:** [April 25, 2021, 12:29am UTC](https://discourse.julialang.org/t/why-the-dimension-of-v1-space-0-3-1-2-is-5/59960 "2021-04-25T00:29:48Z")

</div>

I am not sure if this question would belong to mathematics or more suitable for mathematics stackexchange. It comes from https://jutho.github.io/TensorKit.jl/stable/man/tutorial/#Symmetries julia\> V1 = ℤ₂Space(0=\>3,1=\>2…

---

## [Triangular Schur decomposition for a matrix with complex eigenvalues?](https://discourse.julialang.org/t/triangular-schur-decomposition-for-a-matrix-with-complex-eigenvalues/25680)

<div class="topic-metadata">

**Author:** [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Replies:** 5\
**Last updated:** [April 22, 2021, 6:57pm UTC](https://discourse.julialang.org/t/triangular-schur-decomposition-for-a-matrix-with-complex-eigenvalues/25680 "2021-04-22T18:57:16Z")

</div>

Is it possible to compute a (strictly) triangular Schur decomposition for a matrix with complex eigenvalues? With the code below I create such a matrix: T = rand(2,2) λ = rand() + rand()\*im D = \[real(λ) imag(λ); -imag(…

---

## [Using symmetry with TensorKit: ERROR: LoadError: MethodError: no method matching similarstructure\_from\_indices](https://discourse.julialang.org/t/using-symmetry-with-tensorkit-error-loaderror-methoderror-no-method-matching-similarstructure-from-indices/59572)

<div class="topic-metadata">

**Author:** [@Nellatur](https://discourse.julialang.org/u/Nellatur)\
**Replies:** 1\
**Last updated:** [April 22, 2021, 2:53am UTC](https://discourse.julialang.org/t/using-symmetry-with-tensorkit-error-loaderror-methoderror-no-method-matching-similarstructure-from-indices/59572 "2021-04-22T02:53:58Z")

</div>

I tried to utilize symmetry in tensor contraction A\[a,b\]\*B\[b,c,d\] = C\[a,c,d\] with B\[b,c,d\] = B\[b,d,c\]. Based on Tutorial · TensorKit.jl I tried the following code using TensorKit using BenchmarkTools #using Tensor…

---

## [The problem of calling “MKL pardiso” in Julia](https://discourse.julialang.org/t/the-problem-of-calling-mkl-pardiso-in-julia/25830)

<div class="topic-metadata">

**Author:** [@FujiwaraTakumiEH](https://discourse.julialang.org/u/FujiwaraTakumiEH)\
**Replies:** 6\
**Last updated:** [April 21, 2021, 4:19am UTC](https://discourse.julialang.org/t/the-problem-of-calling-mkl-pardiso-in-julia/25830 "2021-04-21T04:19:01Z")

</div>

Background： I have a large sparse matrix written by Julia that requires solutions, and I want to use MKL pardiso to improve speed. I’ve found the pardiso.jl page and read README. What I’ve done： Install Pardiso in Jul…

---

## [Getindex A\[i,j\] wrong complexity on SparseMatrixCSC?](https://discourse.julialang.org/t/getindex-a-i-j-wrong-complexity-on-sparsematrixcsc/59277)

<div class="topic-metadata">

**Author:** [@bonevbs](https://discourse.julialang.org/u/bonevbs)\
**Replies:** 18\
**Last updated:** [April 19, 2021, 11:30pm UTC](https://discourse.julialang.org/t/getindex-a-i-j-wrong-complexity-on-sparsematrixcsc/59277 "2021-04-19T23:30:12Z")

</div>

The complexity of extracting a sparse submatrix A\[i,j\] of size k x l from a large sparse matrix of size n with nnz entries should be O(k log k + l nz log k). Accessing my sparse matrices seemed very slow and I checked …

---

## [Using DefaultDict as a (high dimension) SparseArray?](https://discourse.julialang.org/t/using-defaultdict-as-a-high-dimension-sparsearray/59554)

<div class="topic-metadata">

**Author:** [@rpmuller](https://discourse.julialang.org/u/rpmuller)\
**Replies:** 0\
**Last updated:** [April 18, 2021, 4:56pm UTC](https://discourse.julialang.org/t/using-defaultdict-as-a-high-dimension-sparsearray/59554 "2021-04-18T16:56:20Z")

</div>

I’m currently using dictionaries with multiple indices to store data from high dimension (12, in my case) sparse arrays. As far as I know, the structures in SparseArrays only handle arrays of dimension 1 and 2. Is ther…

---

## [How to bring differential equations to wanted value with DiffEqFlux?](https://discourse.julialang.org/t/how-to-bring-differential-equations-to-wanted-value-with-diffeqflux/54167)

<div class="topic-metadata">

**Author:** [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Replies:** 24\
**Last updated:** [April 17, 2021, 11:13am UTC](https://discourse.julialang.org/t/how-to-bring-differential-equations-to-wanted-value-with-diffeqflux/54167 "2021-04-17T11:13:38Z")

</div>

Hello, I have a population system (bacteria/phages) that I have described with these ODEs that include the logistic factor: function sir!(du, u, p, t) # SIRl with logistic term μ, κ, φ, ω, η, β = p #= du\[1\]…

---

## [Second Order DE producing incorrect results](https://discourse.julialang.org/t/second-order-de-producing-incorrect-results/59380)

<div class="topic-metadata">

**Author:** [@daviiinsky](https://discourse.julialang.org/u/daviiinsky)\
**Replies:** 3\
**Last updated:** [April 16, 2021, 10:38pm UTC](https://discourse.julialang.org/t/second-order-de-producing-incorrect-results/59380 "2021-04-16T22:38:10Z")

</div>

Hello! I was working on the following problem where I’m integrating a second order differential equation. Initially I tried putting it into the 2nd Order Solver in DifferentialEquations.jl, where it did produce a plot s…

---

## [Adding noise in frequency domain while solving an SPDE](https://discourse.julialang.org/t/adding-noise-in-frequency-domain-while-solving-an-spde/59240)

<div class="topic-metadata">

**Author:** [@tiago](https://discourse.julialang.org/u/tiago)\
**Replies:** 3\
**Last updated:** [April 14, 2021, 2:35pm UTC](https://discourse.julialang.org/t/adding-noise-in-frequency-domain-while-solving-an-spde/59240 "2021-04-14T14:35:45Z")

</div>

Hello, I’m implementing a numerical solver to a certain kind of a 2D stochastic PDE using Fourier Transforms. So, this solver is a Galerkin type method, which means that choosing the right basis functions I can apply F…

---

## [Difference between sum over indexed array or equivalent view on the array](https://discourse.julialang.org/t/difference-between-sum-over-indexed-array-or-equivalent-view-on-the-array/59197)

<div class="topic-metadata">

**Author:** [@oheil](https://discourse.julialang.org/u/oheil)\
**Replies:** 0\
**Last updated:** [April 13, 2021, 1:43pm UTC](https://discourse.julialang.org/t/difference-between-sum-over-indexed-array-or-equivalent-view-on-the-array/59197 "2021-04-13T13:43:25Z")

</div>

The difference is small, but I can’t figure out, why there is any difference and where this uncertainty comes from. The following code creates a Vector of random Float64 and puts randomly NaN into it. It calculates the …

---

## [What does \`fastabs(z::Complex)\` do?](https://discourse.julialang.org/t/what-does-fastabs-z-complex-do/59064)

<div class="topic-metadata">

**Author:** [@huangc](https://discourse.julialang.org/u/huangc)\
**Replies:** 3\
**Last updated:** [April 12, 2021, 2:14am UTC](https://discourse.julialang.org/t/what-does-fastabs-z-complex-do/59064 "2021-04-12T02:14:10Z")

</div>

There is a fastabs(z::Complex) defined in both SpecialFunctions.jl and Base.Math. From its name, I would guess it computes the same thing as abs(z::Complex) but faster. However julia\> z = 3 + 4im 3 + 4im julia\> abs(z)…

---

## [How to create JSON files for finite element meshes?](https://discourse.julialang.org/t/how-to-create-json-files-for-finite-element-meshes/58861)

<div class="topic-metadata">

**Author:** [@ziolai](https://discourse.julialang.org/u/ziolai)\
**Replies:** 0\
**Last updated:** [April 8, 2021, 5:41pm UTC](https://discourse.julialang.org/t/how-to-create-json-files-for-finite-element-meshes/58861 "2021-04-08T17:41:16Z")

</div>

Packages like femgl (GitHub - mikolalysenko/femgl: WebGL finite element viewer) and GridApp (GitHub - gridap/Gridap.jl: Grid-based approximation of partial differential equations in Julia) employ finite element mesh file…

---

## [Finite Element Assembly using map over elements](https://discourse.julialang.org/t/finite-element-assembly-using-map-over-elements/58576)

<div class="topic-metadata">

**Author:** [@ziolai](https://discourse.julialang.org/u/ziolai)\
**Replies:** 6\
**Last updated:** [April 5, 2021, 9:24am UTC](https://discourse.julialang.org/t/finite-element-assembly-using-map-over-elements/58576 "2021-04-05T09:24:19Z")

</div>

Hi, I am wondering whether the loop over the elements in a finite element assembly can be replace by a flavor of map over the list of elements. I am happy to consider the linear elements on a one-dimensional mesh to st…

---

## [Integration fails: “Warning: Automatic dt set the starting dt as NaN, causing instability”](https://discourse.julialang.org/t/integration-fails-warning-automatic-dt-set-the-starting-dt-as-nan-causing-instability/56030)

<div class="topic-metadata">

**Author:** [@Michael\_Barmann](https://discourse.julialang.org/u/Michael_Barmann)\
**Replies:** 10\
**Last updated:** [March 27, 2021, 5:38pm UTC](https://discourse.julialang.org/t/integration-fails-warning-automatic-dt-set-the-starting-dt-as-nan-causing-instability/56030 "2021-03-27T17:38:18Z")

</div>

I’ve written some code to perform parameter estimation on a system of ODEs, and I keep getting the following error: ┌ Warning: First function call produced NaNs. Exiting. └ @ OrdinaryDiffEq C:\\Users\\Michael\\.julia\\packa…

---

## [Integration over regions with varying boundaries, triangular domains and more](https://discourse.julialang.org/t/integration-over-regions-with-varying-boundaries-triangular-domains-and-more/57157)

<div class="topic-metadata">

**Author:** [@Aleksandr\_Mikheev](https://discourse.julialang.org/u/Aleksandr_Mikheev)\
**Replies:** 10\
**Last updated:** [March 24, 2021, 5:08am UTC](https://discourse.julialang.org/t/integration-over-regions-with-varying-boundaries-triangular-domains-and-more/57157 "2021-03-24T05:08:06Z")

</div>

This topic may be considered, in some sense, as a follow-up of my previous thread. Thanks to stevengj and ChrisRackauckas I believe I more or less solved the “symbolic part” of my problem and could start working on the a…

---

## [Error when assigning a difference to a vector](https://discourse.julialang.org/t/error-when-assigning-a-difference-to-a-vector/57748)

<div class="topic-metadata">

**Author:** [@umair\_durrani](https://discourse.julialang.org/u/umair_durrani)\
**Replies:** 5\
**Last updated:** [March 24, 2021, 1:57am UTC](https://discourse.julialang.org/t/error-when-assigning-a-difference-to-a-vector/57748 "2021-03-24T01:57:45Z")

</div>

I have posted this question on stackoverflow as well. I am using the following code to apply a function to my data. The function definition is also provided below. However, I am getting a type error. Could you please he…

---

## [Differentialequations.jl: SDE ensemble solve fails for vector SDEs?](https://discourse.julialang.org/t/differentialequations-jl-sde-ensemble-solve-fails-for-vector-sdes/57631)

<div class="topic-metadata">

**Author:** [@colm-connaughton](https://discourse.julialang.org/u/colm-connaughton)\
**Replies:** 2\
**Last updated:** [March 23, 2021, 2:52pm UTC](https://discourse.julialang.org/t/differentialequations-jl-sde-ensemble-solve-fails-for-vector-sdes/57631 "2021-03-23T14:52:35Z")

</div>

I’ve been using the examples in the documentation to play around with the SDE solvers in DifferentialEquations.jl and have run into trouble trying to run ensemble simulations with vector-valued SDEs (the scalar case work…

---

## [Getting CartesianIndices to propagate](https://discourse.julialang.org/t/getting-cartesianindices-to-propagate/57315)

<div class="topic-metadata">

**Author:** [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Replies:** 8\
**Last updated:** [March 20, 2021, 11:43am UTC](https://discourse.julialang.org/t/getting-cartesianindices-to-propagate/57315 "2021-03-20T11:43:33Z")

</div>

Julia (here 1.6RC1 on Windows 10) has a number of mechanism to calculate with positions inside an array such as ranges like (1:10) or generators or via CartesianIndices(x). Yet they all seem to not automatically propagat…

---

## [Fast Hessian size increase](https://discourse.julialang.org/t/fast-hessian-size-increase/57560)

<div class="topic-metadata">

**Author:** [@Sunny](https://discourse.julialang.org/u/Sunny)\
**Replies:** 6\
**Last updated:** [March 19, 2021, 6:58pm UTC](https://discourse.julialang.org/t/fast-hessian-size-increase/57560 "2021-03-19T18:58:15Z")

</div>

I’d like to compute the Hessian for array values and to get some array with dimension (2,2) but instead I got this julia\> hessian(x -\> sum(x.^3), \[1 2; 3 4\]) # uses linear indexing of x 4×4 Array{$Int,2}: 6 0 0 …

---

## [Why is SUM always used in differentiation?](https://discourse.julialang.org/t/why-is-sum-always-used-in-differentiation/57559)

<div class="topic-metadata">

**Author:** [@Sunny](https://discourse.julialang.org/u/Sunny)\
**Replies:** 3\
**Last updated:** [March 19, 2021, 6:54pm UTC](https://discourse.julialang.org/t/why-is-sum-always-used-in-differentiation/57559 "2021-03-19T18:54:55Z")

</div>

I’ve seen a lot of examples where the output of a NN or any function during the differentiation is preprocessed with sum operator. For example this: julia\> hessian(x -\> sum(x.^3), \[1 2; 3 4\]) # uses linear indexing of …

---

## [Multidimensional integration and differentiation](https://discourse.julialang.org/t/multidimensional-integration-and-differentiation/56163)

<div class="topic-metadata">

**Author:** [@simonf](https://discourse.julialang.org/u/simonf)\
**Replies:** 3\
**Last updated:** [March 10, 2021, 10:42pm UTC](https://discourse.julialang.org/t/multidimensional-integration-and-differentiation/56163 "2021-03-10T22:42:11Z")

</div>

Hi, I have a series of parameterized functions containing double integrals and function limits and want to find stationary points of those functions. I have a solution using SymPy.jl, but this is only working well for k…

---

## [Householder routines reflector! and reflectorApply! in LinearAlgebra](https://discourse.julialang.org/t/householder-routines-reflector-and-reflectorapply-in-linearalgebra/56766)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 4\
**Last updated:** [March 10, 2021, 3:15am UTC](https://discourse.julialang.org/t/householder-routines-reflector-and-reflectorapply-in-linearalgebra/56766 "2021-03-10T03:15:33Z")

</div>

Hello, I would like to use the routines reflector! and reflectorApply! of LinearAlgebra (julia/generic.jl at master · JuliaLang/julia · GitHub) to efficiently apply an Householder reflection to a vector a. The setup is…

---

## [The need of (i)fftshift's to compute a PDE using Fourier Transform](https://discourse.julialang.org/t/the-need-of-i-fftshifts-to-compute-a-pde-using-fourier-transform/56587)

<div class="topic-metadata">

**Author:** [@tiago](https://discourse.julialang.org/u/tiago)\
**Replies:** 12\
**Last updated:** [March 8, 2021, 8:54pm UTC](https://discourse.julialang.org/t/the-need-of-i-fftshifts-to-compute-a-pde-using-fourier-transform/56587 "2021-03-08T20:54:50Z")

</div>

Hello, I’m currently writing an algorithm to solve a specific kind of PDE, via Fourier Transform. In the several examples that I saw, the general idea is to transform everything to the frequency domain using an fft, do…

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

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