ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 11 Oct 2020 21:39:24 +0200plotted real intersection but solve only shows imaginaryhttps://ask.sagemath.org/question/53835/plotted-real-intersection-but-solve-only-shows-imaginary/I plotted `x^3 - x` and its derivative `3*x^2 - 1` to get two intersections in the real plane.
plot([x^3-x,3*x^2 - 1],-3,3,color=['blue','green'],legend_label=["f","derivative"])
![intersection](/upfiles/16024461625093012.png)
However, when I solved the two with `solve(x^3-x == 3*x^2 - 1, x)`, all I get are imaginary values.
solve(x^3-x == 3x^2 - 1,x)
[x == -1/2*(1/9*I*sqrt(37)*sqrt(3) + 1)^(1/3)*(I*sqrt(3) + 1) - 2/3*(-I*sqrt(3) + 1)/(1/9*I*sqrt(37)*sqrt(3) + 1)^(1/3) + 1, x == -1/2*(1/9*I*sqrt(37)*sqrt(3) + 1)^(1/3)*(-I*sqrt(3) + 1) - 2/3*(I*sqrt(3) + 1)/(1/9*I*sqrt(37)*sqrt(3) + 1)^(1/3) + 1, x == (1/9*I*sqrt(37)*sqrt(3) + 1)^(1/3) + 4/3/(1/9*I*sqrt(37)*sqrt(3) + 1)^(1/3) + 1]
Shouldn't `solve` show me the two intersections or am I disastrously confused?cybervigilanteSun, 11 Oct 2020 21:39:24 +0200https://ask.sagemath.org/question/53835/Trouble finding intersection of two functionshttps://ask.sagemath.org/question/44019/trouble-finding-intersection-of-two-functions/ Hi all,
I'm still pretty new using SageMath, but I'm trying to duplicate functionality that I've been able to do in wolfram alpha
Wolfram Input:
Intersection points of [//math:90000 1.03^x//] and [//math:63000 1.095^x//]
So far I've been able to recreate and graph these functions very easily using SageMath, but I'm having a difficult time using the solve function to actually return a numerical value for the intersection point itself.
My SageMath code looks like:
x = var('x')
f1 = (63000*((1.095)^x))
f2 = (90000*((1.03)^x))
ans=solve(f2==f1,x)
print ans
print n(ans[0].rhs())
ans prints as
"[
219^x == 1/35*200^(x - 1)*103^x*100^(-x + 2)
]"
And I get an error "TypeError: cannot evaluate symbolic expression numerically" in my attempts to resolve it to an approximate number.
Can anyone tell me what I'm doing wrong?lgushurstMon, 22 Oct 2018 07:51:55 +0200https://ask.sagemath.org/question/44019/