how to find version number of Julia? Is there a ver() command?
Just entering out the constant VERSION would also display the version number. julia> VERSION v”0.4.0″
Just entering out the constant VERSION would also display the version number. julia> VERSION v”0.4.0″
In Julia, it’s a convention to append ! to names of functions that modify their arguments. The reason is Julia function arguments are passed-by-sharing, without this “bang” convention, it’s not easy to know whether a function will change the content of input arguments or not.
The first index is not necessarily 1 because Julia supports custom indexing. To understand why it is useful, you can’t beat Tim Holy’s blog post. Custom indices allow you to encode information about your data in the indexing pattern itself: sometimes it is more natural to start counting from one, sometimes from zero, sometimes from … Read more
A zero length array defined using only [] will lack sufficient type information. julia> typeof([]) Array{None,1} So to avoid that problem is to simply indicate the type. julia> typeof(Int64[]) Array{Int64,1} And you can apply that to your DataFrame problem julia> df = DataFrame(A = Int64[], B = Int64[]) 0x2 DataFrame julia> push!(df, [3 6]) julia> … Read more
Use the vcat and hcat functions: julia> a, b = [1;2;3], [4;5;6] ([1,2,3],[4,5,6]) help?> vcat Base.vcat(A…) Concatenate along dimension 1 julia> vcat(a, b) 6-element Array{Int64,1}: 1 2 3 4 5 6 help?> hcat Base.hcat(A…) Concatenate along dimension 2 julia> hcat(a, b) 3×2 Array{Int64,2}: 1 4 2 5 3 6
As of August 2017, Julia v0.5.2 is available on the conda-forge channel: https://anaconda.org/conda-forge/julia It has been set up to install packages inside <env_prefix>/share/julia/site, to maintain isolation from the user’s ~/.julia user’s home directory. conda create -n julia -c conda-forge julia
Your variable x does not contain an array but a type. x = Vector{Float64} typeof(x) # DataType You can create an array as Array(Float64, n) (but beware, it is uninitialized: it contains arbitrary values) or zeros(Float64, n), where n is the desired size. Since Float64 is the default, we can leave it out. Your example … Read more
Vectorized operations like .^ are exactly the kind of thing that Octave is good at because they’re actually entirely implemented in specialized C code. Somewhere in the code that is compiled when Octave is built, there is a C function that computes .^ for a double and an array of doubles – that’s what you’re really timing … Read more
You can give a range as the first argument to rand, as in rand(1:n): julia> rand(1:10) 7 julia> rand(1:10,10,10) 10×10 Array{Int64,2}: 10 2 5 8 5 5 3 7 1 3 5 1 4 2 4 4 1 6 6 9 8 1 3 9 4 8 7 8 7 10 3 8 1 5 … Read more
The Julia equivalent of None is the constant nothing: a value that is returned by expressions and functions which don’t have anything interesting to return. In both languages, this value is not printed at an interactive prompt when an expression evaluates to it, but is otherwise just a normal value. There’s nothing magical about it … Read more