Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
It's not homework, I'm just learning SageMath

Okay. If you lied, may you live in interesting times (e. g. cross-examination by your instructor...)

I didn't think x needed to be part of a set,

Really ? That means that we'll work in an "elementary" (high school) point of view, and consider searching for real solutions.

Being lazy, I'll start by minimizing typing. Store your equation in a Python variable :

sage: E=90000*1.03^x==63000*1.095^x ; E
90000*1.03000000000000^x == 63000*1.09500000000000^x

Try to solve it directly :

sage: E.solve(x)
[219^x == 1/35*200^(x - 1)*103^x*100^(-x + 2)]

Sage tells us that there may exist a solution, which would satisfy this equation, which is, in some way, a restatement of our original equation (sage replaced your floating-pont numbers by close approximations expressed as "simple" fractions, an interesting step I won't discuss here...). This implicit solution isn't good enough for us.

Let's try to get rid of the powers ; to this end, we'll take the logarithms of both members of the equation, thus mapping our powers to products (see Wikipedia for an explanation if needed). The logarithm being monotonic on the set of positive real numbers, this will get you the same solution(s), if any.

Sage allows us to shortcut that by applying the log method to the equation :

sage: E.log().solve(x)
[log(9*103^x*100^(-x + 2)) == log(315*219^x*200^(-x + 1))]

Well... this worked only partially : Sage did not expand the logarithms of both sides, and still leaves us with an implicit equation. Let's do it ; again, Sage allows us to apply the log_expand method to both sides of the equation :

sage: E.log().expand_log()
0.02955880224154443*x + log(90000) == 0.09075436326846412*x + log(63000)

Now, this is a first degree linear equation, that Sage can solve :

sage: E.log().expand_log().solve(x)
[x == 91739056/5614023*log(90000) - 91739056/5614023*log(63000)]

Sage tells us that if finds one solution, which it gives us as "exactly" as it can. Oh, you were expecting a numerical approximation of the value ? Here it comes :

sage: E.log().expand_log().solve(x)[0].rhs().n()

Now, is this solution the solution ? Maybe not. You see, there are more in maths than real numbers ; $x$ may be a complex number, whose logarithm is a horse of a totally different color.

But discussing the nature and number of solution(s) of your equation is left to you, dear reader.

But beware : to be rigorous, this discussion needs sophomore-level analysis. Logarithms of real numbers were more or less understood by the beginning of the XVIIth century, while correct comprehension of complex analysis had to wait for the XIXth century, and is closely related to still open problems.