Ask Your Question

ploting problems

asked 2011-08-25 07:20:09 -0500

milofis gravatar image

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?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2011-08-25 07:35:12 -0500

benjaminfjones gravatar image

To 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)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-08-25 07:20:09 -0500

Seen: 95 times

Last updated: Aug 25 '11