exponential functions · MIT License
Overview
Give five points to plot for a transformed exponential or logarithmic function, with its asymptote, domain, and range.
- Owner-tested on a TI calculator
- Version 1.0.0
- 1857 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
- The function is in the form shown on the menu, with the shift inside written as x-h.
- Points come from the parent graph's exponents -2 to 2, so they are easy to plot.
- The base must be greater than 0 and not 1; inf and nan are asked for again.
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 graph transformed exponential and log functions
The idea
Every exponential graph y = b^x passes through a few easy points: (0, 1), (1, b), and (-1, 1/b). A log graph y = log_b(x) is the same curve reflected over the line y = x, so its easy points are (1, 0), (b, 1), and (1/b, -1).
A transformed function moves and stretches those points. h shifts the graph left or right, k shifts it up or down, a stretches it and flips it when negative, and a minus sign inside reflects it across a vertical line. Plot the moved points, draw the asymptote, and the graph follows.
The formula
y = a*b^(x-h) + k
y = a*log_b(x-h) + k
exponential asymptote: y = k; log asymptote: x = h
a- the vertical stretch, flipping the graph when it is negative
b- the base, greater than 0 and not 1
h, k- the horizontal and vertical shifts
asymptote- the line the graph gets closer to but never reaches
Using the program
- Choose 1 for an exponential function or 2 for a logarithmic one.
- Enter a, the base b, h, and k. Numbers can be fractions such as 1/2, sqrt( ), or e.
- Answer 2 to Flip x inside? when the function has a minus sign in front of x - h, as in b^-(x-h).
- The program shows five points to plot, then the asymptote, the domain, and the range.
Worked example
Graph y = 2^(x-1) + 3. Choose 1 and enter a = 1, b = 2, h = 1, k = 3, and 1 for no flip.
the points (t, 2^t) of y = 2^x move to (t + 1, 2^t + 3)
The program shows (-1, 13/4), (0, 7/2), (1, 4), (2, 5), and (3, 7), then ASYMPTOTE: y = 3, DOMAIN: (-inf, inf), and RANGE: (3, inf).
Graph y = log_2(x). Choose 2 and enter a = 1, b = 2, h = 0, k = 0, and no flip. The program shows (1/4, -2), (1/2, -1), (1, 0), (2, 1), and (4, 2), with ASYMPTOTE: x = 0 and DOMAIN: (0, inf).
Tips and common mistakes
- Shift the asymptote along with the graph: y = 2^(x-1) + 3 levels off at y = 3, not y = 0.
- The domain of a log graph starts at its asymptote, so log_2(x - h) needs x greater than h, or less than h when x is flipped.
- A base between 0 and 1, such as 1/2, makes an exponential graph fall from left to right.
- Plot all five points before drawing; the points far from the asymptote show the shape best.
Where this comes up
Graphing transformed exponential and logarithmic functions is part of the exponential functions unit of algebra 2, precalculus, and college algebra.
Exact reviewed bytes
Source code
from math import exp,sqrtE=exp(1)def P():input("[enter]");print("\n"*11)def V(s):s=s.strip()if s=="e":return Eif s.startswith("sqrt(") and s.endswith(")"):return sqrt(V(s[5:-1]))if "/" in s:a,b=s.split("/",1);return V(a)/V(b)return float(s)def N(p):while 1:try:v=V(input(p).lower().replace(" ",""))if v-v:raise ValueErrorreturn vexcept (ValueError,ZeroDivisionError):print("Enter a number")def B():while 1:try:b=V(input("Base b? ").lower().replace(" ",""))if b>0 and b!=1 and b-b==0:return bexcept (ValueError,ZeroDivisionError):passprint("b>0, not 1. Like:\n2 1/2 sqrt(2) e")def F(x):if abs(x-round(x))<1e-9:return str(int(round(x)))for d in range(2,101):n=round(x*d)if abs(x-n/d)<1e-8:return str(n)+"/"+str(d)return str(round(x,4))def get():a=N("a? ");b=B();h=N("h? ");k=N("k? ")s=-1 if input("Flip x inside? 1 No 2 Yes ").strip()=="2" else 1print("\n"*11);return a,b,h,k,sdef pts(L):print("5 PLOT POINTS")for x,y in L:print("("+F(x)+", "+F(y)+")")P()def ex():print("y=a*b^(+/-[x-h])+k")a,b,h,k,s=get()pts([(h+s*t,a*b**t+k) for t in(-2,-1,0,1,2)])print("ASYMPTOTE: y = "+F(k)+"\nDOMAIN: (-inf, inf)")print("RANGE: "+("("+F(k)+", inf)" if a>0 else "(-inf, "+F(k)+")" if a<0 else "y = "+F(k)));P()def lg():print("y=a*log_b(+/-[x-h])+k")a,b,h,k,s=get()pts([(h+s*b**t,a*t+k) for t in(-2,-1,0,1,2)])print("ASYMPTOTE: x = "+F(h))print("DOMAIN: "+("("+F(h)+", inf)" if s==1 else "(-inf, "+F(h)+")")+"\nRANGE: (-inf, inf)");P()print("Exp/Log Points\n __\n ___(o )> quack!\n \\ <_. )\n `---'\n by DuckieDai\nhiddenwordscanner.com");P()while 1:c=input("1 Exponential\n2 Logarithmic\n3 Quit\nChoice? ").strip();print("\n"*11)try:if c=="1":ex()elif c=="2":lg()elif c=="3":breakexcept (OverflowError,ValueError):print("Too large");P()
- Filename
PLOT.py- Size
- 1857 bytes
- SHA-256
87d7c33e525b12b637608657182b57af198deb0c31b8ddbf03bc5e99752028a6
Usage
Inputs
- 1 for exponential y = a*b^(x-h)+k or 2 for logarithmic y = a*log_b(x-h)+k
- a, the base b, h, and k, as numbers, fractions, sqrt( ), or e
- Whether x is reflected inside, as in b^-(x-h) or log_b(-(x-h))
Outputs
- Five plot points, from the key points of the parent graph
- The asymptote, y = k or x = h
- The domain and range
Units: Function parameters; no physical units.
Assumptions and limitations
Assumptions
- The function is in the form shown on the menu, with the shift inside written as x-h.
- Points come from the parent graph's exponents -2 to 2, so they are easy to plot.
Constraints
- The base must be greater than 0 and not 1; inf and nan are asked for again.
- Values are shown as whole numbers, fractions with bottoms up to 100, or decimals to four places.
Known failures
- Numbers too large for the calculator show Too large and return to the menu.
- When a is 0 the graph is a flat line, but the program still lists an asymptote.
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 two changes: the number and base prompts now ask again when inf or nan is typed, and a result too large for the calculator now shows Too large and returns to the menu, where the original stopped with an error. Every other step is unchanged; this exact file has not yet been rerun on a calculator.
- Dependencies
- math
- Suggested calculator name
PLOT— 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 PLOT 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.