# New to Julia

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

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

**Page:** 64

---

## [Efficient Broadcasting in Julia: CartesianIndex vs. Reshape](https://discourse.julialang.org/t/efficient-broadcasting-in-julia-cartesianindex-vs-reshape/106929)

<div class="topic-metadata">

**Author:** [@swanchristmas](https://discourse.julialang.org/u/swanchristmas)\
**Replies:** 1\
**Last updated:** [November 30, 2023, 8:12am UTC](https://discourse.julialang.org/t/efficient-broadcasting-in-julia-cartesianindex-vs-reshape/106929 "2023-11-30T08:12:22Z")

</div>

I came across a discussion post on using \[CartesianIndex()\] for singleton insertion in Julia arrays. Intrigued by potential performance differences, I conducted a benchmark comparing it with the reshape method. Benchmar…

---

## [Return (1,), what is the meaning?](https://discourse.julialang.org/t/return-1-what-is-the-meaning/106924)

<div class="topic-metadata">

**Author:** [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Replies:** 2\
**Last updated:** [November 30, 2023, 3:25am UTC](https://discourse.julialang.org/t/return-1-what-is-the-meaning/106924 "2023-11-30T03:25:16Z")

</div>

I am new to Julia. The following code is from some people’s package: function apply\_column!(::IsDeterministic, w, op::AbstractMatrix, add, val, boost=1) w .+= op\[:, add\] .\* val return (1,) end What does return (…

---

## [Getting precompilation error for SymPy](https://discourse.julialang.org/t/getting-precompilation-error-for-sympy/106899)

<div class="topic-metadata">

**Author:** [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Replies:** 1\
**Last updated:** [November 29, 2023, 7:10pm UTC](https://discourse.julialang.org/t/getting-precompilation-error-for-sympy/106899 "2023-11-29T19:10:51Z")

</div>

I’m getting this error while trying to precompile SymPy \[ Info: Precompiling SymPy \[24249f21-da20-56a4-8eb1-6a02cf4ae2e6\] Python path configuration: PYTHONHOME = '/Users/sahil.khan/.julia/conda/3:/Users/sahil.khan/.ju…

---

## [Installation or guidance](https://discourse.julialang.org/t/installation-or-guidance/106911)

<div class="topic-metadata">

**Author:** [@Stayal](https://discourse.julialang.org/u/Stayal)\
**Replies:** 1\
**Last updated:** [November 29, 2023, 6:49pm UTC](https://discourse.julialang.org/t/installation-or-guidance/106911 "2023-11-29T18:49:55Z")

</div>

Hello everyone I am Shivangi Tayal, beginner on Julia and Gridap. I want to use Gridap for writting codes for Finite Element Method. Please guide me on installation process (or tell me where I have to install it Linux o…

---

## [Still do not understand difference between diagonal and scalar noise](https://discourse.julialang.org/t/still-do-not-understand-difference-between-diagonal-and-scalar-noise/106860)

<div class="topic-metadata">

**Author:** [@acubed](https://discourse.julialang.org/u/acubed)\
**Replies:** 2\
**Last updated:** [November 29, 2023, 6:14pm UTC](https://discourse.julialang.org/t/still-do-not-understand-difference-between-diagonal-and-scalar-noise/106860 "2023-11-29T18:14:16Z")

</div>

I have system of N coupled stochastic differential equations, that looks like \\displaystyle\\frac{du\_i}{dt}=F(u\_i)+\\eta\_i here F is the function that mixes u\_i with u\_j. The quantity \\eta\_i is so-called white noise with…

---

## [Plotting daily death using Makie](https://discourse.julialang.org/t/plotting-daily-death-using-makie/106895)

<div class="topic-metadata">

**Author:** [@Chao](https://discourse.julialang.org/u/Chao)\
**Replies:** 5\
**Last updated:** [November 29, 2023, 1:09pm UTC](https://discourse.julialang.org/t/plotting-daily-death-using-makie/106895 "2023-11-29T13:09:48Z")

</div>

Hello, I am plotting the daily new death per day. It should be a line, but it looks strange. Here are my codes: # read the data covid\_death = filter(row -\> row.location == "Germany" && row.date \>= Date(2020, 6, 1) &&…

---

## [Can't take a gradient using Symbolic vector](https://discourse.julialang.org/t/cant-take-a-gradient-using-symbolic-vector/106867)

<div class="topic-metadata">

**Author:** [@Cade\_Armstrong](https://discourse.julialang.org/u/Cade_Armstrong)\
**Replies:** 9\
**Last updated:** [November 29, 2023, 12:07am UTC](https://discourse.julialang.org/t/cant-take-a-gradient-using-symbolic-vector/106867 "2023-11-29T00:07:30Z")

</div>

I’m running into some trouble when taking a gradient of a symbolic function using a symbolic vector. using Symbolics @variables x\[1:2\] xₒ = \[1;1\] f = (x\[1\] + 2\*x\[2\])^3 f\_fun = build\_function(f, x) vals = eval(f\_fun…

---

## [Function definition with parametric types](https://discourse.julialang.org/t/function-definition-with-parametric-types/106830)

<div class="topic-metadata">

**Author:** [@oliviermilla](https://discourse.julialang.org/u/oliviermilla)\
**Replies:** 3\
**Last updated:** [November 28, 2023, 10:11am UTC](https://discourse.julialang.org/t/function-definition-with-parametric-types/106830 "2023-11-28T10:11:28Z")

</div>

Hello, It’s a basic question, but it’s still unclear to me. What are the functional differences between the function definitions below? struct A{T} end func(a::A) = #code func(a\<:A) = #code func(a::A{T}) where {T} =…

---

## [Scope Issues of Exported Functions in Module](https://discourse.julialang.org/t/scope-issues-of-exported-functions-in-module/106784)

<div class="topic-metadata">

**Author:** [@Ian\_Harreschou](https://discourse.julialang.org/u/Ian_Harreschou)\
**Replies:** 9\
**Last updated:** [November 28, 2023, 12:44am UTC](https://discourse.julialang.org/t/scope-issues-of-exported-functions-in-module/106784 "2023-11-28T00:44:01Z")

</div>

Probably a basic question and answer I am searching for here, but I am trying to get into package development and it has been quite difficult. This time around, I have made much more progress, but just ran into issues wi…

---

## [Prime number hunting](https://discourse.julialang.org/t/prime-number-hunting/106771)

<div class="topic-metadata">

**Author:** [@Loves\_Reddit](https://discourse.julialang.org/u/Loves_Reddit)\
**Replies:** 2\
**Last updated:** [November 27, 2023, 10:16pm UTC](https://discourse.julialang.org/t/prime-number-hunting/106771 "2023-11-27T22:16:38Z")

</div>

Hello are there any Julia programs for prime number hunting similar to GIMPS?

---

## [Can I create a reference to a section of a matrix without copying its elements?](https://discourse.julialang.org/t/can-i-create-a-reference-to-a-section-of-a-matrix-without-copying-its-elements/106813)

<div class="topic-metadata">

**Author:** [@Bottom](https://discourse.julialang.org/u/Bottom)\
**Replies:** 3\
**Last updated:** [November 27, 2023, 8:01pm UTC](https://discourse.julialang.org/t/can-i-create-a-reference-to-a-section-of-a-matrix-without-copying-its-elements/106813 "2023-11-27T20:01:24Z")

</div>

In my code I have some 3D matrices M\[m,i,j\] where I iterate much less frequent over the first index (m: timestep) than over the other two (i,j: spatial discretization). I would like to have an alias for M\[m, :, :\] so I c…

---

## [Failure to precompile Plots.jl in Linux](https://discourse.julialang.org/t/failure-to-precompile-plots-jl-in-linux/106608)

<div class="topic-metadata">

**Author:** [@Fengyu](https://discourse.julialang.org/u/Fengyu)\
**Replies:** 4\
**Last updated:** [November 27, 2023, 7:31pm UTC](https://discourse.julialang.org/t/failure-to-precompile-plots-jl-in-linux/106608 "2023-11-27T19:31:43Z")

</div>

Hi, I have trouble to precompile Plots.jl in Linux. I looked through a couple of similar questions but my problem still can not be solved. Any help will be appreciated. Below is the error msg and environment info: julia\>…

---

## [What is the the Julian way to find out how to subset an arbitrary object?](https://discourse.julialang.org/t/what-is-the-the-julian-way-to-find-out-how-to-subset-an-arbitrary-object/106807)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 4\
**Last updated:** [November 27, 2023, 4:18pm UTC](https://discourse.julialang.org/t/what-is-the-the-julian-way-to-find-out-how-to-subset-an-arbitrary-object/106807 "2023-11-27T16:18:12Z")

</div>

This is basically a followup to my earlier question, since perhaps the title ended up being misleading: The FastAI package has objects called “Learner”. Is there some standard way to investigate what is in these beside…

---

## [Using @eval with zipped pair of Symbols](https://discourse.julialang.org/t/using-eval-with-zipped-pair-of-symbols/106787)

<div class="topic-metadata">

**Author:** [@Daptine](https://discourse.julialang.org/u/Daptine)\
**Replies:** 3\
**Last updated:** [November 27, 2023, 7:33am UTC](https://discourse.julialang.org/t/using-eval-with-zipped-pair-of-symbols/106787 "2023-11-27T07:33:22Z")

</div>

f1(x) = x+1 f2(x) = x+2 for (t, op) in zip((:Int, :Float64),(:f1, :f2)) print(t, " ", op, "\\n") @eval begin f3($op) = begin println($t) println($op) x -\> $t($op(x) + 3) end end end f3…

---

## [Missing shared library file when pre-compiling](https://discourse.julialang.org/t/missing-shared-library-file-when-pre-compiling/104575)

<div class="topic-metadata">

**Author:** [@acnash](https://discourse.julialang.org/u/acnash)\
**Replies:** 12\
**Last updated:** [November 26, 2023, 6:26pm UTC](https://discourse.julialang.org/t/missing-shared-library-file-when-pre-compiling/104575 "2023-11-26T18:26:13Z")

</div>

Hi all, I’m new to Julia but “old” regarding software development. I’m trying to add the package BlackBoxOptim for some Julia code, but I’m having problems finding a shared C library file, “libmbedtls.so”. As far as I’m…

---

## [Import struct without changing its "scope"](https://discourse.julialang.org/t/import-struct-without-changing-its-scope/106529)

<div class="topic-metadata">

**Author:** [@Yue-Zhengyuan](https://discourse.julialang.org/u/Yue-Zhengyuan)\
**Replies:** 7\
**Last updated:** [November 22, 2023, 4:50am UTC](https://discourse.julialang.org/t/import-struct-without-changing-its-scope/106529 "2023-11-22T04:50:21Z")

</div>

I have problems on importing struct from other files. Suppose I have the file structure: - Lattices.jl - Hamiltonians.jl - main.jl Lattices.jl defines a struct called Lattice: module Lattices export Lattice struct La…

---

## [DimensionMismatch: matrix A has dimensions (100,10), matrix B has dimensions (1,7)](https://discourse.julialang.org/t/dimensionmismatch-matrix-a-has-dimensions-100-10-matrix-b-has-dimensions-1-7/106528)

<div class="topic-metadata">

**Author:** [@SimonHubert](https://discourse.julialang.org/u/SimonHubert)\
**Replies:** 5\
**Last updated:** [November 25, 2023, 11:17pm UTC](https://discourse.julialang.org/t/dimensionmismatch-matrix-a-has-dimensions-100-10-matrix-b-has-dimensions-1-7/106528 "2023-11-25T23:17:18Z")

</div>

Hello I have this problem with my neural network. I want to classify a 7 segment led digits. Problem is i get this error: DimensionMismatch: matrix A has dimensions (100,10), matrix B has dimensions (1,7) 1. \<mark\>\*\*\_…

---

## [Calling f(a) = f(a) correctly gives StackOverflowError but not f(a...) = f(a)](https://discourse.julialang.org/t/calling-f-a-f-a-correctly-gives-stackoverflowerror-but-not-f-a-f-a/106692)

<div class="topic-metadata">

**Author:** [@sadish-d](https://discourse.julialang.org/u/sadish-d)\
**Replies:** 17\
**Last updated:** [November 25, 2023, 4:53am UTC](https://discourse.julialang.org/t/calling-f-a-f-a-correctly-gives-stackoverflowerror-but-not-f-a-f-a/106692 "2023-11-25T04:53:34Z")

</div>

I start with this: VERSION == v"1.9.0" f(a::Int64) = nothing Now, If I define this method and call f(1.), I get a StackOverflowError. Makes sense.: f(a) = f(a) @code\_lowered f(1.) # CodeInfo( # 1 ─ %1 = Main.f(a) # └─…

---

## [Doubt in the 7 - Gridap Darcy Equation Tutorial](https://discourse.julialang.org/t/doubt-in-the-7-gridap-darcy-equation-tutorial/106673)

<div class="topic-metadata">

**Author:** [@pablorubial](https://discourse.julialang.org/u/pablorubial)\
**Replies:** 1\
**Last updated:** [November 24, 2023, 6:10pm UTC](https://discourse.julialang.org/t/doubt-in-the-7-gridap-darcy-equation-tutorial/106673 "2023-11-24T18:10:59Z")

</div>

Hi everyone, I’m new on Julia and I have two doubts about how Julian works: In this tutorial a function is defined to define differents properties in different parts of the domain: function σ(x,u) if ((abs(x\[1\]-0.5) \<…

---

## [Understanding allocations - function returned by function](https://discourse.julialang.org/t/understanding-allocations-function-returned-by-function/106661)

<div class="topic-metadata">

**Author:** [@ysfoo](https://discourse.julialang.org/u/ysfoo)\
**Replies:** 1\
**Last updated:** [November 24, 2023, 6:50am UTC](https://discourse.julialang.org/t/understanding-allocations-function-returned-by-function/106661 "2023-11-24T06:50:59Z")

</div>

I’m trying to understand why executing a function that has been created by a function causes extra allocations. Example: # 2 allocations function make\_func() function my\_func(x) val = 1.23 return val + x end retu…

---

## [How to make PrettyPrint print arrays with fewer rows & columns](https://discourse.julialang.org/t/how-to-make-prettyprint-print-arrays-with-fewer-rows-columns/106613)

<div class="topic-metadata">

**Author:** [@jinfreedom](https://discourse.julialang.org/u/jinfreedom)\
**Replies:** 4\
**Last updated:** [November 24, 2023, 1:37am UTC](https://discourse.julialang.org/t/how-to-make-prettyprint-print-arrays-with-fewer-rows-columns/106613 "2023-11-24T01:37:29Z")

</div>

Currently PrettyPrinting.jl prints an array in the REPL like this julia\> pprint(zeros(100,50)) \[0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0…

---

## [Parallel computing and GPU support in neuralPDE.jl package](https://discourse.julialang.org/t/parallel-computing-and-gpu-support-in-neuralpde-jl-package/104976)

<div class="topic-metadata">

**Author:** [@Aakhash\_Sundaresan](https://discourse.julialang.org/u/Aakhash_Sundaresan)\
**Replies:** 49\
**Last updated:** [November 22, 2023, 11:39am UTC](https://discourse.julialang.org/t/parallel-computing-and-gpu-support-in-neuralpde-jl-package/104976 "2023-11-22T11:39:30Z")

</div>

I’m actually trying to use the NeuralPDE.jl package for solving a system of PDE’s. I dont know for some reason the performance is massively slow for a neural network of size 30 neurons with 3 HL and 9 such individual net…

---

## [How to dispatch on a type alias?](https://discourse.julialang.org/t/how-to-dispatch-on-a-type-alias/106476)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 39\
**Last updated:** [November 22, 2023, 8:11am UTC](https://discourse.julialang.org/t/how-to-dispatch-on-a-type-alias/106476 "2023-11-22T08:11:46Z")

</div>

I have trouble implementing the dispatch I want using type aliases. I want to dispatch on Type{A{T1,B{T3}}} where {T1,T3}, but i do not find the right syntax. I currently have something that looks like : struct A{T1,T2}…

---

## [Symbolic integration](https://discourse.julialang.org/t/symbolic-integration/32869)

<div class="topic-metadata">

**Author:** [@Stephen](https://discourse.julialang.org/u/Stephen)\
**Replies:** 12\
**Last updated:** [November 22, 2023, 6:12am UTC](https://discourse.julialang.org/t/symbolic-integration/32869 "2023-11-22T06:12:37Z")

</div>

Is there any recommend package to compute the integration of following？

---

## [How to run julia notebooks on cluster computers?](https://discourse.julialang.org/t/how-to-run-julia-notebooks-on-cluster-computers/75277)

<div class="topic-metadata">

**Author:** [@pafloxy](https://discourse.julialang.org/u/pafloxy)\
**Replies:** 8\
**Last updated:** [May 15, 2022, 9:29pm UTC](https://discourse.julialang.org/t/how-to-run-julia-notebooks-on-cluster-computers/75277 "2022-05-15T21:29:48Z")

</div>

Hi! I write most of the code in Jupyter notebooks or in Pluto notebooks, however recently I have been asked to shift to cluster computers, However I am unaware of how exactly or even if it is possible to run code written…

---

## [Occasionally NaNs when using similar()](https://discourse.julialang.org/t/occasionally-nans-when-using-similar/48224)

<div class="topic-metadata">

**Author:** [@lineycroc](https://discourse.julialang.org/u/lineycroc)\
**Replies:** 37\
**Last updated:** [November 21, 2023, 8:24pm UTC](https://discourse.julialang.org/t/occasionally-nans-when-using-similar/48224 "2023-11-21T20:24:49Z")

</div>

I am occasionally (but not always!) getting NaNs when using the similar command on a Float array. Here is a MME: using Random: seed! function run\_weird\_test() seed!(0) # this really shouldn't do anything... but here…

---

## [Is Julia worth it for this project?](https://discourse.julialang.org/t/is-julia-worth-it-for-this-project/106483)

<div class="topic-metadata">

**Author:** [@Mathis](https://discourse.julialang.org/u/Mathis)\
**Replies:** 8\
**Last updated:** [November 21, 2023, 4:20pm UTC](https://discourse.julialang.org/t/is-julia-worth-it-for-this-project/106483 "2023-11-21T16:20:14Z")

</div>

Hi, I am in the process of building a browser game that essentially mimics the Football Manager game from Sports Interactive. The simulation in the original Football Manager game involves managing a football team by mak…

---

## [Using @turbo and remaining agnostic about variable names](https://discourse.julialang.org/t/using-turbo-and-remaining-agnostic-about-variable-names/106533)

<div class="topic-metadata">

**Author:** [@ditfurth](https://discourse.julialang.org/u/ditfurth)\
**Replies:** 1\
**Last updated:** [November 21, 2023, 3:33pm UTC](https://discourse.julialang.org/t/using-turbo-and-remaining-agnostic-about-variable-names/106533 "2023-11-21T15:33:49Z")

</div>

Hi all, right now, I specify the variables: @turbo for j in axes(delta, 1), k in axes(delta, 2) delta\[j, k\] += exp(nu\_alpha\[k\] + price\[j\]\*nu\_p\[k\] + x\_j\[j\]\*nu\_xj\[k\] + x\_r\[j\]\*nu\_xr\[k\] + x\_m\[j\]\*nu\_xm\[k\] +xi\[j\]) …

---

## [Implementing the Learn rate scheduling in the NeuralPDE julia package](https://discourse.julialang.org/t/implementing-the-learn-rate-scheduling-in-the-neuralpde-julia-package/106500)

<div class="topic-metadata">

**Author:** [@Aakhash\_Sundaresan](https://discourse.julialang.org/u/Aakhash_Sundaresan)\
**Replies:** 5\
**Last updated:** [November 21, 2023, 1:27pm UTC](https://discourse.julialang.org/t/implementing-the-learn-rate-scheduling-in-the-neuralpde-julia-package/106500 "2023-11-21T13:27:10Z")

</div>

Hi eveyone, I have a query regarding the implementation of the learn rate scheduling in the NeuralPDE frmework during training. I want to progressively reduce the learning rate of the ADAM optimizer using a decay factor.…

---

## [ERROR: LoadError: EOFError: read end of file](https://discourse.julialang.org/t/error-loaderror-eoferror-read-end-of-file/106472)

<div class="topic-metadata">

**Author:** [@fathanbk](https://discourse.julialang.org/u/fathanbk)\
**Replies:** 9\
**Last updated:** [November 21, 2023, 3:53am UTC](https://discourse.julialang.org/t/error-loaderror-eoferror-read-end-of-file/106472 "2023-11-21T03:53:44Z")

</div>

I started to learn julia but i got this error when I’m trying to deserialize my file.mat

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

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