Last active
August 29, 2015 13:55
-
-
Save tueda/8688781 to your computer and use it in GitHub Desktop.
An experiment on System`Private`InternalSeries in Mathematica v5.1+.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
* Tested in v5.1, v5.2, v6.0.3, v7.0.1, v8.0.4 and v9.0.1. | |
* It is said that Wolfram changed the way how Series works between v5.0 and | |
* v5.1, but I don't have any working binaries of <= v5.0 for now. | |
*) | |
ExplicitFunc[x_] := 1/x^3 Log[1-x]; | |
Series[ExplicitFunc[x], {x, 0, 3}] // Print; | |
Series[Log[1-x] ExplicitFunc[x], {x, 0, 3}] // Print; | |
(* Define the power series via Series. *) | |
Func /: Series[Func[x_], {x_, 0, n_Integer}] := | |
Series[ExplicitFunc[x], {x, 0, n}]; | |
Series[Func[x], {x, 0, 3}] // Print; | |
Series[Log[1-x] Func[x], {x, 0, 3}] // Print; (* Func[x] is Taylor-expanded. *) | |
Clear[Func]; | |
(* Define the power series via System`Private`InternalSeries. *) | |
Func /: System`Private`InternalSeries[Func[x_], {x_, 0, n_Integer}] := | |
System`Private`InternalSeries[ExplicitFunc[x], {x, 0, n}]; | |
Series[Func[x], {x, 0, 3}] // Print; | |
Series[Log[1-x] Func[x], {x, 0, 3}] // Print; (* Correctly expanded. *) | |
Clear[Func]; | |
(* vim: set ft=mma et ts=8 sts=2 sw=2: *) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment