I have another question in regards to using expl3. I am trying to generate a random parabola and then print a rewritten form of that generated equation. I have a \NewDocumentCommand named \parabola. I have a few global variables declared that correspond to different coefficients in standard form of a quadratic. Namely, for the standard form of a quadratic given by: (A/D)(x-h)^2+k. Where A is and integer in [-2,2]\{0}, D is an integer in [1,5], and h and k are an integers in [-2,2]. On top of this, I'd like a section that takes the standard form I use for plotting and writes it in expanded form (i.e. ax^2+bx+c). This part I am certainly lost in accomplishing. My preamble is given and document are given below:
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=0.75in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{amsmath,amssymb,enumitem}
\usepackage[first=-20, last=20]{lcg}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usepackage{calculator}
\usepackage{calculus}
\usepackage{ifthen}
\usepackage{xfp}
\usepackage{pgffor}
\usepackage{pgfplots}
\newcommand{\randi}{\rand\arabic{rand}}
\ExplSyntaxOn\newcommand{\intR}[2]{\chgrand[first=#1, last=#2] \randi}\ExplSyntaxOff
\ExplSyntaxOn\newcommand{\firstpower}{\chgrand[first=2, last=5] \randi}\ExplSyntaxOff
\ExplSyntaxOn\def\isneg#1{
\expandafter\ifnum#1>0 ~+\else ~-\fi
}\ExplSyntaxOff
\ExplSyntaxOn\def\isopp#1{
\expandafter\ifnum#1>0 ~-\else ~+\fi
}\ExplSyntaxOff
\ExplSyntaxOn\def\isone#1{
\expandafter\ifnum#1=1 ~1\else ~2\fi
}\ExplSyntaxOff
\newcommand{\addsub}{\pgfmathrandomitem{\choice}{choices1}\choice}
\pgfmathdeclarerandomlist{choices1}{{+}{-}}
\newcommand{\subnone}{\pgfmathrandomitem{\choice}{choices3}\choice}
\pgfmathdeclarerandomlist{choices3}{{}{-}}
\pgfplotsset{ every non boxed x axis/.append style={x axis line style=-}, every non boxed y axis/.append style={y axis line style=-}}
\NewDocumentCommand{\parabola}{}{
\int_gset:Nn \g_point_num_int { \int_rand:nn { -2 } { 2 } }
\int_gset:Nn \g_point_denom_int { \int_rand:nn { 1 } { 5 } }
\int_gset:Nn \g_point_xv_int { \int_rand:nn { -2 } { 2 } }
\int_gset:Nn \g_point_yv_int { \int_rand:nn { -2 } { 2 } }
\begin{tikzpicture}
\begin{axis}[
width=0.7\textwidth,
height=0.7\textwidth,
grid=major,
xmin=-5,
xmax=5,
ymin=-5,
ymax=5,
axis~lines=center
% axis lines = left
]
\addplot[smooth, red, thick] {(\g_point_num_int / \g_point_denom_int)*(x-\g_point_xv_int)^2+\g_point_yv_int};
\end{axis}
\end{tikzpicture}
}
\int_new:N \l_val_An_int
\int_new:N \l_val_Bn_int
\int_new:N \l_val_Cn_int
\int_new:N \l_val_Ad_int
\int_new:N \l_val_Bd_int
\int_new:N \l_val_Cd_int
\NewDocumentCommand{\paraexpand}{}{
% Writing expression for the A coefficient
\MULTIPLY{ \int_gset:N \g_point_num_int }{ 1 }{\tempNum}~
\MULTIPLY{ \int_gset:N \g_point_denom_int }{ 1 }{\tempDenom}~
\FRACTIONSIMPLIFY{ \tempNum }{ \tempDenom }{\An}{\Ad}
\ABSVALUE{ \An }\absAn~
\int_if_odd:nTF \isone{\Ad} {
\int_if_odd:nTF \isone{\absAn} {} {\int_set:Nn \l_val_A_int {\absAn} } } { \FRACTIONSIMPLIFY{\absAn}{\Ab}{}{} }
% Writing expression for numerator of B coefficient
\MULTIPLY{ \int_gset:N \g_point_xv_int }{ 2 }{\tempB}~
\MULTIPLY{ \tempB }{ \tempNum }{\solBn}~
\FRACTIONSIMPLIFY{ \solBn }{ \tempDenom }{\Bn}{\Bd}~
\ABSVALUE{ \Bn }\absBn~
% Writing expression for numerator of C coefficient
\SQUARE{ \g_point_xv_int }{ \hsq }~
\MULTIPLY{ \tempNum }{ \hsq }{\tempCl}~
\MULTIPLY{ \tempDenom }{ \int_gset:N \g_point_yv_int }{\tempCr}~
\ADD{ \tempCl }{ \tempCr }{\solCn}~
\FRACTIONSIMPLIFY{ \solCn }{ \tempDenom }{\Cn}{\Cd}~
\ABSVALUE{ \Cn }\absCn~
\if_odd:nTF \isone{}
$
\solA x^2
\isopp{\solB} \absB x
\isneg{\solC} \absC
$
}
\ExplSyntaxOff
\begin{document}
\newpage
\section*{Problem 7}
\begin{center}
\parabola
\end{center}
\paraexpand
\end{document}
There is a lot of unnecessary lines in there as it's part of a larger document, and I can't be 100% certain which parts in there are required for my section. I cut out most of the document so if it looks like I'm missing something please comment and tell me. Again, I'm trying to generate a random quadric equation in standard form, given constraints, plot that equation, then list the expanded form of the equation below the plot.

sagetexto work on there, would you? It's not a package it seems to be automatically found by Overleaf. – David G. Nov 12 '20 at 18:01sagetex. I suspect they don't support it but you should try the Contact Us page and check to be sure. – DJP Nov 12 '20 at 22:16