login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for ExampleCompositeFunction revision 1 of 1

1
Editor: test1
Time: 2023/09/23 01:04:28 GMT+0
Note:

changed:
-
In practice we frequently need to deal with composite functions.
This is frequently formulated as 'y' depends in 'x' where 'x'
is a function (say of argument 't').  Unlike some other systems
in FriCAS one have to be explicit with dependencies.  This
make simple cases slightly more verbose, but allows clean
handling of more complicated cases.  For concretness
consider the following situation:
\begin{latex}
$$
z(y(x(t)))
$$
\end{latex}
where 'z' is simple function of 'y',  'x' is simple function of 't' say
\begin{latex}
$$
z = c x y,
$$
$$
x = \frac{1}{t}
$$
\end{latex}
and 'y' is arbitrary.  We want to compute second derivative of our
function.

In FriCAS we can express is in very natural way.  First define 'y' as an
operator to represent arbitrary function:
\begin{axiom}
y := operator 'y
\end{axiom}
Now we just translate math to FriCAS syntax:
\begin{axiom}
x := 1/t
z := c*x*y(x)
D(z, t, 2)
\end{axiom}

In practice we frequently need to deal with composite functions. This is frequently formulated as y depends in x where x is a function (say of argument t). Unlike some other systems in FriCAS one have to be explicit with dependencies. This make simple cases slightly more verbose, but allows clean handling of more complicated cases. For concretness consider the following situation:


$$
z(y(x(t)))
$$
 
where z is simple function of y, x is simple function of t say

$$
z = c x y,
$$
$$
x = \frac{1}{t}
$$
 
and y is arbitrary. We want to compute second derivative of our function.

In FriCAS we can express is in very natural way. First define y as an operator to represent arbitrary function:

fricas
(1) -> y := operator 'y

\label{eq1}y(1)
Type: BasicOperator?

Now we just translate math to FriCAS syntax:

fricas
x := 1/t

\label{eq2}\frac{1}{t}(2)
Type: Fraction(Polynomial(Integer))
fricas
z := c*x*y(x)

\label{eq3}\frac{c \ {y \left({\frac{1}{t}}\right)}}{t}(3)
Type: Expression(Integer)
fricas
D(z, t, 2)

\label{eq4}\frac{{c \ {{y^{\prime \prime}}\left({\frac{1}{t}}\right)}}+{4 \  c \  t \ {{y^{\prime}}\left({\frac{1}{t}}\right)}}+{2 \  c \ {{t}^{2}}\ {y \left({\frac{1}{t}}\right)}}}{{t}^{5}}(4)
Type: Expression(Integer)