1math::calculus::symdiff(Sny)mbolic differentiation for Tmcalth::calculus::symdiff(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       math::calculus::symdiff - Symbolic differentiation for Tcl
9

SYNOPSIS

11       package require Tcl  8.5
12
13       package require grammar::aycock  1.0
14
15       package require math::calculus::symdiff  1.0.1
16
17       math::calculus::symdiff::symdiff expression variable
18
19       math::calculus::jacobian variableDict
20
21______________________________________________________________________________
22

DESCRIPTION

24       The math::calculus::symdiff package provides a symbolic differentiation
25       facility for Tcl math expressions. It is useful for  providing  deriva‐
26       tives  to  packages  that either require the Jacobian of a set of func‐
27       tions or else are more efficient or stable when the  Jacobian  is  pro‐
28       vided.
29

PROCEDURES

31       The math::calculus::symdiff package exports the two procedures:
32
33       math::calculus::symdiff::symdiff expression variable
34              Differentiates  the  given expression with respect to the speci‐
35              fied variable. (See Expressions below for a  discussion  of  the
36              subset of Tcl math expressions that are acceptable to math::cal‐
37              culus::symdiff.)  The result is a Tcl expression that  evaluates
38              the  derivative.  Returns  an error if expression is not a well-
39              formed expression or is not differentiable.
40
41       math::calculus::jacobian variableDict
42              Computes the Jacobian of a system of equations.  The  system  is
43              given  by  the dictionary variableDict, whose keys are the names
44              of variables in the system, and whose values are Tcl expressions
45              giving the values of those variables. (See Expressions below for
46              a discussion of the subset of  Tcl  math  expressions  that  are
47              acceptable  to  math::calculus::symdiff. The result is a list of
48              lists: the i'th element of the j'th sublist is the  partial  de‐
49              rivative of the i'th variable with respect to the j'th variable.
50              Returns an error if any of the expressions cannot be differenti‐
51              ated, or if variableDict is not a well-formed dictionary.
52

EXPRESSIONS

54       The  math::calculus::symdiff package accepts only a small subset of the
55       expressions that are acceptable to Tcl commands such  as  expr  or  if.
56       Specifically, the only constructs accepted are:
57
58       ·      Floating-point constants such as 5 or 3.14159e+00.
59
60       ·      References  to  Tcl  variable using $-substitution. The variable
61              names must consist of alphanumerics and underscores: the  ${...}
62              notation is not accepted.
63
64       ·      Parentheses.
65
66       ·      The +, -, *, /. and ** operators.
67
68       ·      Calls  to the functions acos, asin, atan, atan2, cos, cosh, exp,
69              hypot, log, log10, pow, sin, sinh. sqrt, tan, and tanh.
70
71       Command substitution, backslash substitution,  and  argument  expansion
72       are not accepted.
73

EXAMPLES

75              math::calculus::symdiff::symdiff {($a*$x+$b)*($c*$x+$d)} x
76              ==> (($c * (($a * $x) + $b)) + ($a * (($c * $x) + $d)))
77              math::calculus::symdiff::jacobian {x {$a * $x + $b * $y}
78                                       y {$c * $x + $d * $y}}
79              ==> {{$a} {$b}} {{$c} {$d}}
80
81

BUGS, IDEAS, FEEDBACK

83       This  document,  and the package it describes, will undoubtedly contain
84       bugs and other problems.  Please report such in the  category  math  ::
85       calculus of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist].
86       Please also report any ideas for enhancements you may have  for  either
87       package and/or documentation.
88
89       When proposing code changes, please provide unified diffs, i.e the out‐
90       put of diff -u.
91
92       Note further that  attachments  are  strongly  preferred  over  inlined
93       patches.  Attachments  can  be  made  by  going to the Edit form of the
94       ticket immediately after its creation, and  then  using  the  left-most
95       button in the secondary navigation bar.
96

SEE ALSO

98       math::calculus, math::interpolate
99
101       Copyright (c) 2010 by Kevin B. Kenny <kennykb@acm.org>
102       Redistribution permitted under the terms of the Open Publication License <http://www.opencontent.org/openpub/>
103
104
105
106
107tcllib                               1.0.1          math::calculus::symdiff(n)
Impressum