The diff command counts faster than ∂/∂x
|
12-06-2023, 06:55 AM
Post: #1
|
|||
|
|||
The diff command counts faster than ∂/∂x
When I type "diff(Σ((-1)^(k+1)/k^x,k,1,20),x)" I get the result after about 4 seconds (appendix 1).
When I type "∂(Σ((-1)^(k+1)/k^x,k,1,20),x)" I get the result after about 3 minutes (sic!) (appendix 2). CAS Mode. Firmware: 2.1.14730. HP-Prime G2. CAS Settings. Simplify: Maximum ("Minimum" gives worse results). The time() command probably does not take into account the formatting time of the result and its display, but the difference is apparent: 0.7 s vs. 29 s (Appendix 3). Regards. |
|||
12-06-2023, 04:24 PM
(This post was last modified: 12-06-2023 04:25 PM by Albert Chan.)
Post: #2
|
|||
|
|||
RE: The diff command counts faster than ∂/∂x
Differentiation, unlike integration, is very mechanical, and should run very fast.
Problem is internal hard-coded simplify, that cannot be controlled by SIMPLIFY setting. My guess is diff(f,x) is less "simplified" than ∂(f,x), thus run much faster. OP problem, we want to stop sum from simplify f with common denominator, making a mess. Instead of summing an expression, we sum a list, which bypass internal simpilfy code. (*) Cas> lst := makelist(k -> (-1)^(k+1)/k^x, 1, 20) Cas> f := sum(lst) diff(f,x) or ∂(f,x) should now run very fast. (*) sum(lst) = '+' operator applied to list, see https://www.hpmuseum.org/forum/thread-20...#pid176469 Cas> (a+b)[1] (lst) 1 - 1/2^x + 1/3^x - 1/4^x + 1/5^x ... + 1/19^x - 1/20^x |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)