# Latest

**URL:** https://discourse.julialang.org/latest.md?page=846

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 847

---

## [Capture a Julia output in the clipboard](https://discourse.julialang.org/t/capture-a-julia-output-in-the-clipboard/91186)

<div class="topic-metadata">

**Author:** [@\_stla](https://discourse.julialang.org/u/_stla)\
**Replies:** 8\
**Last updated:** [December 3, 2022, 9:22pm UTC](https://discourse.julialang.org/t/capture-a-julia-output-in-the-clipboard/91186 "2022-12-03T21:22:28Z")

</div>

Hello, Currently I don’t have a mouse and the pad of my laptop is really really bad: I can’t select some text. But I need to copy-paste some Julia outputs. How can I capture the output of a function and write it in the…

---

## [Integral of a function inside non-rectangular domain](https://discourse.julialang.org/t/integral-of-a-function-inside-non-rectangular-domain/72132)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 16\
**Last updated:** [December 3, 2022, 8:27pm UTC](https://discourse.julialang.org/t/integral-of-a-function-inside-non-rectangular-domain/72132 "2022-12-03T20:27:26Z")

</div>

I want to integrate some function f(x,y) inside a non-rectangular domain, say a disk defined by x² + y² ≤ 1. Is there a package for doing this? I actually tried to define g(x,y) = f(x,y) \* (x^2+y^2 ≤1). Then g(x,y) is…

---

## [Exact integral of a polynomial over a simplex](https://discourse.julialang.org/t/exact-integral-of-a-polynomial-over-a-simplex/91132)

<div class="topic-metadata">

**Author:** [@\_stla](https://discourse.julialang.org/u/_stla)\
**Replies:** 5\
**Last updated:** [December 3, 2022, 8:26pm UTC](https://discourse.julialang.org/t/exact-integral-of-a-polynomial-over-a-simplex/91132 "2022-12-03T20:26:30Z")

</div>

Hello, I wrote a function which computes the exact value of a multivariate polynomial over a simplex. I’m open to any comment on my code. I also implemented this method in Python. I’m sure it is correct, I multi-checke…

---

## [I Need help with DiffEqFlux](https://discourse.julialang.org/t/i-need-help-with-diffeqflux/91164)

<div class="topic-metadata">

**Author:** [@Miraj\_Miraj](https://discourse.julialang.org/u/Miraj_Miraj)\
**Replies:** 2\
**Last updated:** [December 3, 2022, 8:25pm UTC](https://discourse.julialang.org/t/i-need-help-with-diffeqflux/91164 "2022-12-03T20:25:45Z")

</div>

Hello Everyone, six days ago, I posted that ‘I need help on Lotka\_voltera code on the blog: DiffEqFlux.jl – A Julia Library for Neural Differential Equations , but for some reason i never get it running no matter how i …

---

## [Help on Lotka Voltera model Parameter Estimation](https://discourse.julialang.org/t/help-on-lotka-voltera-model-parameter-estimation/90860)

<div class="topic-metadata">

**Author:** [@Miraj\_Miraj](https://discourse.julialang.org/u/Miraj_Miraj)\
**Replies:** 8\
**Last updated:** [December 3, 2022, 8:23pm UTC](https://discourse.julialang.org/t/help-on-lotka-voltera-model-parameter-estimation/90860 "2022-12-03T20:23:42Z")

</div>

Hello Everyone, I have been trying to rerun the Lotka\_voltera code on the blog: DiffEqFlux.jl – A Julia Library for Neural Differential Equations, but for some reason i never get it running no matter how i tried. Can so…

---

## [\[ANN\] MetidaFreq.jl - Contingency tables and Meta-analysis](https://discourse.julialang.org/t/ann-metidafreq-jl-contingency-tables-and-meta-analysis/91188)

<div class="topic-metadata">

**Author:** [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Replies:** 0\
**Last updated:** [December 3, 2022, 6:47pm UTC](https://discourse.julialang.org/t/ann-metidafreq-jl-contingency-tables-and-meta-analysis/91188 "2022-12-03T18:47:42Z")

</div>

This package inspired by FreqTables and OpenMetaAnalyst base on R project. MetidaFreq.jl is made to get contingency table from data or set of contingency tables. Then you can do meta-analysis for risk ratio, risk differ…

---

## [Returning vector of Distribution parameters](https://discourse.julialang.org/t/returning-vector-of-distribution-parameters/91185)

<div class="topic-metadata">

**Author:** [@simonrschultz](https://discourse.julialang.org/u/simonrschultz)\
**Replies:** 2\
**Last updated:** [December 3, 2022, 5:46pm UTC](https://discourse.julialang.org/t/returning-vector-of-distribution-parameters/91185 "2022-12-03T17:46:15Z")

</div>

Hello, apologies if this is a very basic question, but I am still getting to grips with some elements of Julia. I am generating an array of Gamma distributions. I want to pull the distribution parameters out to plot the…

---

## [\[ANN\] FastRandPCA - Fast Randomized PCA for Sparse Data](https://discourse.julialang.org/t/ann-fastrandpca-fast-randomized-pca-for-sparse-data/90803)

<div class="topic-metadata">

**Author:** [@vpetukhov](https://discourse.julialang.org/u/vpetukhov)\
**Replies:** 7\
**Last updated:** [December 3, 2022, 2:38pm UTC](https://discourse.julialang.org/t/ann-fastrandpca-fast-randomized-pca-for-sparse-data/90803 "2022-12-03T14:38:51Z")

</div>

After struggling to find a working Julia implementation of PCA for sparse matrices, I found one in Matlab (frPCA\_sparse) and translated it to Julia: FastRandPCA.jl. On my test it works pretty fast: 186s for a 500 x 10\_00…

---

## [Memory allocations after reading arrays from .mat file](https://discourse.julialang.org/t/memory-allocations-after-reading-arrays-from-mat-file/91124)

<div class="topic-metadata">

**Author:** [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Replies:** 6\
**Last updated:** [December 3, 2022, 2:29pm UTC](https://discourse.julialang.org/t/memory-allocations-after-reading-arrays-from-mat-file/91124 "2022-12-03T14:29:38Z")

</div>

Dear all, I have written script that reads arrays from a .mat file and allocated new arrays based on the size of the arrays read from the .mat file. The issue is that when the new arrays are allocated using the size of…

---

## [How to subset dataframe whose first column is smaller than the second column?](https://discourse.julialang.org/t/how-to-subset-dataframe-whose-first-column-is-smaller-than-the-second-column/91178)

<div class="topic-metadata">

**Author:** [@zhangchunyong](https://discourse.julialang.org/u/zhangchunyong)\
**Replies:** 1\
**Last updated:** [December 3, 2022, 1:30pm UTC](https://discourse.julialang.org/t/how-to-subset-dataframe-whose-first-column-is-smaller-than-the-second-column/91178 "2022-12-03T13:30:26Z")

</div>

I have a dataframe,and I want to subset the dataframe whose first column is smaller than second column. julia\> a=DataFrame(p=\[1,2,3,4,5,6\],q=\[1,2,4,5,2,9\]) 6×2 DataFrame Row │ p q │ Int64 Int64 ─────┼───────…

---

## [Get CPU usage](https://discourse.julialang.org/t/get-cpu-usage/24468)

<div class="topic-metadata">

**Author:** [@Caesar\_KG](https://discourse.julialang.org/u/Caesar_KG)\
**Replies:** 7\
**Last updated:** [December 3, 2022, 1:06pm UTC](https://discourse.julialang.org/t/get-cpu-usage/24468 "2022-12-03T13:06:04Z")

</div>

Is there any built-in function that I can use to get the CPU usage of PCs? I’m writing a load balancer that orchestrates multiple PCs to perform a computation task based on CPU and memory usage. I know other languages li…

---

## [Does union cause type instability？](https://discourse.julialang.org/t/does-union-cause-type-instability/91173)

<div class="topic-metadata">

**Author:** [@zhangchunyong](https://discourse.julialang.org/u/zhangchunyong)\
**Replies:** 5\
**Last updated:** [December 3, 2022, 12:23pm UTC](https://discourse.julialang.org/t/does-union-cause-type-instability/91173 "2022-12-03T12:23:01Z")

</div>

a=Vector{Union{Missing, Int64}}() push!(a,1) push!(a,missing) push! to the union vector.Can this cause type instability?

---

## [Accessing an N-dimensional array with a vector with N indeces](https://discourse.julialang.org/t/accessing-an-n-dimensional-array-with-a-vector-with-n-indeces/91101)

<div class="topic-metadata">

**Author:** [@Pablo\_Marchant](https://discourse.julialang.org/u/Pablo_Marchant)\
**Replies:** 5\
**Last updated:** [December 3, 2022, 11:27am UTC](https://discourse.julialang.org/t/accessing-an-n-dimensional-array-with-a-vector-with-n-indeces/91101 "2022-12-03T11:27:04Z")

</div>

I’m currently trying to optimize some code I made that needs to access arrays with a user defined number of dimensions. For example, I could get a 3-dimensional array from a user and need to access an element of this arr…

---

## [ForwardDiff and FunctionWrappers](https://discourse.julialang.org/t/forwarddiff-and-functionwrappers/91130)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 8\
**Last updated:** [December 3, 2022, 11:21am UTC](https://discourse.julialang.org/t/forwarddiff-and-functionwrappers/91130 "2022-12-03T11:21:14Z")

</div>

I have code that makes use of FunctionWrappers in some places. I need to compute gradients for code that involves these wrappers - is this possible? For example, using FunctionWrappers using ForwardDiff f1 = FunctionWra…

---

## [Type-stability with a vector of FunctionWrappers](https://discourse.julialang.org/t/type-stability-with-a-vector-of-functionwrappers/91122)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 7\
**Last updated:** [December 3, 2022, 10:28am UTC](https://discourse.julialang.org/t/type-stability-with-a-vector-of-functionwrappers/91122 "2022-12-03T10:28:51Z")

</div>

I have the following code that I want to use for storing a vector of functions: using FunctionWrappers import FunctionWrappers: FunctionWrapper abstract type AbstractF end struct F{P,T,U} \<: AbstractF p::P f::F…

---

## [Ellipsis (splatting) with named arguments](https://discourse.julialang.org/t/ellipsis-splatting-with-named-arguments/91170)

<div class="topic-metadata">

**Author:** [@\_stla](https://discourse.julialang.org/u/_stla)\
**Replies:** 4\
**Last updated:** [December 3, 2022, 10:06am UTC](https://discourse.julialang.org/t/ellipsis-splatting-with-named-arguments/91170 "2022-12-03T10:06:55Z")

</div>

Hello, Let these two functions: function f(x, a, b) return b\*(x+a) end function g(args....) return f(1, args...) end If we run g(2,3), we get f(1, 2, 3). Is there a way to do g(b=3, a=2) and get the same result?…

---

## [Problem with HamiltonianProblem in Differential](https://discourse.julialang.org/t/problem-with-hamiltonianproblem-in-differential/91161)

<div class="topic-metadata">

**Author:** [@mpirke](https://discourse.julialang.org/u/mpirke)\
**Replies:** 2\
**Last updated:** [December 3, 2022, 9:58am UTC](https://discourse.julialang.org/t/problem-with-hamiltonianproblem-in-differential/91161 "2022-12-03T09:58:48Z")

</div>

Hi there! Im playing around with some easy physics problems. Here I tried to simulate a simple pendulum. I wanted to solve it via the HamiltonianProblem functionality from DifferentialEquations.jl. Im not sure what’s t…

---

## [Initialize Dict to enable values of different type](https://discourse.julialang.org/t/initialize-dict-to-enable-values-of-different-type/91153)

<div class="topic-metadata">

**Author:** [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Replies:** 3\
**Last updated:** [December 3, 2022, 9:53am UTC](https://discourse.julialang.org/t/initialize-dict-to-enable-values-of-different-type/91153 "2022-12-03T09:53:44Z")

</div>

What is the reason that case 3 fails? And how to avoid this? How can I initialize a Dict to enable values of different type? Here is my snippet: function MyDictFill(\_a::Dict = Dict()) if ~haskey(\_a, "a") …

---

## [How to Plot this Riemann Sum Correctly?](https://discourse.julialang.org/t/how-to-plot-this-riemann-sum-correctly/90944)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [December 3, 2022, 8:48am UTC](https://discourse.julialang.org/t/how-to-plot-this-riemann-sum-correctly/90944 "2022-12-03T08:48:14Z")

</div>

Hi all, I have a function : x^{3} - 5x^{2} + 2x + 8 and I have this code: using Plots, LaTeXStrings, ValidatedNumerics gr() f(x) = x^3 - 5x^2 + 2x + 8 #plot(f, 0, 2, aspect\_ratio=:equal, fill=(0, :green), alpha=0.…

---

## [PID with Mass Spring Dramper using ModelingToolkit.jl](https://discourse.julialang.org/t/pid-with-mass-spring-dramper-using-modelingtoolkit-jl/59063)

<div class="topic-metadata">

**Author:** [@Brad\_Carman](https://discourse.julialang.org/u/Brad_Carman)\
**Replies:** 12\
**Last updated:** [December 3, 2022, 7:51am UTC](https://discourse.julialang.org/t/pid-with-mass-spring-dramper-using-modelingtoolkit-jl/59063 "2022-12-03T07:51:16Z")

</div>

I’m attempting to using ModelingToolkit (for the first time) to solve a simple PID controller with mass/spring/damper. The PID output is y which I’m converting directly to a force driving the position x of the mass m wi…

---

## [PyTorch 2.0](https://discourse.julialang.org/t/pytorch-2-0/91169)

<div class="topic-metadata">

**Author:** [@davide445](https://discourse.julialang.org/u/davide445)\
**Replies:** 0\
**Last updated:** [December 3, 2022, 7:36am UTC](https://discourse.julialang.org/t/pytorch-2-0/91169 "2022-12-03T07:36:55Z")

</div>

I get notified about the new release Not an expert just talking with specialists and finding my way getting to know Flux a bit for my simulation experiments, wanted to know the opinion of other forumeers if this PyT r…

---

## [DiffEq skips over event in the first \`solve\` but works after \`reinit!\`](https://discourse.julialang.org/t/diffeq-skips-over-event-in-the-first-solve-but-works-after-reinit/90935)

<div class="topic-metadata">

**Author:** [@cuihantao](https://discourse.julialang.org/u/cuihantao)\
**Replies:** 16\
**Last updated:** [December 3, 2022, 3:42am UTC](https://discourse.julialang.org/t/diffeq-skips-over-event-in-the-first-solve-but-works-after-reinit/90935 "2022-12-03T03:42:06Z")

</div>

The code below simulates a series resistor and inductor supplied by an AC source through a diode. The diode turns off when the current is \<=0 and turns back on when the voltage across the diode is \>=1. Skipping over eve…

---

## [Monomials with variable of a model](https://discourse.julialang.org/t/monomials-with-variable-of-a-model/91048)

<div class="topic-metadata">

**Author:** [@irezvyakova](https://discourse.julialang.org/u/irezvyakova)\
**Replies:** 3\
**Last updated:** [December 3, 2022, 3:13am UTC](https://discourse.julialang.org/t/monomials-with-variable-of-a-model/91048 "2022-12-03T03:13:38Z")

</div>

Does there exist a nice way to use a certain variable of a model (say, model = Model(COSMO.Optimizer) @variable(model, u) @variable(model, t) ) to get a vector of monomials of \[u,t\] up to certain degree (say, 10) wi…

---

## [Optimization taking too long](https://discourse.julialang.org/t/optimization-taking-too-long/91159)

<div class="topic-metadata">

**Author:** [@mb96](https://discourse.julialang.org/u/mb96)\
**Replies:** 5\
**Last updated:** [December 3, 2022, 3:00am UTC](https://discourse.julialang.org/t/optimization-taking-too-long/91159 "2022-12-03T03:00:27Z")

</div>

Hi everyone, I am solving an optimization problem with a lot of variables through JuMP with Ipopt solver. The convergence time is extremely sensitive to one of my constraints: for example if I use a linear functional f…

---

## [Doubt about "nzval" field in factorization?](https://discourse.julialang.org/t/doubt-about-nzval-field-in-factorization/91151)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 3\
**Last updated:** [December 3, 2022, 12:22am UTC](https://discourse.julialang.org/t/doubt-about-nzval-field-in-factorization/91151 "2022-12-03T00:22:40Z")

</div>

I have the below MWE. I have two things: 1- The matrices of factor and factor1 are different. However, why the fifth element of factor.nzval=7 not 6. but the matrices of \`\`? using SparseArrays, LinearAlgebra, KLU A\_Mat…

---

## [Pull data from websites in Julia](https://discourse.julialang.org/t/pull-data-from-websites-in-julia/91112)

<div class="topic-metadata">

**Author:** [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Replies:** 10\
**Last updated:** [December 2, 2022, 8:33pm UTC](https://discourse.julialang.org/t/pull-data-from-websites-in-julia/91112 "2022-12-02T20:33:17Z")

</div>

As ski resorts begin to open, they update data on their websites throughout the day, every day. Two factors skiiers care about are: (1) # trails currently open, (2) current Snow base Each resort website posts this info…

---

## [Symbolics.jl: How to preevaluate a computationally expensive expression in build\_function()](https://discourse.julialang.org/t/symbolics-jl-how-to-preevaluate-a-computationally-expensive-expression-in-build-function/91147)

<div class="topic-metadata">

**Author:** [@davidschlegel](https://discourse.julialang.org/u/davidschlegel)\
**Replies:** 6\
**Last updated:** [December 2, 2022, 6:23pm UTC](https://discourse.julialang.org/t/symbolics-jl-how-to-preevaluate-a-computationally-expensive-expression-in-build-function/91147 "2022-12-02T18:23:30Z")

</div>

I like the build\_function() method of Symbolics.jl which basically bakes symbolic expressions into compiled code. However, it does so by compiling the full expression which might be numerically highly inefficient. Supp…

---

## [Not able to use lag and lead function](https://discourse.julialang.org/t/not-able-to-use-lag-and-lead-function/91142)

<div class="topic-metadata">

**Author:** [@sai\_matcha](https://discourse.julialang.org/u/sai_matcha)\
**Replies:** 1\
**Last updated:** [December 2, 2022, 5:10pm UTC](https://discourse.julialang.org/t/not-able-to-use-lag-and-lead-function/91142 "2022-12-02T17:10:30Z")

</div>

Hi i just tried to sun a simple exmaple which is given here https://stackoverflow.com/questions/61038354/create-lag-lead-time-series-with-by-groups-in-julia using DataFrames, ShiftedArrays df1 = DataFrame(var1=\["a","a…

---

## [Emacs again](https://discourse.julialang.org/t/emacs-again/41459)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 2\
**Last updated:** [December 2, 2022, 4:26pm UTC](https://discourse.julialang.org/t/emacs-again/41459 "2022-12-02T16:26:36Z")

</div>

I have made some advances with cygwin-based use of Emacs 23.6 on Windows 10, but then the experience with the command line was disappointing. In particular, I couldn’t get used to the mapping between the cygwin and Wind…

---

## [Solving wave PDE with ModelingToolkit.jl and method of lines](https://discourse.julialang.org/t/solving-wave-pde-with-modelingtoolkit-jl-and-method-of-lines/90750)

<div class="topic-metadata">

**Author:** [@fabiopierella](https://discourse.julialang.org/u/fabiopierella)\
**Replies:** 21\
**Last updated:** [December 2, 2022, 3:13pm UTC](https://discourse.julialang.org/t/solving-wave-pde-with-modelingtoolkit-jl-and-method-of-lines/90750 "2022-12-02T15:13:09Z")

</div>

Hi everyone, I am trying to reproduce a standing wave in a 2D fluid domain. I am having troubles to go past the discretization step with the ModelingToolkit.jl - hereafter you find a detailed description of the problem …

[Previous page](https://discourse.julialang.org/latest.md?page=845)

[Next page](https://discourse.julialang.org/latest.md?page=847)
