aboutsummaryrefslogtreecommitdiff
path: root/src/input/expr.input.pamphlet
blob: bd8b4402b246af7237255dbf06434ddec0e0667c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/input expr.input}
\author{The Axiom Team}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
<<*>>=
)clear all
foo := operator 'foo
bar := operator 'bar
g := foo x
eval(g, x = x**2 + 1)
-- chain rule can be applied formally
differentiate(%, x)
-- multivariate
f := bar(x, y)
-- parallel substitution is possible
eval(f, [x = y, y = x])
[differentiate(f, x), differentiate(f, y)]
-- multivariate chain rule
ff := eval(f, [x = x**2 * foo y, y = x + y])
differentiate(ff, x)
differentiate(ff, y)
-- let's create one with commuting partial derivatives
-- let's change the way bar is printed on the screen, make it #1 @ #2
pbar(l:List OUTFORM):OUTFORM == infix(" @ "::SYMBOL::OUTFORM, l)
display(bar, pbar)
-- let's see the result
f
ff
-- back to normal
deleteProperty!(bar, "%display")
f
-- let's give bar some partial derivatives, say bar(u, v) = u * v
bar1 l == last l
bar2 l == first l
derivative(bar, [bar1, bar2]$(LIST(LIST(EXPR INT) -> EXPR INT)))
[differentiate(f, x), differentiate(f, y)]
[differentiate(ff, x), differentiate(ff, y)]
-- some structural testing
h := inv(x + f + g**2)
isPower h
y * g**2 * h
isTimes %
isPlus(denom(h)::EXPR(INT))
isExpt(inv(g**2), "foo")
isExpt(inv(g**2), "bar")
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}