Zulip Chat Archive

Stream: Is there code for X?

Topic: finset.center_mass as a linear map


Yaël Dillies (Sep 17 2021 at 17:38):

I'm trying to redefine docs#finset.center_mass as a linear map.

def finset.center_mass {𝕜 E : Type*} [ordered_semiring 𝕜] [add_comm_monoid E] [module 𝕜 E]
  (s : finset ι) (p : ι  E) :
  (ι  𝕜) →ₗ[𝕜] E :=
λ w,  i in s, w i  p i, ???

I'm completely clueless about the names of the bundled linear maps I need. What are they? Maybe docs#linear_map.smul_right is close?

Yury G. Kudryashov (Sep 17 2021 at 17:45):

I suggest that you use docs#finsupp and docs#finsupp.lift

Yury G. Kudryashov (Sep 17 2021 at 17:45):

No, wrong bundled version.

Yury G. Kudryashov (Sep 17 2021 at 17:47):

I'm surprised that we don't have a more bundled version of docs#finsupp.total


Last updated: Dec 20 2023 at 11:08 UTC