Quantcast
Channel: First steps - JuliaLang
Browsing all 2795 articles
Browse latest View live

How can I use Zygote to get the gradient

Hello, I am new here and i just add the pkg Zygote to find the gradient of the function (2+2*alpha-3)^2, i want to get the value of alpha how can i do that 7 posts - 3 participants Read full topic

View Article


Strange behaviour with if-else-Statements

Hello, I’m new to Julia and working with Julia/JuMP for optimization purposes. I want to use if-else-statements in the constraints I’m defining to write them more compact. When trying so I ran in some...

View Article


How to change the return-value of homedir()

So I want to change the starting location in my file-tree when I use Jupyter. From what I understand, Jupiter opens up the file tree at the location returned by homedir(). So my question is, how can I...

View Article

Export functions included from different modules with the same name

Here is my example: module AB using Reexport include("A.jl") include("B.jl") @reexport using .A @reexport using .B end And, both A, B has functions close!. Then, using close! causes warning like this:...

View Article

Can't add GLM

Trying to add GLM and getting dependency errors. [StatsPlots, Distributions, etc.] I’m using Julia 1.2 (can’t change for other dependency reasons). Does anyone have any ideas? I tried to build but GLM...

View Article


Dictionary initialization

If I type the following in the REPL, I get what I expect: a dictionary with two elements. Note: I want the definition to be over two lines. cols = Dict([ "FID_NEW" => :fid_new, "POINT_X" =>...

View Article

PackageCompile system image for different computers

I’ll like to compile a system image that I can use on our in-house compute cluster. My problem is that the image I build on one computer, will not load on an other. I have build a system image on my...

View Article

How to get the first row of each group of a DataFrame?

How do I get the first row from each group of a grouped DataFrame? Say, I want to find the sex and height of the tallest person in each age-group: using DataFrames df = DataFrame(sex =...

View Article


Using sequential conditions inside sum()

How to define sequential conditions inside sum() ? For example, embedding the block tot=0 for j in Set1 if (i,j) in Set2 condition1 if k in Set3[(i,j)] condition2 tot = tot + f(i,j,k) end end end...

View Article


Image may be NSFW.
Clik here to view.

Could not download https://pkg.julialang.org/registries and cannot precompile...

Hi Julia users! As the new version came out and having a LOT of problems installing/precompiling CUDA.jl, CUDAnative.jl, CuArrays.jl, I decided to freshly reinstall Julia 1.5.2. However, I see the...

View Article

Generate a (mutable) struct which inherits others

Hi. Is there any way for a (mutable) struct to inherit fields from others? For example, what I’m trying to do is: mutable struct Parent foo bar end mutable struct Child <: Parent end and use child...

View Article

Image may be NSFW.
Clik here to view.

Is `macro` "a compressed part of code"?

According to this, I’m trying to use macro for inheritance as @xiaodai suggested. However, I’ve not figured out how exactly macro works What I’m trying to do is basically “refering a struct’s fields...

View Article

When do you all PyCall?

So I’ve been brushing up a little bit on my python, but doing so under the guise of julia projects that require/benefit from pycall so I don’t rust out any skills. Had me thinking, when do other...

View Article


Image may be NSFW.
Clik here to view.

Faster array indexing with a logical array

Hi everyone, Pretty basic question… I was experimenting with indexing arrays with logical arrays. For instance, say I have an array shaped (10000,2) and I need to extract all the indices where the sum...

View Article

IJulia/Jupyter Notebook in different language (Russian!) than expected

Hi, all! I’ve been following Julia for years now, but decided to completely dive in just recently. I’m planning to give a talk at my university on using Julia and wanted to show how to use it in...

View Article


Scraping a html table from a website

I am trying to obtain COVID-19 data from a website. The website has the data which I want but it is in a html table format I am looking for Julia tools to scrape the information from the html table....

View Article

No REPL output when editor code is run (remote julia process over sftp)

Steps to reproduce: open ftp pane to remote host click the start remote julia process tab open an editor file highlight a line of executable code (without a trailing “;”) hit ctrl+enter What settings...

View Article


Image may be NSFW.
Clik here to view.

Error: Reducing over an empty collection is not allowed

Hi everyone, I am trying to sort and sum data based off of the first column of ‘DNVGL_total’ into a new array. However, when trying to do this, I get the error ‘Reducing over an empty collection is...

View Article

How to pass a relative UnitRange to a function?

I have the following which tries to apply a relative unit range to a string whose length is unknown: function testnums(data::String,numrange::String) data[numrange] end foo = "asdfasdfasdf" bar =...

View Article

Image may be NSFW.
Clik here to view.

How to set number of threads for VS Code?

There are quite a few topics about this question but I am still confused after reading them. I am using VS Code for Julia Version 1.5.0. Currently, The documentation...

View Article
Browsing all 2795 articles
Browse latest View live