How change Plots default color palette
Hello, I know that Plots assigns line colors from a default color palette, but I cannot figure out how to change this palette… Could someone please tell me how thats done? Specifically, I would like...
View ArticleMake function which changes varriable
The example is pretty self-explanatory, I want to make a function which changes a variable. But it doesn’t work, how do I make it to? a = 2 function change_a!(a) a = 3 nothing end change_a!(a)...
View ArticleOpen REPL in VS Code
Everytime I restart VS Code, I forget how to switch from PowerShell to REPL. I know there is a command, and a mouse, toolbar path, but I can’t keep track of either, and I don’t see an option that...
View ArticleSubsampling an ODESolution at Integer Times (and then plotting)
Hi, I’m currently playing around with DifferentialEquations.jl and Catalyst.jl for simulating the paths of Markov Jump Processes, with an end goal of eventually using it to prototype some Bayesian...
View ArticleHelp understanding Metagraphs.filter_vertices(g, fn)
I’m having trouble grasping basic usage of filtering based on v->f(v), MWE: g = MetaDiGraph(3) set_props!(g,1,Dict(:a=>"a",:b=>1)) set_props!(g,2,Dict(:🐰=>1))...
View ArticleWhy doesn't modifying a shallow copy of an array reflect on the original?
Suppose if I had the following array: even_numbers = Int32[2,4,6,8,10] # Creating a 5 element array. and I made a shallow copy: b = copy(even_numbers) If I were to modify or delete an element from b...
View ArticleModifying all the frequency components of an FFT to 0 EXCEPT the 0th, +-3rd,...
I have an array and I want to modify its FFT frequencies by an exponential factor except those that are a multiple of 3 (or more generally, M). For example, we can do this naively as: N = 256 M = 3 ψ...
View ArticleVector of tuples vs Matrix type
I’m pretty new to Julia and was wondering what the preferred practice for storing something like a bunch of coordinates, mesh triangles or graph edges? Say I want to store edges in a graph. The...
View ArticleWhy does code in a package use "using" and "import"?
Hi, In looking at how Julia packages are implemented, I see a common idiom that I don’t quite understand. For example, if you look at YaoBase/src/YaoBase.jl at...
View ArticleBest Practice for Initializing an Array Prior to for Loop
Hello, Is there a best practice for initializing arrays prior to for loops / does it matter? (I’ve seen a few similar posts but I don’t think there’s any that explain the differences, or when you...
View ArticleEasier way to feed stdin to external program and fetch stdout?
Let’s say I have n external program which reads input from stdin and writes it to stdout. What would be the easiest way to feed the given string to the program and get the result back? I think I can...
View ArticleMethodError: no method matching getindex in JuliaPro
How to get out of this error? MethodError: no method matching getindex (:: ConstraintRef {Model, JuMP.GenericRangeConstraint {JuMP.GenericAffExpr {Float64, Variable}}}, :: Int64, :: Int64) 2 posts - 2...
View ArticleWhy is 2^63 negative?
Hi Making my first steps into julia, coming from R and python. Following the getting started guide, I noticed the following: 2^62 # 4611686018427387904 2^63 # <--- This is negative? #...
View ArticleIncrease value of element in array. Like setindex!, but addition
Sometimes I have an array, and want to pass a copy of the array into a function, but updated, e.g. function my_array_function(array) do_something_else_function(setindex!(copy(array),0.,1)) end this is...
View ArticleCopyto! in DiffeqGPU EnsembleProblem
How to copy slices in EnsembleGPUArray? code: function f_du(du,u,p,t) @inbounds begin copyto!(du,p) end nothing end tspan = (0.0f0,1.0f0) u0 = [1.0,2.0,3.0] p0=[-1.,-2.,-3.] prob =...
View ArticleWeb Noob; how hard would it be to integrate julia with HTML?
So I am not a web developer. Sometimes I do web stuff at work, and a little for fun. I was doing some thinking, and a question came to mind. Why can’t Julia be a serverside web language like PHP?...
View ArticleHow do I check if variable is defined in the current workspace? (not using...
So I can use @isdefined my_undefined_variable and it returns false. But is there something similar without using the macro (a function)? There seems to be a function isdefined(), but I don’t know how...
View ArticleConstructing dates from a vector of numbers?
I have a solution of a differential equations problem, with a given time vector, say 50 values in the range [0,10]. I want to use date along the abscissa axis in the plot. So essentially, I want to...
View ArticleCompat Questions
So I maintain a few small packages. Lately, their dependancies have shuffled around because the ecosystem is chugging along (woo!). But, when I go to use one or two of my packages I run into...
View ArticleGet all Permutations of Array?
Hi I found some old Julia code which states that this used to work: en.wikibooks.org Julia for MATLAB Users/Core Language/Mathematics - Wikibooks, open books for... julia> perms(a) =...
View Article