Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
vpa summation?

Subject: vpa summation?

From: Chris

Date: 16 Sep, 2010 23:17:20

Message: 1 of 4

I am trying to get familiar with the matlab function vpa by forward summing:

       n
summation: (1/i^4)
      i = 1

I want to get the single precision to 7 digits. I know the sum converges on
(pi)^4 / 90 as n goes to infinity.

If I do vpa((pi^4)/90,7) matlab returns ??? Maximum recursion limit reached

Any help to point me in the right direction?

Subject: vpa summation?

From: John D'Errico

Date: 16 Sep, 2010 23:43:04

Message: 2 of 4

"Chris " <ridered300tr@hotmail.com> wrote in message <i6u8i0$2kq$1@fred.mathworks.com>...
> I am trying to get familiar with the matlab function vpa by forward summing:
>
> n
> summation: (1/i^4)
> i = 1
>
> I want to get the single precision to 7 digits. I know the sum converges on
> (pi)^4 / 90 as n goes to infinity.
>
> If I do vpa((pi^4)/90,7) matlab returns ??? Maximum recursion limit reached
>
> Any help to point me in the right direction?

Why do you need to use vpa, if you are only looking for
7 digits of precision?

A simple for loop will do this, using simple double
or even single arithmetic.

WPT?

John

Subject: vpa summation?

From: Chris

Date: 17 Sep, 2010 00:27:19

Message: 3 of 4

> Why do you need to use vpa, if you are only looking for
> 7 digits of precision?
>
> A simple for loop will do this, using simple double
> or even single arithmetic.
>
> WPT?
>
> John


Opps, I was confused about the problem for a second. Thanks

Subject: vpa summation?

From: Steven_Lord

Date: 17 Sep, 2010 14:02:46

Message: 4 of 4



"Chris " <ridered300tr@hotmail.com> wrote in message
news:i6u8i0$2kq$1@fred.mathworks.com...
> I am trying to get familiar with the matlab function vpa by forward
> summing:
>
> n
> summation: (1/i^4)
> i = 1
>
> I want to get the single precision to 7 digits. I know the sum converges
> on (pi)^4 / 90 as n goes to infinity.
> If I do vpa((pi^4)/90,7) matlab returns ??? Maximum recursion limit
> reached
>
> Any help to point me in the right direction?

First, VPA is intended to work on symbolic objects; (pi^4)/90 is not a
symbolic object (unless you've defined pi as a symbolic variable.)

Second, you may be interested in the SYMSUM function.

http://www.mathworks.com/help/toolbox/symbolic/symsum.html

syms k
f = @(n) symsum(1/k^4, k, 1, round(n));
f(1) % 1 term
f(2) % 2 terms

You can use DOUBLE or VPA to convert the symbolic answer returned by f(n)
into a numeric answer if you want to convince yourself that it converges to
(pi^4)/90, or just use:

f(Inf)

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us