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

Order of arguments in mutating functions

I’m sure this has been asked before, but my searches came up empty. I have a function F that takes another function f and an array A as input. The function mutates A. So is the order F!(f,A) or...

View Article


Unexpect results constructing a DArray

I have been playing with DistributedArrays recently and found the following result: r1 = @spawnat 2 ones(Int64, 3, 2) r2 = @spawnat 3 fill(5, (3,2)) r3 = @spawnat 2 fill(9, (3,2)) r4 = @spawnat 3...

View Article


Image may be NSFW.
Clik here to view.

How do I get an almost "normal" normal distribution?

Sorry for the “normal” normal . What I mean is that I need a Gaussian distribution with a slight change. I need to include a factor \xi, such as the density distribution below I don’t need the best...

View Article

Install Plots: ERROR: KeyError: key "Zlib_jll" not found

Fresh install and fresh active project… (Julia) pkg> add Plots Resolving package versions… ERROR: KeyError: key “Zlib_jll” not found Any Ideas? 6 posts - 2 participants Read full topic

View Article

Taking derivative of abstract function pattern in sympy

I want to compute a derivative of an expression involving an abstract function like xg(x) or the mixed partial of xg(x)/(g(x)+g(y)). Based on the original python docs here, I tried: using SymPy x =...

View Article


How to get a function to print stuff with REPL-like formatting

Sometimes it’s easier if what gets printed by a function looks nice (like in the REPL): function printout(x) println("x is: ",x) end Ex 1. Beautiful formatting that can be instantly read and...

View Article

Second plot series send to background

Is it possible to send a second plot (e.g. a vertical line) to the background? I know, if I drew the vertical line first, I would get what I want. However, then I have to provide axis scales in order...

View Article

A simple macro to transform `newcol = fn(:col)` to `:col => fn => :newcol`;...

In DataFrames.jl there are a number of places where you have use this syntax :col => fn => :newcol to compute new columns. This makes sense once you get used to it, but sometimes you want a...

View Article


PyJulia, passing numpy array from Python side

I’m looking into extending Python with Julia code through PyJulia, particularly allocating numpy arrays in Python, passing them to Julia (without copying) to do some processing and then use the result...

View Article


Fastest way to broadcast reductions of SubArrays

I have an array arr whose subarrays correspond to the column-groups given in colinds. Below is an example of division that does what I want without creating any subarrays or broadcasting. The desired...

View Article

How to locate in which package a certain function belongs

How to locate in which package a certain function belongs. For example I am interested in finding the package for the function integrate_ODE, which is shown in an example of the Pluto package...

View Article

Pivot a dataframe to wide format with values in multiple columns

Hi, I am trying to perform a long to wide transformation of a data frame in Julia. The original data frame I have is: wide = DataFrame(x = 1:12, a = 2:13, b = 3:14, val1 = randn(12), val2 = randn(12),...

View Article

Does it make sense for @orderby and @groupby not to commute?

I have a dataframe which I want to group by some column value, and within each group I want the rows sorted by another column. I can do an @orderby |> @groupby, however I feel like a @groupby |>...

View Article


Fastest way to create new column in DataFrames.jl

I found 3 ways to create new columns in DataFrames.jl (two of which are equivalent) df = DataFrame(a = rand(1_000_000), b= rand(1_000_000)) @time transform!(df, [:a, :b] => (a,b)->a + b) @time...

View Article

Parallelism? Async != Parallel?

Hi Guys, for me the Documentation about Parallel Programming is kinda Confusing in Julia. For me its hard to distinguish the first two Groups of Parallel Programming....

View Article


How to use NamedDimsArrays(NamedDims.jl) as containers for JuMP Variables?

I am planning to develop a very large power system model. In AMPL it took 1-2h to generate the model and 12h to solve the model with cplex. In JuMP one can use symbols to create DenseAxisArrays of...

View Article

Image may be NSFW.
Clik here to view.

Is there any graph / graph plotting package that allow edges having different...

Usecase: Displaying the architecture of block copolymers. Block copolymers consist of many blocks each of which contains identical monomers and are connected by covalent bond at their joints. I think...

View Article


How to apply a function only to the second column of a matrix

How to apply a function only to the second column of a matrix The only way I know of is this. Is there an easier way to apply the sin function to only the second column of a matrix? julia> m = [1....

View Article

Image may be NSFW.
Clik here to view.

Embed webcam in Pluto

It was so cool to see a webcam embedded in a Pluto notebook. But as I tried out the codes shown in the screenshot, I got an error saying camera_input not defined. So what is missing here to achieve...

View Article

How to find out which package prevents updating TikzPictures in Julia v1.5

I got the following error message but it doesn’t look helpful. (@v1.5) pkg> add TikzPictures@v3.3.0 Resolving package versions... ERROR: Unsatisfiable requirements detected for package TikzPictures...

View Article
Browsing all 2795 articles
Browse latest View live