Hidden WordScanner
Private scans · No account required

DuckieDai Log Expander

Expand the log of a product, quotient, or power into a sum of simpler logs, step by step: enter the factors on the top and bottom with their powers.

exponential functions · MIT License

Overview

Expand the log of a product, quotient, or power into a sum of simpler logs, step by step: enter the factors on the top and bottom with their powers.

  • Owner-tested on a TI calculator
  • Version 1.0.0
  • 2349 bytes
  • No imports

Before you run it

  • TI-84 Plus CE Python · No calculator OS or Python App version has been verified.
  • TI Connect CE .py transfer to the Python App; the owner's transfer details were not recorded
  • Every variable factor is assumed to be positive, so each log in the answer is defined.
  • A plain number that is a whole power of the base, such as 8 in base 2, becomes a whole number; e becomes 1 in a natural log.
  • Up to 12 factors on the top and 12 on the bottom.

Try the DuckieDai calculator screen

Follow the program's prompts and result flow before downloading.

JavaScript is required for the optional browser simulation. Source viewing and downloading remain available without it.

Simulation boundary: This preview uses a reviewed browser adapter. It does not execute the downloaded Python and does not prove TI-Python or calculator compatibility.

Learn the math

How to expand a logarithm

The idea

Expanding a log turns the log of one big expression into a sum of simpler logs. Products become sums, quotients become differences, and powers come out in front.

Write the expression as factors on the top and factors on the bottom, each with a power. Every top factor adds its log, every bottom factor subtracts its log, and each power multiplies its log.

The formula

log_b(A*B) = log_b(A) + log_b(B)

log_b(A/B) = log_b(A) - log_b(B)

log_b(A^p) = p*log_b(A)

log_b(b^k) = k

b
the base: Enter for 10, a number such as 2, or a letter. Choose ln for base e
A, B
the factors, each assumed positive
p
the power of a factor; a square root is the power 1/2

Using the program

Worked example

Expand log(x^2 y^3 / z). Choose 1 and press enter for base 10. Top: 2 factors, x with power 2 and y with power 3. Bottom: 1 factor, z with power 1.

log(x^2 y^3 / z) = 2 log(x) + 3 log(y) - log(z)

The program shows RESULT: 2*log(x) + 3*log(y) - log(z).

Expand ln(e^2 sqrt(x)). Choose 2. Top: 2 factors, e with power 2 and x with power 1/2. Bottom: 0. The program shows 2 + 1/2*ln(x), because ln(e^2) is 2.

Expand log_2(8x). Choose 1 with base 2. Top: 8 and x, both with power 1. Bottom: 0. The program shows 3 + log_2(x), because 2^3 = 8.

Tips and common mistakes

Where this comes up

Expanding logarithms is a core skill in the logarithmic functions unit of algebra 2, precalculus, and college algebra, and it comes back in calculus for logarithmic differentiation.

Go further: Logarithm Rules and How to Solve Exponential Equations

Exact reviewed bytes

Source code

Download .py

