Thank You very Much. I have been trying that for day and now after your advice it worked in mins.
f(x,y) = e^cos(x)-1 a = plot_slope_field(f(x,y), (x,-0,5),(y,-5,5)) v = eulers_method(f,0,0,1/10,5,algorithm="none") plot(line(v)+a) That is exactly what i was after. Thank Again Dan On Tuesday, May 21, 2013 10:35:43 PM UTC+1, William wrote: > > On Tue, May 21, 2013 at 2:15 PM, Daniel Harris > <mail.d...@googlemail.com <javascript:>> wrote: > > Hello > > > > I am really bogged down now and need some guidance. > > > > I am trying to follow an Open University Maths course but I dont have > access > > to MathCad. I can see on paper a graph created in mathcad using the > > eulers_method to graph a direcrion/gradient field and solution curve for > the > > function f(x,y)=e^cos(x) -1. I just cannot achieve this using sagemath. > I > > am trying > > > > eulers_method(e^cos(x)-1,0,0,1/10,5,algorithm="none") > > f(x,y) = exp(cos(x))-1 > v = eulers_method(f,0,0,1/10,5,algorithm="none") > line(v) > > > > > which does not work and i am struggling can someone point me in the > right > > direction. > > > > Thanks in Advance > > > > Dan > > > > > > On Saturday, May 18, 2013 11:09:28 PM UTC+1, Daniel Harris wrote: > >> > >> Hello > >> > >> I am quite new to sage and I am trying to copy a graph created using > >> mathcad. The following code seems to do the result but i am not sure > if it > >> is the best way of doing it. Any help would be appreciated > >> > >> var('a','b') > >> > >> Slopefield = plot_slope_field((a+b), (a,-5,5), (b,-5,5)) > >> > >> x = var('x') > >> > >> y = function('y', x) > >> > >> DE = diff(y,x) - x-y > >> > >> f = desolve(DE, [y,x], (0,0)) > >> > >> SolnPlot = plot(f, (x, -5,5)) > >> > >> (SolnPlot+Slopefield).show(aspect_ratio=1, xmin=-5, xmax=5, ymin=-5, > >> ymax=5) > >> > >> > >> > >> Thanks Dan > >> > >> ps the above code has been cut and pasted from a sage doc and slightly > >> modified by myself and i have no idea why the -x-y works in the DE > part. > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "sage-support" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to sage-support...@googlegroups.com <javascript:>. > > To post to this group, send email to > > sage-s...@googlegroups.com<javascript:>. > > > Visit this group at http://groups.google.com/group/sage-support?hl=en. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > > > -- > William Stein > Professor of Mathematics > University of Washington > http://wstein.org > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support?hl=en. For more options, visit https://groups.google.com/groups/opt_out.