All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Binomial Baffle (Posted on 2014-12-30) Difficulty: 3 of 5
If we expand (1 + 0.2)2014 by the binomial theorem, we get:
A(0) + A(1) + A(2) + .......+ A(2014) where:
A(j) = C(2014, j) *(0.2)j and:
C(x, y) = x!/(y!*(x-y)!)

Find the value of j for which A(j) is maximum.

No Solution Yet Submitted by K Sengupta    
Rating: 3.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 2
DefDbl A-Z
Dim crlf$, loge10, twopi

Function mform$(x, t$)
  a$ = Format$(x, t$)
  If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
  mform$ = a$
End Function

Private Sub Form_Load()
 ChDir "C:\Program Files (x86)\DevStudio\VB\projects\flooble"
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
 DoEvents
 
 twopi = Atn(1) * 8
 loge10 = Log(10)
 l2014f = lxf(2014)
 For j = 0 To 2014
   term = l2014f - lxf(j) - lxf(2014 - j) + j * Log(0.2) / loge10
   If term > Max Then Max = term: jmax = j
 Next
 Text1.Text = Text1.Text & jmax & Str(Max) & Str(10 ^ Max) & crlf
  
 Text1.Text = Text1.Text & crlf

 Text1.Text = Text1.Text & " done"
End Sub


Function lxf#(x#)
  If x# < 171 Then
    fact# = 1
    If x# > 1 Then
      For i = 2 To x#
       fact# = fact# * i
      Next
    End If
    lo# = log10#(fact#)
  Else
    lo# = log10#(x#) * (x# + 0.5)
    lo# = lo# + (-x# + 1# / (12# * x#) - 1# / (360# * x# * x# * x#) + 1# / (1260# * x# * x# * x# * x# * x#)) / loge10#
    lo# = lo# + log10#(twopi#) / 2#
  End If
  lxf# = lo#
End Function

Function log10(x)
   log10 = Log(x) / loge10
End Function

finds j=335 has the maximum A(j), which is ~= 7.05447607762139 * 10^157.

The program uses logarithms to avoid overflow and the output is:

335 157.848464765072 7.05447607762139E+157

  Posted by Charlie on 2014-12-30 14:35:48
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (4)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information