exponential functions · MIT License
Overview
Solve five common logarithmic equation patterns for x, including equations with a sum of two logs, and keep only answers that make every log defined.
- Owner-tested on a TI calculator
- Version 1.0.0
- 2455 bytes
- Uses math
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 equation has the shape shown on its menu line; the program asks only for the numbers that fill it in.
- A log written without a base works the same in any base, so options 2 to 4 do not ask for one.
- Answers that are whole numbers or fractions with a bottom of 500 or less are shown exactly; others are rounded to six decimal places.
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 solve logarithmic equations
The idea
Most log equations are solved the same way. Use the log rules to gather everything into one log on each side, then drop the logs and solve the equation that is left.
The catch is the domain. You can only take the log of a positive number, so an answer that makes any log's input zero or negative is not a solution, even when the algebra produces it. Such an answer is called extraneous, and this program leaves it out for you.
The formula
k*log_b(A) = log_b(A^k)
log_b(A) + log_b(B) = log_b(A*B)
log_b(A) - log_b(B) = log_b(A/B)
log_b(A) = c means A = b^c
b- the base: positive and not 1. Options 2 to 4 have no base to enter, because their answers are the same in every base
k- the number in front of a log; the first rule turns it into a power
h, j- the numbers added to x inside a log; for x - 2, enter -2
n, m- the positive numbers inside the logs that do not contain x
c- a plain number with no log around it
Using the program
- Choose the menu line that matches your equation, then type the numbers that fill it in. Decimals and fractions such as 1/3 are accepted.
- 1 is k log_b(x+h) = log_b(n) + c. 2 is k log(x) = log(n). 3 is k log(x) - log(m) = log(n).
- 4 is log(x+h) = log(x) + log(n). 5 is log_b(x+h) + log_b(x+j) = c.
- The answer appears as a solution set. Whole numbers and fractions are shown exactly, and options 1 to 4 add the decimal value underneath.
- When no answer keeps every log defined, the program says NO VALID SOLUTION or NO SOLUTION instead.
Worked example
Solve log_2(x+2) + log_2(x-2) = 5. Choose 5 and enter base 2, h = 2, j = -2, and c = 5.
(x+2)(x-2) = 2^5 = 32, so x^2 = 36
The algebra gives x = 6 or x = -6. But x = -6 makes x + 2 = -4, and there is no log of a negative number, so the program shows SOLUTION SET: {6}.
Solve log(x+6) = log(x) + log(3). Choose 4 and enter h = 6 and n = 3. Combining the right side gives log(3x), so x + 6 = 3x, and the program shows SOLUTION SET: {3} and Decimal: 3.0.
Doing it by hand
Option 1 is the most involved pattern, because the plain number c has to be turned into a log before the logs can be combined. Every log is base 3 here.
Solve 2 log_3(x+1) = log_3(4) + 2.
2 = log_3(3^2) = log_3(9)
log_3((x+1)^2) = log_3(4) + log_3(9) = log_3(36)
(x+1)^2 = 36, so x + 1 = 6 or x + 1 = -6
x + 1 = -6 would put a negative number inside log_3, so only x + 1 = 6 counts, and x = 5. In the program, choose 1 and enter base 3, k = 2, h = 1, n = 4, and c = 2: it shows SOLUTION SET: {5} and Decimal: 5.0.
The program does the same thing in one line: it raises both sides to undo the logs, giving x + h = (n*b^c)^(1/k), and then checks that x + h is positive.
Tips and common mistakes
- Rewrite your equation to match a menu line before you start, and keep the signs: log(x - 2) means h = -2.
- Check every answer in the original equation. Any value that makes a log's input zero or negative must be thrown out.
- log with no base usually means base 10 and ln means base e. For options 2 to 4 it does not matter which one your equation uses.
- If the answer is not a simple fraction, the program rounds it to six decimal places.
Where this comes up
Solving log equations is a core skill in the exponential and logarithmic functions unit of algebra 2, precalculus, and college algebra, and it is usually where extraneous solutions are first taught.
Go further: Logarithm Rules and How to Solve Exponential Equations
Exact reviewed bytes
Source code
# DuckieDai(TM) Log Equation 3.4# Guided equation patternsfrom math import log,sqrtdef N(p):while 1:try:s=input(p).strip()if '/' in s:a,b=s.split('/')return float(a)/float(b)return float(s)except:print('Try number or a/b')def F(x):if abs(x-round(x))<1e-8:return str(int(round(x)))for d in range(2,501):n=round(x*d)if abs(x-n/d)<1e-9:return str(n)+'/'+str(d)return str(round(x,6))def done(x,valid=True):print('\n'*5)if not valid:print('NO VALID SOLUTION')else:print('SOLUTION SET:')print('{'+F(x)+'}')print('Decimal:',round(x,6))print('\n'*2)print('DUCKIEDAI(TM)')print('LOG EQUATION 3.4')print(' __')print(' ___(o )> quack!')print(" \\ <_. )")print(" `---'")print('by DuckieDai')print('hiddenwordscanner.com')input('Press Enter ')print('\n'*6)while 1:print('1: klog_b(x+h)=log_b(n)+c')print('2: klog(x)=log(n)')print('3: klog(x)-log(m)=log(n)')print('4: log(x+h)=log(x)+log(n)')print('5: log_b(x+h)+log_b(x+j)=c')print('6: Quit')q=input('Choice? ')if q=='6':breakif q not in ('1','2','3','4','5'):continueprint('\n'*6)try:if q=='1':print('k log_b(x+h)=log_b(n)+c')b=N('Base b? ')k=N('k? ')h=N('h? ')n=N('n? ')c=N('c? ')if b<=0 or b==1 or k==0 or n<=0:print('Invalid base/input')else:v=(n*b**c)**(1/k)done(v-h,v>0)elif q=='2':print('k log(x)=log(n)')k=N('k? ')n=N('n? ')if k==0 or n<=0:print('Invalid input')else:done(n**(1/k))elif q=='3':print('klog(x)-log(m)=log(n)')k=N('k? ')m=N('m? ')n=N('n? ')if k==0 or m<=0 or n<=0:print('Invalid input')else:done((m*n)**(1/k))elif q=='4':print('log(x+h)=log(x)+log(n)')h=N('h? ')n=N('n? ')if n<=0:print('Invalid n')elif n==1:if h==0:print('ALL x > 0')else:print('NO SOLUTION')else:x=h/(n-1)done(x,x>0 and x+h>0)else:print('log_b(x+h)+log_b(x+j)=c')b=N('Base b? ')h=N('h? ')j=N('j? ')c=N('c? ')if b<=0 or b==1:print('Invalid base')else:disc=(h-j)**2+4*b**croots=[(-(h+j)+sqrt(disc))/2, (-(h+j)-sqrt(disc))/2]good=[x for x in roots if x+h>0 and x+j>0]print('\n'*5)if good:print('SOLUTION SET:')print('{'+','.join(F(x) for x in good)+'}')else:print('NO SOLUTION')except (ValueError,OverflowError,ZeroDivisionError):print('Cannot solve input')input('Press Enter ')print('\n'*6)
- Filename
LOGEQ34.py- Size
- 2455 bytes
- SHA-256
2f8ea00b7e4aab3303c283ec003914446cc2f5abde8fba5aa1f2abcdb229c85d
Usage
Inputs
- One menu choice from 1 to 6
- Option 1: base b, k, h, n, and c
- Option 2: k and n; option 3: k, m, and n
- Option 4: h and n
- Option 5: base b, h, j, and c
Outputs
- The solution set, with exact whole-number or fraction answers where possible
- The decimal value of the answer for options 1 to 4
- NO VALID SOLUTION or NO SOLUTION when there is no answer, or a note that every positive x is a solution
Units: Pure numbers; no physical units.
Assumptions and limitations
Assumptions
- Every equation has the shape shown on its menu line; the program asks only for the numbers that fill it in.
- A log written without a base works the same in any base, so options 2 to 4 do not ask for one.
- Answers that are whole numbers or fractions with a bottom of 500 or less are shown exactly; others are rounded to six decimal places.
Constraints
- The base b must be greater than 0 and cannot be 1.
- k cannot be 0, and the numbers inside the logs on the right side (n, and m in option 3) must be greater than 0.
- Numbers may be typed as decimals or as a fraction such as 1/3; anything else asks again.
Known failures
- An answer that breaks the domain of a log, such as a negative x + h, is reported as NO VALID SOLUTION or left out of the solution set.
- Numbers too large for the calculator show Cannot solve input instead of an answer.
- A menu choice other than 1 to 6 shows the menu again.
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. The file is published exactly as provided; this exact file has not yet been rerun on a calculator.
- Dependencies
- math
- Suggested calculator name
LOGEQ34— 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 LOGEQ34 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.