# General Usage

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

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

**Page:** 356

---

## [Why the \`sqrt(x)\` does not including the minus part?](https://discourse.julialang.org/t/why-the-sqrt-x-does-not-including-the-minus-part/91676)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 4\
**Last updated:** [December 15, 2022, 9:09am UTC](https://discourse.julialang.org/t/why-the-sqrt-x-does-not-including-the-minus-part/91676 "2022-12-15T09:09:55Z")

</div>

HI all, I try this: sqrt(1) why it only returns 1.0 not +1 and -1 ? How to get all the roots? Which packages to use? Thanks.

---

## [Using LsqFit on complex data](https://discourse.julialang.org/t/using-lsqfit-on-complex-data/79620)

<div class="topic-metadata">

**Author:** [@PazzyBoardman449](https://discourse.julialang.org/u/PazzyBoardman449)\
**Replies:** 7\
**Last updated:** [December 15, 2022, 7:32am UTC](https://discourse.julialang.org/t/using-lsqfit-on-complex-data/79620 "2022-12-15T07:32:30Z")

</div>

I’m trying to use LsqFit.jl to fit data that is complex (in the form x + im\*y). For purposes of showing the problem, I’m using the example provided on GitHub for LsqFit but I’m changing the model such that it has an imag…

---

## [How to Simplify Symbolic Calculations with SymPy (A+B)(A-B) = A^{2} - B^{2}](https://discourse.julialang.org/t/how-to-simplify-symbolic-calculations-with-sympy-a-b-a-b-a-2-b-2/91680)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [December 15, 2022, 7:27am UTC](https://discourse.julialang.org/t/how-to-simplify-symbolic-calculations-with-sympy-a-b-a-b-a-2-b-2/91680 "2022-12-15T07:27:45Z")

</div>

Hi all, I have this integral with Mean Value Theorem to find value of c: \\frac{\\int\_{A}^{B} (ax+b) \\ dx}{B-A} = f(c) with f(c) = ac+b then I use this code: using SymPy x, a, b = symbols("x a b") A, B = symbols("A…

---

## [Can Gnuplot Made by Lazarus Plot 3D surface along with its orthogonal line in Julia?](https://discourse.julialang.org/t/can-gnuplot-made-by-lazarus-plot-3d-surface-along-with-its-orthogonal-line-in-julia/91429)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 4\
**Last updated:** [December 15, 2022, 7:06am UTC](https://discourse.julialang.org/t/can-gnuplot-made-by-lazarus-plot-3d-surface-along-with-its-orthogonal-line-in-julia/91429 "2022-12-15T07:06:30Z")

</div>

I have been looking how to create this: Then saw this link: and this discussion: I tried with LazySets to create without the plane: using LazySets, LaTeXStrings using Plots: plot, plot!, text, lens!, bbox gr() …

---

## [How to Use SymPy to calculate Definite Integrals with Symbols of Constant?](https://discourse.julialang.org/t/how-to-use-sympy-to-calculate-definite-integrals-with-symbols-of-constant/91673)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [December 15, 2022, 6:58am UTC](https://discourse.julialang.org/t/how-to-use-sympy-to-calculate-definite-integrals-with-symbols-of-constant/91673 "2022-12-15T06:58:21Z")

</div>

Hi all, I am using SymPy to try calculate this \\int\_{A}^{B} ax+b \\ dx the function f(x) = ax+b where a and b are constant in symbolics. The integral is definite but, the interval of the integral is in symbolics too A …

---

## [How to Use SymPy to calculate definite integral for Absolute value function / |x|?](https://discourse.julialang.org/t/how-to-use-sympy-to-calculate-definite-integral-for-absolute-value-function-x/91674)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 1\
**Last updated:** [December 15, 2022, 6:51am UTC](https://discourse.julialang.org/t/how-to-use-sympy-to-calculate-definite-integral-for-absolute-value-function-x/91674 "2022-12-15T06:51:26Z")

</div>

Hi all, another integral problem, I thought this could be done to calculate the simple: \\int\_{-2}^{2} |x| \\ dx with this code: x = symbols("x") f(x) = abs(x) integrate(f, (x, -2, 2)) The errors: LoadError: Method…

---

## [Creating an animation with data from dataframe using GLMakie?](https://discourse.julialang.org/t/creating-an-animation-with-data-from-dataframe-using-glmakie/91627)

<div class="topic-metadata">

**Author:** [@rud-lucien](https://discourse.julialang.org/u/rud-lucien)\
**Replies:** 5\
**Last updated:** [December 15, 2022, 1:47am UTC](https://discourse.julialang.org/t/creating-an-animation-with-data-from-dataframe-using-glmakie/91627 "2022-12-15T01:47:13Z")

</div>

Hi, Hoping to get some help figuring how to create an animation in Makie using data from a DataFrame. Specifically I was trying to animate a point moving through a line using the scatter function. Below is about as far …

---

## [How can I declare a function in a module for the sole purpose of being extended by users?](https://discourse.julialang.org/t/how-can-i-declare-a-function-in-a-module-for-the-sole-purpose-of-being-extended-by-users/91661)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 1\
**Last updated:** [December 15, 2022, 12:07am UTC](https://discourse.julialang.org/t/how-can-i-declare-a-function-in-a-module-for-the-sole-purpose-of-being-extended-by-users/91661 "2022-12-15T00:07:33Z")

</div>

Suppose I have such a module module Foo abstract type Bar end function do\_something(bar::Bar) bar\_prepared = prepare(bar) "do something" end end My intention for the user is that the user will define a concr…

---

## [How can I call Julia's StaticArrays.SMatrix from Python](https://discourse.julialang.org/t/how-can-i-call-julias-staticarrays-smatrix-from-python/91660)

<div class="topic-metadata">

**Author:** [@bd1](https://discourse.julialang.org/u/bd1)\
**Replies:** 0\
**Last updated:** [December 14, 2022, 11:18pm UTC](https://discourse.julialang.org/t/how-can-i-call-julias-staticarrays-smatrix-from-python/91660 "2022-12-14T23:18:34Z")

</div>

I am trying to run Julia code from Python using PyJulia. I am confused about how should I run mat = SMatrix{2, 2}(\[1 2; 3 4\]) in Python? I was trying from julia import StaticArrays as sa mat = sa.SMatrix{2, 2}(\[1 2; …

---

## [Function that fixes an argument of another function](https://discourse.julialang.org/t/function-that-fixes-an-argument-of-another-function/91423)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 4\
**Last updated:** [December 14, 2022, 10:46pm UTC](https://discourse.julialang.org/t/function-that-fixes-an-argument-of-another-function/91423 "2022-12-14T22:46:46Z")

</div>

I need to define a function that fixes the value of another function’s argument. One way is the following: using InvertedIndices, PreallocationTools, BenchmarkTools function construct\_fixed\_f(g, n, val, cache) new\_f…

---

## [Loading a module with Project.toml containing the name field but no uuid](https://discourse.julialang.org/t/loading-a-module-with-project-toml-containing-the-name-field-but-no-uuid/91651)

<div class="topic-metadata">

**Author:** [@Olivier\_Merchiers](https://discourse.julialang.org/u/Olivier_Merchiers)\
**Replies:** 2\
**Last updated:** [December 14, 2022, 10:13pm UTC](https://discourse.julialang.org/t/loading-a-module-with-project-toml-containing-the-name-field-but-no-uuid/91651 "2022-12-14T22:13:31Z")

</div>

Hello everyone, I’m on a constant quest to find the easiest way to load a module without using include. I discovered recently through the use of the DrWatson.jl package that you can do using MyPkg from its environment …

---

## [DataDrivenProblem strange error](https://discourse.julialang.org/t/datadrivenproblem-strange-error/91621)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 10\
**Last updated:** [December 14, 2022, 6:58pm UTC](https://discourse.julialang.org/t/datadrivenproblem-strange-error/91621 "2022-12-14T18:58:56Z")

</div>

I have come across an error when running a data fitting problem of continuous time. I have created a MWE example to demonstrate with synthetic data. While the data might not have a good fit, the error produced does not s…

---

## [Flexible design to extend or remove kwarg in functions](https://discourse.julialang.org/t/flexible-design-to-extend-or-remove-kwarg-in-functions/91644)

<div class="topic-metadata">

**Author:** [@Thomas](https://discourse.julialang.org/u/Thomas)\
**Replies:** 1\
**Last updated:** [December 14, 2022, 6:25pm UTC](https://discourse.julialang.org/t/flexible-design-to-extend-or-remove-kwarg-in-functions/91644 "2022-12-14T18:25:29Z")

</div>

Lets say I am defining outer\_func(x; verbose=true) = (y=1;inner\_func(x,y, verbose=verbose) inner\_func(x,y; verbose=false) = (z=x+y;verbose && println(z);z^2) Now I would like to add two kwargs, manually like this oute…

---

## [A fast reference implementation of a pretty projective geometric algebra](https://discourse.julialang.org/t/a-fast-reference-implementation-of-a-pretty-projective-geometric-algebra/91451)

<div class="topic-metadata">

**Author:** [@g2g](https://discourse.julialang.org/u/g2g)\
**Replies:** 18\
**Last updated:** [December 14, 2022, 5:52pm UTC](https://discourse.julialang.org/t/a-fast-reference-implementation-of-a-pretty-projective-geometric-algebra/91451 "2022-12-14T17:52:25Z")

</div>

As shown at the end of this post, I recently ported pga3d.cpp (the bivector.net C++ reference implementation of projective geometric algebra) to Julia because bivector.net does not currently offer a Julia reference imple…

---

## [Multiple tasks on GPU resulting in CUSOLVERError for large number of tasks](https://discourse.julialang.org/t/multiple-tasks-on-gpu-resulting-in-cusolvererror-for-large-number-of-tasks/91492)

<div class="topic-metadata">

**Author:** [@Eveee](https://discourse.julialang.org/u/Eveee)\
**Replies:** 4\
**Last updated:** [December 14, 2022, 5:40pm UTC](https://discourse.julialang.org/t/multiple-tasks-on-gpu-resulting-in-cusolvererror-for-large-number-of-tasks/91492 "2022-12-14T17:40:12Z")

</div>

Hi all, I am learning CUDA.jl and trying to launch a bunch of tasks in parallel on the GPU: using LinearAlgebra, Random, CUDA function do\_svd!(c,a::Any) c .= svdvals!(a); end function compute\_gpu(outputs,inputs) …

---

## [Comparing Folds/FLoop Executors](https://discourse.julialang.org/t/comparing-folds-floop-executors/91649)

<div class="topic-metadata">

**Author:** [@markowkes](https://discourse.julialang.org/u/markowkes)\
**Replies:** 0\
**Last updated:** [December 14, 2022, 5:16pm UTC](https://discourse.julialang.org/t/comparing-folds-floop-executors/91649 "2022-12-14T17:16:53Z")

</div>

I wrote the following code to test the various executors profited by Floops.jl and FoldsThreads.jl to distribute work between multiple threads. The code creates work (of various sizes) and distributes this work amongst …

---

## [Offline installation of Julia packages](https://discourse.julialang.org/t/offline-installation-of-julia-packages/20083)

<div class="topic-metadata">

**Author:** [@gdestouet](https://discourse.julialang.org/u/gdestouet)\
**Replies:** 23\
**Last updated:** [December 14, 2022, 3:52pm UTC](https://discourse.julialang.org/t/offline-installation-of-julia-packages/20083 "2022-12-14T15:52:46Z")

</div>

Hello, I need to install a bunch of packages on an offline computer ( it must be disconnected ). I didn’t found any guide that provide a clean way for installing packages offline and maybe someone could help me with th…

---

## [Propensity Score Matching](https://discourse.julialang.org/t/propensity-score-matching/54348)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 6\
**Last updated:** [December 14, 2022, 3:37pm UTC](https://discourse.julialang.org/t/propensity-score-matching/54348 "2022-12-14T15:37:54Z")

</div>

Are there any Julia packages for propensity score matching? I find the R package MatchIt too slow to use. MatchIt: Getting Started

---

## [How to save images from internet to file](https://discourse.julialang.org/t/how-to-save-images-from-internet-to-file/91639)

<div class="topic-metadata">

**Author:** [@edas](https://discourse.julialang.org/u/edas)\
**Replies:** 3\
**Last updated:** [December 14, 2022, 12:55pm UTC](https://discourse.julialang.org/t/how-to-save-images-from-internet-to-file/91639 "2022-12-14T12:55:47Z")

</div>

Hi, I want to save image from internet to file. I cannot find image related information. Below is my example to get page and extract image block. Example site is my own site, using free theme. using HTTP, Gumbo, Casc…

---

## [Duplicating integrator with KLUFactorization(; reuse\_symbolic = true)](https://discourse.julialang.org/t/duplicating-integrator-with-klufactorization-reuse-symbolic-true/91635)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 4\
**Last updated:** [December 14, 2022, 12:38pm UTC](https://discourse.julialang.org/t/duplicating-integrator-with-klufactorization-reuse-symbolic-true/91635 "2022-12-14T12:38:11Z")

</div>

I have a problem that uses multithreading and I’ve set it up to copy some integrators defining a differential equation problem. I’m running into issues with KLUFactorization(), namely my method fails when KLUFactorizatio…

---

## [Fastest way to add arrays](https://discourse.julialang.org/t/fastest-way-to-add-arrays/91593)

<div class="topic-metadata">

**Author:** [@Marcell\_Havlik](https://discourse.julialang.org/u/Marcell_Havlik)\
**Replies:** 12\
**Last updated:** [December 14, 2022, 11:37am UTC](https://discourse.julialang.org/t/fastest-way-to-add-arrays/91593 "2022-12-14T11:37:54Z")

</div>

Hey Julianners, Can you help me on how to create fast array addition? I believe this is the fastest way: using CUDA using BenchmarkTools BenchmarkTools.DEFAULT\_PARAMETERS.seconds = 1.00 add\_cab(c, a, b) = @inbounds …

---

## [Path of this package?](https://discourse.julialang.org/t/path-of-this-package/16401)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 28\
**Last updated:** [December 14, 2022, 11:11am UTC](https://discourse.julialang.org/t/path-of-this-package/16401 "2022-12-14T11:11:04Z")

</div>

Suppose I am developing a package MyPkg. How can I get the path to MyPkg.jl? I used Pkg.dir() \* "MyPkg/", but that doesn’t work in Julia 1.0 anymore

---

## [Why \`@nospecialize(ex)\` in macros?](https://discourse.julialang.org/t/why-nospecialize-ex-in-macros/91589)

<div class="topic-metadata">

**Author:** [@tfiers](https://discourse.julialang.org/u/tfiers)\
**Replies:** 2\
**Last updated:** [December 14, 2022, 8:28am UTC](https://discourse.julialang.org/t/why-nospecialize-ex-in-macros/91589 "2022-12-14T08:28:04Z")

</div>

Why do Julia experts use @nospecialize(ex) in functions used by macros? E.g. here: Typed globals: macro to define multiple, without manual type annotations - #2 by simeonschaub I’d say the only types the argument could…

---

## [f(x::MyType{T, S}) where (T || S) \<: Foo?](https://discourse.julialang.org/t/f-x-mytype-t-s-where-t-s-foo/91581)

<div class="topic-metadata">

**Author:** [@cjwyett](https://discourse.julialang.org/u/cjwyett)\
**Replies:** 15\
**Last updated:** [December 14, 2022, 5:40am UTC](https://discourse.julialang.org/t/f-x-mytype-t-s-where-t-s-foo/91581 "2022-12-14T05:40:24Z")

</div>

Hi, I have a type where I want a different dispatch if one of the parameters is Foo. abstract type FooBarBaz end struct Foo \<: FooBarBaz end struct Bar \<: FooBarBaz end struct Baz \<: FooBarBaz end struct MyType{T\<:F…

---

## [Web-scraping with Julia](https://discourse.julialang.org/t/web-scraping-with-julia/91596)

<div class="topic-metadata">

**Author:** [@Andrej\_Ranisavljevic](https://discourse.julialang.org/u/Andrej_Ranisavljevic)\
**Replies:** 1\
**Last updated:** [December 14, 2022, 3:28am UTC](https://discourse.julialang.org/t/web-scraping-with-julia/91596 "2022-12-14T03:28:03Z")

</div>

Is there any way to scrape data from login required websites with Julia? I’ve used Gumbo and Cascadia so far for non-login websites but i can’t seem to find any solution for websites that require login.

---

## [Problem with array of structs](https://discourse.julialang.org/t/problem-with-array-of-structs/91614)

<div class="topic-metadata">

**Author:** [@teob](https://discourse.julialang.org/u/teob)\
**Replies:** 2\
**Last updated:** [December 13, 2022, 6:49pm UTC](https://discourse.julialang.org/t/problem-with-array-of-structs/91614 "2022-12-13T18:49:34Z")

</div>

Hello everyone, I have the following problem: Base.@kwdef struct s a = \[0.0,0.0,0.0\] end vec = fill(s(), 3) for (indx,v) in enumerate(vec) v.a\[1\] = indx end vec retruns: 3-element Vector{s}: s(\[3.0, 0.0, 0…

---

## [Using @test\_throws for any error/excpeption](https://discourse.julialang.org/t/using-test-throws-for-any-error-excpeption/91609)

<div class="topic-metadata">

**Author:** [@HashBrown](https://discourse.julialang.org/u/HashBrown)\
**Replies:** 1\
**Last updated:** [December 13, 2022, 6:02pm UTC](https://discourse.julialang.org/t/using-test-throws-for-any-error-excpeption/91609 "2022-12-13T18:02:41Z")

</div>

I want to test that certain uses of my code throws an error, however I am not concerned with exactly what type of error. Is there a way to use @test\_throws without specifying the exact type of error?

---

## [Parallel strategies recommendation](https://discourse.julialang.org/t/parallel-strategies-recommendation/91580)

<div class="topic-metadata">

**Author:** [@Carol](https://discourse.julialang.org/u/Carol)\
**Replies:** 2\
**Last updated:** [December 13, 2022, 5:28pm UTC](https://discourse.julialang.org/t/parallel-strategies-recommendation/91580 "2022-12-13T17:28:41Z")

</div>

Hi, I want to discuss a better parallel strategy for my current code. I have a data matrix with 500,000 columns: step1: each column will be used (independently) in function 1, where the column will be updated at the …

---

## [Recommended way of disabling precompilation for a package I'm dev'ing](https://discourse.julialang.org/t/recommended-way-of-disabling-precompilation-for-a-package-im-deving/91539)

<div class="topic-metadata">

**Author:** [@tictaccat](https://discourse.julialang.org/u/tictaccat)\
**Replies:** 3\
**Last updated:** [December 13, 2022, 4:55pm UTC](https://discourse.julialang.org/t/recommended-way-of-disabling-precompilation-for-a-package-im-deving/91539 "2022-12-13T16:55:41Z")

</div>

I’m currently in the situation where I’m in dev mode for a package X and actively making changes to its source. But this makes a package Y which depends on X have very long precompilation times every time I have to quit …

---

## [Error in launching process on LSF Cluster, after updating Julia version](https://discourse.julialang.org/t/error-in-launching-process-on-lsf-cluster-after-updating-julia-version/91601)

<div class="topic-metadata">

**Author:** [@marcobonici](https://discourse.julialang.org/u/marcobonici)\
**Replies:** 0\
**Last updated:** [December 13, 2022, 1:13pm UTC](https://discourse.julialang.org/t/error-in-launching-process-on-lsf-cluster-after-updating-julia-version/91601 "2022-12-13T13:13:20Z")

</div>

Hi, I have added a new julia version on my university Cluster, moving from 1.7.2 to 1.8.3. I have add ClusterManagers and tried adding some processes, as I have always done. The problem is that I am not being able to a…

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

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