[CAS] sum
12-17-2014, 03:04 AM
Post: #1
 compsystems Senior Member Posts: 1,332 Joined: Dec 2013
[CAS] sum
approx(Σ(sin(n)/n,n,1,inf)) => 1.07079632679 ok

approx(Σ(sin(n)/n,n,1,1000)) => undef ?

approx(Σ(sin(n)/n,n,1,100)) => 1.0604289384 ok
12-17-2014, 03:20 AM
Post: #2
 Helge Gabert Senior Member Posts: 467 Joined: Dec 2013
RE: [CAS] sum
You really want to calculate Σ(sin(n)/n,n,1,1000) exactly, and then approximate? Why?

Direct in CAS: Σ(sin(n)/n,n,1,1000.) returns 1.07069 . . .
12-17-2014, 03:35 AM (This post was last modified: 12-17-2014 03:50 AM by compsystems.)
Post: #3
 compsystems Senior Member Posts: 1,332 Joined: Dec 2013
RE: [CAS] sum
with [CAS & EXACT MODE ON]

Σ(sin(n)/n,n,1,1000) =>
(1/7128865274665093053166 ...................
as it is difficult to visualize the answer, I convert to approximate
APPROX(ANS) => UNDEF

Now [CAS & EXACT MODE OFF]
Σ(sin(n)/n,n,1,1000) => 1.07069415432 ok
12-17-2014, 03:41 AM
Post: #4
 Helge Gabert Senior Member Posts: 467 Joined: Dec 2013
RE: [CAS] sum
Yes, I have the same settings (exact on), but I never get the answer 1/7128865.... The calc hangs. (But maybe I'm not patient enough to wait).

I see what you are saying, though . . . if you get an exact answer, you should be able to get the approximation.
12-17-2014, 03:43 AM
Post: #5
 Han Senior Member Posts: 1,882 Joined: Dec 2013
RE: [CAS] sum
(12-17-2014 03:41 AM)Helge Gabert Wrote:  Yes, I have the same settings (exact on), but I never get the answer 1/7128865.... The calc hangs. (But maybe I'm not patient enough to wait).

I see what you are saying, though . . . if you get an exact answer, you should be able to get the approximation.

Sometimes it hangs and sometimes it doesn't. It does take a long time, but I've had it hang (to where [On][Symb] did nothing) and using the reset hole was the only way to get the calc back into working order.

Graph 3D | QPI | SolveSys
12-17-2014, 08:11 AM (This post was last modified: 12-17-2014 08:21 AM by parisse.)
Post: #6
 parisse Senior Member Posts: 1,236 Joined: Dec 2013
RE: [CAS] sum
If you compute the sum in exact mode, the CAS does not recognize something to get a closed simple form, and the sum is rewritten with very large integers. Conversion to float requires a multi-precision floats library, that is not available on the Prime, with Xcas and MPFR inside, you get an approximation.
12-17-2014, 11:21 AM
Post: #7
 Snorre Member Posts: 101 Joined: Dec 2013
RE: [CAS] sum
Hello,

As was already pointed out, you should do ∑(approx(sin(n)/n,...) instead of approx(∑(sin(n)/n,...)) to avoid forcing the CAS to build really long symbolic terms.

But what makes me wonder is why the "undef" result.
For example: sum(1/k,k=1..n) returns "undef" if there aren't any assumptions made about n ("euler_gamma+Psi(n+1)" if assume(n>0)).
On the other side: sum(1/|k|,k=1..n) returns just the term I've entered (regardless of assumptions about n).

Despite both sums should return the same, I'm fine with the latter since it tells me the CAS wasn't able to find a closed form solution.
But the first result "undef" seems wrong to me (I'd expect it for such cases like 0/0 etc.) and hard to track if the sum is part of a bigger expression.
(I've set automatic simplification to "None")
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)