高校数学の質問スレ(医者・東大卒専用) Part438 (979レス)
上下前次1-新
抽出解除 レス栞
リロード規制です。10分ほどで解除するので、他のブラウザへ避難してください。
52: 2024/08/15(木)19:23:48.55 ID:ysyyeRB1(2/2) AAS
Rに移植
j=\(n){
a=sample(3,n,replace=TRUE)
count=1
while(length(unique(a))!=2){
a=sample(3,n,replace=TRUE)
count=count+1
省21
152: 2024/08/25(日)12:59:59.55 ID:/qrXHaIo(3/11) AAS
>>140
行列で計算させると算出時間が爆速なのにびっくりしました。
達人のスクリプトを改造して道具箱に保存しておきます。
(* j 人でジャンケンをしたときの終了までの回数の最頻値とその確率を返す *)
calc[j_]:=(
M=Table[If[n==m,1-(2^m-2)/3^(m-1),Binomial[m,n]/3^(m-1)],{m,1,j},{n,1,j}];
p=Differences@Table[MatrixPower[M,i][[j,1]],{i,0,10j}];
省10
279: 2024/10/31(木)13:47:25.55 ID:grkcalAP(3/9) AAS
function (n, m)
{
stopifnot(is.numeric(n), is.numeric(m))
if (length(n) == 1) {
n <- rep(n, length(m))
}
else if (length(m) == 1) {
省13
373(1): 2024/12/04(水)16:35:44.55 ID:M2J+bJMI(2/2) AAS
Wolfram Language 14.0.0 Engine for Microsoft Windows (64-bit)
Copyright 1988-2023 Wolfram Research, Inc.
In[1]:= solve[nn_,n_,m_]:=(
ass=Counts[#]& /@ Flatten[Table[Sort /@ IntegerPartitions[x,{n},Range[0,m-1]],{x,m*Range[0,n-1]}],1];
li=KeyValueMap[List,#]& /@ ass;
{q,r}=QuotientRemainder[nn,m];
c=Flatten@{Table[q+1,r],Table[q,m-r]};
省10
427(1): 2024/12/19(木)15:01:20.55 ID:K/JbHbND(1) AAS
東大卒なら算出できるんじゃないの?
Wolfram,Pyth9n,C,Rのどれかは理工系卒なら使えて当然。
Fランは違うのか?
729(3): 02/20(木)18:42:43.55 ID:wRRdyhfp(2/3) AAS
>>728
答は出せたの?Fランくん?
813: 04/30(水)08:13:09.55 ID:wedVH8wl(10/10) AAS
コメントが長すぎて読みにくくなった。
818: 05/01(木)11:18:32.55 ID:L1qIlz9/(4/4) AAS
ニッチな値の探索処理が終了しないコード
rm(list=ls())
library(fmsb)
library(parallel)
alpha <- 0.05
# Function to perform a single simulation
sim_single <- function(N = 100) {
省49
828: 05/05(月)19:09:02.55 ID:LDY1RQtT(3/4) AAS
Details:
The function works by simulating the event outcomes in each group through bootstrap resampling. For each group, it draws `n1` (or `n2`) samples with replacement from a hypothetical population that has the observed proportion of events (`r1/n1` or `r2/n2`). The number of events in each resampled set (`R1` and `R2`) is then used to calculate a bootstrapped risk ratio `(R1/n1) / (R2/n2)`. This process is repeated `nboot` times to generate a distribution of risk ratios. The function then calculates the mean of this distribution and its Highest Density Interval (HDI), which represents the most credible range for the true risk ratio given the data and the bootstrap procedure.
If `verbose` is set to `TRUE`, the function attempts to plot the distribution of the bootstrapped risk ratios using a script named `plotpost.R`. This requires that the `plotpost.R` script exists in the current working directory and is capable of handling the vector of bootstrapped risk ratios.
Value:
The function returns a list with the following components:
省4
847(1): 05/25(日)04:22:37.55 ID:P4nhnL8B(1/6) AAS
# dbeta(L,a,b) == dbbeta(U,a,b)
# Solve[L^(a-1)(1-L)^(b-1)==U^(a-1)(1-U)^(b-1), b]
L=1/7
U=1/5
credMass = 0.95
f = function(a) 1 + ((a - 1) * log(U / L)) / log((1 - L) / (1 - U))
g = function(a) pbeta(U,a,f(a)) - pbeta(L,a,f(a)) - credMass
省9
923: 06/22(日)13:20:05.55 ID:AY7cZjkg(4/10) AAS
>>922
AIは解答を出しておりません
上下前次1-新書関写板覧索設栞歴
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 0.035s