This is a guide for installing Mathematica ARM Version (Raspberry Pi) on Android devices with a full GUI. The guide assumes that one has Termux-x11 and proot-distro working in order to have a GUI. You are required to have a Mathematica key for Linux to activate.
Termux and Termux-x11 are a terminal and x11-forwarding implementation for Android devices. There is no root requirement, thus the security of your device will not be compromised. Please refer to these guides in order to install and get them working.
Proot-distro is a quick way to get a linux distro to work on Android devices. It is not a virtual machine because all installed distros are the ARM64 version to work with most phones/tablets' processors. Rather, proot-distro is a container environment manager, handling/hijacking system IO and storage to emulate chroot and mount for non-rooted devices, thus if your device is rooted, you do not need to install proot-distro. Because it is not a virtual machine, you have almost full processing speed except for the IO hijacking, giving a minor hit to the performance. However, as long as the calculation in Mathematica does not involve a lot of IOs, performance is very decent. Please follow the guide and install the debian (for rooted device, install debian using whatever you want).
Here, we need debian because the ARM version of Mathematica is built for Raspbian originally, which is debian-based, thus using debian via proot-distro helps to handle some system dependents that native Termux does not have. It is my goal in the future to have Mathematica working natively on Termux to get native performance. Inputs/helps are needed and welcome!
How to Install Wolfram Kernel (back end):
Start proot-distro debian by
proot-distro login debian
Allow a multi-architecture (64+32-bit) and install 32-bit libraries because Mathematica uses some of these (the latter is optional, but it might help in case you see some error related to 32-bit instruction)
dpkg --add-architecture armhf
apt install libatomic1:armhf libgl1:armhf
Download the Raspberry Pi installation script from Wolfram and put it in the root folder of debian. You should have access to your usual Android "Download" folder through
cd //sdcard/Download/
Execute the official installation script (Current version is 13.3.1, but this might change when they release new version)
bash ./install-wolfram-engine-13.3.1.sh
At this point, everything should be set. You can activate Mathematica by starting its Kernel and follow the instruction (I activate sucessfully using a Linux Mathematica Key provided by my institution)
wolfram
After activation, you should have been forwarded to the Wolfram CLI Kernel, where we have full access to the Kernel (back end). To quit, execute
Quit[]
How to run Mathematica GUI (front end):
Start the Termux-x11 app on your Android device and a termux terminal. Then, start an x11 instance by executing in Termux terminal
termux-x11 :1 &
If Termux and Termux-x11 have been installed correctly, you should see the x11 app window black and the mouse cursor is an x.
Start debian with x-11 forwarding
proot-distro login debian --shared-tmp
Set display to the previously started (1 in this case)
export DISPLAY=:1
Optional step: Install xfce4 desktop environment to have full multi-window desktop experience (otherwise you cannot control fullscreen window in x11 window)
apt install xfce4
To start the desktop environment (you should see the x11 app with full desktop interface now)
xfce4-session &
Start Mathematica from command line
mathematica &
and you should see the Raspberry Pi Mathematica window pop-up!
Tested device: Samsung Tab S9 with Snapdragon 8 gen 2 runnning Android 14 + One UI 6.