Questions tagged [julia]

The Julia programming language is fast, expressive and dynamic. By aggressively targeting technical computing it has become a robust general purpose language. It addresses the two-language problem by combining the ease of use of high-level languages such as R and Python with the performance of C and Fortran.

Julia is a high-level, high-performance dynamic programming language for technical computing. It addresses the two-language problem by combining the ease of use of languages such as R and Python with the performance of C and Fortran. Julia provides a sophisticated compiler, distributed parallel execution, numerical accuracy, and an extensive mathematical function library. Environments such as Julia for VS Code, Jupyter, and Pluto provide a rich development environment with interactive graphics.

Community-contributed libraries continue to be added at a rapid pace. Programs written in Julia are organized around multiple dispatch - by defining and overloading functions with different combinations of argument types. Part of what makes Julia so expressive is that argument types can be user-defined, and user-defined types live in the same type hierarchy and have the same status as built-in types.

The Julia compiler includes a parser written in Scheme (femtolisp), some compiler passes and the runtime in C, code generation through LLVM using C++, and other compiler passes (type inference, inlining, etc.) as well as much of the Base library in Julia itself. For just-in-time generation of 64-bit or 32-bit optimized machine code the LLVM compiler framework is used.

Julia has foreign function interfaces for C, C++, Python, R, and Java, to name a few. Julia can also be embedded in any other software through its C API. Many of these interfaces are high performance and avoid copying data to the extent possible.

Resources for Julia:

Books

Publications

12250 questions
5
votes
3 answers

plotting a line tangent to a function at a point

Heres a block of code that plots a function over a range, as well as the at a single input : a = 1.0 f(x::Float64) = -x^2 - a scatter(f, -3:.1:3) scatter!([a], [f(a)]) i would like to plot the line, tangent to the point, like so: Is there a…
neutrino
  • 894
  • 8
  • 23
5
votes
1 answer

How can I have fixed-width format of an interpolated string in markdown Julia?

Let's say I have a variable filename = "/home/jimmy/logger.log". I want to have some markdown documentation like this: md""" The output is logged at `$(filename)` """ There are two work arounds that I know of: first: Markdown.parse("The output is…
jerlich
  • 340
  • 3
  • 12
5
votes
3 answers

Splitting datasets into train and test in julia

I am trying to split the dataset into train and test subsets in Julia. So far, I have tried using MLDataUtils.jl package for this operation, however, the results are not up to the expectations. Below are my findings and issues: Code # the inputs…
Mohammad Saad
  • 1,935
  • 10
  • 28
5
votes
1 answer

Julia: How can I update my published julia package?

I'm trying to develop my first Julia package, FeatureEng.jl but I'm having trouble updating the package on the registry. I've set up the GitHub actions TagBot and Register and tried updating the package version via the Project.toml file and via git…
A Poor
  • 856
  • 10
  • 26
5
votes
2 answers

How to use in Julia a Python package that is not available in Anaconda and needs to be installed via pip

I use Julia 1.6.0 (beta as of today) and would like to use a Python package plfit via PyCall. Unfortunately, plfit is not available in Anaconda and hence I cannot install it using Conda module: julia> using Conda julia> Conda.add("plfit") [ Info:…
Przemyslaw Szufel
  • 40,002
  • 3
  • 32
  • 62
5
votes
1 answer

Downgrade to DifferentialEquations v6.0 in Julia

How can I downgrade the DifferentialEquations package to version 6.0 (or earlier), such that all depending packages also downgrade if they require a version that is > 6.0?
piiipmatz
  • 400
  • 1
  • 10
5
votes
1 answer

Julia syntax - Return type annotation for a function with a where clause

I'm new to Julia. This may be a stupid question, but I can't seem to get the syntax for this right. I can do check_condition(func::F, arg::Int) where {F} = func(arg) and check_condition(func::Function, arg::Int)::Bool = func(arg) But if I want to…
Cartucho
  • 117
  • 7
5
votes
1 answer

How to subscribe to the Binance market stream using Julia and WebSockets.jl

I'm trying for a while now to connect to the Binance market stream using the WebSockets.jl package but I do not get any response. I've already had a look here and found this question, but this results in the same problem as described: the inbox…
5
votes
2 answers

What is the difference between `ifelse` and the ternary operator in Julia?

Suppose I have this code: cond = true a = cond ? 1 : 2 b = ifelse(cond, 1, 2) What is the difference between the two operations?
DVNold
  • 849
  • 3
  • 14
5
votes
1 answer

What does `abspath(PROGRAM_FILE) == @__FILE__` do?

Given this code: function main() println("hello") end if abspath(PROGRAM_FILE) == @__FILE__ main() end What does the last part do, and how does it work? Where are those variables defined?
DVNold
  • 849
  • 3
  • 14
5
votes
2 answers

Julia: CSV.write very memory inefficient?

I noticed that when saving large dataframes as CSVs the memory allocations are an order of magnitude higher than the size of the dataframe in memory (or the size of the CSV file on disk), at least by a factor of 10. Why is this the case? And is…
cno
  • 645
  • 4
  • 14
5
votes
3 answers

How to set the default attributes of Plots?

In Julia plotting with Plots, I know how to set the various attributes when using plot() (Attributes). I want to know how to set the default attributes, so that I don't need to set them every time. For instance, I want to change the font-family to…
Leftriver
  • 77
  • 1
  • 8
5
votes
0 answers

Under what circumstances would Julia allocate memory to single digits?

Suppose I write this function function test_function(T) c = 1 d = 31 q = 321 b = 32121 a = 10 for i in 1:T c = d + q + b + a end end There will be no memory allocation.…
user1691278
  • 1,751
  • 1
  • 15
  • 20
5
votes
1 answer

Julia: How to reshape an array while preserving the order?

There is a similar question in Python, but I am asking about a Julia version. I have a multidimensional array with shape img = (3, 64, 64), which represents an image with the first dimension being RGB. I want to use plt.imshow(img) to show the image…
U2647
  • 213
  • 1
  • 6
5
votes
2 answers

Create new directory in Julia for each run

I'm running Julia code which generates a plot and a text file. There exists an "Output" folder in the same folder where the code in question is located. For the first run, I create a "Run_1" folder, with "Plots" and "Data" subfolders: fig_path =…
Joshuah Heath
  • 663
  • 1
  • 5
  • 20
1 2 3
99
100