Hidden WordScanner
Private scans · No account required

DuckieDai Log Equation Solver

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.

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

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.

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 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

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

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

Download .py

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

  1. # DuckieDai(TM) Log Equation 3.4
  2. # Guided equation patterns
  3. from math import log,sqrt
  4. def N(p):
  5. while 1:
  6. try:
  7. s=input(p).strip()
  8. if '/' in s:
  9. a,b=s.split('/')
  10. return float(a)/float(b)
  11. return float(s)
  12. except:print('Try number or a/b')
  13. def F(x):
  14. if abs(x-round(x))<1e-8:return str(int(round(x)))
  15. for d in range(2,501):
  16. n=round(x*d)
  17. if abs(x-n/d)<1e-9:return str(n)+'/'+str(d)
  18. return str(round(x,6))
  19. def done(x,valid=True):
  20. print('\n'*5)
  21. if not valid:print('NO VALID SOLUTION')
  22. else:
  23. print('SOLUTION SET:')
  24. print('{'+F(x)+'}')
  25. print('Decimal:',round(x,6))
  26. print('\n'*2)
  27. print('DUCKIEDAI(TM)')
  28. print('LOG EQUATION 3.4')
  29. print(' __')
  30. print(' ___(o )> quack!')
  31. print(" \\ <_. )")
  32. print(" `---'")
  33. print('by DuckieDai')
  34. print('hiddenwordscanner.com')
  35. input('Press Enter ')
  36. print('\n'*6)
  37. while 1:
  38. print('1: klog_b(x+h)=log_b(n)+c')
  39. print('2: klog(x)=log(n)')
  40. print('3: klog(x)-log(m)=log(n)')
  41. print('4: log(x+h)=log(x)+log(n)')
  42. print('5: log_b(x+h)+log_b(x+j)=c')
  43. print('6: Quit')
  44. q=input('Choice? ')
  45. if q=='6':break
  46. if q not in ('1','2','3','4','5'):continue
  47. print('\n'*6)
  48. try:
  49. if q=='1':
  50. print('k log_b(x+h)=log_b(n)+c')
  51. b=N('Base b? ')
  52. k=N('k? ')
  53. h=N('h? ')
  54. n=N('n? ')
  55. c=N('c? ')
  56. if b<=0 or b==1 or k==0 or n<=0:
  57. print('Invalid base/input')
  58. else:
  59. v=(n*b**c)**(1/k)
  60. done(v-h,v>0)
  61. elif q=='2':
  62. print('k log(x)=log(n)')
  63. k=N('k? ')
  64. n=N('n? ')
  65. if k==0 or n<=0:print('Invalid input')
  66. else:done(n**(1/k))
  67. elif q=='3':
  68. print('klog(x)-log(m)=log(n)')
  69. k=N('k? ')
  70. m=N('m? ')
  71. n=N('n? ')
  72. if k==0 or m<=0 or n<=0:print('Invalid input')
  73. else:done((m*n)**(1/k))
  74. elif q=='4':
  75. print('log(x+h)=log(x)+log(n)')
  76. h=N('h? ')
  77. n=N('n? ')
  78. if n<=0:print('Invalid n')
  79. elif n==1:
  80. if h==0:print('ALL x > 0')
  81. else:print('NO SOLUTION')
  82. else:
  83. x=h/(n-1)
  84. done(x,x>0 and x+h>0)
  85. else:
  86. print('log_b(x+h)+log_b(x+j)=c')
  87. b=N('Base b? ')
  88. h=N('h? ')
  89. j=N('j? ')
  90. c=N('c? ')
  91. if b<=0 or b==1:print('Invalid base')
  92. else:
  93. disc=(h-j)**2+4*b**c
  94. roots=[(-(h+j)+sqrt(disc))/2, (-(h+j)-sqrt(disc))/2]
  95. good=[x for x in roots if x+h>0 and x+j>0]
  96. print('\n'*5)
  97. if good:
  98. print('SOLUTION SET:')
  99. print('{'+','.join(F(x) for x in good)+'}')
  100. else:print('NO SOLUTION')
  101. except (ValueError,OverflowError,ZeroDivisionError):
  102. print('Cannot solve input')
  103. input('Press Enter ')
  104. 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

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.