I don't know anything about your economics problem but when I typed cp=contour_plot(utility,(x,0,24),(y, 0,24),fill=False,cmap='cool',contours=(100,1000,2048,2700,3500),plot_points=200)
instead, I definitely got a different plot. Can you try that (or even with a higher value) and see if it is correct? On Sat, Jan 31, 2009 at 9:37 AM, Paolo Crosetto <[email protected]> wrote: > > Hi everyone, > > I run into a very strange problem, that looks like critical to me. > Basically, I plot two functions that I know must be tangent at a given > point, and they are not. > > First, the code: > > x,y=var('x,y') > utility=y*x^2 > budget = 24-x > cp=contour_plot(utility,(x,0,24),(y, > 0,24),fill=False,cmap='cool',contours=(100,1000,2048,2700,3500)) > bp=plot(budget,(x,0,24),color='red') > cp+bp > > Now, the plot that comes after calling 'cp+bp' must have the following > property: the straight red line must be tangent to the contour of the > utility function evaluated at level utility=2048; and they must be > tangent at the point (16,8). In my system (Sage 3.2.3 on OpenSuse11.1) > they are NOT tangent; in fact, the sage plot indicates tangency at a > lower level, ~1820. > I checked the calculations many times, both with pencil and paper and > with Maple and Mathematica (besides, this is a _very_ standard problem > in economics, 101 course): the contourplot is tangent to the budget > line at u=2048 and correctly so displayed in maple and mathematica. I > am fairly sure this is not a miscalculation on my part. > > My questions are: > - Is it possible that this is a plotting problem? [i.e. the two curves > are plotted on different scales?] and if so, why would it happen? > - Or else is it a calculation problem on the part of sage? I'd find > this absolutely strange. And critical: I want to trust Sage to do the > calculations correctly. > > Can you reproduce it? > > Thanks, > > Paolo Crosetto > ----------------------------------------------- > PhD Student in economics > University of Milan - Italy > ----------------------------------------------- > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
