不确定度计算器三端工程:Web、iOS、Android。项目目标是让直接测量、间接不确定度传播、批量公式、线性回归、单位换算和结果复制/导出在三端保持一致。
apps/web Vite + React + TypeScript Web 应用
apps/ios SwiftUI iOS 应用
apps/android Jetpack Compose Android 应用
shared 跨端测试向量
scripts 三端测试脚本
legacy 旧静态 HTML 版本归档
- 直接测量:样本标准差
s,A 类uA = s / sqrt(n),B 类uB = instrumentError / sqrt(3)。 - 合成标准不确定度:
uc = sqrt(uA² + uB²)。 - 扩展不确定度:
U = k * uc,默认覆盖因子k = 2。 - 间接测量:使用中心差分估计偏导数并进行方和传播。
- 批量计算:逐行计算公式,忽略缺少变量的无效行,对有效值计算均值、样本标准差和 A 类不确定度。
- 共享测试向量位于
shared/test-vectors/uncertainty-cases.json。
cd apps/web
npm install
npm run dev常用检查:
npm test
npm run build
npm run test:e2ePlaywright 配置使用本机 Google Chrome channel。若机器没有 Chrome,需要安装 Chrome 或调整 apps/web/playwright.config.ts。
cd apps/android
./gradlew test --console=plain
./gradlew :app:installDebugAndroid 脚本会优先从 apps/android/local.properties 的 sdk.dir 定位 adb。没有连接设备或运行中的模拟器时,单元测试仍会执行,设备 smoke 会跳过。
cd apps/ios
xcodebuild -project BQDD.xcodeproj -scheme BQDD -destination 'platform=iOS Simulator,name=iPhone 17,OS=latest' test当前本机发现的限制:Xcode 选择 iphonesimulator26.5,但机器只检测到 iOS 26.4 simulator runtime,因此 iOS XCTest 会失败。安装匹配的 iOS 26.5 runtime 后重新运行脚本。
scripts/test-web.sh
scripts/test-android.sh
scripts/test-ios.sh
scripts/test-all.sh当前基线:
scripts/test-web.sh通过:runtime audit、Vitest、Vite build、Playwright desktop/mobile。scripts/test-android.sh通过 Gradle unit tests;无连接设备或运行中 emulator 时跳过 smoke。scripts/test-ios.sh通过新增 Swift 语法检查,但因 iOS 26.5 simulator runtime 缺失而提前失败并输出说明。
计划发布分支:
git push -u origin codex/uncertainty-triple-platform
gh pr create --base main --head codex/uncertainty-triple-platform --title "[codex] uncertainty calculator triple-platform engineering"创建 PR 后在 GitHub 上请求 Copilot review。若 PR review 权限或功能不可用,可用 gh copilot 对最终 diff 做 CLI review。