# Numerics

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

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

**Page:** 15

---

## [Performance problems in one-dimensional complex integration](https://discourse.julialang.org/t/performance-problems-in-one-dimensional-complex-integration/100912)

<div class="topic-metadata">

**Author:** [@javier\_mj](https://discourse.julialang.org/u/javier_mj)\
**Replies:** 15\
**Last updated:** [June 27, 2023, 10:52pm UTC](https://discourse.julialang.org/t/performance-problems-in-one-dimensional-complex-integration/100912 "2023-06-27T22:52:23Z")

</div>

Hello to all I am currently moving some code to Julia with the intention of improving performance. However, within a function I am running into a bottleneck when calculating the integral in one dimension of a complex fu…

---

## [DAE - Sundials parallel capabilities access through sundials.jl or DifferentialEquation.jl](https://discourse.julialang.org/t/dae-sundials-parallel-capabilities-access-through-sundials-jl-or-differentialequation-jl/99924)

<div class="topic-metadata">

**Author:** [@Relojuca](https://discourse.julialang.org/u/Relojuca)\
**Replies:** 5\
**Last updated:** [June 25, 2023, 11:29am UTC](https://discourse.julialang.org/t/dae-sundials-parallel-capabilities-access-through-sundials-jl-or-differentialequation-jl/99924 "2023-06-25T11:29:28Z")

</div>

Hi People. I am implementing a code for solving a DAE system using sundials and IDA (through the DifferentialEquation.jl interface). However, as my simulation requires the solution of several equations \> 500. It is taki…

---

## [Speeding up the multiplying, adding, subtracting of 3D matrices](https://discourse.julialang.org/t/speeding-up-the-multiplying-adding-subtracting-of-3d-matrices/100488)

<div class="topic-metadata">

**Author:** [@smac](https://discourse.julialang.org/u/smac)\
**Replies:** 16\
**Last updated:** [June 24, 2023, 11:03am UTC](https://discourse.julialang.org/t/speeding-up-the-multiplying-adding-subtracting-of-3d-matrices/100488 "2023-06-24T11:03:00Z")

</div>

I’ve been working on “translating” my 3d finite difference codes for (magneto)hydrodynamics, and am at the stage where for at least one set of parameters, the codes are giving similar results (damped propagating waves). …

---

## [Symbolics.jacobian\_sparsity detection errors with PreallocationTools](https://discourse.julialang.org/t/symbolics-jacobian-sparsity-detection-errors-with-preallocationtools/100715)

<div class="topic-metadata">

**Author:** [@sanjeev](https://discourse.julialang.org/u/sanjeev)\
**Replies:** 2\
**Last updated:** [June 22, 2023, 10:02pm UTC](https://discourse.julialang.org/t/symbolics-jacobian-sparsity-detection-errors-with-preallocationtools/100715 "2023-06-22T22:02:52Z")

</div>

When I try to do jacobian sparsity detection, I get error that ERROR: MethodError: no method matching zero(::Type{Any}). The array returned from PreallocationsTools.jl for array of Symbolics.Num datatype, is of type Ve…

---

## [Btime for loading @tensor inside loop](https://discourse.julialang.org/t/btime-for-loading-tensor-inside-loop/100613)

<div class="topic-metadata">

**Author:** [@Nellatur](https://discourse.julialang.org/u/Nellatur)\
**Replies:** 4\
**Last updated:** [June 21, 2023, 1:31am UTC](https://discourse.julialang.org/t/btime-for-loading-tensor-inside-loop/100613 "2023-06-21T01:31:17Z")

</div>

Hi, for the following code using LinearAlgebra using BenchmarkTools using TensorOperations # Initialization A = rand(100, 100) B = rand(100, 100) B\_3d = rand(100, 100, 100) n=100 C\_new = zeros(100, 100, 100) @btime…

---

## [Is that possible to specify dimensions in gemm?](https://discourse.julialang.org/t/is-that-possible-to-specify-dimensions-in-gemm/100433)

<div class="topic-metadata">

**Author:** [@Nellatur](https://discourse.julialang.org/u/Nellatur)\
**Replies:** 3\
**Last updated:** [June 16, 2023, 7:39pm UTC](https://discourse.julialang.org/t/is-that-possible-to-specify-dimensions-in-gemm/100433 "2023-06-16T19:39:01Z")

</div>

In Linear Algebra · The Julia Language gemm has fewer entries than LAPACK: dgemm, e.g., dimensions of matrices A and B. Specifying dimensions sometimes can let higher dimensional arrays look like matrices arrays - How …

---

## [Solving a system of two equations with two variables with certain properties](https://discourse.julialang.org/t/solving-a-system-of-two-equations-with-two-variables-with-certain-properties/100240)

<div class="topic-metadata">

**Author:** [@Zerosum](https://discourse.julialang.org/u/Zerosum)\
**Replies:** 3\
**Last updated:** [June 15, 2023, 12:39pm UTC](https://discourse.julialang.org/t/solving-a-system-of-two-equations-with-two-variables-with-certain-properties/100240 "2023-06-15T12:39:44Z")

</div>

I wondered if there is any more robust and faster way to solve a system of two equations with two variables than the NLsolve package. The first equation is F(x,y)=0 and the second G(x,y)=0. Both of them are very complic…

---

## [ITensor type definition for function input argument](https://discourse.julialang.org/t/itensor-type-definition-for-function-input-argument/100340)

<div class="topic-metadata">

**Author:** [@8me](https://discourse.julialang.org/u/8me)\
**Replies:** 3\
**Last updated:** [June 15, 2023, 10:18am UTC](https://discourse.julialang.org/t/itensor-type-definition-for-function-input-argument/100340 "2023-06-15T10:18:20Z")

</div>

I want to define a function which takes two ITensor of order 1 and dim 4 as input arguments. So my question would be, what is the suggested way of doing this …

---

## [Element by element wise multiplication and addition/subtraction of 3d matrices](https://discourse.julialang.org/t/element-by-element-wise-multiplication-and-addition-subtraction-of-3d-matrices/100178)

<div class="topic-metadata">

**Author:** [@smac](https://discourse.julialang.org/u/smac)\
**Replies:** 19\
**Last updated:** [June 14, 2023, 7:28pm UTC](https://discourse.julialang.org/t/element-by-element-wise-multiplication-and-addition-subtraction-of-3d-matrices/100178 "2023-06-14T19:28:40Z")

</div>

Hello, I’m new to Julia, with prior experience of fortran and Matlab. I have a 3d magnetohydrodynamics code which does all the time stepping + spatial derivatives using 3d matrices, with the operations carried out using…

---

## [Comparing the subsetted elements of a 3d matrix](https://discourse.julialang.org/t/comparing-the-subsetted-elements-of-a-3d-matrix/100355)

<div class="topic-metadata">

**Author:** [@smac](https://discourse.julialang.org/u/smac)\
**Replies:** 2\
**Last updated:** [June 14, 2023, 6:59pm UTC](https://discourse.julialang.org/t/comparing-the-subsetted-elements-of-a-3d-matrix/100355 "2023-06-14T18:59:59Z")

</div>

Hello, I originally posted this earlier today as part of an earlier question submitted to the community, but I think maybe it should be a “new” post. So I am cutting and pasting the most important parts of the message he…

---

## [Maximum timestep in DIfferential solver](https://discourse.julialang.org/t/maximum-timestep-in-differential-solver/100135)

<div class="topic-metadata">

**Author:** [@Sarthak\_Choudhury](https://discourse.julialang.org/u/Sarthak_Choudhury)\
**Replies:** 4\
**Last updated:** [June 10, 2023, 5:11pm UTC](https://discourse.julialang.org/t/maximum-timestep-in-differential-solver/100135 "2023-06-10T17:11:19Z")

</div>

Hi, I am currently solving an ODE in DifferentialEquations.jl which has explicit time dependence. I arrive at a solution for a larger time t\_{max} with the solution saved at 1000 time points in between. Now I want to zo…

---

## [Is there a symbolic Integrator](https://discourse.julialang.org/t/is-there-a-symbolic-integrator/100140)

<div class="topic-metadata">

**Author:** [@bombadil224](https://discourse.julialang.org/u/bombadil224)\
**Replies:** 1\
**Last updated:** [June 10, 2023, 4:47pm UTC](https://discourse.julialang.org/t/is-there-a-symbolic-integrator/100140 "2023-06-10T16:47:17Z")

</div>

I have been writing a Homotopy approximation method solver for differential equations. This requires the use of integration, So far I have been using a very simple function for the integration of polynomials. This is cle…

---

## [Instability detected in solving ODE with DifferentialEquations.jl](https://discourse.julialang.org/t/instability-detected-in-solving-ode-with-differentialequations-jl/99792)

<div class="topic-metadata">

**Author:** [@Rezair](https://discourse.julialang.org/u/Rezair)\
**Replies:** 7\
**Last updated:** [June 9, 2023, 10:23pm UTC](https://discourse.julialang.org/t/instability-detected-in-solving-ode-with-differentialequations-jl/99792 "2023-06-09T22:23:22Z")

</div>

I am trying to solve an equation in Julia but I get Unstable retcode, I have solved the same eqaution in MATLAB with no issues. here is a simplified version of the code: using DifferentialEquations struct RosslerMSF …

---

## [ODE solvers - Matlab ode23s vs Rosenbrock23 implementations](https://discourse.julialang.org/t/ode-solvers-matlab-ode23s-vs-rosenbrock23-implementations/99950)

<div class="topic-metadata">

**Author:** [@Nick1](https://discourse.julialang.org/u/Nick1)\
**Replies:** 5\
**Last updated:** [June 8, 2023, 9:15pm UTC](https://discourse.julialang.org/t/ode-solvers-matlab-ode23s-vs-rosenbrock23-implementations/99950 "2023-06-08T21:15:20Z")

</div>

I am working on solving stiff ODEs and I was comparing MATLAB and Julia solvers. While both give the same solution when the system reaches a steady state, at the beginning there is a small difference for the same relativ…

---

## [Implementing the Wedge Product](https://discourse.julialang.org/t/implementing-the-wedge-product/17824)

<div class="topic-metadata">

**Author:** [@DrPapa](https://discourse.julialang.org/u/DrPapa)\
**Replies:** 10\
**Last updated:** [June 8, 2023, 7:57pm UTC](https://discourse.julialang.org/t/implementing-the-wedge-product/17824 "2023-06-08T19:57:34Z")

</div>

First off, does anybody know of an existing implementation of the wedge product in Julia? I performed a pretty expensive search and came up empty. For my application I need to compute \\wedge\_{i=1}^{n-1}\\boldsymbol{v}\_i…

---

## [Compute fourrier transform in Julia](https://discourse.julialang.org/t/compute-fourrier-transform-in-julia/99664)

<div class="topic-metadata">

**Author:** [@Fourier](https://discourse.julialang.org/u/Fourier)\
**Replies:** 21\
**Last updated:** [June 5, 2023, 9:07am UTC](https://discourse.julialang.org/t/compute-fourrier-transform-in-julia/99664 "2023-06-05T09:07:16Z")

</div>

Given a function evaluated to a grid, how can I compute its fourrier transform nummericially? For example, given the box function function step(x) if abs(x) \< a return 1 else return 0 end end how can I comput…

---

## [2D diffusion and crank nicolson](https://discourse.julialang.org/t/2d-diffusion-and-crank-nicolson/99528)

<div class="topic-metadata">

**Author:** [@jtgreen](https://discourse.julialang.org/u/jtgreen)\
**Replies:** 0\
**Last updated:** [May 28, 2023, 7:57pm UTC](https://discourse.julialang.org/t/2d-diffusion-and-crank-nicolson/99528 "2023-05-28T19:57:02Z")

</div>

I’m trying to solve 2D diffusion using the crank nicolson method and seem to be screwing it up. For one, Ax=b should be solved with A\\b, but gives nonsensical results. Oddly, b\\A seems to give something approximating wha…

---

## [Using Metatheory.jl to simplify algebra expression](https://discourse.julialang.org/t/using-metatheory-jl-to-simplify-algebra-expression/99550)

<div class="topic-metadata">

**Author:** [@VPBML](https://discourse.julialang.org/u/VPBML)\
**Replies:** 0\
**Last updated:** [May 29, 2023, 10:25am UTC](https://discourse.julialang.org/t/using-metatheory-jl-to-simplify-algebra-expression/99550 "2023-05-29T10:25:40Z")

</div>

Hi, I am trying to use Metatheory.jl to simplify my algebra expressions (the expressions have type Expr), but did not get the results I expected. For example, when I tried to simplify the Expr :(a+(a-b)), I got :(a+(a-b…

---

## [Complex Integration](https://discourse.julialang.org/t/complex-integration/99544)

<div class="topic-metadata">

**Author:** [@Fourier](https://discourse.julialang.org/u/Fourier)\
**Replies:** 1\
**Last updated:** [May 29, 2023, 8:05am UTC](https://discourse.julialang.org/t/complex-integration/99544 "2023-05-29T08:05:27Z")

</div>

Is there a package that has support for complex numbers when integrating? I quite liked monte carlo integration, because the integrals I am evaluating are 3 dimensional and the error of MC is dimension independant. Also…

---

## [Elliptic functions of complex argument](https://discourse.julialang.org/t/elliptic-functions-of-complex-argument/51876)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 8\
**Last updated:** [May 23, 2023, 8:42pm UTC](https://discourse.julialang.org/t/elliptic-functions-of-complex-argument/51876 "2023-05-23T20:42:52Z")

</div>

Does anyone know a good package where Elliptic functions are implemented for complex values of the argument? May be some C or Fortran package that can be easily called from Julia? I know that there is the package Ellipt…

---

## [Nested parallel loops with @spawn](https://discourse.julialang.org/t/nested-parallel-loops-with-spawn/32364)

<div class="topic-metadata">

**Author:** [@mzilhao](https://discourse.julialang.org/u/mzilhao)\
**Replies:** 13\
**Last updated:** [May 22, 2023, 11:30pm UTC](https://discourse.julialang.org/t/nested-parallel-loops-with-spawn/32364 "2023-05-22T23:30:15Z")

</div>

Hi all, I’m trying to choose the best way of parallelizing my code given the the current options of @spawn and @threads. A toy model for what I’m trying to do is the following: function solve\_model\_serial!(A, Nu, Nx, N…

---

## [Numeric value substitution into SymPy Symbolic array or matrix](https://discourse.julialang.org/t/numeric-value-substitution-into-sympy-symbolic-array-or-matrix/99204)

<div class="topic-metadata">

**Author:** [@johannesnauta](https://discourse.julialang.org/u/johannesnauta)\
**Replies:** 5\
**Last updated:** [May 22, 2023, 10:42am UTC](https://discourse.julialang.org/t/numeric-value-substitution-into-sympy-symbolic-array-or-matrix/99204 "2023-05-22T10:42:10Z")

</div>

I am having trouble substituting numerical values into symbolic arrays and matrices. I have read about lambdify, but I still fail to provide numerical values for the arguments in a consistent way. As an example, consid…

---

## [Stackoverflow Error in plot of 3D data point](https://discourse.julialang.org/t/stackoverflow-error-in-plot-of-3d-data-point/99093)

<div class="topic-metadata">

**Author:** [@Movicmatics](https://discourse.julialang.org/u/Movicmatics)\
**Replies:** 8\
**Last updated:** [May 22, 2023, 12:25am UTC](https://discourse.julialang.org/t/stackoverflow-error-in-plot-of-3d-data-point/99093 "2023-05-22T00:25:30Z")

</div>

Hello everyone, I am trying to run my code but I am encountering an error, I would be glad if help can be render. The Error mesage is: ERROR: StackOverflowError: Stacktrace: \[1\] RecipesPipeline.Volume(v::Array{Floa…

---

## [Eigenvalue ordering unexpectedly different in two cases](https://discourse.julialang.org/t/eigenvalue-ordering-unexpectedly-different-in-two-cases/99189)

<div class="topic-metadata">

**Author:** [@Nikos\_Gianniotis](https://discourse.julialang.org/u/Nikos_Gianniotis)\
**Replies:** 2\
**Last updated:** [May 21, 2023, 8:52pm UTC](https://discourse.julialang.org/t/eigenvalue-ordering-unexpectedly-different-in-two-cases/99189 "2023-05-21T20:52:23Z")

</div>

Hello everyone, I am probably making a subtle mistake or assumption somewhere as I cannot understand why the following two eigendecompositions do not return the eigenvalues in the same order. Could somebody please expla…

---

## [Solving Ax = b s.t. x contains all positive values](https://discourse.julialang.org/t/solving-ax-b-s-t-x-contains-all-positive-values/99138)

<div class="topic-metadata">

**Author:** [@dleather](https://discourse.julialang.org/u/dleather)\
**Replies:** 4\
**Last updated:** [May 20, 2023, 8:00am UTC](https://discourse.julialang.org/t/solving-ax-b-s-t-x-contains-all-positive-values/99138 "2023-05-20T08:00:11Z")

</div>

I am solving an asset pricing equations via discretizing an underlying Markov process, X \\in R^d, resulting in \\tilde{X} \\sim \\Pi, where \\Pi is a transition matrix whose rows sum to unity, and all entries in \[0,1\]. Let \\…

---

## [Array ordering and naive summation](https://discourse.julialang.org/t/array-ordering-and-naive-summation/1929)

<div class="topic-metadata">

**Author:** [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Replies:** 5\
**Last updated:** [May 13, 2023, 6:00pm UTC](https://discourse.julialang.org/t/array-ordering-and-naive-summation/1929 "2023-05-13T18:00:32Z")

</div>

One of the first things you learn in numerical analysis is that floating-point operations are not associative. A classic example is this: julia\> (0.1 + 0.2) + 0.3 0.6000000000000001 julia\> 0.1 + (0.2 + 0.3) 0.6 I was …

---

## [How to construct the variational equation of an ODE without handwriting the Jacobi matrix](https://discourse.julialang.org/t/how-to-construct-the-variational-equation-of-an-ode-without-handwriting-the-jacobi-matrix/98735)

<div class="topic-metadata">

**Author:** [@xiaoming](https://discourse.julialang.org/u/xiaoming)\
**Replies:** 1\
**Last updated:** [May 12, 2023, 2:50pm UTC](https://discourse.julialang.org/t/how-to-construct-the-variational-equation-of-an-ode-without-handwriting-the-jacobi-matrix/98735 "2023-05-12T14:50:38Z")

</div>

Hello! I am new to Julia. I want to solve the variational equation of an ODE without handwriting the Jacobi matrix. Here is an MME. Suppose that the ODE equations are the followings: \\dot{x}=y\\\\ \\dot{y}=x-x^3-0.1y+0.…

---

## [Define an ODE which depends on an external function with the @ode\_def macro](https://discourse.julialang.org/t/define-an-ode-which-depends-on-an-external-function-with-the-ode-def-macro/98067)

<div class="topic-metadata">

**Author:** [@atmyo4](https://discourse.julialang.org/u/atmyo4)\
**Replies:** 1\
**Last updated:** [May 6, 2023, 12:21am UTC](https://discourse.julialang.org/t/define-an-ode-which-depends-on-an-external-function-with-the-ode-def-macro/98067 "2023-05-06T00:21:28Z")

</div>

Hello! I want to solve a system of ODEs that includes a parameter that varies over time. To obtain the value of the parameter I use an external function that uses the solution of another system of ODEs that has already b…

---

## [Strange runtime complexity of eigen(...)](https://discourse.julialang.org/t/strange-runtime-complexity-of-eigen/98392)

<div class="topic-metadata">

**Author:** [@mritter](https://discourse.julialang.org/u/mritter)\
**Replies:** 2\
**Last updated:** [May 5, 2023, 5:18pm UTC](https://discourse.julialang.org/t/strange-runtime-complexity-of-eigen/98392 "2023-05-05T17:18:16Z")

</div>

Hi everyone! I’m currently trying to look into the runtime complexity of some code which uses an eigendecomposition, and I don’t understand what I’m seeing. Reduced to an MWE, I’m doing the following: Generate a rando…

---

## [Automatic differentiation in different cases](https://discourse.julialang.org/t/automatic-differentiation-in-different-cases/98268)

<div class="topic-metadata">

**Author:** [@Djamil\_Lakhdar-Hamin](https://discourse.julialang.org/u/Djamil_Lakhdar-Hamin)\
**Replies:** 2\
**Last updated:** [May 3, 2023, 8:10pm UTC](https://discourse.julialang.org/t/automatic-differentiation-in-different-cases/98268 "2023-05-03T20:10:57Z")

</div>

I am trying to figure out : how to automatically differentiate some function f(x1,x2,x3…) for vector of numbers. I want to use one package preferably , but if I have to mix, I want to mix zygote with ForwardDiff. I th…

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

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