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
Tried it? Did this program work on your calculator?
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.
TI-84 Plus CE Python · screen preview
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
- Choose 1 for log or 2 for ln. For log, type the base, or press enter for base 10.
- Say how many factors are on the top, then type each factor and its power. Press enter for a power of 1.
- Do the same for the bottom; type 0 if there is no bottom.
- Type a factor with brackets, such as (x+1), to keep it together. The brackets are dropped in the answer: log(x+1).
- Plain numbers that are exact powers of the base, such as 8 in base 2 or e in ln, become whole numbers.
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
- A log of a sum does not split: log(x + 1) stays as it is. That is why a factor like (x+1) is entered as one piece.
- Rewrite roots as powers first: the cube root of x is x to the power 1/3.
- Expanding assumes every factor is positive. Check that against the original problem.
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
# DuckieDai(TM) Guided Log Expand# Assumes positive variable factorsdef number(s):try:if '/' in s:a,b=s.split('/')return float(a)/float(b)return float(s)except:return Nonedef fmt(x):if abs(x-round(x))<1e-9:return str(int(round(x)))for d in range(2,65):n=round(x*d)if abs(x-n/d)<1e-8:return str(n)+'/'+str(d)return str(round(x,5))def exact(n,b):if n==1:return 0if b is None or n<=0:return Nonev=1for k in range(1,21):v*=bif abs(v-n)<1e-8:return kif v>n:breakreturn Nonedef term(a,p):if a=='e' and L=='ln':return p,''n=number(a)if n is not None:if n<=0:return Noneif n==1:return 0,''k=exact(n,B)if k is not None:return p*k,''if a.startswith('(') and a.endswith(')'):a=a[1:-1]return p,adef clear():print('\n'*8)def run():parts=[]for sign,name in ((1,'TOP'),(-1,'BOTTOM')):clear()print(name+' FACTORS')while 1:try:count=int(input('How many? '))if 0<=count<=12:breakexcept:passprint('Enter 0 to 12')for i in range(count):clear()print(name+' '+str(i+1)+'/'+str(count))a=input('Factor? ').strip()if not a:return 'Empty factor'clear()print(name+' '+str(i+1)+'/'+str(count))print('SQRT = power 1/2')while 1:p=number(input('Power? (Enter=1) ') or '1')if p is not None and p>0:breakprint('Power must be > 0')t=term(a,sign*p)if t is None:return 'Factor must be > 0'parts.append(t)out=''for p,a in parts:if abs(p)<1e-9:continuew=abs(p)s=fmt(w) if not a else ('' if w==1 else fmt(w)+'*')+L+'('+a+')'if out:out+=(' + ' if p>0 else ' - ')+selse:out=('-' if p<0 else '')+sreturn out or '0'print('DUCKIEDAI(TM)')print('LOG EXPAND')print(' __')print(' ___(o )> quack!')print(' \\ <_. )')print(" `---'")print('by DuckieDai')print('hiddenwordscanner.com')while 1:print('\n1: log 2: ln 3: quit')c=input('Choice? ')if c=='3':breakif c not in ('1','2'):continueL='log' if c=='1' else 'ln'B=Noneif c=='1':b=input('Base (Enter=10)? ').strip() or '10'B=number(b)if B is not None and (B<=0 or B==1):print('Bad base');continueif B is None and not b.isalpha():print('Use base # or letter');continueif b!='10':L='log_'+bclear()answer=run()clear()print('RESULT:')print(answer)input('Press enter ')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
- 1.0.0 — current version, published . Download this reviewed version
Related learning
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.