这个 Linux 图形计算器让数学很有趣
计算器

> 
> 就像你在高中时最喜欢的图形计算器一样，KAlgebra 是科学计算器的同时还有 2D 绘图仪等功能。
> 
> 
> 


![](/data/attachment/album/202203/10/094459uyvi79oza97iwwkp.jpg)


如果你在高中时期一直盯着 TI-80 系列计算器，但后来就在也没动过它，那么你有时可能会渴望重温那些激动人心的代数和微积分岁月。Linux KDE 项目中的某个人一定也有这种感觉，因为有个 KDE 框架库 Analitza 提供了相关的语法和小部件，使你能够使用 K 系列应用（如图形计算器 KAlgebra）执行高级数学函数。


### 在 Linux 上安装 KAlgebra


在 Linux 上，你可以从软件仓库安装 KAlgebra。例如，在 Fedora、Mageia 和类似设备上：



```
$ sudo dnf install kalgebra

```

在 Elementary、Linux Mint 和其他基于 Debian 的发行版上：



```
$ sudo apt install kalgebra

```

或者，你可以 [以 flatpak 安装它](https://opensource.com/article/21/11/install-flatpak-linux)。


### Linux 计算器


KAlgebra 与学校中使用的许多著名图形计算器一样，既是科学计算器又是 2D 绘图仪。但与我曾经使用过的任何图形计算器不同，它也是一个 3D 绘图仪。但在进入 3D 空间之前，先从一些基本语法开始。


在 KAlgebra 中表示方程时，你必须对数学符号进行一些小的翻译，因为它们通常是手写的，需要了解它们在计算机上的表示方式。例如，要将华氏度转换为摄氏度，公式为：(5÷9) × (n-32)，其中 n 是华氏度。这通常是方程和数学函数的表达方式：它们使用 ÷ 和 × 之类的特殊符号以及 n 之类的变量，然后它们确定哪个变量代表什么样的值。你不一定知道每个特殊数学符号的含义，但只要你知道特殊符号具有特定含义，那么你就可以查找它。在温度转换示例中，符号很常见，因此你可能已经知道 ÷ 表示除法，× 表示乘法。


在 KAlgebra 中，与大多数编程语言一样，除法由正斜杠表示，乘法由星号表示，因此转换 70 华氏度的等式为 `(5/9)*(70-32)`。


KAlgebra 中还有用于常见数学运算的特殊功能，当你在 KAlgebra 中输入任何字母时，工具提示会为可用的函数提供潜在的自动补全功能。在 KAlgerbra 中编写温度转换方程的另一种方法是使用 `times` 函数：`times(5/9, 70-32)`。


当你完成数学问题时，已确定的变量会列在计算器的右栏中，包括 `ans` 值，该值会根据已完成方程的答案进行更新。那么理论上，你应该能够反转转换并从 `ans` 得出华氏温度。


![Temperature conversion in KAlgebra](/data/attachment/album/202203/10/094509ohjjilz4ni0ajjgl.jpg "Temperature conversion in KAlgebra")


### 图形计算器


数字很有趣，但当它们被用来绘制形状时，它们才真正变得有趣。图形上二维空间的可视化是所有学科发展的一项重要技能，其中最重要的是计算机编程。


要在图形上画一条线，你必须设置一个水平值（x 轴）或一个垂直值（y 轴），或者两者都设置。在常见的数学符号中，一条有效的直线方程就是 `x=5`。这会在图形的 0 原点上方 5 点处生成一条水平直线。然而，在 KAlgebra 中，你必须明确表示你只想用符号 `x->5` 来设置 x 值。


![A line in KAlgebra](/data/attachment/album/202203/10/094509zoc0h0ocu10azoyb.jpg "A line in KAlgebra")


除此之外，绘图与其他地方一样简单。你可以编写复杂的方程式，并且可以使用特殊函数，例如 `sin`。


![Sin wave and an s-curve](/data/attachment/album/202203/10/094510yfa2l2ix6klaql3e.jpg "Sin wave and an s-curve")


### Linux 上的 3D 图


当你进入 3D 图形选项卡时，你可能已经很好地理解了 KAlgebra 的语法，并且也超出了我的数学知识。我从电子学和合成中学到了关于笛卡尔图的所有知识，所以我对 3D 图最有趣的事情是将正弦波可视化为 3D 对象：


![Sine waves in space](/data/attachment/album/202203/10/094510jey8cp9vspy0y000.jpg "Sine waves in space")


3D 图表和 2D 图表（除了一维）之间的区别在于 3D 图表中只能有一个图，因此请明智地选择方程式。


### 数学可以有趣吗？


事实证明，是的，数学可以很有趣，答案就是一个很好的图形计算器。当我一直在通过数学课来弥补过去一些相当糟糕的数学成绩时，我想要是能使用计算器就好了。我发现 KAlgebra 是一个非常有用的工具，不仅可以解决任意问题，还可以理解方程的语法，以及函数的目的。无论你的数学成绩如何，请拿出你的 KAlgebra 计算器，运行一些数字。这真是非常有趣。




---


via: <https://opensource.com/article/22/2/kalgebra-linux-calculator>


作者：[Seth Kenlon](https://opensource.com/users/seth) 选题：[lujun9972](https://github.com/lujun9972) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
If you spent your high school years gazing at TI-80 series calculators but lost track of the device somewhere along the way, then you might sometimes yearn to relive those thrilling years of algebra and calculus. Somebody on the Linux KDE project must have felt that way, too, because one of the KDE Framework libraries, Analitza, provides syntax and widgets to enable you to perform advanced math functions with K apps like the graphing calculator KAlgebra.

## Install KAlgebra on Linux

On Linux, you can install KAlgebra from your software repository. For example, on Fedora, Mageia, and similar:

`$ sudo dnf install kalgebra`


On Elementary, Linux Mint, and other Debian-based distributions:

`$ sudo apt install kalgebra`


Alternately, you can [install it as a flatpak](https://opensource.com/article/21/11/install-flatpak-linux).


## Linux calculator

KAlgebra is, like many of the famous graphing calculators used in schools, both a scientific calculator and a 2D plotter. Unlike any of the graphing calculators I've ever used, it's also a 3D plotter. But before rushing into 3D space, start with some basic syntax.

When representing an equation in KAlgebra, you must do some minor translation of math symbols as they're often written by hand to how they're represented on a computer. For instance, to convert Fahrenheit degrees to Celsius, the equation is: (5÷9) × (n-32), where *n* is Fahrenheit. This is generally how equations and mathematical functions are expressed: they use special symbols like ÷ and × as well as variables like n, and then they identify what variable represents what kind of value. You may or may not know the meaning of every special math symbol, but as long as you know that a special symbol has a specific meaning, then you can look it up. In the temperature conversion example, the symbols are pretty common, so you probably already know that ÷ represents division and × represents multiplication.

In KAlgebra, as in most programming languages, division is represented by a forward slash and multiplication by an asterisk, so the equation to, for example, convert 70° Fahrenheit is `(5/9)*(70-32)`

.

There are also special functions for common math operations in KAlgebra, and when you type any letter into KAlgebra, a tooltip provides potential auto-completion for available functions. Another way to write the equation for temperature conversion in KAlgerbra is to use the *times* function: `times(5/9, 70-32)`

.

As you complete math problems, established variables are listed in the right column of the calculator, including the `ans`

value, which is updated with the answer to the completed equation. In theory, then, you should be able to reverse the conversion and derive a Fahrenheit temperature from *ans*.

![Temperature conversion in KAlgebra Temperature conversion in KAlgebra](https://opensource.com/sites/default/files/kalgebra-temperature_0.jpg)

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))

## Graphing calculator

Numbers are fun, but they really get fun when they're used to draw shapes. The visualization of 2D space on a graph is an important skill to develop for all kinds of disciplines, not the least of which is computer programming.

To draw a line on a graph, you must set a horizontal value (the x-axis) or a vertical value (the y-axis) or both. A valid equation for a straight line in common mathematical notation is just `x=5`

. This produces a straight horizontal line 5 points above the 0 origin point of the graph. However, in KAlgebra you must make it explicit that you want to set just the x value with the notation `x->5`

.

![A line in KAlgebra A line in KAlgebra](https://opensource.com/sites/default/files/kalgebra-line-x.jpg)

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))

Other than that, graphing is as straightforward as it is elsewhere. You can write complex equations, and you can use special functions, like `sin`

.

![Sin wave and an s-curve Sin wave and an s-curve](https://opensource.com/sites/default/files/kalgebra-sin.jpg)

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))

## 3D graph on Linux

By the time you get to the 3D graph tab, you likely have a good understanding of the syntax of KAlgebra, and you've also exceeded my mathematical knowledge. I learned everything I know about cartesian graphs from electronics and synthesis, so the most fun I've had with the 3D graph is visualizing a sine wave as a 3D object:

![Sine waves in space Sine waves in space](https://opensource.com/sites/default/files/kalgebra-sin-3d.jpg)

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))

The difference between the 3D graph and the 2D graph (aside from 1 dimension) is that you can only have one plot in the 3D graph, so choose your equations wisely.

## Can math be fun?

It turns out that yes, math can be fun, and the answer is a good graphing calculator. As I've been working my way through math lessons to make up for some pretty dismal math grades in my past, I find myself wishing that calculators had been encouraged. I'm finding KAlgebra to be a very useful tool for not only solving arbitrary problems, but also for understanding the syntax of equations, and the purpose of functions. Whatever your relationship with mathematics, take out your KAlgebra calculator and run some numbers. It's actually really fun.

## Comments are closed.