# General Usage

**URL:** https://discourse.julialang.org/c/usage/6.md?page=348

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

**Page:** 349

---

## [Optimize the product of a matrix and scalar](https://discourse.julialang.org/t/optimize-the-product-of-a-matrix-and-scalar/92443)

<div class="topic-metadata">

**Author:** [@ejlongman](https://discourse.julialang.org/u/ejlongman)\
**Replies:** 3\
**Last updated:** [January 3, 2023, 11:17am UTC](https://discourse.julialang.org/t/optimize-the-product-of-a-matrix-and-scalar/92443 "2023-01-03T11:17:26Z")

</div>

This code: function objective(xy) x, y = xy return (3y^2\*x + x^3-m3)\*W\*(3y^2\*x + x^3-m3) end xy0 = \[x, y\] result = optimize(objective, xy0, NelderMead()) println(result) minimizer = result.minimizer x, y = min…

---

## [How to estimate likelihood functions with normalizing flows in Julia](https://discourse.julialang.org/t/how-to-estimate-likelihood-functions-with-normalizing-flows-in-julia/92414)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 7\
**Last updated:** [January 3, 2023, 11:03am UTC](https://discourse.julialang.org/t/how-to-estimate-likelihood-functions-with-normalizing-flows-in-julia/92414 "2023-01-03T11:03:17Z")

</div>

Hi- I am interested in using normalizing flows in Julia to approximate intractable likelihood functions. The basic idea is to train a neural network to learn the relationship between parameters and samples from a model.…

---

## [How to embed Linkedin page in franklin.jl made website?](https://discourse.julialang.org/t/how-to-embed-linkedin-page-in-franklin-jl-made-website/92376)

<div class="topic-metadata">

**Author:** [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Replies:** 17\
**Last updated:** [January 3, 2023, 9:40am UTC](https://discourse.julialang.org/t/how-to-embed-linkedin-page-in-franklin-jl-made-website/92376 "2023-01-03T09:40:41Z")

</div>

How can i add Linkedin icon franklin.jl made website ?

---

## [State space feedback](https://discourse.julialang.org/t/state-space-feedback/92416)

<div class="topic-metadata">

**Author:** [@lev96jeff](https://discourse.julialang.org/u/lev96jeff)\
**Replies:** 6\
**Last updated:** [January 3, 2023, 8:02am UTC](https://discourse.julialang.org/t/state-space-feedback/92416 "2023-01-03T08:02:39Z")

</div>

Hello everyone! I am new to julia and trying to model with 1 input and 2 output. my problem is that i am unable to create a feedback with a pid controller in the forward path, even if i create the feedback the (first o…

---

## [Symbolics.jl collect like terms?](https://discourse.julialang.org/t/symbolics-jl-collect-like-terms/92426)

<div class="topic-metadata">

**Author:** [@Samuel\_Remedios](https://discourse.julialang.org/u/Samuel_Remedios)\
**Replies:** 1\
**Last updated:** [January 3, 2023, 7:56am UTC](https://discourse.julialang.org/t/symbolics-jl-collect-like-terms/92426 "2023-01-03T07:56:56Z")

</div>

Is there functionality similar to SymPy’s collect in Symbolics.jl? Alternatively I would appreciate another solution to this problem which maybe makes more sense: I’m manipulating a multivariate symbolic equation in th…

---

## [Loss function with scalable constraints](https://discourse.julialang.org/t/loss-function-with-scalable-constraints/92433)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 2\
**Last updated:** [January 2, 2023, 11:38pm UTC](https://discourse.julialang.org/t/loss-function-with-scalable-constraints/92433 "2023-01-02T23:38:49Z")

</div>

Assume a loss function of the firm L1 + a \* L2 where L1 and L2 depend on model parameters. I wish to adjust the coefficient ‘a’ so that the two terms have equal magnitude. However, I do not want the coefficient to be dif…

---

## [Functionality of torch.nograd](https://discourse.julialang.org/t/functionality-of-torch-nograd/92432)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 1\
**Last updated:** [January 2, 2023, 10:55pm UTC](https://discourse.julialang.org/t/functionality-of-torch-nograd/92432 "2023-01-02T22:55:36Z")

</div>

What is the recommended approach to exclude parts of my loss functiin from being targeted by Zygote? I am using Lux.jl. Thanks.

---

## [Optim fails test?](https://discourse.julialang.org/t/optim-fails-test/92339)

<div class="topic-metadata">

**Author:** [@ejlongman](https://discourse.julialang.org/u/ejlongman)\
**Replies:** 9\
**Last updated:** [January 2, 2023, 9:34pm UTC](https://discourse.julialang.org/t/optim-fails-test/92339 "2023-01-02T21:34:25Z")

</div>

Hello, I get the following error when I test Optim. When I try to use the package with “using Optim” I get an error regarding “printf” Package Optim errored during testing Stacktrace: \[1\] pkgerror(msg::String) @ …

---

## [Efficient filter for product iterator](https://discourse.julialang.org/t/efficient-filter-for-product-iterator/92392)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 4\
**Last updated:** [January 2, 2023, 9:33pm UTC](https://discourse.julialang.org/t/efficient-filter-for-product-iterator/92392 "2023-01-02T21:33:55Z")

</div>

while solving a Kakuro puzzle I decided to brute force a section of the puzzle (see image with 8 squares marked x1…x8) I wrote a succinct iterator based approach (f1() in the code below) which is not very efficient comp…

---

## [Gemm! vs symm! performance](https://discourse.julialang.org/t/gemm-vs-symm-performance/92201)

<div class="topic-metadata">

**Author:** [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Replies:** 7\
**Last updated:** [January 2, 2023, 8:19pm UTC](https://discourse.julialang.org/t/gemm-vs-symm-performance/92201 "2023-01-02T20:19:58Z")

</div>

Hi! I try to compare gemm! or symm! performance and get these results for small matrices. gemm! have much better performance, when to use symm!? C = rand(10, 10) A = rand(10, 10) B = rand(10, 10) julia\> @benchmark Lin…

---

## [Evaluating expression on tuple of variables doesn't work inside function](https://discourse.julialang.org/t/evaluating-expression-on-tuple-of-variables-doesnt-work-inside-function/92423)

<div class="topic-metadata">

**Author:** [@derikk](https://discourse.julialang.org/u/derikk)\
**Replies:** 2\
**Last updated:** [January 2, 2023, 7:44pm UTC](https://discourse.julialang.org/t/evaluating-expression-on-tuple-of-variables-doesnt-work-inside-function/92423 "2023-01-02T19:44:04Z")

</div>

I’m trying to write a function that takes in an expression and an assignment to a set of variables, and outputs the expression evaluated on those variables. I came up with the following code: function eval\_vars(expr::Ex…

---

## [Package version conflicts](https://discourse.julialang.org/t/package-version-conflicts/92047)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 6\
**Last updated:** [January 2, 2023, 7:36pm UTC](https://discourse.julialang.org/t/package-version-conflicts/92047 "2023-01-02T19:36:15Z")

</div>

If two packages, say, Flux.jl and Lux.jl, included different versions of Zygote.jl, would this be an issue? Manifest.jl appears to only list one version of each module. What happens in this case? Thanks. Gordon

---

## [DataDrivenDiffEq input question](https://discourse.julialang.org/t/datadrivendiffeq-input-question/92159)

<div class="topic-metadata">

**Author:** [@ejmeitz](https://discourse.julialang.org/u/ejmeitz)\
**Replies:** 4\
**Last updated:** [January 2, 2023, 5:12pm UTC](https://discourse.julialang.org/t/datadrivendiffeq-input-question/92159 "2023-01-02T17:12:05Z")

</div>

I was playing with sparse regression within DataDrivenDiffEq.jl and noticed that when I input a differential equation solution object vs. the discrete data contained in that solution I get wildly different answers. The O…

---

## [Extending julia with C or C++ like python?](https://discourse.julialang.org/t/extending-julia-with-c-or-c-like-python/92406)

<div class="topic-metadata">

**Author:** [@yexiangyan](https://discourse.julialang.org/u/yexiangyan)\
**Replies:** 3\
**Last updated:** [January 2, 2023, 3:14pm UTC](https://discourse.julialang.org/t/extending-julia-with-c-or-c-like-python/92406 "2023-01-02T15:14:07Z")

</div>

Hello everyone. Since I have a C++ library that already has a python interface, it works by the mechanism of getting the arguments passed from a python function and then doing a series of parsing jobs. Something like th…

---

## [Solid of Revolution from Python to Julia](https://discourse.julialang.org/t/solid-of-revolution-from-python-to-julia/92354)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [January 2, 2023, 1:57pm UTC](https://discourse.julialang.org/t/solid-of-revolution-from-python-to-julia/92354 "2023-01-02T13:57:56Z")

</div>

Hi all, I have this Python code that can plot solid of revolution of function with input of the region then become the 3-dimensional object. # R is a region in the xy plane bounded by y = 4 - 2x # Plot A solid of revo…

---

## [How to resolve this method invalidation for \`all\` introduced by loading FillArrays?](https://discourse.julialang.org/t/how-to-resolve-this-method-invalidation-for-all-introduced-by-loading-fillarrays/92417)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 0\
**Last updated:** [January 2, 2023, 1:39pm UTC](https://discourse.julialang.org/t/how-to-resolve-this-method-invalidation-for-all-introduced-by-loading-fillarrays/92417 "2023-01-02T13:39:11Z")

</div>

julia\> using SnoopCompileCore julia\> invalidations = @snoopr using FillArrays; julia\> using SnoopCompile julia\> trees = invalidation\_trees(invalidations); julia\> trees\[end\] inserting all(f::Function, x::FillArrays.Ab…

---

## [Optimization.solve, accessing the number of iterations](https://discourse.julialang.org/t/optimization-solve-accessing-the-number-of-iterations/92402)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 2\
**Last updated:** [January 2, 2023, 7:56am UTC](https://discourse.julialang.org/t/optimization-solve-accessing-the-number-of-iterations/92402 "2023-01-02T07:56:32Z")

</div>

When using Optimization.jl to perform function minimization or weight evaluation in neural networks using Lux, how can I access the iteration number and other optimization characteristics that vary in time from the callb…

---

## [Parameter argument in ODE definition](https://discourse.julialang.org/t/parameter-argument-in-ode-definition/92390)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 1\
**Last updated:** [January 2, 2023, 5:25am UTC](https://discourse.julialang.org/t/parameter-argument-in-ode-definition/92390 "2023-01-02T05:25:19Z")

</div>

@ChrisRackauckas, In the demo listed at https://docs.sciml.ai/Overview/dev/showcase/missing\_physics/, there is the following call that defines a Universal differential equation, where U is a neural network model: # D…

---

## [IOBuffer becomes not writable after \`run\`](https://discourse.julialang.org/t/iobuffer-becomes-not-writable-after-run/92323)

<div class="topic-metadata">

**Author:** [@felipenoris](https://discourse.julialang.org/u/felipenoris)\
**Replies:** 2\
**Last updated:** [January 2, 2023, 3:06am UTC](https://discourse.julialang.org/t/iobuffer-becomes-not-writable-after-run/92323 "2023-01-02T03:06:07Z")

</div>

Hi! When upgrading from Julia v1.7 to Julia v1.8, I noticed this change of behavior when using run passing an IOBuffer as stdout kwarg. On Julia v1.7, I could pass the same instance of the IOBuffer to consecutive run ca…

---

## [New line in Documenter](https://discourse.julialang.org/t/new-line-in-documenter/92393)

<div class="topic-metadata">

**Author:** [@dgagnon](https://discourse.julialang.org/u/dgagnon)\
**Replies:** 4\
**Last updated:** [January 1, 2023, 8:51pm UTC](https://discourse.julialang.org/t/new-line-in-documenter/92393 "2023-01-01T20:51:58Z")

</div>

Hello How can I add one or more blanks lines in a Markdown document? I’ve been browsing the web for 10 minutes and I found solution based on HTML ( ) or Markdown (&bnsp) or even (~). None of them work for me. I am U…

---

## [Joining GroupedDataFrames](https://discourse.julialang.org/t/joining-groupeddataframes/92353)

<div class="topic-metadata">

**Author:** [@s-baumann](https://discourse.julialang.org/u/s-baumann)\
**Replies:** 7\
**Last updated:** [January 1, 2023, 4:24pm UTC](https://discourse.julialang.org/t/joining-groupeddataframes/92353 "2023-01-01T16:24:53Z")

</div>

I want to make a struct containing small dataframes that can efficiently merge into larger dataframes. Is there any out of the box solutions to cache the matching effort required for the joins. I tried to do this using …

---

## [Shorthand for a function that returns kwargs](https://discourse.julialang.org/t/shorthand-for-a-function-that-returns-kwargs/92387)

<div class="topic-metadata">

**Author:** [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Replies:** 3\
**Last updated:** [January 1, 2023, 3:56pm UTC](https://discourse.julialang.org/t/shorthand-for-a-function-that-returns-kwargs/92387 "2023-01-01T15:56:25Z")

</div>

Is it possible to create a function with kwargs that returns a kwargs NamedTuple like this get\_abc(;a,b,c) = (a=a,b=b,c=c) without =(a=a,b=b,c=c)? Or need macroses ?

---

## [About triu error in time code](https://discourse.julialang.org/t/about-triu-error-in-time-code/92383)

<div class="topic-metadata">

**Author:** [@naznaila](https://discourse.julialang.org/u/naznaila)\
**Replies:** 0\
**Last updated:** [January 1, 2023, 2:24pm UTC](https://discourse.julialang.org/t/about-triu-error-in-time-code/92383 "2023-01-01T14:24:01Z")

</div>

UndefVarError: triu not defined Stacktrace: \[1\] GMRES\_NoRestart(n::Int64) @ Main .\\In\[2\]:5 \[2\] macro expansion @ .\\In\[3\]:2 \[inlined\] \[3\] top-level scope @ .\\timing.jl:262 \[inlined\] \[4\] top-level scope @ .\\In\[3\]:…

---

## [Beginner question: precompiling local modules](https://discourse.julialang.org/t/beginner-question-precompiling-local-modules/92375)

<div class="topic-metadata">

**Author:** [@Yonatan\_Beer](https://discourse.julialang.org/u/Yonatan_Beer)\
**Replies:** 2\
**Last updated:** [January 1, 2023, 2:09pm UTC](https://discourse.julialang.org/t/beginner-question-precompiling-local-modules/92375 "2023-01-01T14:09:36Z")

</div>

I am still pretty new to Julia, so I do not know if this question is cogent. My workflow generally looks like making a bunch of smaller functions packaged into bundles. In Julia, the way to do this at first seems to be t…

---

## [Optimizer not found error](https://discourse.julialang.org/t/optimizer-not-found-error/92364)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 8\
**Last updated:** [December 31, 2022, 7:08pm UTC](https://discourse.julialang.org/t/optimizer-not-found-error/92364 "2022-12-31T19:08:09Z")

</div>

@ChrisRackauckas, I am running a UODE solver using Optimization.jl per recommendation. Here are a few lines from a larger code (I might construct a MWE later). adtype = Optimization.AutoZygote() # adtype = Optimizatio…

---

## [Precompilation of DifferentialEquations.jl](https://discourse.julialang.org/t/precompilation-of-differentialequations-jl/92363)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 10\
**Last updated:** [December 31, 2022, 6:57pm UTC](https://discourse.julialang.org/t/precompilation-of-differentialequations-jl/92363 "2022-12-31T18:57:34Z")

</div>

I am loading (with using) several packages. DifferentialEquations.jl takes a long time to precompile (1-2 minutes). I exit Julia and reload the packages. Again, DifferentialEquations.jl takes the same time to precompile.…

---

## [RequestError: HTTP/2 502 while requesting https://pkg.julialang.org/registries](https://discourse.julialang.org/t/requesterror-http-2-502-while-requesting-https-pkg-julialang-org-registries/92342)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 5\
**Last updated:** [December 31, 2022, 5:38pm UTC](https://discourse.julialang.org/t/requesterror-http-2-502-while-requesting-https-pkg-julialang-org-registries/92342 "2022-12-31T17:38:42Z")

</div>

The general registry suddenly seems to be down. (This is Nightly Julia, but the same thing happens with 1.8.) (@v1.10) pkg\> up ┌ Warning: could not download https://pkg.julialang.org/registries │ exception = RequestEr…

---

## [Lm (GLM) gives negative R2](https://discourse.julialang.org/t/lm-glm-gives-negative-r2/92346)

<div class="topic-metadata">

**Author:** [@jgr](https://discourse.julialang.org/u/jgr)\
**Replies:** 2\
**Last updated:** [December 31, 2022, 3:39pm UTC](https://discourse.julialang.org/t/lm-glm-gives-negative-r2/92346 "2022-12-31T15:39:48Z")

</div>

Hi, I’m using lm to estimate R2 for a regression. The data is not real data, and y and x are pretty much the same. I would expect a R2 close to 1, however, I got -Inf or other negative values. I’m not sure why. A replica…

---

## [Problems with posdef symmetric matrix and LinearSolve](https://discourse.julialang.org/t/problems-with-posdef-symmetric-matrix-and-linearsolve/92343)

<div class="topic-metadata">

**Author:** [@CodeLenz](https://discourse.julialang.org/u/CodeLenz)\
**Replies:** 3\
**Last updated:** [December 31, 2022, 3:04pm UTC](https://discourse.julialang.org/t/problems-with-posdef-symmetric-matrix-and-linearsolve/92343 "2022-12-31T15:04:59Z")

</div>

I am trying to move some FEM code to use the LinearSolve package. Consider the code using LinearAlgebra, SparseArrays, LinearSolve # Create a posdef symmetric matrix A = sprand(100,100,0.01); A = A + A' + 100\*I; # rhs…

---

## [How to publish a pdf with Weave](https://discourse.julialang.org/t/how-to-publish-a-pdf-with-weave/92337)

<div class="topic-metadata">

**Author:** [@ceysa75](https://discourse.julialang.org/u/ceysa75)\
**Replies:** 3\
**Last updated:** [December 31, 2022, 2:17pm UTC](https://discourse.julialang.org/t/how-to-publish-a-pdf-with-weave/92337 "2022-12-31T14:17:14Z")

</div>

Hi all, I am trying to generate a pdf document from my jmd file as follows: weave("myTest.jmd"; doctype = "md2pdf") However, for some reason it exits with an error (whereas a html can be generated without any issues). …

[Previous page](https://discourse.julialang.org/c/usage/6.md?page=347)

[Next page](https://discourse.julialang.org/c/usage/6.md?page=349)
