> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/di-38-zhang-you-xi-ke-xue-ji-suan-he-zhuan-ye-gong-ju/di-38.7-jie-ke-yan-he-zhuan-ye-ji-suan.md).

# 38.7 科研和专业计算

FreeBSD 上可运行的科研工具包括数学（GeoGebra）、天文（Stellarium）等。本节按类别列出各软件的安装方式与基本用途。

## 代数学

FreeBSD 基本系统内置两个计算器工具：bc 采用中缀表示法，dc 采用后缀表示法（逆波兰表示法）。

`dc` 是采用后缀表示法的开源任意精度计算器。在传统 Unix 系统中，`bc` 曾作为 `dc` 的预处理器实现——先将中缀表达式转换为后缀表达式，再交由 `dc` 执行计算。

其源代码位于 FreeBSD 官方源代码存储库 <https://github.com/freebsd/freebsd-src/tree/main/contrib/bc>，可供研究与学习。用户可通过 `man bc` 或 `man dc` 命令查看手册页，获取更多使用细节。

### bc（Basic Calculator）基础计算器

bc 是采用中缀表示法的交互式任意精度计算器，支持基本算术运算和函数计算。

```sh
$ bc # 进入 bc 计算器
1+15 # 加法
16
sqrt(256) # 开方
16
5^3	 # 求立方
125
90/3 # 除法
30
10%4 # 求余数
2
quit # 退出程序
```

## 几何学

### 几何绘图软件 GeoGebra

GeoGebra 是动态几何软件，支持几何、代数和微积分的可视化与计算。

使用 pkg 安装：

```sh
# pkg install geogebra
```

或者使用 Ports 安装：

```sh
# cd /usr/ports/math/geogebra/
# make install clean
```

![GeoGebra 界面](/files/F1jV1uJofOYUkQFUTNBI)

## 线性规划

本节介绍线性规划软件 GLPK 的使用方法。线性规划是运筹学的重要分支，广泛应用于资源优化配置、生产计划制定与金融风险管理等领域。

### GLPK

GLPK（GNU Linear Programming Kit）是 GNU 项目开发的开源线性规划工具包。

使用 pkg 安装 GLPK：

```sh
# pkg install glpk
```

或者使用 Ports 安装 GLPK：

```sh
# cd /usr/ports/math/glpk/
# make install clean
```

线性规划常用单纯形法。在计算机上，有多种软件可辅助求解线性规划问题，例如 Microsoft Excel 的“规划求解”功能。

### 计算机代数系统 wxMaxima

wxMaxima 是 Maxima 计算机代数系统的图形用户界面，提供直观的交互环境与强大的数学计算能力。

使用 pkg 安装：

```sh
# pkg install wxmaxima
```

或使用 Ports 安装：

```sh
# cd /usr/ports/math/wxmaxima/
# make install clean
```

wxMaxima 不仅可数值计算，还支持符号运算与公式推导。代码示例仅供参考，详见 [官方文档](https://maxima.sourceforge.io/documentation.html)。

## 物理和化学

### 元素周期表 `GPeriodic`

GPeriodic 是一款元素周期表查看软件，提供元素的基本信息和物理化学性质。

使用 pkg 安装：

```sh
# pkg install gperiodic
```

或者使用 Ports 安装：

```sh
# cd /usr/ports/biology/gperiodic/
# make install clean
```

![GPeriodic 元素周期表](/files/RPZvCovf6V4j8q4wwgNR)

## 天文地理

### 星图软件 Stellarium

Stellarium 是一款开源的天文馆软件，可模拟真实的星空观测。

使用 pkg 安装：

```sh
# pkg install stellarium
```

或者使用 Ports 安装：

```sh
# cd /usr/ports/astro/stellarium/
# make install clean
```

![Stellarium 界面](/files/mfZeHUt2kTv0zUd5yoIV)

![Stellarium 星图](/files/kVyHjYeOO9PfxgDlRGTh)

> **技巧**
>
> 默认进入全屏模式，按 **F11** 可切换全屏模式。

### GNOME 地图

GNOME 地图是一款地图查看软件，提供地图浏览和位置搜索功能。

使用 pkg 安装：

```sh
# pkg install gnome-maps
```

或者使用 Ports 安装：

```sh
# cd /usr/ports/deskutils/gnome-maps/
# make install clean
```

![GNOME 地图](/files/oL3mYBXYg6tVXGsFC98n)

地图数据基于 OpenStreetMap，整体较新，但缺少详细的兴趣点信息和导航功能，不如商业地图服务详细。

## 工具与软件

### 科学计算软件 GNU Octave

GNU Octave 是一款开源的科学计算软件，兼容 MATLAB 语言，用于数值计算和数据可视化。

使用 pkg 安装：

```sh
# pkg install octave
```

或者使用 Ports 安装：

```sh
# cd /usr/ports/math/octave/
# make install clean
```

## 参考文献

* Howard G D. bc — An arbitrary precision calculator language\[EB/OL]. \[2026-04-17]. <https://github.com/gavinhoward/bc>. Gavin D. Howard 开发的 bc/dc 实现。
* FreeBSD Project. Differential Revision D19982\[EB/OL]. (2019-05-23)\[2026-04-17]. <https://reviews.freebsd.org/D19982>. FreeBSD 自 [13.0 起](https://github.com/freebsd/freebsd-src/commit/252884ae7e4760f0e3cb45fdc2fff8fb952251ae)将 Gavin D. Howard 开发的 bc/dc 实现纳入基本系统（`contrib/bc`），bc 与 dc 在同一二进制文件中集成。
* FreeBSD Project. bc(1) -- an arbitrary precision calculator language\[EB/OL]. \[2026-04-17]. <https://man.freebsd.org/cgi/man.cgi?query=bc&sektion=1>. 任意精度计算器语言手册页。
* FreeBSD Project. dc(1) -- an arbitrary precision calculator\[EB/OL]. \[2026-04-17]. <https://man.freebsd.org/cgi/man.cgi?query=dc&sektion=1>. 任意精度计算器手册页。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/di-38-zhang-you-xi-ke-xue-ji-suan-he-zhuan-ye-gong-ju/di-38.7-jie-ke-yan-he-zhuan-ye-ji-suan.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
