kubaPod / MoreCalculus

Developement repository for MoreCalculus Mathematica package
9 stars 4 forks source link

Transformation rules with derivatives #4

Open kubaPod opened 6 years ago

kubaPod commented 6 years ago

Here is an example that DChange can't handle very well currently:

DChange[
  0 == r'[t]^2 + r[t]^2 u'[t]^2 - 2 \[Kappa]^2/r[t] - h
, {r'[t] == R'[u] u'[t], r[t] == R[u], u'[t] == c/R[u]^2}
]

One way I can think out to fix this is to use //. i.e.

DChange[expr_, functions : {(_[___] == _) ..}
] := expr //. Replace[functions, (f_[vars__] == body_) :> (f -> Function[{vars}, body]), {1}]

– xzczd Mar 7 '16 at 13:02

kubaPod commented 6 years ago

@xzczd Thanks for feedback. This or additional rule for multiple functions like:

Fold[ 
  DChange
, 0 == r'[t]^2 + r[t]^2 u'[t]^2 - 2 \[Kappa]^2/r[t] - h
, {r'[t] == R'[u] u'[t], r[t] == R[u], u'[t] == c/R[u]^2} 
] 

but yours is more general.