ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 25 Aug 2011 07:35:12 -0500ploting problemshttp://ask.sagemath.org/question/8260/ploting-problems/I want to do the plot of: log (y) vs log (x), when y = log (x) and x is between (1,150), so I tried:
sage: var ('x,y')
(x, y)
sage: y = function ('y',x)
sage: y = x^2
sage: plot (log(y), (log(x), 1,150))
but the final result that I found is wrong (I did the real plot using openoffice and gnuplot), so finally someone could you help me to solve this problem?Thu, 25 Aug 2011 07:20:09 -0500http://ask.sagemath.org/question/8260/ploting-problems/Answer by benjaminfjones for <p>I want to do the plot of: log (y) vs log (x), when y = log (x) and x is between (1,150), so I tried:</p>
<p>sage: var ('x,y')
(x, y)
sage: y = function ('y',x)
sage: y = x^2
sage: plot (log(y), (log(x), 1,150))</p>
<p>but the final result that I found is wrong (I did the real plot using openoffice and gnuplot), so finally someone could you help me to solve this problem?</p>
http://ask.sagemath.org/question/8260/ploting-problems/?answer=12606#post-id-12606To plot one quantity vs. another you can build a list of coordinates of points on the graph and then plot those points. Use `plot` for graphing a function of an independent variable. In your graph, neither axis variable is "independent".
sage: coordinates = [ (log(x), log(x^2)) for x in range(1,150) ]
sage: point( coordinates )
Which is just a line with slope 2 since $\log(x^2) = 2 \log(x)$. If you want the points to be connected with lines try:
sage: line(coordinates)Thu, 25 Aug 2011 07:35:12 -0500http://ask.sagemath.org/question/8260/ploting-problems/?answer=12606#post-id-12606