Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

making coefficients random is difficult #77

Open
@RobinHankin

Description

@RobinHankin

When thinking about issues#74 and#76, I wanted something that would take a polynomial and change the coefficients. I wanted a way to return the same polynomial but with random coefficients. I can do something like this:

library("mvp")a<- rmvp()a#> mvp object algebraically equal to#> 3 a b + 3 a^2 e f^3 + 7 a^2 e^2 f + b d^2 + 3 c e + 5 c^4 + 3 fcoeffs(a)<-2^coeffs(a)a#> mvp object algebraically equal to#> 8 a b + 8 a^2 e f^3 + 128 a^2 e^2 f + 2 b d^2 + 8 c e + 32 c^4 + 8 f

But I wanted to make the coefficients a random large-ish number. My best effort:

library("mvp")library("disordR")a<- rmvp()a#> mvp object algebraically equal to#> 7 + 4 a + a b e^2 + 2 a c d e + 4 c^2 d f^2 + 4 d + 3 e ff<-function(x){disord(sample(50:90, length(x),replace=TRUE),h=hash(x))}coeffs(a)<- f(coeffs(a))a#> mvp object algebraically equal to#> 68 + 72 a + 68 a b e^2 + 52 a c d e + 83 c^2 d f^2 + 80 d + 60 e f

This seems unnecessarily difficult. I should either make an easier way [note thatdisordR must be loaded above] or explain why it is a stupid idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp