1 | initial version |
Here's the code I was trying to indicate in my comment plus a little bit extra to address your latest comments. It uses your code and calc314's code. Since you said you wanted it to display the answer, 166.66 you have asked for just the x-value. p1 = plot(20x + 10000, -8,600, ymin = -15, ymax = 30000) p2 = plot(80x, -8,600, ymin = -15, ymax = 30000, color = 'orange') p9 = (p1 + p2) ans=solve(20x+10000==80x,x) x0=ans[0].rhs() y0=80*x0 p3=point( (x0,y0), size=40) p4=text('%s'%x0,(x0+30,y0-1000)) p5=text('(%s,%s)'%(x0,y0),(x0+30,y0-3000)) p9=p1+p2+p3+p4+p5 show(p9) print 'x value of intersection', x0 print 'x value of intersection', n(x0,digits=3)
2 | No.2 Revision |
Here's the code I was trying to indicate in my comment plus a little bit extra to address your latest comments. It uses your code and calc314's code. Since you said you wanted it to display the answer, 166.66 you have asked for just the x-value. x-value.
p1 = You can, of course, remove the line p5=text('(%s,%s)'%(x0,y0),(x0+30,y0-3000)) and which print statement works best for you.
3 | No.3 Revision |
Here's the code I was trying to indicate in my comment plus a little bit extra to address your latest comments. It uses your code and calc314's code. Since you said you wanted it to display the answer, 166.66 you have asked for just the x-value.
p1 = plot(20*x + 10000, -8,600, ymin = -15, ymax = 30000)
p2 = plot(80*x, -8,600, ymin = -15, ymax = 30000, color = 'orange')
p9 = (p1 + p2)
ans=solve(20*x+10000==80*x,x)
x0=ans[0].rhs()
y0=80*x0
p3=point( (x0,y0), size=40)
p4=text('%s'%x0,(x0+30,y0-1000))
p5=text('(%s,%s)'%(x0,y0),(x0+30,y0-3000))
p9=p1+p2+p3+p4+p5
show(p9)
print 'x value of intersection', x0
print 'x value of intersection', n(x0,digits=3)
You can, of course, remove the line p5=text('(%s,%s)'%(x0,y0),(x0+30,y0-3000)) and which pick the print statement works best for you.
4 | No.4 Revision |
Here's the code I was trying to indicate in my comment plus a little bit extra to address your latest comments. It uses your code and calc314's code. Since you said you wanted it to display the answer, 166.66 you have asked for just the x-value.
p1 = plot(20*x + 10000, -8,600, ymin = -15, ymax = 30000)
p2 = plot(80*x, -8,600, ymin = -15, ymax = 30000, color = 'orange')
p9 = (p1 + p2)
ans=solve(20*x+10000==80*x,x)
x0=ans[0].rhs()
y0=80*x0
p3=point( (x0,y0), size=40)
p4=text('%s'%x0,(x0+30,y0-1000))
p5=text('(%s,%s)'%(x0,y0),(x0+30,y0-3000))
p9=p1+p2+p3+p4+p5
show(p9)
print 'x value of intersection', x0
print 'x value of intersection', n(x0,digits=3)
You can, of course, remove the line p5=text('(%s,%s)'%(x0,y0),(x0+30,y0-3000)) and pick the print statement works best for you.you like best.
5 | fix digits |
Here's the code I was trying to indicate in my comment plus a little bit extra to address your latest comments. It uses your code and calc314's code. Since you said you wanted it to display the answer, 166.66 you have asked for just the x-value.
p1 = plot(20*x + 10000, -8,600, ymin = -15, ymax = 30000)
p2 = plot(80*x, -8,600, ymin = -15, ymax = 30000, color = 'orange')
p9 = (p1 + p2)
ans=solve(20*x+10000==80*x,x)
x0=ans[0].rhs()
y0=80*x0
p3=point( (x0,y0), size=40)
p4=text('%s'%x0,(x0+30,y0-1000))
p5=text('(%s,%s)'%(x0,y0),(x0+30,y0-3000))
p9=p1+p2+p3+p4+p5
show(p9)
print 'x value of intersection', x0
print 'x value of intersection', n(x0,digits=3)
n(x0,digits=5)
You can, of course, remove the line p5=text('(%s,%s)'%(x0,y0),(x0+30,y0-3000)) and pick the print statement you like best.