Opened 2 months ago
Last modified 3 days ago
#2948 assigned enhancement
Symbolic differentiation
Reported by: | gkronber | Owned by: | gkronber |
---|---|---|---|
Priority: | medium | Milestone: | HeuristicLab 3.3.16 |
Component: | Problems.DataAnalysis.Symbolic | Version: | trunk |
Keywords: | Cc: |
Description
Sometimes it can be helpful to look at derivatives of a model. It is rather straightforward to implement symbolic differentiation using our tree representation of expressions.
Change History (10)
comment:1 Changed 2 months ago by gkronber
- Owner set to gkronber
- Status changed from new to accepted
- Version set to trunk
comment:2 Changed 2 months ago by gkronber
comment:3 Changed 2 months ago by gkronber
r16207: added new unit test class to project (combine with previous commit)
comment:4 Changed 2 months ago by gkronber
r16213: changed unit test cases to assert results of derivative calculations. Fixed bug in deriving sqrt(x)
comment:5 Changed 2 months ago by gkronber
- Owner changed from gkronber to mkommend
- Status changed from accepted to reviewing
comment:6 Changed 2 months ago by gkronber
r16216: removed string interpolation
comment:7 follow-up: ↓ 9 Changed 5 weeks ago by mkommend
- Owner changed from mkommend to gkronber
- Status changed from reviewing to assigned
Review Comments
Derivative Calculator
- Method Derive (line 29) - Although ADFs are virtually never used at least a check that they are not present should be included before accessing tree.Root.GetSubtree(0).GetSubtree(0).
- Static symbol variables (line 38-42) - Should be static readonly to avoid reassignment.
- Should a shortcut for deriving f(x1, ... x10) / dy be included ( f'(x1,...,x10)/dy = 0) or is this automatically handled by simplification of a constant expression regardless of its length?
- Method Derive (line 74) - Is there a specific reason why unary multiplication is not handled?
- Method Derive (line 90) - Is there a specific reason why divisions with more than 2 arguments are not handled?
- Method Derive (line 136) - What about the tangent symbol that can be expressed as sin() / cos()?
- Method IsCompatible (line 172) - This method is never used!
DeriveTest
- Reviewed unit tests
- Some of them look overly complicated (due to our simplifier) and I had to use wolfram alpha for verification.
comment:8 Changed 4 weeks ago by gkronber
r16294: worked on review comments.
comment:9 in reply to: ↑ 7 Changed 4 weeks ago by gkronber
implemented the following review comments with r16294:
Replying to mkommend:
- Method Derive (line 29) - Although ADFs are virtually never used at least a check that they are not present should be included before accessing tree.Root.GetSubtree(0).GetSubtree(0).
- Static symbol variables (line 38-42) - Should be static readonly to avoid reassignment.
- Method Derive (line 74) - Is there a specific reason why unary multiplication is not handled?
- Method Derive (line 90) - Is there a specific reason why divisions with more than 2 arguments are not handled?
- Method Derive (line 136) - What about the tangent symbol that can be expressed as sin() / cos()?
Still open:
- Should a shortcut for deriving f(x1, ... x10) / dy be included ( f'(x1,...,x10)/dy = 0) or is this automatically handled by simplification of a constant expression regardless of its length?
- Method IsCompatible (line 172) - This method is never used!
It can be used by classes working with DerivativeCalculator. The pattern is the same for the AutoDiffConverter.
r16206: added first implementation of symbolic differentiation as well as a test case (to be checked manually)