# Latest

**URL:** https://discourse.julialang.org/latest.md?page=921

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

**Page:** 922

---

## [Allocation during construction of compile-time sized structure](https://discourse.julialang.org/t/allocation-during-construction-of-compile-time-sized-structure/87435)

<div class="topic-metadata">

**Author:** [@user664303](https://discourse.julialang.org/u/user664303)\
**Replies:** 1\
**Last updated:** [September 18, 2022, 12:25pm UTC](https://discourse.julialang.org/t/allocation-during-construction-of-compile-time-sized-structure/87435 "2022-09-18T12:25:04Z")

</div>

I have a simple, immutable structure that wraps a statically sized matrix. When I construct it with an initialization value, it causes a memory allocation. I expected there to be no such allocation. Should there be an al…

---

## [How to draw a directed graph of transition matrix](https://discourse.julialang.org/t/how-to-draw-a-directed-graph-of-transition-matrix/87399)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 2\
**Last updated:** [September 18, 2022, 9:59am UTC](https://discourse.julialang.org/t/how-to-draw-a-directed-graph-of-transition-matrix/87399 "2022-09-18T09:59:41Z")

</div>

Hi all, I would like to draw a network to visualize a transition matrix. I was wondering if there is a package somewhere that automatically generates a directed graph from a transition matrix. Here is an example of what…

---

## [How julia calculates pi?](https://discourse.julialang.org/t/how-julia-calculates-pi/87094)

<div class="topic-metadata">

**Author:** [@qwerty](https://discourse.julialang.org/u/qwerty)\
**Replies:** 19\
**Last updated:** [March 14, 2026, 1:02am UTC](https://discourse.julialang.org/t/how-julia-calculates-pi/87094 "2026-03-14T01:02:04Z")

</div>

I think I have found a simple formula to calculate pi but my formula is much slower than BigFloat (pi). How julia calculates pi? I also ask you: how do I know if my formula already exists?

---

## [Combining Lux.jl with Optimization.jl](https://discourse.julialang.org/t/combining-lux-jl-with-optimization-jl/87412)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 11\
**Last updated:** [September 18, 2022, 3:26am UTC](https://discourse.julialang.org/t/combining-lux-jl-with-optimization-jl/87412 "2022-09-18T03:26:41Z")

</div>

Hi there, while trying to compile a state-of-the-art NeuralDifferentialEquations tutorial I stumbled upon the recent addition of Lux.jl and Optimization.jl It seems they don’t really work together, because Optimization…

---

## [How to concisely define a recursive constraint？](https://discourse.julialang.org/t/how-to-concisely-define-a-recursive-constraint/87411)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 4\
**Last updated:** [September 18, 2022, 1:55am UTC](https://discourse.julialang.org/t/how-to-concisely-define-a-recursive-constraint/87411 "2022-09-18T01:55:31Z")

</div>

How to concisely define a recursive constraint with JuMP, for example: x\_{t}-x\_{t-1}\\geqslant 1\\quad\\forall t = 1,\\cdots,T, where x\_0=0 but I don’t want to define an extra variable for it. In another words, I want to …

---

## [Setting font of minus sign in exponent in Makie](https://discourse.julialang.org/t/setting-font-of-minus-sign-in-exponent-in-makie/87243)

<div class="topic-metadata">

**Author:** [@yhchang96](https://discourse.julialang.org/u/yhchang96)\
**Replies:** 3\
**Last updated:** [September 18, 2022, 1:03am UTC](https://discourse.julialang.org/t/setting-font-of-minus-sign-in-exponent-in-makie/87243 "2022-09-18T01:03:11Z")

</div>

With the following code: using CairoMakie CairoMakie.activate!() set\_theme!() set\_theme!(font = "Arial",) function log\_tick\_formatter(values) return map(v -\> "10" \* Makie.UnicodeFun.to\_superscript(round(Int64, v))…

---

## [MathOptInterface.OTHER\_ERROR when trying to use ISRES of NLopt through JuMP](https://discourse.julialang.org/t/mathoptinterface-other-error-when-trying-to-use-isres-of-nlopt-through-jump/87420)

<div class="topic-metadata">

**Author:** [@knkn1711](https://discourse.julialang.org/u/knkn1711)\
**Replies:** 1\
**Last updated:** [September 17, 2022, 11:41pm UTC](https://discourse.julialang.org/t/mathoptinterface-other-error-when-trying-to-use-isres-of-nlopt-through-jump/87420 "2022-09-17T23:41:49Z")

</div>

I am trying to minimize a nonlinear function with nonlinear inequality constraints with NLopt and JuMP. In my test code below, I am minimizing a function with a known global minima. Local optimizers such as LD\_MMA fail…

---

## [\[sharing tools/experiences\] github copilot can be a nice addition](https://discourse.julialang.org/t/sharing-tools-experiences-github-copilot-can-be-a-nice-addition/79452)

<div class="topic-metadata">

**Author:** [@Egwene\_al\_Vere](https://discourse.julialang.org/u/Egwene_al_Vere)\
**Replies:** 4\
**Last updated:** [September 17, 2022, 2:15pm UTC](https://discourse.julialang.org/t/sharing-tools-experiences-github-copilot-can-be-a-nice-addition/79452 "2022-09-17T14:15:33Z")

</div>

Just trying out the github copilot (https://copilot.github.com/) for a couple of weeks, it supports julia and some of the suggestions I get from it are uncannily useful, almost brings a smile and it’s been a fun experien…

---

## [Struct/method definition order advice](https://discourse.julialang.org/t/struct-method-definition-order-advice/87377)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 12\
**Last updated:** [September 17, 2022, 10:13am UTC](https://discourse.julialang.org/t/struct-method-definition-order-advice/87377 "2022-09-17T10:13:27Z")

</div>

In Julia, you can have # in src/monster.jl struct Monster end # in src/player.jl struct Player end capture(::Player, ::Monster) This will only work if include("src/player.jl") is done after include("src/monster.jl"). …

---

## [Question regarding Base.power\_by\_squaring](https://discourse.julialang.org/t/question-regarding-base-power-by-squaring/87416)

<div class="topic-metadata">

**Author:** [@danielramos](https://discourse.julialang.org/u/danielramos)\
**Replies:** 2\
**Last updated:** [September 17, 2022, 7:11pm UTC](https://discourse.julialang.org/t/question-regarding-base-power-by-squaring/87416 "2022-09-17T19:11:41Z")

</div>

I’ve been playing with the @code\_typed macro and checking how some pieces of code behave. I was trying to check the differences between ^(2,5) and ^(2,-5) but @code\_typed shows the same output for these two cases (I’m us…

---

## [Feeding Julia strings in pipe to external program](https://discourse.julialang.org/t/feeding-julia-strings-in-pipe-to-external-program/1333)

<div class="topic-metadata">

**Author:** [@jebej](https://discourse.julialang.org/u/jebej)\
**Replies:** 7\
**Last updated:** [September 17, 2022, 6:36pm UTC](https://discourse.julialang.org/t/feeding-julia-strings-in-pipe-to-external-program/1333 "2022-09-17T18:36:13Z")

</div>

Is it possible to use a string, instead of the output of a command, when using pipeline? For example instead of writing run(pipeline(\`echo hello\`, \`sort\`)) I would write something like run(pipeline("hello", \`sort\`))

---

## [Difference between nprocs and nthreads](https://discourse.julialang.org/t/difference-between-nprocs-and-nthreads/87361)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 2\
**Last updated:** [September 17, 2022, 5:35pm UTC](https://discourse.julialang.org/t/difference-between-nprocs-and-nthreads/87361 "2022-09-17T17:35:58Z")

</div>

Hello, I’m trying to get my head around distributed programming to execute a script on a cluster. My code works well on my workstation with one CPU. It internally uses @threads to parallelize some stuff within the main…

---

## [Precompiled packages when $HOME is shared among different systems?](https://discourse.julialang.org/t/precompiled-packages-when-home-is-shared-among-different-systems/87364)

<div class="topic-metadata">

**Author:** [@rkube](https://discourse.julialang.org/u/rkube)\
**Replies:** 4\
**Last updated:** [September 17, 2022, 3:47pm UTC](https://discourse.julialang.org/t/precompiled-packages-when-home-is-shared-among-different-systems/87364 "2022-09-17T15:47:50Z")

</div>

Hi, I’m running julia on our clusters. At the moment, the user $HOMES are shared between 2 clusters, as they new one is phased in. Now I’d like to run MPI applications in this configuration. For convenience, I’m using …

---

## [Inset position and dimensions relative to the axes instead of relative to the plot](https://discourse.julialang.org/t/inset-position-and-dimensions-relative-to-the-axes-instead-of-relative-to-the-plot/87375)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 0\
**Last updated:** [September 16, 2022, 3:50pm UTC](https://discourse.julialang.org/t/inset-position-and-dimensions-relative-to-the-axes-instead-of-relative-to-the-plot/87375 "2022-09-16T15:50:57Z")

</div>

I am trying to create an inset using Plots.jl. (To be specific, I am using GR backend). Is there a keyword argument, that will interpret bbox(x,y, w,h) in such a way that the length parameters are treated as the coordin…

---

## [Cannot use "Plots" and "PyPlot" on my old Mac](https://discourse.julialang.org/t/cannot-use-plots-and-pyplot-on-my-old-mac/87369)

<div class="topic-metadata">

**Author:** [@guojing0](https://discourse.julialang.org/u/guojing0)\
**Replies:** 4\
**Last updated:** [September 17, 2022, 1:03pm UTC](https://discourse.julialang.org/t/cannot-use-plots-and-pyplot-on-my-old-mac/87369 "2022-09-17T13:03:58Z")

</div>

Hi, I am currently reading Statistics with Julia and quite enjoy it. In the birthday paradox section of second chapter, the following code is listed to illustrate the paradox with the use of Plots and pyplot(). So I typ…

---

## [Using ModelingToolkit.jl to model a matrix ODE](https://discourse.julialang.org/t/using-modelingtoolkit-jl-to-model-a-matrix-ode/82490)

<div class="topic-metadata">

**Author:** [@golanor](https://discourse.julialang.org/u/golanor)\
**Replies:** 3\
**Last updated:** [September 17, 2022, 12:44pm UTC](https://discourse.julialang.org/t/using-modelingtoolkit-jl-to-model-a-matrix-ode/82490 "2022-09-17T12:44:04Z")

</div>

Hi, I’m trying to create a matrix ODE using ModelingToolkit,jl (to simplify autodiff and code optimization), but I’m receiving an error which I did not find in any of the issues of the library. Any idea what I’m doing w…

---

## [How to convert code from python to julia. the magic squares](https://discourse.julialang.org/t/how-to-convert-code-from-python-to-julia-the-magic-squares/87397)

<div class="topic-metadata">

**Author:** [@TesMar](https://discourse.julialang.org/u/TesMar)\
**Replies:** 1\
**Last updated:** [September 17, 2022, 8:47am UTC](https://discourse.julialang.org/t/how-to-convert-code-from-python-to-julia-the-magic-squares/87397 "2022-09-17T08:47:33Z")

</div>

Hello everybody. I ask for help to convert this python code to Julia: sorry for the language errors, but i’m italian. Blockquote import collections from statistics import\* import numpy as np import pylab as pl fi…

---

## [Help to adapt the resolution of an ODE in Matlab to Julia](https://discourse.julialang.org/t/help-to-adapt-the-resolution-of-an-ode-in-matlab-to-julia/87389)

<div class="topic-metadata">

**Author:** [@lucasmsoares96](https://discourse.julialang.org/u/lucasmsoares96)\
**Replies:** 3\
**Last updated:** [September 17, 2022, 6:41am UTC](https://discourse.julialang.org/t/help-to-adapt-the-resolution-of-an-ode-in-matlab-to-julia/87389 "2022-09-17T06:41:18Z")

</div>

Hello guys. I’m having trouble adapting a Matlab code that resolves a second-order ODE to the Julia equivalent. This is the code in Matlab. It plots a graph with 3 curves: syms y(x); dy = diff(y); edo = diff(y,x,2) == …

---

## [Usage of lm with Unitful](https://discourse.julialang.org/t/usage-of-lm-with-unitful/87394)

<div class="topic-metadata">

**Author:** [@wheeheee](https://discourse.julialang.org/u/wheeheee)\
**Replies:** 0\
**Last updated:** [September 17, 2022, 6:25am UTC](https://discourse.julialang.org/t/usage-of-lm-with-unitful/87394 "2022-09-17T06:25:16Z")

</div>

I tried to use lm from GLM.jl with units from Unitful, but then received this error below. Is there some way to make this work? Or should I stick to stripping the units first before using lm? julia\> test\_df = DataFr…

---

## [Latex docstring for functions](https://discourse.julialang.org/t/latex-docstring-for-functions/87191)

<div class="topic-metadata">

**Author:** [@Rex\_Wang](https://discourse.julialang.org/u/Rex_Wang)\
**Replies:** 4\
**Last updated:** [September 17, 2022, 6:22am UTC](https://discourse.julialang.org/t/latex-docstring-for-functions/87191 "2022-09-17T06:22:07Z")

</div>

I’m trying to use latex strings for function documentation. It works fine following the instruction here: LaTeX Syntax @doc raw""" balabala... \`\`some equations\`\` """ myfun(x) = x However, the tex string become inval…

---

## [Defining methods in isolation in \`jldoctest\`s](https://discourse.julialang.org/t/defining-methods-in-isolation-in-jldoctest-s/87263)

<div class="topic-metadata">

**Author:** [@Jollywatt](https://discourse.julialang.org/u/Jollywatt)\
**Replies:** 1\
**Last updated:** [September 17, 2022, 5:35am UTC](https://discourse.julialang.org/t/defining-methods-in-isolation-in-jldoctest-s/87263 "2022-09-17T05:35:17Z")

</div>

With Documenter.jl, each code block evaluates in its own scope: Every doctest block is evaluated inside its own module . This means that definitions (types, variables, functions etc.) from a block can not be used in th…

---

## [Feature request: generalization of findmax/findmin to n values](https://discourse.julialang.org/t/feature-request-generalization-of-findmax-findmin-to-n-values/10286)

<div class="topic-metadata">

**Author:** [@davidbp](https://discourse.julialang.org/u/davidbp)\
**Replies:** 5\
**Last updated:** [September 17, 2022, 1:26am UTC](https://discourse.julialang.org/t/feature-request-generalization-of-findmax-findmin-to-n-values/10286 "2022-09-17T01:26:36Z")

</div>

Given an array X I would like to find the n maximum (or minimum) values of the array and the positions where they are located. In matlab there is the following function that just does this We have findmax that alread…

---

## [Plotting Multiple ODE Trajectories on the Same Plot](https://discourse.julialang.org/t/plotting-multiple-ode-trajectories-on-the-same-plot/87387)

<div class="topic-metadata">

**Author:** [@yoshi](https://discourse.julialang.org/u/yoshi)\
**Replies:** 5\
**Last updated:** [September 17, 2022, 12:44am UTC](https://discourse.julialang.org/t/plotting-multiple-ode-trajectories-on-the-same-plot/87387 "2022-09-17T00:44:14Z")

</div>

I have a bunch of ODE simulation outputs. I’m having trouble plotting all the solutions on the same plot. I can do something like the following code. But do I need to reshape the entire simulation output to do this? pl…

---

## [Permission Denied when installing package with Julia 1.8.1 on Windows](https://discourse.julialang.org/t/permission-denied-when-installing-package-with-julia-1-8-1-on-windows/87376)

<div class="topic-metadata">

**Author:** [@johnh](https://discourse.julialang.org/u/johnh)\
**Replies:** 1\
**Last updated:** [September 16, 2022, 11:24pm UTC](https://discourse.julialang.org/t/permission-denied-when-installing-package-with-julia-1-8-1-on-windows/87376 "2022-09-16T23:24:31Z")

</div>

Windows 10 laptop. Julia Version 1.8.1 (2022-09-06) I upgraded using juliaup yesterday julia\> using BenchmarkTools │ Package BenchmarkTools not found, but a package named BenchmarkTools is available from a registry. …

---

## [Type compare](https://discourse.julialang.org/t/type-compare/87351)

<div class="topic-metadata">

**Author:** [@Brian1](https://discourse.julialang.org/u/Brian1)\
**Replies:** 9\
**Last updated:** [September 16, 2022, 7:54pm UTC](https://discourse.julialang.org/t/type-compare/87351 "2022-09-16T19:54:18Z")

</div>

As shown blow: (Int,10) isa Tuple{Type{Int},Int} False So, how can I define a T, function f(x::T) where T \<: Tuple{Type{Int},Int} end Of course, this would work T \<: Tuple{DataType,Int}, but it is limited. Is there o…

---

## [Senior Scientist, Decision Science @ Merck](https://discourse.julialang.org/t/senior-scientist-decision-science-merck/86284)

<div class="topic-metadata">

**Author:** [@thevolatilebit](https://discourse.julialang.org/u/thevolatilebit)\
**Replies:** 6\
**Last updated:** [September 16, 2022, 8:26pm UTC](https://discourse.julialang.org/t/senior-scientist-decision-science-merck/86284 "2022-09-16T20:26:53Z")

</div>

Decision science (dynamical modeling, optimisation, uncertainty quantification, and beyond) with :juliaheartpulsing:! https://jobs.merck.com/us/en/job/R197735/Senior-Scientist-Decision-Science

---

## [Bounded optimization without prior knowledge of bounds](https://discourse.julialang.org/t/bounded-optimization-without-prior-knowledge-of-bounds/87385)

<div class="topic-metadata">

**Author:** [@structural](https://discourse.julialang.org/u/structural)\
**Replies:** 1\
**Last updated:** [September 16, 2022, 7:47pm UTC](https://discourse.julialang.org/t/bounded-optimization-without-prior-knowledge-of-bounds/87385 "2022-09-16T19:47:59Z")

</div>

I need to optimize a function f(x) over some region A. The function returns an error if evaluated outside the region. However I do not know the region A beforehand. I can only tell whether x' \\in A by evaluating f(x') an…

---

## [Viscircles and Norm not defined](https://discourse.julialang.org/t/viscircles-and-norm-not-defined/87380)

<div class="topic-metadata">

**Author:** [@Eric.O](https://discourse.julialang.org/u/Eric.O)\
**Replies:** 2\
**Last updated:** [September 16, 2022, 6:57pm UTC](https://discourse.julialang.org/t/viscircles-and-norm-not-defined/87380 "2022-09-16T18:57:51Z")

</div>

I Keep getting this 3 errors with my code. I made some search to correct them but the options are not working. I will be glad if anyone can give me some guidance, please. this are my errors The “hold on” for plots is n…

---

## [Is there a way to use MKLPardisoSolver or other parallel solver with KLU?](https://discourse.julialang.org/t/is-there-a-way-to-use-mklpardisosolver-or-other-parallel-solver-with-klu/87382)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 2\
**Last updated:** [September 16, 2022, 6:30pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-use-mklpardisosolver-or-other-parallel-solver-with-klu/87382 "2022-09-16T18:30:27Z")

</div>

Does MKLPardisoSolver only accept matrix inputs? A= sprand(10000, 10000, 0.1); II= rand(10000, 2); # typeof(II) is Matrix{Float64} (alias for Array{Float64, 2}) V= zeros(10000, 2); ps = MKLPardisoSolver() solve!(ps…

---

## [How to overload operators and their doc bindings](https://discourse.julialang.org/t/how-to-overload-operators-and-their-doc-bindings/87372)

<div class="topic-metadata">

**Author:** [@uje](https://discourse.julialang.org/u/uje)\
**Replies:** 20\
**Last updated:** [September 16, 2022, 5:04pm UTC](https://discourse.julialang.org/t/how-to-overload-operators-and-their-doc-bindings/87372 "2022-09-16T17:04:44Z")

</div>

julia\> module Foo struct Point x::Int y::Int end """ \<(a::Point, b::Point) -\> Bool Compare two \`Point\`s…

[Previous page](https://discourse.julialang.org/latest.md?page=920)

[Next page](https://discourse.julialang.org/latest.md?page=922)
