# General Usage

**URL:** https://discourse.julialang.org/c/usage/6.md?page=630

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

**Page:** 631

---

## [ERROR: TypeError: in new, expected Float64, got a value of type ForwardDiff.Dual{Nothing,Float64,10}](https://discourse.julialang.org/t/error-typeerror-in-new-expected-float64-got-a-value-of-type-forwarddiff-dual-nothing-float64-10/56909)

<div class="topic-metadata">

**Author:** [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Replies:** 6\
**Last updated:** [March 11, 2021, 4:32pm UTC](https://discourse.julialang.org/t/error-typeerror-in-new-expected-float64-got-a-value-of-type-forwarddiff-dual-nothing-float64-10/56909 "2021-03-11T16:32:58Z")

</div>

I’m trying to solve a problem similar to the Trebuche problem using the sciml\_train diffeqflux, etc. I have a neural network married to a diffeq simulation and the neural network would ultimately condition the parameter…

---

## [External product of StaticArrays vectors](https://discourse.julialang.org/t/external-product-of-staticarrays-vectors/56955)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 2\
**Last updated:** [March 11, 2021, 3:38pm UTC](https://discourse.julialang.org/t/external-product-of-staticarrays-vectors/56955 "2021-03-11T15:38:39Z")

</div>

Hi, I have two SVector’s, and I wish to compute their external product. I have three requirements the output should be a SMatrix, the operation should be FAST (slow, I can do myself…) preferably, the output is non-mu…

---

## [How to make mutually referencial structs?](https://discourse.julialang.org/t/how-to-make-mutually-referencial-structs/56952)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 4\
**Last updated:** [March 11, 2021, 3:06pm UTC](https://discourse.julialang.org/t/how-to-make-mutually-referencial-structs/56952 "2021-03-11T15:06:31Z")

</div>

Hello, here is a MWE: mutable struct Bar{T} y::T foo end Bar(y) = Bar(y, nothing) mutable struct Foo{T, B \<: Bar} x::T bar::B end function Foo(x, bar) foo = Foo(x, bar) bar.foo = foo retur…

---

## [Is there a "native" way for me to splat all the values of the parameters of a stru](https://discourse.julialang.org/t/is-there-a-native-way-for-me-to-splat-all-the-values-of-the-parameters-of-a-stru/56951)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [March 11, 2021, 2:33pm UTC](https://discourse.julialang.org/t/is-there-a-native-way-for-me-to-splat-all-the-values-of-the-parameters-of-a-stru/56951 "2021-03-11T14:33:03Z")

</div>

is there a “native” way for me to splat all the values of the parameters of a struct? So: struct A x y z end a = A(1,2,3) a... (1,2,3) or a vector \[1,2,3\] Note that the original poster on Slack cannot see …

---

## [Not sure if I am using \`Revise\` correctly](https://discourse.julialang.org/t/not-sure-if-i-am-using-revise-correctly/56774)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 10\
**Last updated:** [March 11, 2021, 1:23pm UTC](https://discourse.julialang.org/t/not-sure-if-i-am-using-revise-correctly/56774 "2021-03-11T13:23:24Z")

</div>

I am trying to use Revise for a module mymodule defined in the file model.jl. julia\> using Revise julia\> include("model.jl"); using .mymodule if I change the file model.jl , the changes are not reflected. I imagine tha…

---

## [Excessive namespace using @reexport](https://discourse.julialang.org/t/excessive-namespace-using-reexport/56823)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 3\
**Last updated:** [March 11, 2021, 1:07pm UTC](https://discourse.julialang.org/t/excessive-namespace-using-reexport/56823 "2021-03-11T13:07:18Z")

</div>

Hi, I’m writing a module that makes use of the Distributions package. Its API has arguments that are Distribution types. So in order to be used in another environment, it is practically mandatory that the Distributions …

---

## [Randomness and reproducible results / unit tests](https://discourse.julialang.org/t/randomness-and-reproducible-results-unit-tests/56941)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 5\
**Last updated:** [March 11, 2021, 12:40pm UTC](https://discourse.julialang.org/t/randomness-and-reproducible-results-unit-tests/56941 "2021-03-11T12:40:07Z")

</div>

I wonder if this is the suggested approach if one want reproducible results / set unit tests that don’t fail because of the random component, or other approaches are favoured… using StableRNGs, Random function myAlgori…

---

## [When and How to use Types](https://discourse.julialang.org/t/when-and-how-to-use-types/56659)

<div class="topic-metadata">

**Author:** [@Ross\_Boylan](https://discourse.julialang.org/u/Ross_Boylan)\
**Replies:** 7\
**Last updated:** [March 11, 2021, 11:36am UTC](https://discourse.julialang.org/t/when-and-how-to-use-types/56659 "2021-03-11T11:36:44Z")

</div>

I have a function that depends on two integer parameters. It currently returns a function, but extensions would likely return objects whose dimensions depended on the input parameters. Naive implementation: using Spec…

---

## [Hi, quick question on using latex strings for labeling plots in PyPlot.jl: what](https://discourse.julialang.org/t/hi-quick-question-on-using-latex-strings-for-labeling-plots-in-pyplot-jl-what/56757)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 3\
**Last updated:** [March 11, 2021, 8:46am UTC](https://discourse.julialang.org/t/hi-quick-question-on-using-latex-strings-for-labeling-plots-in-pyplot-jl-what/56757 "2021-03-11T08:46:56Z")

</div>

Hi, quick question on using latex strings for labeling plots in PyPlot.jl: what would be a correct way to do in-place variable substitution? Here’s a piece of code that does not work …. ax.set\_title(L"$ $(a) $") Not…

---

## [PKG.JL error](https://discourse.julialang.org/t/pkg-jl-error/56866)

<div class="topic-metadata">

**Author:** [@baddate](https://discourse.julialang.org/u/baddate)\
**Replies:** 2\
**Last updated:** [March 10, 2021, 11:20pm UTC](https://discourse.julialang.org/t/pkg-jl-error/56866 "2021-03-10T23:20:24Z")

</div>

I want to add ‘Genie’ package, but there was an error: (@v1.5) pkg\> add Genie ERROR: The following package names could not be resolved: \* Genie (not found in project, manifest or registry) And, when i tried to update …

---

## [Is there a many to one dictionary shorthand?](https://discourse.julialang.org/t/is-there-a-many-to-one-dictionary-shorthand/56837)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 4\
**Last updated:** [March 10, 2021, 10:18pm UTC](https://discourse.julialang.org/t/is-there-a-many-to-one-dictionary-shorthand/56837 "2021-03-10T22:18:09Z")

</div>

Consider this named tuple, which could also be written as a dictionary (a = 1, b = 1, c = 2, d = 2) Is there a shorthand to group keys with the same value eg? ( (a,b) = 1, (c,d) = 2) Could use an if - in statement.…

---

## [Update Makie plot in a loop](https://discourse.julialang.org/t/update-makie-plot-in-a-loop/56911)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 6\
**Last updated:** [March 10, 2021, 9:06pm UTC](https://discourse.julialang.org/t/update-makie-plot-in-a-loop/56911 "2021-03-10T21:06:09Z")

</div>

Hi, I am looking for the equivalent of Plots.display() to update a plot in Atom Juno for example during a computation. I was suggested AbstractPlotting.inline!(false) but it did not seem to work. Thank you for your hel…

---

## [Possible bug in KrylovKit.eigsolve](https://discourse.julialang.org/t/possible-bug-in-krylovkit-eigsolve/55962)

<div class="topic-metadata">

**Author:** [@iamsuddhasattwa](https://discourse.julialang.org/u/iamsuddhasattwa)\
**Replies:** 11\
**Last updated:** [March 10, 2021, 8:36pm UTC](https://discourse.julialang.org/t/possible-bug-in-krylovkit-eigsolve/55962 "2021-03-10T20:36:06Z")

</div>

I am trying to find the first 4 eigenvalues of a symmetric 8X8 matrix, arranged in increasing order of real part. Symmetry means that the eigenvalues are real. Moreover, as you will see from the output, it is a block dia…

---

## [Help with GLM logistic regression](https://discourse.julialang.org/t/help-with-glm-logistic-regression/56899)

<div class="topic-metadata">

**Author:** [@jonjilla](https://discourse.julialang.org/u/jonjilla)\
**Replies:** 4\
**Last updated:** [March 10, 2021, 7:01pm UTC](https://discourse.julialang.org/t/help-with-glm-logistic-regression/56899 "2021-03-10T19:01:21Z")

</div>

Can someone help me with using GLM for logistic regression. I’m testing this out on the iris dataset. using RDatasets iris = dataset("datasets","iris") I’ve worked with this before and know that the PetalLength is a …

---

## [Precompilation conflicts between Symbolics and ModelingToolkit while installing DifferentialEquations](https://discourse.julialang.org/t/precompilation-conflicts-between-symbolics-and-modelingtoolkit-while-installing-differentialequations/56869)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 2\
**Last updated:** [March 10, 2021, 5:50pm UTC](https://discourse.julialang.org/t/precompilation-conflicts-between-symbolics-and-modelingtoolkit-while-installing-differentialequations/56869 "2021-03-10T17:50:36Z")

</div>

While precompiling DifferentialEquations in a new environment, I encounter the following warnings: (NewEnv) pkg\> add DifferentialEquations Resolving package versions... Updating \`~/NewEnv/Project.toml\` \[0c46a032\] + …

---

## [Hot restart of the main loop when the source code changes](https://discourse.julialang.org/t/hot-restart-of-the-main-loop-when-the-source-code-changes/38840)

<div class="topic-metadata">

**Author:** [@waralex](https://discourse.julialang.org/u/waralex)\
**Replies:** 5\
**Last updated:** [March 10, 2021, 5:43pm UTC](https://discourse.julialang.org/t/hot-restart-of-the-main-loop-when-the-source-code-changes/38840 "2021-03-10T17:43:30Z")

</div>

Hi, everybody! I’m currently working on the Julia backend for Plotly Dash and I’m faced with the following task. In Python and R, Dash has the following feature: if the server is running in debug mode, changes to the ap…

---

## [SharedArray undefined on worker](https://discourse.julialang.org/t/sharedarray-undefined-on-worker/36926)

<div class="topic-metadata">

**Author:** [@Paul\_McVay](https://discourse.julialang.org/u/Paul_McVay)\
**Replies:** 7\
**Last updated:** [March 10, 2021, 3:57pm UTC](https://discourse.julialang.org/t/sharedarray-undefined-on-worker/36926 "2021-03-10T15:57:38Z")

</div>

I have what I thought was a really basic usage of SharedArrays. But it says the array is undefined on the worker processes and I have no idea why it would be. I have the following code in a file “test.jl”. I run it with j…

---

## [Why is this a matching error?](https://discourse.julialang.org/t/why-is-this-a-matching-error/56882)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 4\
**Last updated:** [March 10, 2021, 2:14pm UTC](https://discourse.julialang.org/t/why-is-this-a-matching-error/56882 "2021-03-10T14:14:08Z")

</div>

Hi, I’m facing this matching error but I simply don’t see why this is not matching… pull!(item, item2 =\> 10) MethodError: no method matching pull!(::Item{Float64,Dirac{Float64},linear\_holding\_cost{Float64}}, ::Pair{Ite…

---

## [Where is lufact()?](https://discourse.julialang.org/t/where-is-lufact/56881)

<div class="topic-metadata">

**Author:** [@compleat](https://discourse.julialang.org/u/compleat)\
**Replies:** 4\
**Last updated:** [March 10, 2021, 1:59pm UTC](https://discourse.julialang.org/t/where-is-lufact/56881 "2021-03-10T13:59:49Z")

</div>

Hi All. Apologies for this, but after 2 years of Julia usage, I still feel like a ‘newbie’ sometimes. I see reference all over the place to ‘lufact()’ but I have tried adding package after package (LinearAlgebra, LinAl…

---

## [How do I use symbolic variables with Unitful?](https://discourse.julialang.org/t/how-do-i-use-symbolic-variables-with-unitful/56420)

<div class="topic-metadata">

**Author:** [@NightMachinary](https://discourse.julialang.org/u/NightMachinary)\
**Replies:** 8\
**Last updated:** [March 10, 2021, 10:05am UTC](https://discourse.julialang.org/t/how-do-i-use-symbolic-variables-with-unitful/56420 "2021-03-10T10:05:15Z")

</div>

I am trying to do some basic Physics problems using Julia. I have had some success using Unitful, but I do not know how I can solve problems for general parameters (i.e., get a closed form of the solution in terms of the…

---

## [Check gpu availability on a non-gpu machine with CUDA.jl](https://discourse.julialang.org/t/check-gpu-availability-on-a-non-gpu-machine-with-cuda-jl/56862)

<div class="topic-metadata">

**Author:** [@kadir-gunel](https://discourse.julialang.org/u/kadir-gunel)\
**Replies:** 1\
**Last updated:** [March 10, 2021, 9:23am UTC](https://discourse.julialang.org/t/check-gpu-availability-on-a-non-gpu-machine-with-cuda-jl/56862 "2021-03-10T09:23:09Z")

</div>

Hello, I need to check the availability of the gpu on the machine - if exists one. How do we check it ? using CUDA CUDA.deviceid() != - 1 ? CuArray : Array But this seems not working with a gpuless computer - the co…

---

## [Creation of range along given dimension](https://discourse.julialang.org/t/creation-of-range-along-given-dimension/56747)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 5\
**Last updated:** [March 10, 2021, 9:13am UTC](https://discourse.julialang.org/t/creation-of-range-along-given-dimension/56747 "2021-03-10T09:13:42Z")

</div>

I currently have to handle multi-dimensional data, where I have to compute several broadcasting operations with ranges. In 2D I use e.g (1:10) .\* (1:5)' which gives a nice matrix. The first vector is of type UnitRange…

---

## [Finding the mean value of subsets of an array](https://discourse.julialang.org/t/finding-the-mean-value-of-subsets-of-an-array/56848)

<div class="topic-metadata">

**Author:** [@EmadMasroor](https://discourse.julialang.org/u/EmadMasroor)\
**Replies:** 4\
**Last updated:** [March 10, 2021, 5:37am UTC](https://discourse.julialang.org/t/finding-the-mean-value-of-subsets-of-an-array/56848 "2021-03-10T05:37:16Z")

</div>

Hello, I am trying to take the mean value of a grid of subregions of an image. The images are from a video, hence the using VideoIO. My question does not actually depend on video-reading functionality using VideoIO fun…

---

## [How to write a macro whose generated code depends on a runtime expression?](https://discourse.julialang.org/t/how-to-write-a-macro-whose-generated-code-depends-on-a-runtime-expression/56635)

<div class="topic-metadata">

**Author:** [@marty0801](https://discourse.julialang.org/u/marty0801)\
**Replies:** 4\
**Last updated:** [March 10, 2021, 1:31am UTC](https://discourse.julialang.org/t/how-to-write-a-macro-whose-generated-code-depends-on-a-runtime-expression/56635 "2021-03-10T01:31:55Z")

</div>

I want to define several structs having nearly identical bodies, and avoid repetitive coding using macros. Example: The As have identical bodies; B adds a single field. struct A1 a::Int end struct A2 a::Int end…

---

## [The max matrix of two matrices](https://discourse.julialang.org/t/the-max-matrix-of-two-matrices/56841)

<div class="topic-metadata">

**Author:** [@Oko](https://discourse.julialang.org/u/Oko)\
**Replies:** 2\
**Last updated:** [March 10, 2021, 1:27am UTC](https://discourse.julialang.org/t/the-max-matrix-of-two-matrices/56841 "2021-03-10T01:27:18Z")

</div>

If I have two N-by-N matrices A and B, how can I find the N-by-N matrix C such that its (m,n)th element is the max of the (m,n)th element in A and the (m,n)th element in B? What would be the simplest way to get the outpu…

---

## [Getting the third Friday of the month](https://discourse.julialang.org/t/getting-the-third-friday-of-the-month/56787)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 8\
**Last updated:** [March 10, 2021, 12:28am UTC](https://discourse.julialang.org/t/getting-the-third-friday-of-the-month/56787 "2021-03-10T00:28:51Z")

</div>

Given a particular month, I need to find the third Friday of that month. I just found out that there is a function called dayofweekofmonth which basically does the reverse of what I want. You give it a date and it tells …

---

## [Permutations of a vector that retain the vector "structure"](https://discourse.julialang.org/t/permutations-of-a-vector-that-retain-the-vector-structure/56790)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 6\
**Last updated:** [March 10, 2021, 12:16am UTC](https://discourse.julialang.org/t/permutations-of-a-vector-that-retain-the-vector-structure/56790 "2021-03-10T00:16:24Z")

</div>

Is there a built-in function that returns the permutations of a vector that are based on the unique elements of the vector, i.e. where the “structure” of the vector is retained ? For example given y = \["a","a","a","b","…

---

## [I noticed two packages \`IntervalSets\` and \`Intervals\` that do the same thing, and](https://discourse.julialang.org/t/i-noticed-two-packages-intervalsets-and-intervals-that-do-the-same-thing-and/56824)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [March 9, 2021, 10:37pm UTC](https://discourse.julialang.org/t/i-noticed-two-packages-intervalsets-and-intervals-that-do-the-same-thing-and/56824 "2021-03-09T22:37:49Z")

</div>

I noticed two packages IntervalSets and Intervals that do the same thing, and both have a similar number of transitive dependents: https://juliahub.com/ui/Packages/IntervalSets/2FHuv/0.5.2 and https://juliahub.com/ui/Pac…

---

## [Generating Custom Structs](https://discourse.julialang.org/t/generating-custom-structs/56768)

<div class="topic-metadata">

**Author:** [@olynch](https://discourse.julialang.org/u/olynch)\
**Replies:** 13\
**Last updated:** [March 9, 2021, 10:26pm UTC](https://discourse.julialang.org/t/generating-custom-structs/56768 "2021-03-09T22:26:15Z")

</div>

For a variety of reasons, it would be very useful for several projects within AlgebraicJulia · GitHub to generate struct definitions based on values that are only present at run time. Essentially, we are working with “s…

---

## [MethodError no method matching and no hints either](https://discourse.julialang.org/t/methoderror-no-method-matching-and-no-hints-either/56772)

<div class="topic-metadata">

**Author:** [@Paht\_J](https://discourse.julialang.org/u/Paht_J)\
**Replies:** 8\
**Last updated:** [March 9, 2021, 8:28pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-and-no-hints-either/56772 "2021-03-09T20:28:17Z")

</div>

Usually when Julia gives me a hint as to what types I should use. But in this case, it isn’t giving me any useful hints. Plot3D.jl ## Code dealing with Blocks @with\_kw struct Block IMAX::Int64 …

[Previous page](https://discourse.julialang.org/c/usage/6.md?page=629)

[Next page](https://discourse.julialang.org/c/usage/6.md?page=631)
