高校数学の質問スレ(医者・東大卒専用) Part438 (991レス)
高校数学の質問スレ(医者・東大卒専用) Part438 http://rio2016.5ch.net/test/read.cgi/math/1723152147/
上
下
前
次
1-
新
通常表示
512バイト分割
レス栞
841: 132人目の素数さん [sage] 2025/05/23(金) 10:58:19.14 ID:or+7Cxzr # " Construct a Monte Carlo study that investigates how the probability of coverage depends on the sample size and true proportion value. In the study, let n be 10, 25, 50, and 100 and let p be .05, .25, and .50. Write an R function that has three inputs, n, p, and the number of Monte Carlo simulations m,and will output the estimate of the exact coverage probability. Implement your function using each combination of n and p and m
= 1000 simulations. Describe how the actual probability of coverage of the traditional interval depends on the sample size and true proportion value. " f = \(n,p,m=1000){ y=rbinom(m,n,p) phat=y/n se=sqrt(phat*(1-phat)/n) lo=phat - qnorm(0.975)*se up=phat + qnorm(0.975)*se mean(lo < p & p < up) } f=Vectorize(f) n_values = c(10, 25, 50,100) p_values = c(0.05, 0.25, 0.5) set.seed(123) outer(n_values,p_values,f) http://rio2016.5ch.net/test/read.cgi/math/1723152147/841
842: 132人目の素数さん [sage] 2025/05/24(土) 02:35:14.53 ID:VetM3rz7 LearnBayes::beta.selectをoptimを使って算出 beta.optim <- function(x1, p1, x2, p2, verbose = TRUE) { # ------------------------- # モーメント近似による初期値推定 # ------------------------- mu0 <- (x1 + x2) / 2 # 仮の平均 sigma2 <- ((x2 - x1) / 4)^2 # 仮の分散(中間50%幅から) v <- mu0 * (1 - mu0) / sigma2 - 1 a0 <- mu0 * v b0 <- (1 - mu0) * v start <- c(a0, b0) # ----------------
--------- # 最適化対象の誤差関数定義 # ------------------------- objective <- function(params) { a <- params[1] b <- params[2] # pbeta による累積確率との差を2乗誤差で評価 err1 <- pbeta(x1, a, b) - p1 err2 <- pbeta(x2, a, b) - p2 return(err1^2 + err2^2) } # ------------------------- # 最適化(境界付き) # ------------------------- result <- optim( par = start, fn = objective, method = "L-BFGS-B", lower = c(1e-4, 1e-4) # ベータ分布は a, b > 0 ) # ------------------------- #
結果の取り出し # ------------------------- a_hat <- result$par[1] b_hat <- result$par[2] if (verbose) { cat("推定されたパラメータ: a =", round(a_hat, 4), ", b =", round(b_hat, 4), "\n") cat("pbeta(x1) =", round(pbeta(x1, a_hat, b_hat), 4), "(目標:", p1, ")\n") cat("pbeta(x2) =", round(pbeta(x2, a_hat, b_hat), 4), "(目標:", p2, ")\n") } # ------------------------- # 結果を返す # ------------------------- ret
urn(list(a = a_hat, b = b_hat, ss_value = result$value)) } http://rio2016.5ch.net/test/read.cgi/math/1723152147/842
843: 132人目の素数さん [sage] 2025/05/24(土) 08:17:52.86 ID:VetM3rz7 library(rjags) # Fit a Bayesian logistic regression model using JAGS and return predictions and posterior summaries fit_bayesian_logistic_jags <- function(data, formula, newdata, n.chains = 3, n.iter = 5000, n.burnin = 1000) { # Extract response variable name from the formula response_var <- all.vars(formula)[1] y <- data[[response_var]] # Convert factor response to binary numeric (0/1) if (is.factor(y)) y <- as.numeric(y
) - 1 y <- as.numeric(y) # Construct design matrices for training and new data X <- model.matrix(formula, data) new_X <- model.matrix(delete.response(terms(formula)), newdata) # Prepare data list for JAGS jags_data <- list( y = y, X = X, n = nrow(X), p = ncol(X), new_X = new_X, scale_beta = rep(2.5, ncol(X)) # Prior scale for each coefficient ) # Define the JAGS model model_string <- " model { for (j in 1:p) { beta[j] ~ dt(0, 1 / pow(scale_beta[j], 2), 1) } for (i in 1:n) { logit_p[
i] <- inprod(X[i,], beta[]) y[i] ~ dbern(1 / (1 + exp(-logit_p[i]))) } new_logit <- inprod(new_X[1,], beta[]) new_p <- 1 / (1 + exp(-new_logit)) } " # Initialize and run the JAGS model model <- jags.model(textConnection(model_string), data = jags_data, n.chains = n.chains, quiet = TRUE) update(model, n.burnin) # Draw posterior samples samples <- coda.samples(model, c("beta", "new_p"), n.iter - n.burnin) mat <- as.matrix(samples) # Return results list( model = s
amples, predicted_prob = mean(mat[, "new_p"]), summary = summary(samples) ) } http://rio2016.5ch.net/test/read.cgi/math/1723152147/843
844: 132人目の素数さん [sage] 2025/05/24(土) 08:18:19.92 ID:VetM3rz7 # Example data data <- data.frame( donation = c(0, 1000, 2000, 0, 3000, 0, 4000, 0, 5000, 0), score = c(90, 40, 35, 88, 30, 85, 25, 92, 20, 89), parent = c(0, 1, 1, 0, 1, 0, 1, 0, 1, 0), admission = as.factor(c(0, 1, 1, 0, 1, 0, 1, 0, 1, 0)) ) # New observation to predict newdata <- data.frame( donation = 2500, score = 40, parent = 1 ) # Fit model and obtain results set.seed(123) result <- fit_bayesian_logistic_jags( data =
data, formula = admission ~ donation + score + parent, newdata = newdata ) # Extract variable names including intercept var_names <- colnames(model.matrix(admission ~ donation + score + parent, data)) # Extract beta coefficient summaries beta_stats <- result$summary$statistics[grep("^beta\\[", rownames(result$summary$statistics)), c("Mean", "SD")] beta_quants <- result$summary$quantiles[grep("^beta\\[", rownames(result$summary$quantiles)), c("2.5%"
;, "97.5%")] # Rename row names using variable names rownames(beta_stats) <- var_names rownames(beta_quants) <- var_names # Display results print(beta_stats) print(beta_quants) cat("Predicted probability:", round(result$predicted_prob, 3), "\n") http://rio2016.5ch.net/test/read.cgi/math/1723152147/844
845: 132人目の素数さん [sage] 2025/05/24(土) 08:37:05.75 ID:VetM3rz7 library(rjags) # Fit a Bayesian logistic regression model using JAGS and return predictions and posterior summaries fit_bayesian_logistic_jags <- function(data, formula, newdata, n.chains = 3, n.iter = 5000, n.burnin = 1000) { # Extract response variable name from the formula response_var <- all.vars(formula)[1] y <- data[[response_var]] # Convert factor response to binary numeric (0/1) if (is.factor(y)) y <- as.numeric(y
) - 1 y <- as.numeric(y) # Construct design matrices for training and new data X <- model.matrix(formula, data) new_X <- model.matrix(delete.response(terms(formula)), newdata) # Prepare data list for JAGS jags_data <- list( y = y, X = X, n = nrow(X), p = ncol(X), new_X = new_X, scale_beta = rep(2.5, ncol(X)) # Prior scale for each coefficient ) # Define the JAGS model model_string <- " model { for (j in 1:p) { beta[j] ~ dt(0, 1 / pow(scale_beta[j], 2), 1) } for (i in 1:n) { logit_p[
i] <- inprod(X[i,], beta[]) y[i] ~ dbern(1 / (1 + exp(-logit_p[i]))) } new_logit <- inprod(new_X[1,], beta[]) new_p <- 1 / (1 + exp(-new_logit)) } " # Initialize and run the JAGS model model <- jags.model(textConnection(model_string), data = jags_data, n.chains = n.chains, quiet = TRUE) update(model, n.burnin) # Draw posterior samples samples <- coda.samples(model, c("beta", "new_p"), n.iter - n.burnin) mat <- as.matrix(samples) # Return results list( model = s
amples, predicted_prob = mean(mat[, "new_p"]), summary = summary(samples) ) } http://rio2016.5ch.net/test/read.cgi/math/1723152147/845
846: 132人目の素数さん [sage] 2025/05/24(土) 21:16:24.84 ID:VetM3rz7 # 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 (re=uniroot(g,c(1,1e5))) curve(g(x),1,150,bty="l") ; abline(h=0,lty=3) c(re$root,f(re$root)) http://rio2016.5ch.net/test/read.cgi/math/1723152147/846
847: 132人目の素数さん [sage] 2025/05/25(日) 04:22:37.55 ID:P4nhnL8B # 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 (re=uniroot(g,c(1,1e5))) a=re$root b=f(a) c(a,b) curve(g(x),1,1.5*a,bty="l") ; abline(h=0,lty=3) a/(a+b) # mean (a-1)/(a-1+b-1) # mode library(LearnBayes) beta.select(list(x=1/7,p=0.025),
list(x=1/5,p=0.975)) http://rio2016.5ch.net/test/read.cgi/math/1723152147/847
848: 132人目の素数さん [sage] 2025/05/25(日) 05:57:52.88 ID:P4nhnL8B >847のRのコードをChatGPTで Mathematicaにコメント付きで移植 (* betaParameter 関数: 指定された信頼区間 [L, U] に、指定された信頼度 credMass(例: 95%)の確率質量を持つ ベータ分布のパラメータ α, β を算出する。 *) betaParameter[L_: 1/7, U_: 1/5, credMass_: 0.95] := Module[ {α, β}, (* f[α] は、PDF[BetaDistribution[α, β], L] == PDF[BetaDistribution[α, β], U] を満たすように β を α に基づいて算出する関数。 *) f[α_] := 1 + ((α -
1) * Log[U / L]) / Log[(1 - L) / (1 - U)]; (* g[α] は、ベータ分布 Beta[α, f[α]] の区間 [L, U] に 含まれる確率(CDFの差)を返す関数。 *) g[α_] := CDF[BetaDistribution[α, f[α]], U] - CDF[BetaDistribution[α, f[α]], L]; (* g[α] = credMass を満たす α を数値的に求める *) α = α /. FindRoot[g[α] == credMass, {α, 1, 1*^5}]; (* 対応する β を算出 *) β = f[α]; (* 結果を返す *) {α, β} ] (* 関数を実行して α, β を取得 *) {α, β} = betaParameter[] (* g[α] を評価して、[L, U] に credMass の質量
があることを確認 *) g[α] http://rio2016.5ch.net/test/read.cgi/math/1723152147/848
849: 132人目の素数さん [sage] 2025/05/25(日) 06:42:27.34 ID:P4nhnL8B >>847 このプロトタイプをAIに与えて描画機能やコメントをつけてもらった。 beta.parameter <- function(lower, upper, credMass = 0.95, verbose = FALSE) { # Helper function to convert decimal numbers to fraction strings using MASS::fractions fractionStr <- function(x) { as.character(MASS::fractions(x)) } # Function to compute beta parameter (beta) based on alpha, # derived from the condition on the shape of the distribution bet
ween lower and upper f <- function(alpha) { 1 + ((alpha - 1) * log(upper / lower)) / log((1 - lower) / (1 - upper)) } # Root-finding function: difference between desired credible mass # and the Beta CDF probability between lower and upper with parameters (alpha, f(alpha)) g <- function(alpha) { pbeta(upper, alpha, f(alpha)) - pbeta(lower, alpha, f(alpha)) - credMass } # Find the root of g(alpha) = 0 over the interval [1, 1e5] # to find the alpha value that satisfies the credible mass condition re &l
t;- uniroot(g, c(1, 1e5)) alpha <- re$root beta <- f(alpha) # Calculate the mean of the Beta distribution mean <- alpha / (alpha + beta) # Calculate the mode if defined (alpha > 1 and beta > 1), # otherwise set mode to NA as it is undefined mode <- if (alpha > 1 && beta > 1) { (alpha - 1) / (alpha + beta - 2) } else { NA } http://rio2016.5ch.net/test/read.cgi/math/1723152147/849
850: 132人目の素数さん [sage] 2025/05/25(日) 06:42:37.76 ID:P4nhnL8B # If verbose flag is TRUE, plot the Beta distribution and annotate results if (verbose) { # Generate x values from 0 to 1 for plotting the density x <- seq(0, 1, length.out = 1000) # Compute Beta density values at x y <- dbeta(x, alpha, beta) # Color bars within the credible interval [lower, upper] as "lightcoral", # others as light gray ("gray70") col <- ifelse(x >= lower & x <= upper, "lightc
oral", "gray70") # Plot histogram-like vertical lines representing the Beta density plot(x, y, type = "h", col = col, lwd = 2, main = sprintf("Beta(%.2f, %.2f) Distribution\n[%s, %s] with %.0f%% Probability Mass", alpha, beta, fractionStr(lower), fractionStr(upper), credMass * 100), xlab = "x", ylab = "Density", bty = "n") # Add vertical dashed line for the mean, colored skyblue abline(v = mean, col = "skyblue", lwd = 1, lty = 2)
# Add vertical dashed line for the mode if defined, colored dark green if (!is.na(mode)) { abline(v = mode, col = "darkgreen", lwd = 1, lty = 2) } # Prepare legend labels for mean, mode (if exists), and credible interval labels <- c( paste0("Mean = ", round(mean, 3)), if (!is.na(mode)) paste0("Mode = ", round(mode, 3)) else NULL, paste0("95% Credible Interval [", fractionStr(lower), ", ", fractionStr(upper), "]") ) # Corresponding colors for l
egend items colors <- c( "skyblue", if (!is.na(mode)) "darkgreen" else NULL, "lightcoral" ) # Line types for legend items (dashed lines for mean and mode, none for credible interval) ltys <- c(2, if (!is.na(mode)) 2 else NULL, NA) # Plot characters for legend (none for lines, solid square for interval) pchs <- c(NA, if (!is.na(mode)) NA else NULL, 15) # Add legend at the top of the plot with no box, scaled text size legend("top", legend = labels, col = col
ors, bty = "n", cex = 0.9, lty = ltys, pch = pchs) } # Return a named vector of calculated parameters and statistics c(alpha = alpha, beta = beta, mean = mean, mode = mode) } http://rio2016.5ch.net/test/read.cgi/math/1723152147/850
851: 132人目の素数さん [sage] 2025/05/25(日) 06:51:16.85 ID:P4nhnL8B 今回スムーズに機能拡張できた理由は、以下のようにプロトタイプが非常に明快かつ健全だったことが大きな要因です。 ✅ プロトタイプの良さが拡張性を支えた理由 1. 構造がシンプル 中心となる数式(pbeta(U, a, b) - pbeta(L, a, b) = credMass)が明確で、ロジックが一貫していました。 f(a) で b を a の関数として定義しており、探索空間を1次元に抑えていた点も効率的。 2. 関数分離と再利用が可能 f(a) や g(a) が関数として定義されていたので、視覚化やバ
リエーションの追加が簡単でした。 3. 出力が明確 c(a, b) と返す構造が明瞭で、追加情報(期待値・最頻値など)も素直に足せました。 4. 数値的安定性が良好 uniroot() による根の探索は数値計算としても信頼性が高く、実用的。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/851
852: 132人目の素数さん [sage] 2025/05/25(日) 10:38:10.59 ID:P4nhnL8B HDI_discrete <- function(prob_data, credMass) { x = prob_data[, 1] p = prob_data[, 2] n = length(x) sp = sort(p, index.return = TRUE) i = sp$ix[seq(n, 1, -1)] ps = p[i] xs = x[i] cp = cumsum(ps) ii = 1:n j = ii[cp >= credMass] j = j[1] achieved_credMass = cp[j] hdi_set = sort(xs[1:j]) v = list(credMass = achieved_credMass, set = hdi_set) return(v) } http://rio2016.5ch.net/test/read.cgi/math/1723152147/852
853: 132人目の素数さん [sage] 2025/05/29(木) 17:36:18.23 ID:WPcwJ6cn " サイコロを50回なげて4回1の目がでた。 1の目のでる確率は1/6である仮説が正しい確率を求めよ。 計算に必要なモデルは適宜設定してよい。 例:サイコロを投げる前のこの仮説が正しい確率は一様分布に従う。 a/(a+b)=p a=p(a+b) (1-p)a=pb b=a*(1-p)/p a=b*p/(1-p) a/b=p/(1-p) " rm(list=ls()) p=1/6 n=50 y=4 pbinom(y,n,p) dbinom(y,n,p) fn <- function(prob){ sub <-function(alpha) pbetat(p,prob,c(1,(1-p)/p)*alpha,c(y,n-y))$post optimiz
e(sub,c(1,100))$objective } fn = Vectorize(fn) fn(0.5) prior.probs=runif(1e6) post.probs=fn(prior.probs) summary(post.probs) HDInterval::hdi(post.probs) source("plotpost.R") plotpost(post.probs,col="lightcoral") lines(density(post.probs)) http://rio2016.5ch.net/test/read.cgi/math/1723152147/853
854: 132人目の素数さん [sage] 2025/05/30(金) 06:24:20.07 ID:zoAuXcvc par(bty="l") y = c(43, 24, 100, 35, 85) yn = max(y) n = length(y) B = 200 like = numeric(B) for(i in yn:B) { like[i] = 1 / (i^n) } pmf = like / sum(like) mean = sum((1:B) * pmf) plot(pmf, main="Posterior PMF of N", xlab="N", ylab="Probability", type="h", col="blue") plot(cumsum(pmf), main="Posterior CDF of N", xlab="N", ylab="Cumulative Probability&quo
t;, type="s", col="blue") abline(h=0.95, lty=3) c(lower=yn, mean=mean, upper=which(cumsum(pmf) > 0.95)[1]) sd = sqrt(sum(((1:B) - mean)^2 * pmf)) prob_N_gt_150 = sum(pmf[151:B]) cat("Posterior Mean:", mean, "\n") cat("Posterior Standard Deviation:", sd, "\n") cat("P(N > 150):", prob_N_gt_150, "\n") http://rio2016.5ch.net/test/read.cgi/math/1723152147/854
855: 132人目の素数さん [sage] 2025/05/30(金) 19:44:31.38 ID:zoAuXcvc (* pbetat関数の定義 *) pbetat[p0_, prob_, ab_, data_] := Module[{a, b, s, f, lbf, bf, post}, a = ab[[1]]; b = ab[[2]]; s = data[[1]]; f = data[[2]]; lbf = s * Log[p0] + f * Log[1 - p0] + Log@Beta[a, b] - Log@Beta[a + s, b + f]; bf = Exp[lbf]; post = prob * bf / (prob * bf + 1 - prob); <|"bf" -> bf, "post" -> post|> ] (* 関数fの定義 *) f[alpha_] := pbetat[1/6, 0.5, {alpha, 5*alpha - 4}, {4, 50 - 4}][&quo
t;post"] (* 最小化 *) result = NMinimize[{f[alpha], 0 <= alpha <= 20}, alpha] http://rio2016.5ch.net/test/read.cgi/math/1723152147/855
856: 132人目の素数さん [sage] 2025/05/30(金) 20:13:47.71 ID:zoAuXcvc p_post_null <- function(p0, prior, alpha, beta, success, failure){ # Calculate the total number of trials from successes and failures. total = success + failure # Calculate the likelihood of the data under the null hypothesis (H0). # This assumes a binomial distribution where the success probability is p0. m0 = dbinom(success, total, p0) # Calculate the marginal likelihood of the data under the alternative hypothesis (H1). # Under
H1, the success probability is assumed to follow a Beta distribution # with parameters alpha and beta. This function (from the 'extraDistr' package) # computes the marginal likelihood by integrating over all possible success probabilities. m1 = extraDistr::dbbinom(success, total, alpha, beta) # Calculate the Bayes Factor (BF01). # This is the ratio of the likelihood under the null hypothesis (m0) # to the marginal likelihood under the alternative hypothesis (m1). BF01 = m0 / m1 # Calculate the posterior
probability of the null hypothesis. # This updates the prior belief (prior) based on the evidence from the data (BF01). p_post = prior * BF01 / (prior * BF01 + 1 - prior) # Return both the Bayes Factor and the posterior probability as a named vector. c(BF01 = BF01, p_post = p_post) } # Optimize the 'alpha' parameter to maximize the posterior probability of the null hypothesis. # We're trying to find the 'alpha' value (within the range 0 to 1e6) that makes the # null hypothesis most plausible, given the da
ta and the relationship beta = 5*alpha - 4. # p_post_null(...)[2] specifically extracts the 'p_post' value from the function's output. optimize(function(alpha) p_post_null(p0 = 1/6, prior = 1/2, alpha, 5 * alpha - 4, # Beta parameter is a function of alpha success = 4, failure = 50 - 4)[2], c(0, 1e6)) # Search range for alpha # Calculate the Bayes Factor and posterior probability using specific alpha and beta values. # These specific values (alpha = 50/9, beta = 5*50/9 - 4) are likely the result of the # o
ptimization step above, or pre-determined values that are of interest. p_post_null(1/6, 1/2, 50/9, 5 * 50/9 - 4, 4, 50 - 4) http://rio2016.5ch.net/test/read.cgi/math/1723152147/856
857: 132人目の素数さん [sage] 2025/05/31(土) 05:25:02.62 ID:jzcOJBMt #' @title ベイズ事後確率計算関数 #' @description 帰無仮説と対立仮説の事後確率を計算 #' @param s 観測成功数(1の目が出た回数) #' @param n 総試行回数 #' @param p0 帰無仮説の確率(例: 1/6) #' @param prior 帰無仮説の事前確率(0~1) #' @param alpha 対立仮説のベータ分布αパラメータ #' @param beta 対立仮説のベータ分布βパラメータ #' @return list(bf01=ベイズファクター, post=事後確率, method=使用手法) calculate_posterior <- function
(s, n, p0, prior, alpha, beta) { # 入力検証 stopifnot( s >= 0, n > 0, p0 > 0 && p0 < 1, prior >= 0 && prior <= 1, alpha > 0, beta > 0 ) # 帰無仮説の尤度計算 m0 <- dbinom(s, n, p0) # 対立仮説の周辺尤度計算(extraDistr有無で自動切替) if (requireNamespace("extraDistr", quietly = TRUE)) { m1 <- extraDistr::dbbinom(s, n, alpha, beta) method <- "extraDistr::dbbinom()" } else { integrand <- function(p) dbinom(s, n, p) * dbeta(p, alpha, bet
a) m1 <- integrate(integrand, 0, 1)$value method <- "数値積分" } # ベイズファクターと事後確率計算(指定された式を使用) bf01 <- m0 / m1 post <- m0 * prior / (m0 * prior + (1 - prior) * m1) # 結果をリストで返す list( bf01 = bf01, post = post, method = method, inputs = list(s = s, n = n, p0 = p0, prior = prior, alpha = alpha, beta = beta), likelihoods = list(m0 = m0, m1 = m1) ) } http://rio2016.5ch.net/test/read.cgi/math/1723152147/857
858: 132人目の素数さん [sage] 2025/06/01(日) 07:35:56.27 ID:/PZFDI/g auc = integrate(unnorm_posterior,0,Inf)$value integrate(\(x) x*unnorm_posterior(x)/auc, 0,Inf) log_auc <- log(integrate(\(x) exp(log(unnorm_posterior(x))), 0, Inf)$value) integrate(\(x) x * exp(log(unnorm_posterior(x)) - log_auc), 0, Inf)$value http://rio2016.5ch.net/test/read.cgi/math/1723152147/858
859: 132人目の素数さん [sage] 2025/06/01(日) 09:23:27.85 ID:9o1m2vAK Calculate the marginal likelihood of the data under the alternative hypothesis (H1). wwwwwwwwwwwwwwwwwwwwwwwwwwwwww あほ~~ wwwwwwwwwwwwwwwwwwwwwwwwwwwwww http://rio2016.5ch.net/test/read.cgi/math/1723152147/859
860: 132人目の素数さん [sage] 2025/06/01(日) 10:41:31.84 ID:/PZFDI/g はい、Gelmanらの推奨は確かに進化しており、近年ではハーフt分布(half-t)がより一般的に推奨されています。この変化の背景と具体的な推奨内容を、理論的根拠と実践的なアドバイスに分けて解説します。 1. Gelmanの推奨の変遷 (1) 初期(2006年頃): ハーフコーシー(自由度ν=1)の推奨 推奨理由: 分散パラメータの弱情報事前分布として適切 裾が重く、極端な値への過剰なペナルティを回避 問題点: 自由度ν=1ではスケールの選択に敏感 小規模データで不安定にな
る可能性 (2) 近年(2013年以降): 自由度ν>1のハーフt分布へ移行 推奨理由: 自由度ν=3〜7でより安定した推定が可能 スケールパラメータの影響が緩和 代表的な論文: Gelman et al. (2013), "The Prior Can Often Only Be Understood in the Context of the Likelihood" http://rio2016.5ch.net/test/read.cgi/math/1723152147/860
861: 132人目の素数さん [sage] 2025/06/02(月) 11:14:31.22 ID:GMuHFUYr x = c(-0.86, -0.3, -0.05, 0.73) n = c(5, 5, 5, 5) y = c(0, 1, 3, 5) (data = cbind(x, n, y)) (response = cbind(y, n - y) ) results = glm(response ~ x, family = binomial) #summary(results) -results$coef[1]/results$coef[2] library(MASS) # mvrnorm を使うため # 推定された係数と共分散行列 beta_hat = coef(results) (vcov_matrix = vcov(results)) # 多変量正規乱数を生成(β0, β1) set.seed(123) # 再現性のため samples = mvrnorm(n = 10000, mu
= beta_hat, Sigma = vcov_matrix) # 各サンプルから LD50 を計算 LD50_samples = -samples[,1] / samples[,2] # 信頼区間(95%) CI = quantile(LD50_samples, probs = c(0.025, 0.975)) # 結果表示 cat("シミュレーションによるLD50の95%信頼区間:\n") print(CI) http://rio2016.5ch.net/test/read.cgi/math/1723152147/861
862: 132人目の素数さん [sage] 2025/06/02(月) 12:04:32.64 ID:GMuHFUYr # データ x <- c(-0.86, -0.3, -0.05, 0.73) n <- c(5, 5, 5, 5) y <- c(0, 1, 3, 5) # JAGSモデル model_string <- " model { for (i in 1:N) { y[i] ~ dbin(p[i], n[i]) logit(p[i]) <- beta0 + beta1 * x[i] } # 事前分布(非情報的) beta0 ~ dnorm(0.0, 0.001) beta1 ~ dnorm(0.0, 0.001) # LD50の定義 LD50 <- -beta0 / beta1 } " # JAGSに渡すデータ data_jags <- list( x = x, n = n, y = y, N = length(y) ) # 初期値 inits &
lt;- function() { list(beta0 = rnorm(1, 0, 1), beta1 = rnorm(1, 0, 1)) } # モデル作成と実行 model <- jags.model(textConnection(model_string), data = data_jags, inits = inits, n.chains = 3) update(model, 1000) # バーンイン # サンプリング samples <- coda.samples(model, variable.names = c("beta0", "beta1", "LD50"), n.iter = 10000) # 結果表示(LD50の95%信用区間) summary(samples) LD50_samples <- as.matrix(samples)[, "LD50"] quantile(LD50_samples, probs = c(0.
025, 0.975)) plot(samples) http://rio2016.5ch.net/test/read.cgi/math/1723152147/862
863: 132人目の素数さん [sage] 2025/06/03(火) 00:31:29.12 ID:CfA5PBxZ x = c(-0.86, -0.3, -0.05, 0.73) n = c(5, 5, 5, 5) y = c(0, 1, 3, 5) (data = cbind(x, n, y)) (response = cbind(y, n - y) ) results = glm(response ~ x, family = binomial(link="logit") ) summary(results) b=MASS::mvrnorm(1e5,results$coef,S=vcov(results)) # log(p/(1-p)) = b1+b2*x LD = function(b1,b2,p=0.5) (log(p/(1-p)) - b1)/b2 LD50=mapply(LD,b[,1],b[,2]) hist(LD50) quantile(LD50,c(0.025,0.5,0.975)) HDInterval::hdi(LD50) http://
rio2016.5ch.net/test/read.cgi/math/1723152147/863
864: 132人目の素数さん [sage] 2025/06/03(火) 23:40:25.34 ID:CfA5PBxZ k=10 m=400 Nmax=1000 sim = \(){ N=sample(m:Nmax,1) if(max(sample(1:N,k))==m) return(N) } N=NULL while(length(N)<1000) N=c(N,sim()) summary(N) quantile(N,c(0.5,0.95)) http://rio2016.5ch.net/test/read.cgi/math/1723152147/864
865: 132人目の素数さん [sage] 2025/06/04(水) 07:49:17.80 ID:n75lIIio set.seed(123) solve = function(x,k=1e5){ f = function(x) runif(1,x-0.5,x+0.5) y=replicate(k,mean(sapply(x,f))) quantile(y,p=c(0.025,0.975)) } solve(c(9,10,11,11,12)) set.seed(123) # 再現性のため solve2 <- function(x, k = 1e5) { # 各x_iに対して一様乱数を生成し、平均を計算(ブートストラップ) bootstrap_means <- replicate(k, { x_true <- runif(length(x), x - 0.5, x + 0.5) mean(x_true) }) # 95%信頼区間を計算 quantile(bootstrap_m
eans, probs = c(0.025, 0.975)) } # 実行例 x_rounded <- c(9, 10, 11, 11, 12) solve2(x_rounded) http://rio2016.5ch.net/test/read.cgi/math/1723152147/865
866: 132人目の素数さん [sage] 2025/06/05(木) 13:25:27.68 ID:tGlaBVfa > stancode(fit) // generated with brms 2.22.0 functions { /* compute monotonic effects * Args: * scale: a simplex parameter * i: index to sum over the simplex * Returns: * a scalar between 0 and rows(scale) */ real mo(vector scale, int i) { if (i == 0) { return 0; } else { return rows(scale) * sum(scale[1:i]); } } } data { int<lower=1> N; // total number of observations array[N] int Y; // response variable int<lower
=1> K; // number of population-level effects matrix[N, K] X; // population-level design matrix int<lower=1> Kc; // number of population-level effects after centering int<lower=1> Ksp; // number of special effects terms int<lower=1> Imo; // number of monotonic variables array[Imo] int<lower=1> Jmo; // length of simplexes array[N] int Xmo_1; // monotonic variable vector[Jmo[1]] con_simo_1; // prior concentration of monotonic simplex int prior_only; // should the likelihood
be ignored? } transformed data { matrix[N, Kc] Xc; // centered version of X without an intercept vector[Kc] means_X; // column means of X before centering for (i in 2:K) { means_X[i - 1] = mean(X[, i]); Xc[, i - 1] = X[, i] - means_X[i - 1]; } } parameters { vector[Kc] b; // regression coefficients real Intercept; // temporary intercept for centered predictors simplex[Jmo[1]] simo_1; // monotonic simplex vector[Ksp] bsp; // special effects coefficients } transformed parameters { real lprior = 0; // p
rior contributions to the log posterior lprior += normal_lpdf(b[1] | 0.15, 0.3); lprior += normal_lpdf(b[2] | 0.08, 0.3); lprior += normal_lpdf(b[3] | 0.8, 0.3); lprior += normal_lpdf(b[4] | 0.5, 0.3); lprior += normal_lpdf(Intercept | -4, 2); lprior += dirichlet_lpdf(simo_1 | con_simo_1); lprior += normal_lpdf(bsp[1] | -0.5, 0.3); } model { // likelihood including constants if (!prior_only) { // initialize linear predictor term vector[N] mu = rep_vector(0.0, N); mu += Intercept; for (n in 1:N) { // add mor
e terms to the linear predictor mu[n] += (bsp[1]) * mo(simo_1, Xmo_1[n]); } target += bernoulli_logit_glm_lpmf(Y | Xc, mu, b); } // priors including constants target += lprior; } generated quantities { // actual population-level intercept real b_Intercept = Intercept - dot_product(means_X, b); } http://rio2016.5ch.net/test/read.cgi/math/1723152147/866
867: 132人目の素数さん [sage] 2025/06/06(金) 04:41:04.79 ID:fR053ZqC # ロジスティック回帰モデル ACT = c(16,18,20,22,24,26,28) n = c(2,7,14,26,13,14,3) y = c(0,0,6,12,7,9,3) fit = glm(cbind(y, n - y) ~ ACT, family = binomial()) #predict(fit, newdata = data.frame(ACT = 20)) |> plogis() predict(fit, newdata = data.frame(ACT = 20) ,type="response") cat("\n\n===== se.fit=TRUE =====\n\n") pred1=predict(fit, newdata = data.frame(ACT = 20) ,type="response",se.fit=TRUE) # 信
頼区間(response))結果表示 ci=c(pred1$fit - 1.96*pred1$se.fit,pred1$fit + 1.96*pred1$se.fit) cat("95% 信頼区間: [", ci[1], ",", ci[2], "]\n") # 予測(log-odds とその標準誤差) pred = predict(fit, newdata = data.frame(ACT = 20), se.fit = TRUE) # 信頼区間(log-odds) log_odds = pred$fit se = pred$se.fit lower_log_odds = log_odds - 1.96 * se upper_log_odds = log_odds + 1.96 * se # 確率(ロジスティック関数で変換) prob = plogis(log_odds) lower_prob = plogis(lower_log_odds) uppe
r_prob = plogis(upper_log_odds) # 結果表示 cat("95% 信頼区間: [", lower_prob, ",", upper_prob, "]\n") http://rio2016.5ch.net/test/read.cgi/math/1723152147/867
868: 132人目の素数さん [sage] 2025/06/06(金) 04:43:11.66 ID:fR053ZqC 確率は0~1の範囲に制限されるため、直接計算は境界(0や1)に近い場合に不適切(例: 負の値や1超えの可能性)。また、ロジスティック回帰の標準誤差はログオッズスケールで計算されるため、確率スケールでの線形近似は精度が落ちる。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/868
869: 132人目の素数さん [sage] 2025/06/06(金) 06:49:45.63 ID:rCqJxG6F お前には永遠に確率論なんて無理だよ。 数学Bの統計すらわからないのに。 自分が理解できていないことすら理解できないゴミ http://rio2016.5ch.net/test/read.cgi/math/1723152147/869
870: 132人目の素数さん [sage] 2025/06/06(金) 08:42:32.31 ID:icvPdYuT 公式当てはめてるだけだからな じゃあその公式をどうやって証明するかまでは考えが及ばない やってることは公文式で大学生の演習解いてる中学生と一緒 http://rio2016.5ch.net/test/read.cgi/math/1723152147/870
871: 132人目の素数さん [sage] 2025/06/12(木) 09:46:29.84 ID:z7P0Lqdi Bayesian Computation with RでRのコードが理解できなかった。バグだとおもったのだが、 https://bayesball.github.io/bcwr/corrections.2nd.edition.txt のerrataにも掲載がないのでAIに聞いてみた。 >> 対数ヤコビアン項が間違っていると思う。 # theta=c(log(eta/(1-eta)),log(K)) > LearnBayes::betabinexch function (theta, data) { eta = exp(theta[1])/(1 + exp(theta[1])) K = exp(theta[2]) y = data[, 1] n = data[, 2] N = length(y) logf = funct
ion(y, n, K, eta) lbeta(K * eta + y, K * (1 - eta) + n - y) - lbeta(K * eta, K * (1 - eta)) val = sum(logf(y, n, K, eta)) val = val + theta[2] - 2 * log(1 + exp(theta[2])) return(val) } <bytecode: 0x000001a5a980e758> <environment: namespace:LearnBayes> これが正しいのでは? betabinexch <- function (theta, data) { eta = exp(theta[1])/(1 + exp(theta[1])) K = exp(theta[2]) y = data[, 1] n = data[, 2] N = length(y) logf = function(y, n, K, eta) lbeta(K * eta + y, K * (1 - eta) + n - y) - lbeta(K
* eta, K * (1 - eta)) val = sum(logf(y, n, K, eta)) val = val + theta[1] + theta[2] - 2 * log(1 + exp(theta[1])) # log Jacobian term return(val) } << いずれのAIも >あなたの指摘は正しいです。対数ヤコビアン項に問題があります。 という趣旨の返事が返ってきた。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/871
872: 132人目の素数さん [] 2025/06/12(木) 18:10:24.36 ID:CDb/RdAY >>871 脳内医者完全にバレたのにまだ頑張ってるんだ 哀れだね http://rio2016.5ch.net/test/read.cgi/math/1723152147/872
873: 132人目の素数さん [sage] 2025/06/12(木) 18:20:13.54 ID:QiRqli9X >>871 バグだと思ったのにIssueもあげないの? スレの私的利用といい、マジで他人の成果やタイトルに乗っかるだけの寄生虫じゃん 税金も年金もコイツに使うだけ無駄だよ http://rio2016.5ch.net/test/read.cgi/math/1723152147/873
874: 132人目の素数さん [] 2025/06/12(木) 18:27:36.57 ID:CDb/RdAY >>871に質問! 当然入試でも満点が取れる解答以外認めません ①円周率が3.05より大きいことを証明せよ。 ただし円周率は(円周)/(円の直径)と定義され、円周率が3.14より大きい事は判明していないものとする。 ②√2+√3が無理数であることを証明せよ。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/874
875: 132人目の素数さん [sage] 2025/06/13(金) 07:38:09.90 ID:XjvE6Ide >>874 証明問題解けないんだから、人のした証明が正しいかの判断できないだろ http://rio2016.5ch.net/test/read.cgi/math/1723152147/875
876: 132人目の素数さん [sage] 2025/06/14(土) 05:53:33.29 ID:nWbGzc8A (1)nを正整数とする。 n^3+4n^2+3nを6で割った余りを求めよ。 (2)nを正整数とする。 n^3+7n^2+5nを6で割った余りを求めよ。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/876
877: 132人目の素数さん [sage] 2025/06/14(土) 10:23:41.50 ID:c0/MskJB >>876 (2)が傑作でございます http://rio2016.5ch.net/test/read.cgi/math/1723152147/877
878: 132人目の素数さん [sage] 2025/06/15(日) 01:22:01.50 ID:bEUsomGs >>876 n^3+7n^2+5n =n(n^2+7n+5) =n{(n+1)(n+2)+3(n+1)+n} ・n(n+1)(n+2)は3連続の正整数の積なので6の倍数 ・n(n+1)は偶数なので3n(n+1)は6の倍数 したがってn^3+7n^2+5nを6で割った余りはn^2を6で割った余りに等しい。 n=6kのとき、求める余りは0 n=6k+1のとき、求める余りは1 n=6k+2のとき、求める余りは4 n=6k+3のとき、求める余りは3 n=6k+4のとき、求める余りは4 n=6k+5のとき、求める余りは1 http://rio2016.5ch.net/test/read.cgi/math/1723152147/878
879: 132人目の素数さん [sage] 2025/06/15(日) 08:32:56.90 ID:MIIBNstg pdf2hdi <- function(pdf, xMIN=0, xMAX=1, cred=0.95, Print=TRUE, nxx=1001){ xx=seq(xMIN,xMAX,length=nxx) xx=xx[-nxx] xx=xx[-1] xmin=xx[1] xmax=xx[nxx-2] AUC=integrate(pdf,xmin,xmax)$value PDF=function(x)pdf(x)/AUC cdf <- function(x) integrate(PDF,xmin,x)$value ICDF <- function(x) uniroot(function(y) cdf(y)-x,c(xmin,xmax))$root ICDF=Vectorize(ICDF) hdi=HDInterval::hdi(ICDF,credMass=cred) print(c(hdi[1],hdi[2]),digits=5) i
f(Print){ par(mfrow=c(3,1)) plot(xx,sapply(xx,PDF),main='pdf',type='h',xlab='x',ylab='Density',col='lightgreen',bty='l') legend('top',bty='n',legend=paste('HDI:',round(hdi,3))) plot(xx,sapply(xx,cdf),main='cdf',type='h',xlab='x',ylab='Probability',col='lightblue',bty='l') pp=seq(0,1,length=nxx) pp=pp[-nxx] pp=pp[-1] plot(pp,sapply(pp,ICDF),type='l',xlab='p',ylab='x',main='ICDF',bty='l') par(mfrow=c(1,1)) } invisible(ICDF) } ICDF=pdf2hdi(function(x) dbeta(x,2,5)) hist(ICDF(seq(1e-12,1-1e-12,le=1000)))
AIの評価 まとめ この pdf2hdi 関数は、数値積分と数値最適化 (uniroot) を巧みに組み合わせることで、任意のPDFからICDFを頑健に導出し、さらに統計的な要約であるHDIを計算する、非常に実用的かつ教育的なコードです。両端での数値計算の回避や正規化といった細部への配慮も素晴らしいです。 これにより、複雑な確率分布でも、そこからサンプリングしたり、HDIを求めたりといった解析が可能になります。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/879
880: 132人目の素数さん [] 2025/06/15(日) 18:28:56.06 ID:/Vl5yuRp >>871 あれ?息しなくなったの? http://rio2016.5ch.net/test/read.cgi/math/1723152147/880
881: 132人目の素数さん [] 2025/06/15(日) 21:18:52.53 ID:iKpVgdzy こんな糞スレさっさと埋めちまおう なんだよ医者専用って 医者が数学板わざわざ来ねぇだろw http://rio2016.5ch.net/test/read.cgi/math/1723152147/881
882: 132人目の素数さん [] 2025/06/15(日) 21:44:35.19 ID:THc6UTle スレ立てたのは自分じゃないが恐らく尿瓶ジジイが自称医者だからゴキブリホイホイしてるだけ それももう誰の目からも医者じゃないことが丸わかりになってこれ以上数学板でも医者のフリができなくなったから息ができなくなっただけ http://rio2016.5ch.net/test/read.cgi/math/1723152147/882
883: 132人目の素数さん [sage] 2025/06/16(月) 14:42:50.11 ID:C9BO4dk2 (1)nを正整数とする。 n^3+4n^2+3nを6で割った余りを求めよ。 (2)nを正整数とする。 n^3+7n^2+5nを6で割った余りを求めよ。 これの解答はまだですか? http://rio2016.5ch.net/test/read.cgi/math/1723152147/883
884: 132人目の素数さん [sage] 2025/06/17(火) 14:25:14.36 ID:0Sosw64R (1)nを正整数とする。 n^3+4n^2+3nを6で割った余りを求めよ。 (2)nを正整数とする。 n^3+7n^2+5nを6で割った余りを求めよ。 この傑作に解答しなさい。 余りの処理を簡潔に行う方法は何か? http://rio2016.5ch.net/test/read.cgi/math/1723152147/884
885: 132人目の素数さん [sage] 2025/06/19(木) 09:36:40.21 ID:Kb+ol8z3 プログラムが弄れる医者や東大卒なら自力で算出できる問題。 Fランや裏口シリツ医には無理。 直線上にならんだ池が6個ある。1〜6と命名する。 池にはカエルがいる。 観察の結果、カエルは翌日には50%の確率で隣の池に移る。 隣に2つの池がある場合、どちらの池に移る確率は等しいとする。 (1)池1にカエルが1匹いるとき、このカエルが100日後はどの池にいる確率が最も高いか。 (2)カエルが池1に1匹、池2に2匹、池3に3匹、池4に4匹、池5に5匹、池6
に6匹いるとする。 100日後にもっとも多くのカエルがいる確率が高いのはどの池か。その池のカエルの数の期待値とともに答えよ。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/885
886: 132人目の素数さん [sage] 2025/06/19(木) 11:26:01.17 ID:Cb7ur7l1 未だに解答されていません もしかして未解決問題ですか? いいえ、傑作質問です (1)nを正整数とする。 n^3+4n^2+3nを6で割った余りを求めよ。 (2)nを正整数とする。 n^3+7n^2+5nを6で割った余りを求めよ。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/886
887: 132人目の素数さん [] 2025/06/19(木) 12:12:34.74 ID:7SdgEhPl >>885 アンタ医者なんかじゃないだろ http://rio2016.5ch.net/test/read.cgi/math/1723152147/887
888: 132人目の素数さん [sage] 2025/06/19(木) 12:42:27.72 ID:JGDW0Xi7 >>886 合同式つかうなりn^3-nで割るなり好きにしろよ。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/888
889: 132人目の素数さん [] 2025/06/19(木) 12:46:46.54 ID:q4l2IwBj >>885 あんたは早く病院医者板のスレで謝罪しろ http://rio2016.5ch.net/test/read.cgi/math/1723152147/889
890: 132人目の素数さん [] 2025/06/19(木) 13:03:46.73 ID:7SdgEhPl A3の医師免許で発狂して以来全く張り合いがないね尿瓶ジジイ>>885 http://rio2016.5ch.net/test/read.cgi/math/1723152147/890
891: 132人目の素数さん [sage] 2025/06/19(木) 15:32:57.26 ID:BgaX8qG8 >>888 解答を記述しなさい。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/891
892: 132人目の素数さん [sage] 2025/06/19(木) 19:11:10.99 ID:BgaX8qG8 a^2+b^2=c^3+d^3 を満たす正整数の組(a,b,c,d)は無数に存在するか。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/892
893: 132人目の素数さん [sage] 2025/06/19(木) 21:12:59.86 ID:scvOAOQ6 >>891 方針説明されてもわからないとか理解力なさ過ぎだろwwww http://rio2016.5ch.net/test/read.cgi/math/1723152147/893
894: 132人目の素数さん [sage] 2025/06/20(金) 05:07:31.24 ID:lixCBOqW 自分の頭の中にある解答と正確に一致するまで 止まらないというだけ 触れるな http://rio2016.5ch.net/test/read.cgi/math/1723152147/894
895: 132人目の素数さん [sage] 2025/06/20(金) 10:20:25.79 ID:H9bDPTb3 未だに解答されていません もしかして未解決問題ですか? いいえ、傑作質問です (1)nを正整数とする。 n^3+4n^2+3nを6で割った余りを求めよ。 (2)nを正整数とする。 n^3+7n^2+5nを6で割った余りを求めよ。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/895
896: 132人目の素数さん [sage] 2025/06/20(金) 10:21:40.02 ID:H9bDPTb3 >>893 方針の説明は解答ではありません。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/896
897: 132人目の素数さん [sage] 2025/06/20(金) 10:22:09.15 ID:H9bDPTb3 >>894 いいえ、別解ももちろん許容しております。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/897
898: 132人目の素数さん [sage] 2025/06/20(金) 10:33:06.75 ID:MF6ybfWx >>896 質問スレなのに解答要求www 解き方分かってるのになんで解答必要なのか合理的な理由述べてみろよ。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/898
899: 132人目の素数さん [sage] 2025/06/20(金) 15:41:32.93 ID:YJQocZkG >>898 解き方は分かっていません もしかしたら未解決問題かもしれませんよ http://rio2016.5ch.net/test/read.cgi/math/1723152147/899
900: 132人目の素数さん [sage] 2025/06/21(土) 08:47:11.33 ID:dWmZZosR >>899 未解決問題wwww 何処がだよ。 解き方も説明されてるだろwww http://rio2016.5ch.net/test/read.cgi/math/1723152147/900
901: 132人目の素数さん [] 2025/06/21(土) 09:28:01.28 ID:gIBPITlW どこからどう見てもクソつまらない考えるだけ無駄な最底辺のバカが思いついた糞問を良問に見せかける解答をしろ、という問題だよ 難しいと思うけどな http://rio2016.5ch.net/test/read.cgi/math/1723152147/901
902: 132人目の素数さん [sage] 2025/06/21(土) 14:04:17.63 ID:TCVt3Th+ この質問が傑作である理由を説明します (1)は因数分解だけで解けます しかし(2)は因数分解できません その工夫が大学受験生にとっては丁度よい難易度となっており、(1)からインスピレーションを得ることもでき、傑作なのです (1)nを正整数とする。 n^3+4n^2+3nを6で割った余りを求めよ。 (2)nを正整数とする。 n^3+7n^2+5nを6で割った余りを求めよ。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/902
903: 132人目の素数さん [sage] 2025/06/21(土) 18:30:36.62 ID:o0NLVsTG >>902 理由www 何処が傑作なんだよwww 簡単な総当たりで解ける問題なんか傑作とは言えないな http://rio2016.5ch.net/test/read.cgi/math/1723152147/903
904: 132人目の素数さん [sage] 2025/06/21(土) 18:36:58.90 ID:TCVt3Th+ >>903 難易度調整が必要なことをご理解ください 京都大学の文系第1問はこれよりも易しいのです 現代の大学入試事情を鑑みて、この程度の難易度にしております http://rio2016.5ch.net/test/read.cgi/math/1723152147/904
905: 132人目の素数さん [] 2025/06/21(土) 18:47:37.84 ID:iVrSlwPC >>902 傑作だと思ってるアンタが一番傑作 http://rio2016.5ch.net/test/read.cgi/math/1723152147/905
906: 132人目の素数さん [sage] 2025/06/21(土) 19:18:01.22 ID:TCVt3Th+ >>905 難易度調整が必要なことをご理解ください 京都大学の文系第1問はこれよりも易しいのです 現代の大学入試事情を鑑みて、この程度の難易度にしております http://rio2016.5ch.net/test/read.cgi/math/1723152147/906
907: 132人目の素数さん [] 2025/06/21(土) 20:12:22.62 ID:iVrSlwPC >>906 話通じてない 日本語も不自由みたいだね http://rio2016.5ch.net/test/read.cgi/math/1723152147/907
908: 132人目の素数さん [sage] 2025/06/22(日) 04:51:06.82 ID:B6ITpw6T >>904 難易度調整www 秒で終わるだろ 調整できてねぇwww http://rio2016.5ch.net/test/read.cgi/math/1723152147/908
909: 132人目の素数さん [sage] 2025/06/22(日) 09:12:46.36 ID:/sdPvP+o Fランの方は投稿をご遠慮ください。 プログラムが弄れる医者や東大卒なら自力で算出できる問題。 Fランや裏口シリツ医には無理。 直線上にならんだ池が6個ある。1〜6と命名する。 池にはカエルがいる。 観察の結果、カエルは翌日には50%の確率で隣の池に移る。 隣に2つの池がある場合、どちらの池に移る確率は等しいとする。 (1)池1にカエルが1匹いるとき、このカエルが100日後はどの池にいる確率が最も高いか。 (2)カエルが池1に1匹、池2に2匹
、池3に3匹、池4に4匹、池5に5匹、池6に6匹いるとする。 100日後にもっとも多くのカエルがいる確率が高いのはどの池か。その池のカエルの数の期待値とともに答えよ。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/909
910: 132人目の素数さん [] 2025/06/22(日) 09:49:30.35 ID:41rWB7Rs >>909 アンタ脳内医者バレたのにまだいたんだ http://rio2016.5ch.net/test/read.cgi/math/1723152147/910
911: 132人目の素数さん [sage] 2025/06/22(日) 11:13:03.25 ID:V0T0lOP1 >>909 設定ぐらいきちんとしろ 問題文すらまともに書けないのかよwww http://rio2016.5ch.net/test/read.cgi/math/1723152147/911
912: 132人目の素数さん [sage] 2025/06/22(日) 11:13:13.52 ID:lVTJ2xwJ >909の計算ができないようなFランの方は投稿をご遠慮ください。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/912
913: 132人目の素数さん [sage] 2025/06/22(日) 11:14:49.70 ID:6D/H02PK >>911 AIはちゃんと計算するよ。 Fランには無理みたいだけどね。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/913
914: 132人目の素数さん [sage] 2025/06/22(日) 11:18:18.20 ID:x1q6L9ud Rだと小数に表示なのでMathematicaで計算。 80353937215217784622318561352545314301219984594089748478819 Out[4]= {------------------------------------------------------------, 803469022129495137770981046170581301261101496891396417650688 20088148412335002790621607242593839987034997410025084906975 > ------------------------------------------------------------, 100433627766186892221372630771322662657637687111424552206336 40174538074
102937850551109060704760584515594716727372518775 > ------------------------------------------------------------, 200867255532373784442745261542645325315275374222849104412672 20086182069423287937895596774418478938984256623118935282825 > ------------------------------------------------------------, 100433627766186892221372630771322662657637687111424552206336 160682421553118032860967525489926293991268384984698970271425 > ------------------------------------------------------------, 80346902
2129495137770981046170581301261101496891396417650688 1255310425166894422771138921081126550349948690321031989171 > -----------------------------------------------------------} 12554203470773361527671578846415332832204710888928069025792 In[5]:= N@ans1 Out[5]= {0.100009, 0.200014, 0.200005, 0.199995, 0.199986, 0.0999912} In[6]:= Flatten@Position[ans1,Max[ans1]] Out[6]= {2} In[7]:= http://rio2016.5ch.net/test/read.cgi/math/1723152147/914
915: 132人目の素数さん [sage] 2025/06/22(日) 11:20:52.91 ID:2CFzB4x4 小数に表示って何? http://rio2016.5ch.net/test/read.cgi/math/1723152147/915
916: 132人目の素数さん [] 2025/06/22(日) 11:29:15.33 ID:VNaddM8B >>913 AIに騙されたのにまだ縋ってるんだ http://rio2016.5ch.net/test/read.cgi/math/1723152147/916
917: 132人目の素数さん [] 2025/06/22(日) 11:31:48.23 ID:VNaddM8B てか出題されじゃなく質問スレなんだけど 日本語も読めないのかよ Fランだってスレタイくらい読めるし理解できるぞ http://rio2016.5ch.net/test/read.cgi/math/1723152147/917
918: 132人目の素数さん [sage] 2025/06/22(日) 11:42:53.11 ID:V0T0lOP1 >>913 AIは問題文がおかしいかどうかなんて判定してくれないぞwww 仮定が不足してても適当に誤魔化して答えるだけだ それすら分からないのクズすぎん? http://rio2016.5ch.net/test/read.cgi/math/1723152147/918
919: 132人目の素数さん [sage] 2025/06/22(日) 12:37:55.33 ID:AY7cZjkg >>917 出題はしておりません 質問をしております http://rio2016.5ch.net/test/read.cgi/math/1723152147/919
920: 132人目の素数さん [sage] 2025/06/22(日) 12:38:56.58 ID:AY7cZjkg この質問は出題ではありません また、京都大学文系第1問よりは難度の高い問題となっております。 解答をお待ちしております (1)nを正整数とする。 n^3+4n^2+3nを6で割った余りを求めよ。 (2)nを正整数とする。 n^3+7n^2+5nを6で割った余りを求めよ。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/920
921: 132人目の素数さん [sage] 2025/06/22(日) 12:40:29.36 ID:AY7cZjkg 定積分 ∫[a,b] cos(x-(ab/x)) dx を求めよ。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/921
メモ帳
(0/65535文字)
上
下
前
次
1-
新
書
関
写
板
覧
索
設
栞
歴
あと 70 レスあります
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.025s