View source below, copy it when JavaScript is available, or download the exact .py bytes.

  1. # DuckieDai(TM) Guided Log Expand
  2. # Assumes positive variable factors
  3. def number(s):
  4. try:
  5. if '/' in s:
  6. a,b=s.split('/')
  7. return float(a)/float(b)
  8. return float(s)
  9. except:return None
  10. def fmt(x):
  11. if abs(x-round(x))<1e-9:return str(int(round(x)))
  12. for d in range(2,65):
  13. n=round(x*d)
  14. if abs(x-n/d)<1e-8:return str(n)+'/'+str(d)
  15. return str(round(x,5))
  16. def exact(n,b):
  17. if n==1:return 0
  18. if b is None or n<=0:return None
  19. v=1
  20. for k in range(1,21):
  21. v*=b
  22. if abs(v-n)<1e-8:return k
  23. if v>n:break
  24. return None
  25. def term(a,p):
  26. if a=='e' and L=='ln':return p,''
  27. n=number(a)
  28. if n is not None:
  29. if n<=0:return None
  30. if n==1:return 0,''
  31. k=exact(n,B)
  32. if k is not None:return p*k,''
  33. if a.startswith('(') and a.endswith(')'):a=a[1:-1]
  34. return p,a
  35. def clear():
  36. print('\n'*8)
  37. def run():
  38. parts=[]
  39. for sign,name in ((1,'TOP'),(-1,'BOTTOM')):
  40. clear()
  41. print(name+' FACTORS')
  42. while 1:
  43. try:
  44. count=int(input('How many? '))
  45. if 0<=count<=12:break
  46. except:pass
  47. print('Enter 0 to 12')
  48. for i in range(count):
  49. clear()
  50. print(name+' '+str(i+1)+'/'+str(count))
  51. a=input('Factor? ').strip()
  52. if not a:return 'Empty factor'
  53. clear()
  54. print(name+' '+str(i+1)+'/'+str(count))
  55. print('SQRT = power 1/2')
  56. while 1:
  57. p=number(input('Power? (Enter=1) ') or '1')
  58. if p is not None and p>0:break
  59. print('Power must be > 0')
  60. t=term(a,sign*p)
  61. if t is None:return 'Factor must be > 0'
  62. parts.append(t)
  63. out=''
  64. for p,a in parts:
  65. if abs(p)<1e-9:continue
  66. w=abs(p)
  67. s=fmt(w) if not a else ('' if w==1 else fmt(w)+'*')+L+'('+a+')'
  68. if out:out+=(' + ' if p>0 else ' - ')+s
  69. else:out=('-' if p<0 else '')+s
  70. return out or '0'
  71. print('DUCKIEDAI(TM)')
  72. print('LOG EXPAND')
  73. print(' __')
  74. print(' ___(o )> quack!')
  75. print(' \\ <_. )')
  76. print(" `---'")
  77. print('by DuckieDai')
  78. print('hiddenwordscanner.com')
  79. while 1:
  80. print('\n1: log 2: ln 3: quit')
  81. c=input('Choice? ')
  82. if c=='3':break
  83. if c not in ('1','2'):continue
  84. L='log' if c=='1' else 'ln'
  85. B=None
  86. if c=='1':
  87. b=input('Base (Enter=10)? ').strip() or '10'
  88. B=number(b)
  89. if B is not None and (B<=0 or B==1):
  90. print('Bad base');continue
  91. if B is None and not b.isalpha():
  92. print('Use base # or letter');continue
  93. if b!='10':L='log_'+b
  94. clear()
  95. answer=run()
  96. clear()
  97. print('RESULT:')
  98. print(answer)
  99. input('Press enter ')
  100. clear()
Filename
LOGEXSF.py
Size
2349 bytes
SHA-256
d99b1ae3aaf075876819d85d042e57ef7b347db276d647274f6b4b7076cd46e5

Usage

Inputs

  • 1 for log or 2 for ln, then for log a base (a number or a letter; Enter for 10)
  • How many factors are on the top and on the bottom
  • Each factor, such as x, (x+1), or 8, and its power

Outputs

  • The expanded expression, such as 2*log(x) + 3*log(y) - log(z)
  • Whole numbers in place of logs of exact powers of the base

Units: Pure expressions; no units.

Assumptions and limitations

Assumptions

  • Every variable factor is assumed to be positive, so each log in the answer is defined.
  • A plain number that is a whole power of the base, such as 8 in base 2, becomes a whole number; e becomes 1 in a natural log.

Constraints

  • Up to 12 factors on the top and 12 on the bottom.
  • Each power must be greater than 0; type 1/2 for a square root. Numbers may be typed as decimals or fractions.

Known failures

  • The program expands only; it does not simplify a log of the base itself, such as log_x(x), to 1.
  • A power typed as inf stops the program with an error when the result is shown.

Compatibility and review

Review status
Owner-tested on a TI calculator
Tested on
Owner reports personally running this program on a TI-84 Plus CE Python calculator; the test date, OS version, and Python App version were not recorded
What happened
Owner reported pass on the calculator before the standard DuckieDai opening screen with the website line replaced the original two line title. The steps after the opening screen are unchanged; this exact file has not yet been rerun on a calculator.
Dependencies
No imports
Suggested calculator name
LOGEXSF — you can give it another valid, unique name when you transfer it
Desktop test cases
Not available for this interactive-only source

This exact source auto-launches an interactive calculator session, so compatibility evidence comes from the recorded physical-device review rather than an importable desktop fixture.

Transfer and launch

Download the .py file, send it to your calculator with TI Connect CE as LOGEXSF or another name, then open the Python App and try the worked example on this page first. This release has no verified calculator OS or Python App version; treat transfer and execution as unverified until independently tested.

Full installation and troubleshooting guide. Check your teacher's or exam's rules before using any program.

Version history

Did a DuckieDai program help with your homework? Every program here is free. If you would like to say thanks, you can leave a tip on Cash App ($duckiedai214) or read what tips pay for.

Independent compatibility resource: Hidden Word Scanner is independent and is not affiliated with or endorsed by Texas Instruments. TI product names describe compatibility only.

Action-count privacy: Successful downloads, preview starts, and preview completions increment same-origin aggregate counters, and so does a Yes or No answer about whether the program worked. Your browser notes that you answered; that note is never sent to the site. No entered values, source text, IP address, account, cookie, device identifier, or fingerprint is stored with these counts.