|
From: Eduardo O. <edu...@gm...> - 2023-07-16 04:08:02
|
On Sat, 15 Jul 2023 at 17:50, Richard Fateman <fa...@gm...> wrote:
>
> I'm not sure what you really want to do, but maybe
> tex('integrate(f,x)= ratsimp(integrate(f,x)));
>
> will work?
Hi Richard,
Here is a _VERY_ bare prototype of what I really want(ed) to do.
If I run this in Maxima,
f : x^3 * sqrt(1 - 4*x^2);
F1 : 'integrate(f, x);
F2 : changevar(F1, u=2*x, u, x);
F3 : rootscontract(F2);
F4 : ev(F3, 'integrate);
F5 : expand(F4);
F6 : subst([u=2*x], F5);
s : sqrt(1-4*x^2);
F7 : expand(F6/s)*s;
nl : "
"$
tex0(ex) := block([s,len],
s : tex(ex,false),
len : slength(s),
substring(s,3,len-2))$
sa2(name,ex) := sconcat(nl, "\\sa{", name, "}{", tex0(ex), "}")$
sa1(nameex) := apply('sa2, nameex)$
sas([nameexs]) := apply('sconcat, map('sa1, nameexs))$
sas(["F1", F1],
["F3", F3],
["F7", F7]);
it produces the middle part of this LaTeX code:
% Usage:
% \sa{42}{foo bar}
% \ga{42}
% is roughly equivalent to this,
% \def\myarg42{foo bar}
% \myarg42
% but with the "4" and the "2" being treated as letters.
\def\sa#1#2{\expandafter\def\csname myarg#1\endcsname{#2}}
\def\ga#1{\csname myarg#1\endcsname}
\sa{F1}{\int {x^3\,\sqrt{1-4\,x^2}}{\;dx}}
\sa{F3}{{{\int {u^3\,\sqrt{1-u^2}}{\;du}}\over{16}}}
\sa{F7}{\sqrt{1-4\,x^2}\,\left({{x^4}\over{5}}-{{x^2}\over{60}}-{{1}\over{
120}}\right)}
$$\begin{array}{l}
\ga{F1} \\
= \ga{F3} \\
= \ga{F7} \\
\end{array}
$$
I am just playing with ways to send Maxima expressions to LaTeX as
definitions...
Cheers =),
Eduardo
|