高校数学の質問スレ(医者・東大卒専用) Part438 (979レス)
高校数学の質問スレ(医者・東大卒専用) Part438 http://rio2016.5ch.net/test/read.cgi/math/1723152147/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
必死チェッカー(本家)
(べ)
自ID
レス栞
あぼーん
276: 132人目の素数さん [sage] 2024/10/31(木) 13:30:26.59 ID:grkcalAP (1) 70÷(-12)の商と余りはいくつか? (2) (-70)÷(-12)の商と余りはいくつか? (* ab2qr=\(a,b){ r1=a%%b r2=r1-b r=ifelse(abs(r1)<=abs(r2),r1,r2) q=(a-r)/b c(q,r) } ab2qr(70,12) ab2qr(70,-12) *) ab2qr[a_Integer,b_Integer] :=( r1=Mod[a,b]; r2=r1-b; r=If[Abs[r1]<=Abs[r2],r1,r2]; q=(a-r)/b; {商->q,絶対的最小剰余->r} ) ab2qr[70,12] ab2qr[70,-12] ab2qr[-70,-12] http://rio2016.5ch.net/test/read.cgi/math/1723152147/276
278: 132人目の素数さん [sage] 2024/10/31(木) 13:43:06.44 ID:grkcalAP library(numbers) Rem=\(a,b){ r=rem(a,b) c((a-r)/b,r) } Rem(70,12) Rem(-70,12) Rem(70,-12) Rem(-70,-12) http://rio2016.5ch.net/test/read.cgi/math/1723152147/278
279: 132人目の素数さん [sage] 2024/10/31(木) 13:47:25.55 ID:grkcalAP function (n, m) { stopifnot(is.numeric(n), is.numeric(m)) if (length(n) == 1) { n <- rep(n, length(m)) } else if (length(m) == 1) { m <- rep(m, length(n)) } ln <- length(n) lm <- length(m) if (ln != lm) stop("Arguments 'n', 'm' must be scalars or have the same length.") if (any(floor(n) != ceiling(n)) || any(floor(m) != ceiling(m))) stop("Arguments 'n', 'm' must be integers or vectors of integers.") k <- ifelse(m != 0, n%%m, NaN) k <- ifelse(m != 0 & sign(n) != sign(m) & k != 0, k - m, k) return(k) } http://rio2016.5ch.net/test/read.cgi/math/1723152147/279
280: 132人目の素数さん [sage] 2024/10/31(木) 13:53:03.07 ID:grkcalAP " https://oshiete.goo.ne.jp/qa/11802945.html 5406の7943乗を13でわったときの絶対値最小余剰を教えてください。 " ab2qr=\(a,b){ r1=a%%b r2=r1-b r=ifelse(abs(r1)<=abs(r2),r1,r2) q=(a-r)/b c(q,r) } ab2qr(5406,13)[2] i=which((-2)^(1:20)%%13==1) 7943%%i ab2qr((-2)^11,13)[2] http://rio2016.5ch.net/test/read.cgi/math/1723152147/280
281: 132人目の素数さん [sage] 2024/10/31(木) 13:54:20.32 ID:grkcalAP Wikipediaの記載通り、 絶対的最小剰余とユークリッド除法によって定められる最小非負剰余、 あるいは別の方法のいずれを用いるかは自由であり、与えられる剰余がそのいずれかであるかは予め決められた規約に従う。この規約は、計算する対象や計算機の機種、あるいはプログラミング言語により、まちまちである。 が体験できた。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/281
282: 132人目の素数さん [sage] 2024/10/31(木) 13:54:27.02 ID:grkcalAP QuotientRemainder[70,12] QuotientRemainder[-70,12] QuotientRemainder[70,-12] QuotientRemainder[-70,-12] RのnumbersとWolframのQuotientRemaiderでは 結果が異なるな。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/282
283: 132人目の素数さん [sage] 2024/10/31(木) 16:17:56.45 ID:grkcalAP Wolfram Language 14.0.0 Engine for Microsoft Windows (64-bit) Copyright 1988-2023 Wolfram Research, Inc. In[1]:= Table[QuotientRemainder[10,b],{b,-9,-1}] Out[1]= {{-2, -8}, {-2, -6}, {-2, -4}, {-2, -2}, {-2, 0}, {-3, -2}, {-4, -2}, {-5, 0}, {-10, 0}} In[2]:= Table[QuotientRemainder[10,b],{b,1,9}] Out[2]= {{10, 0}, {5, 0}, {3, 1}, {2, 2}, {2, 0}, {1, 4}, {1, 3}, {1, 2}, {1, 1}} http://rio2016.5ch.net/test/read.cgi/math/1723152147/283
284: 132人目の素数さん [sage] 2024/10/31(木) 16:27:50.37 ID:grkcalAP >>283 Rに移植 QuotientRemainder=\(a,b){ q=a%/%b r=a-b*q data.frame(q=q,r=r) } 除数が負なら剰余に負の値も許す仕様。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/284
285: 132人目の素数さん [sage] 2024/10/31(木) 16:35:40.36 ID:grkcalAP Wolframの練習問題 練習問題 20^24を1031で割ったときの商と絶対的最小剰余を求めよ。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/285
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.025s