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

Image may be NSFW.
Clik here to view.

Alternate color for each point in scatter plot and add legend

I’m plotting a series where I’d like to alternate colors for each point. This works fine via the mc keyword, but I can’t get the legend to indicate the color coding scheme correctly: using Plots a =...

View Article


HDF5 build failure on HPC

Hello everyone, could you please spend a minute to look at these error message ? I am trying to install MLDatasets on an HPC cluster but I got the following error while building and using HDF5. I know...

View Article


Delete all rows contained in a dataframe, as specified by an array of ids

Using ids = findall(nonunique(mydata)) I have found the ids of all rows that are duplicates. Now, I want to clean mydata by erasing the duplicate rows. How is that done? 4 posts - 4 participants Read...

View Article

Is there a Function type which captures its return type

I have a struct which should contain a parametrized function returning a certain type. Can I impose this type restriction onto the struct field? using Unitful struct a T::Function # This will allow...

View Article

Problems with Animation

Dear all, I want to do a simple animation: using Plots plotly() x=-1:0.01:1 y=-1:0.01:1 h(x,y)=x^2-y^2; anim = Animation() for θ in range(0,2π,length=10) surface(x,y,h,leg=false,camera=(θ,30))...

View Article


Copying subvector makes pointer?

Hi! I’m getting some surprising behavior from a Vector of Vectors. julia> b=[[1,2,3]] 1-element Array{Array{Int64,1},1}: [1, 2, 3] julia> pushfirst!(b,b[1]) 2-element Array{Array{Int64,1},1}:...

View Article

DataFrames precompiling error

Hi Everyone, I’m new to Julia (and also coding). I started to use 1.5.3 on my ubuntu 18.04. I would like to use DataFrames, but I couldn’t. I tried to use it on 1.6.0rc1, but I’ve got the same...

View Article

Image may be NSFW.
Clik here to view.

Problems with the scale 3d on animations

Dear all, I have the following code to perform an animation in 3d: using Plots plotlyjs() anim = Animation() for n in range(0,2π,length=10) t=0:0.1:n x=cos.(t) y=sin.(t) z=t...

View Article


Sorting by two values (basic sorting)

This is probably fairly simple. I want to sort a set of tuples first by the second value, and then by the first value, like this: julia> a = [ rand(1:3,2) for i in 1: 5 ] 5-element...

View Article


Why is Base.OneTo not exported?

It’s quite weird (and somewhat worrying) how I can’t refer to Base.OneTo as just OneTo: $ julia _ _ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for...

View Article

Parameterizing matrix in Turing model without mutating arrays

Hi All. So I’ve got this compartment model which uses a matrix exponential, \hat y = e^{A\,t} x_0, where the elements of the N by N matrix A are flow rates between N compartments, and x_0 are the...

View Article

Image may be NSFW.
Clik here to view.

Playing around with Union{}, Type{Union{}}, Type{Core.TypeofBottom}, etc

Consider this weird Julia session: $ julia _ _ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _` | | | | |_|...

View Article

Functions of continuous variables

Hello, there! I want to plot a function p(s) \times s, being s \in \mathbb{R}. My code is: Pkg.add("Plots") using Plots p(s) = s/2 * exp(-s^2/4) plot(s,p(s)) The problem is that when I run it, I got...

View Article


Plotting two different functions

Hello, there! I’m trying to plot two different functions at the same graph, using Plots.jl, as follows Pkg.add("Plots") using Plots p(s) = s/2 * exp(-s^2/4) g(s) = exp(-s) plot(p,g) but I receive the...

View Article

Type instability of nested function

I have the following function, and it has a type instability (Core.Box). In the real code, I use f as an argument of another function which calls f multiple times (e.g. bisection to solve f(x)=0). How...

View Article


Random number and parallel execution

As a fork of this thread I created a MWE that illustrates a behaviour I have seen frequently and which, clearly, I do not understand. First, let us sum serially and in parallel some simple computation...

View Article

A cancellable async loop?

Hi - I’d like to be able to send a ‘cancel’ command to an async loop that runs in the background and fetches data. It’s not clear from the docs how I might do that - is this possible using channels? 3...

View Article


Trouble with Debugger.@bp

I can’t seem to get @bp to catch when used in a module that’s part of a package. I have: module ToyModule import Debugger function f(x) @bp return x^2 end end in a package called Cluster. In a new...

View Article

Finding the vertices of a hypercube

I defined a data structure to represent a hypercube. It is defined by the min and max bounds on each dimension. struct HyperCube min_bounds::Array{Float32} max_bounds::Array{Float32} end Now, I want...

View Article

Weird Tuple types that seem like they should be disallowed?

I noticed that some Tuple types that are parameterized by non-types exist, but seem useless. I wonder if they: May have instances at all? Should be disallowed? Example: _ _ _ _(_)_ | Documentation:...

View Article
Browsing all 2795 articles
Browse latest View live