Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: continued fraction->simple fraction
Replies: 1   Last Post: Feb 21, 2013 11:05 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Christopher Creutzig

Posts: 252
Registered: 2/24/09
Re: continued fraction->simple fraction
Posted: Feb 21, 2013 11:05 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 20.01.13 16:58, bar@robox.up.krakow.pl wrote:
> Hello,
> Is a way i Matlab to convert formula looks like continued fraction
> to the sum of simple fraction ?
>
>
> example:
>
> 1/((-0.89 + 2.31 I) +
>
> 0.9/((1.41 + 1.41 I) +
> 0.99/((1 - 1.73 I) + 0.99/((-1 - I) + z))))/((1.41 +
> 1.41 I) + 0.99/((1 - 1.73 I) + 0.99/((-1 - I) + z)))^2


If your input is a symbolic object, try simplifyFraction:

>> syms z
>> f = 1/((-0.89 + 2.31i) + 0.9/((1.41 + 1.41i) + ...

0.99/((1 - 1.73i) + 0.99/((-1 - i) + z))))/((1.41 +1.41i) + ...
0.99/((1 - 1.73i) + 0.99/((-1 - i) + z)))^2;
>> simplifyFraction(f)

ans =

-(1000000*(z*(100 - 173*i) - 174 + 73*i)^2)/(9*(z*(16131 - 3431*i) -
14909 - 8047*i)*(z*(343098 - 3512620*i) - 2663758 + 2508796*i))

ans =

-(1.11e5*(z*(100.0 - 173.0*i) - 174.0 + 73.0*i)^2)/((z*(3.43e5 -
3.51e6*i) - 2.66e6 + 2.51e6*i)*(z*(1.61e4 - 3433.0*i) - 1.49e4 - 8055.0*i))



I'm not sure what you mean by ?the sum of simple fractions,? though. You
can expand the combined fraction into a sum, but I'm not sure that is an
improvement:

>> vpa(expand(simplifyFraction(f)), 3)

ans =

(z^2*(- 2.21e9 - 3.84e9*i))/(z*(6.77e10 - 9.92e10*i) + z^2*(6.52e9 +
5.78e10*i) - 5.99e10 + 1.6e10*i) + (z*(- 1.06e9 + 8.31e9*i))/(z*(6.77e10
- 9.92e10*i) + z^2*(6.52e9 + 5.78e10*i) - 5.99e10 + 1.6e10*i) + (2.77e9
- 2.82e9*i)/(z*(6.77e10 - 9.92e10*i) + z^2*(6.52e9 + 5.78e10*i) -
5.99e10 + 1.6e10*i)


> answer: (accuracy about 10^-10)
>
> (-0.0698942 + 0.0304086 I) + (
> 0.0406374 + 0.0181059 I)/((-0.782731 - 0.665337 I) + 1. z) - (
> 0.0510353 + 0.0306458 I)/((-0.780845 - 0.68207 I) + 1. z)


I fail to see how that is the same as the partial sum of a continued
fraction above. It might be an earlier partial sum, of course.


HTH,
Christopher




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.