# Numerics

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

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

**Page:** 14

---

## [Float64 but with single precision](https://discourse.julialang.org/t/float64-but-with-single-precision/102899)

<div class="topic-metadata">

**Author:** [@Dario-Rosa85](https://discourse.julialang.org/u/Dario-Rosa85)\
**Replies:** 1\
**Last updated:** [August 17, 2023, 10:30am UTC](https://discourse.julialang.org/t/float64-but-with-single-precision/102899 "2023-08-17T10:30:44Z")

</div>

Sorry for the question which might look a bit stupid. I am preparing an example to show that certain numerical methods are unstable. To do this, I would need a method to use a Float64 number but, for the example, I would…

---

## [Computing value and first & second derivatives of a scalar function with scalar input, using ForwardDiff](https://discourse.julialang.org/t/computing-value-and-first-second-derivatives-of-a-scalar-function-with-scalar-input-using-forwarddiff/102866)

<div class="topic-metadata">

**Author:** [@user664303](https://discourse.julialang.org/u/user664303)\
**Replies:** 6\
**Last updated:** [August 16, 2023, 10:04pm UTC](https://discourse.julialang.org/t/computing-value-and-first-second-derivatives-of-a-scalar-function-with-scalar-input-using-forwarddiff/102866 "2023-08-16T22:04:33Z")

</div>

I cannot find, either in the documentation of ForwardDiff, or on the web more widely, any information on how to compute the second derivative of a scalar function with a scalar input. How can I do this? (Given a function…

---

## [Numerical simulation changes with different tspan](https://discourse.julialang.org/t/numerical-simulation-changes-with-different-tspan/102726)

<div class="topic-metadata">

**Author:** [@Yoni\_Maltsman](https://discourse.julialang.org/u/Yoni_Maltsman)\
**Replies:** 4\
**Last updated:** [August 14, 2023, 5:54pm UTC](https://discourse.julialang.org/t/numerical-simulation-changes-with-different-tspan/102726 "2023-08-14T17:54:37Z")

</div>

I am attempting to simulate a network of four neurons, where the ith neuron’s dynamics are described by the following differential equations: \\dot{V}\_m = I\_{syn} - (V\_m - \\alpha\_f^-\\tanh(V\_m - \\delta\_f^-) + \\alpha\_s^+…

---

## [Finding root numerically for a function defined in a finite range](https://discourse.julialang.org/t/finding-root-numerically-for-a-function-defined-in-a-finite-range/102729)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 16\
**Last updated:** [August 14, 2023, 5:28pm UTC](https://discourse.julialang.org/t/finding-root-numerically-for-a-function-defined-in-a-finite-range/102729 "2023-08-14T17:28:23Z")

</div>

I have a function f(x) defined in range (-a, \\infty). f(x) is actually a piecewise function f\_1(x) for (-a,0), and f\_2(x) for (0, \\infty). For these two functions f\_1, f\_2 the 2nd derivative diverges at the boundary x=0.…

---

## [How to properly work with changing precision in ArbNumerics](https://discourse.julialang.org/t/how-to-properly-work-with-changing-precision-in-arbnumerics/102775)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 2\
**Last updated:** [August 13, 2023, 9:03pm UTC](https://discourse.julialang.org/t/how-to-properly-work-with-changing-precision-in-arbnumerics/102775 "2023-08-13T21:03:17Z")

</div>

I do not understand how I should properly work with ArbNumerics. I tried setting the number of digits at the beginning of my code, so that later I easily change the number of digits for all of my variables. digits = 20…

---

## [Problem with small integrals](https://discourse.julialang.org/t/problem-with-small-integrals/101634)

<div class="topic-metadata">

**Author:** [@Ross\_Boylan](https://discourse.julialang.org/u/Ross_Boylan)\
**Replies:** 19\
**Last updated:** [August 12, 2023, 12:39pm UTC](https://discourse.julialang.org/t/problem-with-small-integrals/101634 "2023-08-12T12:39:02Z")

</div>

I am computing 2 integrals over the real line using quadgk from the package of the same name. The goal is to estimate the ratio of the integrals. Often both integrals are quite small, especially in some extreme cases I’…

---

## [Possibility to store outcome of \`ForwardDiff.jacobian\` already in sparse format](https://discourse.julialang.org/t/possibility-to-store-outcome-of-forwarddiff-jacobian-already-in-sparse-format/102635)

<div class="topic-metadata">

**Author:** [@DanDoe](https://discourse.julialang.org/u/DanDoe)\
**Replies:** 2\
**Last updated:** [August 11, 2023, 6:19am UTC](https://discourse.julialang.org/t/possibility-to-store-outcome-of-forwarddiff-jacobian-already-in-sparse-format/102635 "2023-08-11T06:19:00Z")

</div>

I use ForwardDiff.jacobian in the following way: function \_jacobian\_ad\_forward(p, t0, u0\_ode, du\_ode, config) J = ForwardDiff.jacobian(du\_ode, u0\_ode, config) do du\_ode, u\_ode f!(du\_ode, u\_ode, p, t0) en…

---

## [How to utilize symmetry in tensor contraction?](https://discourse.julialang.org/t/how-to-utilize-symmetry-in-tensor-contraction/102514)

<div class="topic-metadata">

**Author:** [@Nellatur](https://discourse.julialang.org/u/Nellatur)\
**Replies:** 2\
**Last updated:** [August 10, 2023, 6:13am UTC](https://discourse.julialang.org/t/how-to-utilize-symmetry-in-tensor-contraction/102514 "2023-08-10T06:13:33Z")

</div>

Hi, I tried to consider tensor contraction A\[a,b\] B\[b,c,d,e\] = C\[a,c,c,e\], where B\[b,c,d,e\] = B\[b,c,e,d\]. I am not sure if my following julia code is right using LinearAlgebra using BenchmarkTools, TensorOperations n …

---

## [Inverse subset algorithm?](https://discourse.julialang.org/t/inverse-subset-algorithm/102252)

<div class="topic-metadata">

**Author:** [@ElOceanografo](https://discourse.julialang.org/u/ElOceanografo)\
**Replies:** 4\
**Last updated:** [August 7, 2023, 5:02pm UTC](https://discourse.julialang.org/t/inverse-subset-algorithm/102252 "2023-08-07T17:02:50Z")

</div>

Reading this paper, I came across a reference to the “inverse subset algorithm,” in the context of efficiently calculating the gradient of the log-determinant of a sparse symmetric matrix (Section 4.1, Equation 8 and imm…

---

## [Unable to change system size in DDE problem using DifferentialEquations.jl](https://discourse.julialang.org/t/unable-to-change-system-size-in-dde-problem-using-differentialequations-jl/102103)

<div class="topic-metadata">

**Author:** [@jewh](https://discourse.julialang.org/u/jewh)\
**Replies:** 10\
**Last updated:** [August 7, 2023, 3:09pm UTC](https://discourse.julialang.org/t/unable-to-change-system-size-in-dde-problem-using-differentialequations-jl/102103 "2023-08-07T15:09:07Z")

</div>

I’m solving a DDE model for gene expression within cells and want to see how the system reacts to me adding a new cell during the simulation. For this I’m using DifferentialEquations.jl, following the tutorial for solvi…

---

## [Is half precision a killer app for RecursiveFactorization?](https://discourse.julialang.org/t/is-half-precision-a-killer-app-for-recursivefactorization/102407)

<div class="topic-metadata">

**Author:** [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Replies:** 2\
**Last updated:** [August 4, 2023, 5:07pm UTC](https://discourse.julialang.org/t/is-half-precision-a-killer-app-for-recursivefactorization/102407 "2023-08-04T17:07:19Z")

</div>

@YingboMa you and your collaborators have done good and noble work with this. I’ve been working on half precision for a while and one of the pain points is that LAPACK/BLAS does not support Float16, even though Apple si…

---

## [Using solution of DDE model as history for another (larger) DDE problem](https://discourse.julialang.org/t/using-solution-of-dde-model-as-history-for-another-larger-dde-problem/102435)

<div class="topic-metadata">

**Author:** [@jewh](https://discourse.julialang.org/u/jewh)\
**Replies:** 1\
**Last updated:** [August 5, 2023, 10:56pm UTC](https://discourse.julialang.org/t/using-solution-of-dde-model-as-history-for-another-larger-dde-problem/102435 "2023-08-05T22:56:41Z")

</div>

I want to study effects on a DDE model when I add another component to the system. Using resize! and callbacks doesn’t work. Therefore I want to solve the DDE model for n components across some time span, then use this…

---

## [Equivalent of Matlab's deval in DifferentialEquations.jl](https://discourse.julialang.org/t/equivalent-of-matlabs-deval-in-differentialequations-jl/102444)

<div class="topic-metadata">

**Author:** [@jewh](https://discourse.julialang.org/u/jewh)\
**Replies:** 2\
**Last updated:** [August 3, 2023, 12:49pm UTC](https://discourse.julialang.org/t/equivalent-of-matlabs-deval-in-differentialequations-jl/102444 "2023-08-03T12:49:15Z")

</div>

Is there a function like deval in DifferentialEquations.jl?

---

## [Creating an interpolating 2D lookup table](https://discourse.julialang.org/t/creating-an-interpolating-2d-lookup-table/102303)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 7\
**Last updated:** [August 1, 2023, 8:59am UTC](https://discourse.julialang.org/t/creating-an-interpolating-2d-lookup-table/102303 "2023-08-01T08:59:50Z")

</div>

I have the function p=f(a, b) and can generate a grid of values for all valid values of a and b using a simulation. The values of p are steadily increasing with a and steadily decreasing with b. I need a numeric approx…

---

## [NonlinearSolve Falsi algorithm: Unexpected ReturnCode](https://discourse.julialang.org/t/nonlinearsolve-falsi-algorithm-unexpected-returncode/102296)

<div class="topic-metadata">

**Author:** [@laikq](https://discourse.julialang.org/u/laikq)\
**Replies:** 2\
**Last updated:** [July 31, 2023, 1:35pm UTC](https://discourse.julialang.org/t/nonlinearsolve-falsi-algorithm-unexpected-returncode/102296 "2023-07-31T13:35:19Z")

</div>

I’m observing unexpected behavior in SimpleNonlinearSolve/NonlinearSolve’s algorithm Falsi (an algorithm for finding roots of nonlinear functions). I expect Falsi to return a successful return code if it converged, and a…

---

## [Solving a system of PDEs with MOL memory allocation problems](https://discourse.julialang.org/t/solving-a-system-of-pdes-with-mol-memory-allocation-problems/102199)

<div class="topic-metadata">

**Author:** [@Hugo\_V](https://discourse.julialang.org/u/Hugo_V)\
**Replies:** 1\
**Last updated:** [July 29, 2023, 3:15pm UTC](https://discourse.julialang.org/t/solving-a-system-of-pdes-with-mol-memory-allocation-problems/102199 "2023-07-29T15:15:03Z")

</div>

Hello, I´m new user of Julia and I´m trying to solve a system of PDES non lineal with method of lines. To check it I´m using a static solution not dependent on time. The idea is to recover to t\_i+1 the same solutions. I…

---

## [ERROR: LoadError: Scalar indexing is disallowed in tullio](https://discourse.julialang.org/t/error-loaderror-scalar-indexing-is-disallowed-in-tullio/101775)

<div class="topic-metadata">

**Author:** [@Nellatur](https://discourse.julialang.org/u/Nellatur)\
**Replies:** 4\
**Last updated:** [July 24, 2023, 3:45am UTC](https://discourse.julialang.org/t/error-loaderror-scalar-indexing-is-disallowed-in-tullio/101775 "2023-07-24T03:45:46Z")

</div>

For the following code using CUDA using Tullio using BenchmarkTools A = rand(500, 500) B = rand(500, 500) A\_d = CUDA.CuArray(A) B\_d = CUDA.CuArray(B) @btime @tullio C\_d\[i,k\] := A\_d\[i,j\] \* B\_d\[j,k\] C = Array(C\_d) I …

---

## [Why repeat precompilation when running 'test DifferentialEquations'?](https://discourse.julialang.org/t/why-repeat-precompilation-when-running-test-differentialequations/101831)

<div class="topic-metadata">

**Author:** [@Henri\_Laurie](https://discourse.julialang.org/u/Henri_Laurie)\
**Replies:** 1\
**Last updated:** [July 21, 2023, 5:58am UTC](https://discourse.julialang.org/t/why-repeat-precompilation-when-running-test-differentialequations/101831 "2023-07-21T05:58:36Z")

</div>

I’ve just installed v1.9.2 (became available for Manjaro), and reinstalled the DifferentialEquations package. Out of curiosity, ran Pkg.test on it (actually just from Pkg manager prompt) and it repeated the precompilatio…

---

## [Best way to perform an integral containing a Boltzmann factor](https://discourse.julialang.org/t/best-way-to-perform-an-integral-containing-a-boltzmann-factor/101698)

<div class="topic-metadata">

**Author:** [@marcsgil](https://discourse.julialang.org/u/marcsgil)\
**Replies:** 3\
**Last updated:** [July 19, 2023, 3:11am UTC](https://discourse.julialang.org/t/best-way-to-perform-an-integral-containing-a-boltzmann-factor/101698 "2023-07-19T03:11:40Z")

</div>

Hello! I’m interesting in calculating an integral of the form \\int\_{\\mathbb{R}^n} d^n x f(x,\\beta) \\exp(-\\beta H(x)) where H is a known an Hamiltonian, \\beta is an inverse temperature and f is a function which I can…

---

## [Handling an overflow example in QuadGK](https://discourse.julialang.org/t/handling-an-overflow-example-in-quadgk/101657)

<div class="topic-metadata">

**Author:** [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Replies:** 5\
**Last updated:** [July 16, 2023, 2:06pm UTC](https://discourse.julialang.org/t/handling-an-overflow-example-in-quadgk/101657 "2023-07-16T14:06:11Z")

</div>

Someone asked me this question over email, and I decided to post my answer here since it might be of more general interest. Suppose that we are trying to compute \\int\_0^\\infty (e^y - 1) \\frac{e^{-2.5y}}{y^{1.2}} dy. Th…

---

## [DifferentialEquations.jl VectorContinuousCallback vs CallbackSet](https://discourse.julialang.org/t/differentialequations-jl-vectorcontinuouscallback-vs-callbackset/88536)

<div class="topic-metadata">

**Author:** [@Max\_M](https://discourse.julialang.org/u/Max_M)\
**Replies:** 7\
**Last updated:** [July 14, 2023, 6:48pm UTC](https://discourse.julialang.org/t/differentialequations-jl-vectorcontinuouscallback-vs-callbackset/88536 "2023-07-14T18:48:35Z")

</div>

From the docs: The \[VectorContinuousCallback\] https://diffeq.sciml.ai/stable/features/callback\_functions/#SciMLBase.VectorContinuousCallback) works like a vector of ContinuousCallbacks and lets the user specify which c…

---

## [Stochastic differential equation with high dimensions is using too much memory and taking too long](https://discourse.julialang.org/t/stochastic-differential-equation-with-high-dimensions-is-using-too-much-memory-and-taking-too-long/101478)

<div class="topic-metadata">

**Author:** [@KalelR](https://discourse.julialang.org/u/KalelR)\
**Replies:** 12\
**Last updated:** [July 13, 2023, 10:52am UTC](https://discourse.julialang.org/t/stochastic-differential-equation-with-high-dimensions-is-using-too-much-memory-and-taking-too-long/101478 "2023-07-13T10:52:05Z")

</div>

Hey! I want to integrate a system of 40+ differential equations each with independent additive white noise. With the current implementation I’m trying this is using way too much memory and is too slow. A minimal example …

---

## [Differential Equations.jl ODEProblem exceedingly slow](https://discourse.julialang.org/t/differential-equations-jl-odeproblem-exceedingly-slow/101500)

<div class="topic-metadata">

**Author:** [@WillHWThompson](https://discourse.julialang.org/u/WillHWThompson)\
**Replies:** 5\
**Last updated:** [July 12, 2023, 2:12pm UTC](https://discourse.julialang.org/t/differential-equations-jl-odeproblem-exceedingly-slow/101500 "2023-07-12T14:12:04Z")

</div>

I am trying to numerically integrate a set of master equations with DifferentialEquations.jl I have defined the differential equation like: function voter\_model\_ame!(dG,G,t,p) N,U = size(G) for n\_prime=1:N,u\_p…

---

## ["equation(s) resulted in a non-finite number.." using MethodOfLines](https://discourse.julialang.org/t/equation-s-resulted-in-a-non-finite-number-using-methodoflines/101408)

<div class="topic-metadata">

**Author:** [@PeX](https://discourse.julialang.org/u/PeX)\
**Replies:** 1\
**Last updated:** [July 10, 2023, 8:08am UTC](https://discourse.julialang.org/t/equation-s-resulted-in-a-non-finite-number-using-methodoflines/101408 "2023-07-10T08:08:20Z")

</div>

Hi all, It’s my first time using MethodOfLines so I’m not sure how to debug it. The (nondimensionalized) equations I’m trying to solve are: \\begin{aligned} & \\frac{\\partial u}{\\partial x}+\\frac{\\partial w}{\\partial z}…

---

## [Best approach to solving this coupled nonlinear PDE system (incompressible convection)?](https://discourse.julialang.org/t/best-approach-to-solving-this-coupled-nonlinear-pde-system-incompressible-convection/101290)

<div class="topic-metadata">

**Author:** [@PeX](https://discourse.julialang.org/u/PeX)\
**Replies:** 3\
**Last updated:** [July 8, 2023, 9:17pm UTC](https://discourse.julialang.org/t/best-approach-to-solving-this-coupled-nonlinear-pde-system-incompressible-convection/101290 "2023-07-08T21:17:44Z")

</div>

Hello everyone! I’m new to solving PDEs with Julia, only done ODEs so far. My problem looks like this: -\\nabla P+\\nabla \\cdot \\sigma+\\rho \\vec{g}=0 \\nabla \\cdot \\vec{u}=0 \\dot{\\varepsilon}=\\frac{1}{2}\\left(\\nabla …

---

## [Benchmarking the Parallel 1D Heat Equation Solver in Chapel, Charm++, C++, HPX, Go, Julia, Python, Rust, Swift, and Java](https://discourse.julialang.org/t/benchmarking-the-parallel-1d-heat-equation-solver-in-chapel-charm-c-hpx-go-julia-python-rust-swift-and-java/101330)

<div class="topic-metadata">

**Author:** [@Perrin\_Meyer](https://discourse.julialang.org/u/Perrin_Meyer)\
**Replies:** 7\
**Last updated:** [July 8, 2023, 10:11am UTC](https://discourse.julialang.org/t/benchmarking-the-parallel-1d-heat-equation-solver-in-chapel-charm-c-hpx-go-julia-python-rust-swift-and-java/101330 "2023-07-08T10:11:45Z")

</div>

Interesting arXiv preprint… TLDNR: (Julia crushes Numpy…)

---

## [Floating number matrix, equal matrix in whole, but not equal column](https://discourse.julialang.org/t/floating-number-matrix-equal-matrix-in-whole-but-not-equal-column/101200)

<div class="topic-metadata">

**Author:** [@maxchendt](https://discourse.julialang.org/u/maxchendt)\
**Replies:** 3\
**Last updated:** [July 5, 2023, 10:14pm UTC](https://discourse.julialang.org/t/floating-number-matrix-equal-matrix-in-whole-but-not-equal-column/101200 "2023-07-05T22:14:55Z")

</div>

norm(Y - B \* A, Inf) is 0, but when comparing individual columns, such as Y\[:,4\] - B \* A\[:,4\] is not zero. Why? using TranscodingStreams, CodecXz, Serialization, Downloads using LinearAlgebra function urlData(url, f…

---

## [Number of primes below a given number](https://discourse.julialang.org/t/number-of-primes-below-a-given-number/58709)

<div class="topic-metadata">

**Author:** [@HexSpin](https://discourse.julialang.org/u/HexSpin)\
**Replies:** 51\
**Last updated:** [July 3, 2023, 11:39am UTC](https://discourse.julialang.org/t/number-of-primes-below-a-given-number/58709 "2023-07-03T11:39:08Z")

</div>

I wish to find the number of primes below a given number, e.g. there are 25 primes below 100. It appears primes.jl does not do this and I can’t seem to locate a package to do so (at least not one compatible with OSX). …

---

## [Principal angles between subspaces](https://discourse.julialang.org/t/principal-angles-between-subspaces/101044)

<div class="topic-metadata">

**Author:** [@fph](https://discourse.julialang.org/u/fph)\
**Replies:** 2\
**Last updated:** [July 1, 2023, 12:53pm UTC](https://discourse.julialang.org/t/principal-angles-between-subspaces/101044 "2023-07-01T12:53:42Z")

</div>

Does Julia have a function to compute canonical / principal angles between subspaces, like scipy.linalg.subspace\_angles or even just Matlab’s subspace which computes the maximum angle only? The computation is essentiall…

---

## [Parallelization efficiency for @tensor @tullio](https://discourse.julialang.org/t/parallelization-efficiency-for-tensor-tullio/101021)

<div class="topic-metadata">

**Author:** [@Nellatur](https://discourse.julialang.org/u/Nellatur)\
**Replies:** 5\
**Last updated:** [June 30, 2023, 6:02pm UTC](https://discourse.julialang.org/t/parallelization-efficiency-for-tensor-tullio/101021 "2023-06-30T18:02:32Z")

</div>

For the input using TensorOperations using LinearAlgebra using BenchmarkTools using Tullio A = rand(1000, 1000) B = rand(1000, 1000) @btime @tensor C\[i,k\] := A\[i,j\]\*B\[j,k\] @btime @tullio C\[i,k\] := A\[i,j\]\*B\[j,k\] I us…

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

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