\documentclass{beamer}
\mode<presentation>
{
\usetheme{AnnArbor} % or try Darmstadt, Madrid, Warsaw, ...
\usecolortheme{wolverine} % or try albatross, beaver, crane, ...
\usefonttheme{default} % or try serif, structurebold, ...
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{caption}[numbered]
}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{patterns,arrows,decorations.pathreplacing,calc}
\begin{document}
\begin{frame}{}
\begin{figure}[H]
\centering
\begin{tikzpicture}[xscale=5,yscale=5]
\draw [<->] (0,1)--(0,0)--(1,0);
\def\constal{2/3};
\def\constax{\constal}
\def\constax{(1-\constal)^2}
\def\constA{\constx/(\constx+\consty)};
\def\constB{(\constal-\constx)/(1-\constx-\consty)};
\def\constC{(1-2*\constal+\constx)/(\constx+\consty)};
\def\constD{\constal^2/(\constal^2+(1-\constal)^2)};
\def\constE{1/2};
\def\constF{(1-\constal)^2/(\constal^2+(1-\constal)^2)};
\def\constG{(\constal^2+(1-\constal)^2)/2};
\def\constH{2*\constal*(1-\constal)};
\def\constI{(\constx+\consty)/2};
\def\constJ{1-\constx-\consty};
\node [below] at (1,0) {$\beta_1$};
\node [left] at (0,1) {$\beta_4$};
\draw ({(\constD-\constC)/(\constA-\constC)},{0})--({(\constD-\constC)/(\constA-\constC)},{1});
\draw[domain=0:1] plot (\x, {-\constG/\constH*\x+(\constA*\constI-\constF*\constG)/(\constA*\constH)});
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
I defined several constants, but they cannot work in tikz. What is the mistake?

\defis a TeX primitive, so as a rule I suggest avoiding any use of such primitives in LaTeX code. If you want to define a new LaTeX macro, use\newcommand. If you want to define a PGF constant, use\pgfmathsetmacroas @user202729 suggested above. – Miyase May 15 '22 at 10:13