Tcl Library Source Code

Documentation
Login
EuroTcl/OpenACS 11 - 12 JULY 2024, VIENNA


[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]

NAME

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

Table Of Contents

SYNOPSIS

package require Tcl 8.5 9
package require grammar::aycock 1.0
package require math::calculus::symdiff 1.0.2

math::calculus::symdiff::symdiff expression variable
math::calculus::jacobian variableDict

DESCRIPTION

The math::calculus::symdiff package provides a symbolic differentiation facility for Tcl math expressions. It is useful for providing derivatives to packages that either require the Jacobian of a set of functions or else are more efficient or stable when the Jacobian is provided.

Procedures

The math::calculus::symdiff package exports the two procedures:

Expressions

The math::calculus::symdiff package accepts only a small subset of the expressions that are acceptable to Tcl commands such as expr or if. Specifically, the only constructs accepted are:

Command substitution, backslash substitution, and argument expansion are not accepted.

Examples

math::calculus::symdiff::symdiff {($a*$x+$b)*($c*$x+$d)} x
==> (($c * (($a * $x) + $b)) + ($a * (($c * $x) + $d)))
math::calculus::symdiff::jacobian {x {$a * $x + $b * $y}
                         y {$c * $x + $d * $y}}
==> {{$a} {$b}} {{$c} {$d}}

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category math :: calculus of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.

SEE ALSO

math::calculus, math::interpolate

COPYRIGHT

Copyright © 2010 by Kevin B. Kenny Redistribution permitted under the terms of the Open Publication License http://www\.opencontent\.org/openpub/