# Derivatives of Exponential and Logarithmic Functions

The derivative of an exponential function of the form $$a^x$$ is $\frac{d}{dx}a^x = (\ln a)a^x$ from sympy import * from sympy.abc import x expr = 2**x expr2 = 3**(2*x) diff(expr) ## 2**x*log(2) diff(expr2) ## 2*3**(2*x)*log(3) The derivative of a function of the form $$\log_ax$$is $\frac{d}{dx}\log_a x = \frac{1}{\ln a} \cdot \frac{1}{x}$ expr3 = log(x, 8) expr4 = log((x**2 + 1), 3) diff(expr3) ## 1/(x*log(8)) diff(expr4) ## 2*x/((x**2 + 1)*log(3))

Posted on

# Exponential Decay

In the equation of population growth, $$dP/dt = kP$$, the constant $$k$$ is given by $$k = (\text{birth rate}) - (\text{death rate})$$. Thus, a population grows only when the birth rate is greater than the death rate. When the death rate is greater than the birth rate we have a decrease or “decay”. Our equation for population decay becomes $$dP/dt = -kP$$, where $$k >0$$. The function that satisfies that rate of return is then …

Posted on

We go over some textbook exercises for exponential functions. Franchise Expansion A franchise business is selling franchises for pizza shops throughout the country. The marketing manager estimates that the number of franchises, $$N$$, will increase at the rate of 10% per year, that is, $\frac{dN}{dt} = 0.10N$ Find the function that satisfies this equation, assuming that the number of franchises at $$t = 0$$ is 50. How many franchises will be there in 20 years? …

Posted on

# Applications of Exponential Functions: Uninhibited and Limited Growth Models

If you have a function like $$f(x) = ce^{kx}$$, where $$c$$ is a constant then its derivative is $$f^\prime (x) = k \cdot f(x)$$, where $$k$$ is also a constant. For example, the general form of a function like $$\frac{dA}{dt} = 5A$$ is $$A(t) = ce^{5t}$$. The general form of a function like $$\frac{dP}{dt} = kP$$ is $$P(t) = ce^{kt}$$. Whereas solutions of an algebraic equation is a number, the solutions to the equations in these examples are functions. …

Posted on

# Sorting Lists of Dictionaries by Common Keys

If you have a list of dictionaries and you would like to sort the entries according to one or more of the dictionary values, you can use itemgetter from operator. from operator import itemgetter entries = [ {"name": "Sarah", "surname": "Connor", "uid": 104}, {"name": "Morticia", "surname": "Addams", "uid": 174}, {"name": "Sal", "surname": "Gomez", "uid": 345}, {"name": "Kawhi", "surname": "Leonard", "uid": 2} ] entries_by_name = sorted(entries, key=itemgetter("name")) entries_by_uid = sorted(entries, key=itemgetter("uid")) entries_by_name ## [{'name': 'Kawhi', 'surname': 'Leonard', 'uid': 2}, {'name': 'Morticia', 'surname': 'Addams', 'uid': 174}, {'name': 'Sal', 'surname': 'Gomez', 'uid': 345}, {'name': 'Sarah', 'surname': 'Connor', 'uid': 104}] entries_by_uid ## [{'name': 'Kawhi', 'surname': 'Leonard', 'uid': 2}, {'name': 'Sarah', 'surname': 'Connor', 'uid': 104}, {'name': 'Morticia', 'surname': 'Addams', 'uid': 174}, {'name': 'Sal', 'surname': 'Gomez', 'uid': 345}] entries_by_uid_and_surname = sorted(entries, key=itemgetter("uid", "surname")) entries_by_uid_and_surname ## [{'name': 'Kawhi', 'surname': 'Leonard', 'uid': 2}, {'name': 'Sarah', 'surname': 'Connor', 'uid': 104}, {'name': 'Morticia', 'surname': 'Addams', 'uid': 174}, {'name': 'Sal', 'surname': 'Gomez', 'uid': 345}] You can also use operations with itemgetter. …

Posted on