# New to Julia

**URL:** https://discourse.julialang.org/c/first-steps/8.md?page=38

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

**Page:** 39

---

## [ContinuousCallback for early termination of ODE fails to trigger](https://discourse.julialang.org/t/continuouscallback-for-early-termination-of-ode-fails-to-trigger/116910)

<div class="topic-metadata">

**Author:** [@apazo](https://discourse.julialang.org/u/apazo)\
**Replies:** 1\
**Last updated:** [July 25, 2024, 11:02am UTC](https://discourse.julialang.org/t/continuouscallback-for-early-termination-of-ode-fails-to-trigger/116910 "2024-07-25T11:02:42Z")

</div>

Hi all, I’m new to Julia, and I’m trying to simulate a simple ODE problem with some callbacks. My model consists of one single equation with two terms, one positive for growth, and one negative for decrease. However, th…

---

## [Vectorizing a summation](https://discourse.julialang.org/t/vectorizing-a-summation/117435)

<div class="topic-metadata">

**Author:** [@gkeee](https://discourse.julialang.org/u/gkeee)\
**Replies:** 5\
**Last updated:** [July 24, 2024, 7:31pm UTC](https://discourse.julialang.org/t/vectorizing-a-summation/117435 "2024-07-24T19:31:15Z")

</div>

term = 0 for k in 1:N term\_inner = 0 for p in 0:m term\_inner += binomial(m, p) \* c\[k\]^p \*f\[k\]^(m - p) \* integral\_Ik\_recursive(p, γ) end term += exp(im \* 2π \* γ \* (k - 1)) \* term\_inner end I want …

---

## [Error using GLMakie](https://discourse.julialang.org/t/error-using-glmakie/107768)

<div class="topic-metadata">

**Author:** [@Simone\_Gabbriellini](https://discourse.julialang.org/u/Simone_Gabbriellini)\
**Replies:** 15\
**Last updated:** [July 24, 2024, 4:59pm UTC](https://discourse.julialang.org/t/error-using-glmakie/107768 "2024-07-24T16:59:57Z")

</div>

I am trying to run a julia program from an ssh session with X-forwarding (note that xclock correctly opens the clock window in my local Xquartz) I have this configuration on my remote Ubuntu 18.04 box: $ inxi -G Graphi…

---

## [How can I round the elements of an array to have digits up to the order of magnitude of the last significant digit in a second array](https://discourse.julialang.org/t/how-can-i-round-the-elements-of-an-array-to-have-digits-up-to-the-order-of-magnitude-of-the-last-significant-digit-in-a-second-array/117378)

<div class="topic-metadata">

**Author:** [@Zotnam](https://discourse.julialang.org/u/Zotnam)\
**Replies:** 13\
**Last updated:** [July 24, 2024, 3:16pm UTC](https://discourse.julialang.org/t/how-can-i-round-the-elements-of-an-array-to-have-digits-up-to-the-order-of-magnitude-of-the-last-significant-digit-in-a-second-array/117378 "2024-07-24T15:16:34Z")

</div>

Hi, i have two arrays of float64: arr\_mean and arr\_stds. i can easily round arr\_stds to 1 or 2 significative digits with round.(arr\_stds, sigdigits=2). My problem is how to round arr\_mean so that each elements after…

---

## [Why I can't convert non-integer float to Int64?](https://discourse.julialang.org/t/why-i-cant-convert-non-integer-float-to-int64/117276)

<div class="topic-metadata">

**Author:** [@Farouk](https://discourse.julialang.org/u/Farouk)\
**Replies:** 6\
**Last updated:** [July 24, 2024, 12:03pm UTC](https://discourse.julialang.org/t/why-i-cant-convert-non-integer-float-to-int64/117276 "2024-07-24T12:03:59Z")

</div>

Hello, I am new to Julia, I worked in the past mostly in Python and a bit with JAVA, C and C++. My question is that in the code below I get InexactError. The conversion works fine with floats with .0 decimal and not with…

---

## [Symbolics - build\_function and broadcasting](https://discourse.julialang.org/t/symbolics-build-function-and-broadcasting/117240)

<div class="topic-metadata">

**Author:** [@AntoineK](https://discourse.julialang.org/u/AntoineK)\
**Replies:** 2\
**Last updated:** [July 23, 2024, 1:51pm UTC](https://discourse.julialang.org/t/symbolics-build-function-and-broadcasting/117240 "2024-07-23T13:51:01Z")

</div>

Hello, Does Symbolics.build\_function supports C-code generation of equations implying broadcasting (broadcast operation) ? I could not find this answer in the documentation. Thank you

---

## [How to replace 'Nothing' data type in an array](https://discourse.julialang.org/t/how-to-replace-nothing-data-type-in-an-array/117366)

<div class="topic-metadata">

**Author:** [@shrdlu](https://discourse.julialang.org/u/shrdlu)\
**Replies:** 6\
**Last updated:** [July 23, 2024, 5:50am UTC](https://discourse.julialang.org/t/how-to-replace-nothing-data-type-in-an-array/117366 "2024-07-23T05:50:35Z")

</div>

Hi everyone, I’m currently trying to untangle a pretty messy multi-nested json file by flattening them out manually and curating them into a dataframe (mostly following the method described here: https://julia.school/ju…

---

## [How do I Implement the SGD optimiser in Julia code](https://discourse.julialang.org/t/how-do-i-implement-the-sgd-optimiser-in-julia-code/117356)

<div class="topic-metadata">

**Author:** [@Vishav\_Rattu](https://discourse.julialang.org/u/Vishav_Rattu)\
**Replies:** 1\
**Last updated:** [July 23, 2024, 2:37am UTC](https://discourse.julialang.org/t/how-do-i-implement-the-sgd-optimiser-in-julia-code/117356 "2024-07-23T02:37:18Z")

</div>

\############################### # Task a using DifferentialEquations, ModelingToolkit, MethodOfLines, DomainSets using Plots using Random using Statistics using ComponentArrays, Lux, DiffEqFlux, OrdinaryDiffEq, Optimi…

---

## [How can i recursively search within a directory to extract h5 file headers](https://discourse.julialang.org/t/how-can-i-recursively-search-within-a-directory-to-extract-h5-file-headers/117358)

<div class="topic-metadata">

**Author:** [@Silva](https://discourse.julialang.org/u/Silva)\
**Replies:** 3\
**Last updated:** [July 22, 2024, 9:35pm UTC](https://discourse.julialang.org/t/how-can-i-recursively-search-within-a-directory-to-extract-h5-file-headers/117358 "2024-07-22T21:35:36Z")

</div>

How can I get glob to search within a complex directory structure to extract headers recursively? So far, glob seems to work only in the main directory. using HDF5 using CSV using DataFrames using Glob # Define the di…

---

## [Exporting/printing an array of dictionaries to external text file](https://discourse.julialang.org/t/exporting-printing-an-array-of-dictionaries-to-external-text-file/117340)

<div class="topic-metadata">

**Author:** [@shrdlu](https://discourse.julialang.org/u/shrdlu)\
**Replies:** 4\
**Last updated:** [July 22, 2024, 9:04pm UTC](https://discourse.julialang.org/t/exporting-printing-an-array-of-dictionaries-to-external-text-file/117340 "2024-07-22T21:04:48Z")

</div>

Hi, I’m trying to export a Julia array (of dictionaries, among some oddities) to a text file to share with a colleague. The array in question looks something like this, but about 70k entries: Dict{String, Any}("tem" …

---

## [Divising a DateTime by 1 or 10 yields different floating point precision](https://discourse.julialang.org/t/divising-a-datetime-by-1-or-10-yields-different-floating-point-precision/117347)

<div class="topic-metadata">

**Author:** [@K5Julien](https://discourse.julialang.org/u/K5Julien)\
**Replies:** 3\
**Last updated:** [July 22, 2024, 2:59pm UTC](https://discourse.julialang.org/t/divising-a-datetime-by-1-or-10-yields-different-floating-point-precision/117347 "2024-07-22T14:59:19Z")

</div>

I have come to an inexplicable (at least for me at the moment) behavior in Julia julia\> using Dates julia\> Dates.value(Minute(60)) / 1 \* 38.849 2330.9399999999996 julia\> Dates.value(Dates.value(Minute(60)) \* 38.849 2330…

---

## [Create a custom @ccall](https://discourse.julialang.org/t/create-a-custom-ccall/117243)

<div class="topic-metadata">

**Author:** [@chkat](https://discourse.julialang.org/u/chkat)\
**Replies:** 4\
**Last updated:** [July 22, 2024, 12:20pm UTC](https://discourse.julialang.org/t/create-a-custom-ccall/117243 "2024-07-22T12:20:54Z")

</div>

I am trying to create a macro that replaces the @ccall in my code. My idea is to create something like this: macro my\_ccall(arg) custom\_function\_before\_ccall() @ccall arg end I am having trouble with the typ…

---

## [Variable Keword arguments should be Final](https://discourse.julialang.org/t/variable-keword-arguments-should-be-final/117338)

<div class="topic-metadata">

**Author:** [@Farouk](https://discourse.julialang.org/u/Farouk)\
**Replies:** 2\
**Last updated:** [July 22, 2024, 12:05pm UTC](https://discourse.julialang.org/t/variable-keword-arguments-should-be-final/117338 "2024-07-22T12:05:40Z")

</div>

Hello, I am using Julia 1.10.4 and I am confused about the variable keyword arguments place. According to this from the docs: The nature of keyword arguments makes it possible to specify the same argument more than on…

---

## [Automatic creating of PowerPoints using Julia](https://discourse.julialang.org/t/automatic-creating-of-powerpoints-using-julia/63274)

<div class="topic-metadata">

**Author:** [@Nash](https://discourse.julialang.org/u/Nash)\
**Replies:** 3\
**Last updated:** [July 22, 2024, 4:20am UTC](https://discourse.julialang.org/t/automatic-creating-of-powerpoints-using-julia/63274 "2024-07-22T04:20:20Z")

</div>

I have data updated every month. at the end of the month, I use specific parts of that data to create tables, which I insert into a standard PowerPoint slide deck. Can I use Julia to automate such a process? If so, how? …

---

## [Vector field plotting of 2x2 matrix](https://discourse.julialang.org/t/vector-field-plotting-of-2x2-matrix/117304)

<div class="topic-metadata">

**Author:** [@Banan\_alkafri](https://discourse.julialang.org/u/Banan_alkafri)\
**Replies:** 1\
**Last updated:** [July 21, 2024, 8:30pm UTC](https://discourse.julialang.org/t/vector-field-plotting-of-2x2-matrix/117304 "2024-07-21T20:30:52Z")

</div>

I am trying to plot a vector field of a 2x2 polynomial matrix defined with DynamicPolynomials.jl. I’m trying CairoMakie but it’s not working. Can you please help me to plot it?

---

## [Specific function type](https://discourse.julialang.org/t/specific-function-type/117256)

<div class="topic-metadata">

**Author:** [@avetissargsian](https://discourse.julialang.org/u/avetissargsian)\
**Replies:** 20\
**Last updated:** [July 21, 2024, 12:15pm UTC](https://discourse.julialang.org/t/specific-function-type/117256 "2024-07-21T12:15:31Z")

</div>

Hello, I am coming from js/ts background. Can someone explain how this code would look like in Julia? Thanks :slight\_smile: function sayHello(f: (s: string) =\> string): string { return f("Hello,"); } sayHello((name: s…

---

## [Creating Julia Package Documentation](https://discourse.julialang.org/t/creating-julia-package-documentation/117296)

<div class="topic-metadata">

**Author:** [@luke98](https://discourse.julialang.org/u/luke98)\
**Replies:** 6\
**Last updated:** [July 21, 2024, 3:15pm UTC](https://discourse.julialang.org/t/creating-julia-package-documentation/117296 "2024-07-21T15:15:21Z")

</div>

Dear All, I am trying to create a website with the documentation for a Julia Package that I am helping to develop. I am using Julia 1.10 and the Documenter.jl package version v1.5.0. I am following the instructions. I …

---

## [Fast read operations from a large array of low-dimensional SVectors](https://discourse.julialang.org/t/fast-read-operations-from-a-large-array-of-low-dimensional-svectors/117264)

<div class="topic-metadata">

**Author:** [@dchatter](https://discourse.julialang.org/u/dchatter)\
**Replies:** 6\
**Last updated:** [July 20, 2024, 2:39pm UTC](https://discourse.julialang.org/t/fast-read-operations-from-a-large-array-of-low-dimensional-svectors/117264 "2024-07-20T14:39:18Z")

</div>

I am looking for a suitable data structure to store the graph of a real-valued function on a rectangular grid in d dimensions; the purpose is given below. The dimension d is at most 5, and SVectors are quite suitable. Ho…

---

## [How to create a rolling horizon approach?](https://discourse.julialang.org/t/how-to-create-a-rolling-horizon-approach/117269)

<div class="topic-metadata">

**Author:** [@Jeroen\_Schilder](https://discourse.julialang.org/u/Jeroen_Schilder)\
**Replies:** 2\
**Last updated:** [July 20, 2024, 1:20pm UTC](https://discourse.julialang.org/t/how-to-create-a-rolling-horizon-approach/117269 "2024-07-20T13:20:53Z")

</div>

Hi guys, I failed my first attempt for my bachelor thesis :frowning: , luckily I got a chance to correct my failings, and I have to give a Julia model (link below) a ‘rolling horizon approach’, where an agents optimizes …

---

## [Why \`length(2) == length(\[2\])\`?](https://discourse.julialang.org/t/why-length-2-length-2/117262)

<div class="topic-metadata">

**Author:** [@ykkan](https://discourse.julialang.org/u/ykkan)\
**Replies:** 2\
**Last updated:** [July 20, 2024, 6:16am UTC](https://discourse.julialang.org/t/why-length-2-length-2/117262 "2024-07-20T06:16:17Z")

</div>

Hi everyone, What is the idea behind that the legnth of a single number is 1 instead of 0? Does anyone know the reason for that design? On the other hand, we have length(\[:x\])==1, but when typing length(:x), we will get…

---

## [Calling Fortran shared library in Julia always returns 0.0](https://discourse.julialang.org/t/calling-fortran-shared-library-in-julia-always-returns-0-0/117239)

<div class="topic-metadata">

**Author:** [@tianyi\_zhang](https://discourse.julialang.org/u/tianyi_zhang)\
**Replies:** 4\
**Last updated:** [July 20, 2024, 2:59am UTC](https://discourse.julialang.org/t/calling-fortran-shared-library-in-julia-always-returns-0-0/117239 "2024-07-20T02:59:07Z")

</div>

Hello, everyone in the Julia discourse community, this is my first post here and I’m having a problem with calling Fortran in Julia. The Fortran code I’m calling can be downloaded here, which is a scientific code. What…

---

## [Calling julia functions from c and vice versa](https://discourse.julialang.org/t/calling-julia-functions-from-c-and-vice-versa/117254)

<div class="topic-metadata">

**Author:** [@PeterCourcoux](https://discourse.julialang.org/u/PeterCourcoux)\
**Replies:** 1\
**Last updated:** [July 19, 2024, 7:47pm UTC](https://discourse.julialang.org/t/calling-julia-functions-from-c-and-vice-versa/117254 "2024-07-19T19:47:32Z")

</div>

I’m new to both Julia and c. I hope what I’m trying to do makes sense! The general idea is to try to use the enlightenment foundation libraries (enlightenment.org) to build UI’s for julia code, so will need to call both …

---

## [Function works correctly for single file, but not in a loop?](https://discourse.julialang.org/t/function-works-correctly-for-single-file-but-not-in-a-loop/116988)

<div class="topic-metadata">

**Author:** [@GeodeticR](https://discourse.julialang.org/u/GeodeticR)\
**Replies:** 8\
**Last updated:** [July 19, 2024, 4:57pm UTC](https://discourse.julialang.org/t/function-works-correctly-for-single-file-but-not-in-a-loop/116988 "2024-07-19T16:57:34Z")

</div>

Okay, I am at a loss here. I have this loop here to skip any data that doesn’t meet a certain threshold. But what I cannot seem to figure out is why this isn’t working in the loop I have, but works fine when I enter it …

---

## [Clarification on the scope of import/using/include](https://discourse.julialang.org/t/clarification-on-the-scope-of-import-using-include/117222)

<div class="topic-metadata">

**Author:** [@Zotnam](https://discourse.julialang.org/u/Zotnam)\
**Replies:** 1\
**Last updated:** [July 19, 2024, 9:44am UTC](https://discourse.julialang.org/t/clarification-on-the-scope-of-import-using-include/117222 "2024-07-19T09:44:49Z")

</div>

Hi guys, i was trying to understand the source code of the package (conformalprediction.jl, and i have noticed something that i didn’t expect. i am quite new to julia and I thought that when i used import or using …

---

## [Why do functions like similar and copy make 2 allocations for large arrays?](https://discourse.julialang.org/t/why-do-functions-like-similar-and-copy-make-2-allocations-for-large-arrays/117217)

<div class="topic-metadata">

**Author:** [@mike1](https://discourse.julialang.org/u/mike1)\
**Replies:** 7\
**Last updated:** [July 19, 2024, 9:17am UTC](https://discourse.julialang.org/t/why-do-functions-like-similar-and-copy-make-2-allocations-for-large-arrays/117217 "2024-07-19T09:17:02Z")

</div>

Hi, Julia Community! I am trying to wrap my head around this one: Functions like similar and copy seem to make 2 allocations if the array is sufficiently large. Can you help me understand why? julia\> using BenchmarkToo…

---

## [Problem with numerical data in Arrow.jl](https://discourse.julialang.org/t/problem-with-numerical-data-in-arrow-jl/117218)

<div class="topic-metadata">

**Author:** [@Giobbe](https://discourse.julialang.org/u/Giobbe)\
**Replies:** 1\
**Last updated:** [July 19, 2024, 8:58am UTC](https://discourse.julialang.org/t/problem-with-numerical-data-in-arrow-jl/117218 "2024-07-19T08:58:56Z")

</div>

Hello to everyBody. I am trying to use Arrow.jl to store my DataFrames from a e-commerce DB and I noticed that the import function doesnt convert properly decimal values in the dataframes. I post the comparison with CS…

---

## [Reuse Compiled Code Between REPLs?](https://discourse.julialang.org/t/reuse-compiled-code-between-repls/117175)

<div class="topic-metadata">

**Author:** [@Gast](https://discourse.julialang.org/u/Gast)\
**Replies:** 10\
**Last updated:** [July 19, 2024, 6:56am UTC](https://discourse.julialang.org/t/reuse-compiled-code-between-repls/117175 "2024-07-19T06:56:31Z")

</div>

Hi all, A newbie question: Can the first-time compilation time be avoided when running the same function in different REPL sessions? Specifically, if I execute a function in the terminal REPL and then want to run the sa…

---

## [Reading Julia documentation. 1. Reassigning to \`pi\`](https://discourse.julialang.org/t/reading-julia-documentation-1-reassigning-to-pi/117016)

<div class="topic-metadata">

**Author:** [@KZiemian](https://discourse.julialang.org/u/KZiemian)\
**Replies:** 3\
**Last updated:** [July 18, 2024, 9:28pm UTC](https://discourse.julialang.org/t/reading-julia-documentation-1-reassigning-to-pi/117016 "2024-07-18T21:28:16Z")

</div>

I’m just started reading documentation of Julia and as a result I will write here some questions that are bogging me. I choose this category, because I would probably have many very basic questions. In the section on va…

---

## [ERROR: LoadError: MethodError: no method matching isnan(::Py)](https://discourse.julialang.org/t/error-loaderror-methoderror-no-method-matching-isnan-py/117063)

<div class="topic-metadata">

**Author:** [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Replies:** 11\
**Last updated:** [July 18, 2024, 3:40pm UTC](https://discourse.julialang.org/t/error-loaderror-methoderror-no-method-matching-isnan-py/117063 "2024-07-18T15:40:16Z")

</div>

I am getting error while running a local python library in julia. ERROR: LoadError: MethodError: no method matching isnan(::Py) Closest candidates are: isnan(::BigFloat) @ Base mpfr.jl:982 isnan(::Missing) @ …

---

## [Filtering dataframe for unique rows with respect one of column](https://discourse.julialang.org/t/filtering-dataframe-for-unique-rows-with-respect-one-of-column/117185)

<div class="topic-metadata">

**Author:** [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Replies:** 1\
**Last updated:** [July 18, 2024, 1:50pm UTC](https://discourse.julialang.org/t/filtering-dataframe-for-unique-rows-with-respect-one-of-column/117185 "2024-07-18T13:50:30Z")

</div>

Hello i have following DataFrame : julia\> a = DataFrame(x = \[1, 2, 2, 3, 4\], b = \[3, 4, 5, 6, 7\]) 5×2 DataFrame Row │ x b │ Int64 Int64 ─────┼────────────── 1 │ 1 3 2 │ 2 4 3…

[Previous page](https://discourse.julialang.org/c/first-steps/8.md?page=37)

[Next page](https://discourse.julialang.org/c/first-steps/8.md?page=39)
