Re: [sage-support] Re: Drawing Circle using simple equation of circle
On Mon, Jun 25, 2012 at 7:39 AM, Slumberland rkhi...@gmail.com wrote: Okay, that's maybe not the answer you're looking for. What he means is that you can't plot it explicitly without solving for y. Implicit is another way of saying not in the form y = (or z= , x = etc) But it can be instructive to figure out how to plot the functions which define a circle. Is that what you want? Sage will solve the equation for you. You can type sage: x,y = var('x,y') sage: b = x^2 + y^2 == 4 sage: c = solve(b,y) sage: c [y == -sqrt(-x^2 + 4), y == sqrt(-x^2 + 4)] The command solve(b,y) solves your equation for the variable y. Plotting this way is awkward but you can do it. In this case, we need each of the functions -sqrt(-x^2+4), sqrt(-x^2+4) Both of these are stored in c. To get them, you can tell python what parts you want: c[0].rhs() gives you the right-hand-side{ ;-) of the first equality stored in c c[1].rhs() grabs the second. So, you could do this: sage: bottom = plot( c[0].rhs(), xmin=-3, xmax=3, aspect_ratio=1) sage: top = plot(c[0].rhs(), xmin=-3, xmax=3) sage: show(bottom+top) and the graph will show, but Python complains that it can't evaluate the function at some points. implicit_plot() is easier to use, that's all. Thanks for explaining the things . :-) It executed the code and it gives half circle. Anyways if it gives warnings then we should not do this way. Thanks once again. -- Priyanka Kapoor priyankacool10.wordpress.com Linux User Group, Ludhiana -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Solving 4th order differential equation
Thanks for helping. I used a mathematical approach for 4th order derivative i.e substituing double derivative as a variable, solving for 2nd order differential equation and substituting back and again solved for 2nd order differentiation. here is code: var('w,x,E,L,k1,k2') y = function('y', x) w= function('w' , x) q = function('q', x) assume(L0) assume(E0) q=x de=E*L*diff(y,x,2)==q y_res=desolve(de,y,ivar=x,ics=[L,0,0]) des=diff(w,x,x)-y_res==0 dess=desolve(des,w,ivar=x,ics=[0,0,0]) print Solution of bernoulli's equation:,dess #Remeber plot can't be formed without giving values of constant### E=6 L=10 p=plot( 1/120*(20*L^3*x^2 - 10*L^2*x^3 + x^5)/(E*L),(x,0,1),thickness=3) p.show() -- Priyanka Kapoor priyankacool10.wordpress.com Linux User Group, Ludhiana -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Solving 4th order differential equation
I want to know how to solve fourth order differential equation in sagemath. Question which i actually want to solve is Euler-bernoulli equation. http://en.wikipedia.org/wiki/Euler%E2%80%93Bernoulli_beam_theory I searched a lot about solving this, but didn't succeed. Does anyone know how to solve this equation. Whether this equation is solved in parts by taking second order derivative two times or directly. Please give any link that shows wonderful working of sagemath regarding 4th order differential equation. I tried this: var('k1,k2') y=function('y',x) w=function('w',x) q=function('q',x) var('x') de=diff(y,x,x)==q ##here i put (d^2/dx^2)(w)=y , thus (d^4/dx^4)(w)= (d^2/dx^2)(y) res=desolve(de,dvar=y,ivar=x) e=diff(w,x,x)-res==0 res1=desolve(res,dvar=w,ivar=x,contrib_ode=True) ## As solution of above will give y and again i put y= (d^2/dx^2)(w) i.e substitute back print res1 print res NotImplementedError: Maxima was unable to solve this ODE. Please help. -- Priyanka Kapoor priyankacool10.wordpress.com Linux User Group, Ludhiana -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Solving 4th order differential equation
On Fri, May 25, 2012 at 3:06 PM, David Joyner wdjoy...@gmail.com wrote: Did you try sympy? No. Does it solve 4th order diff. eq.? If yes, can you please give link. And approach that i am using is wrong or invalid? -- Priyanka Kapoor priyankacool10.wordpress.com Linux User Group, Ludhiana -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Solving second degree ODE with constants in sage
I would do it like this: x = var('x') # independent variable b = var('b') # constant y = function('y', x) # unknown function # define 2nd order ODE; (undampened spring with unit of mass attached) myode = diff(y,x,2)+b*y == 0 # define 2order ODE assume(b0) # mass is always possitive f = desolve_laplace(de = myode,dvar = y, ivar=x) I should return an expression like: cos(sqrt(b)*x)*y(0) + sin(sqrt(b)*x)*D[0](y)(0)/sqrt(b) Thanks. It helped me. -- Priyanka Kapoor http://kapoorpriyanka.in Linux User Group, Ludhiana -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Application/Use of Sage in IT company or Industries
I want to ask that what is the use of sage? Why should we use it? Where its being used till date? These questions might be simple and i want to know before i go deep in sage. Please everyone on this mailing list reply that why you use sage? Whatever i think about sage is that sage is helpful for teaching maths. -- Priyanka Kapoor http://kapoorpriyanka.in Linux User Group, Ludhiana -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Drawing Circle using simple equation of circle
I plotted circle using parametric equation, using circle() function. But i want to plot x^2+y^2=4 I tried this: var('x,y') b=[x^2+y^2==4] c=plot(b,(x,-2,2),(y,-2,2),color='blue') c.save('ram.png') I am getting the following error TypeError: float() argument must be a string or a number Can anyone help me. I am new to sage that's why unable to solve errors -- Priyanka Kapoor http://kapoorpriyanka.in Linux User Group, Ludhiana -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Array and Loop in Sagetex
It looks like you want TeX to do the loop. Try the forloop package: http://www.ctan.org/tex-archive/macros/latex/contrib/forloop/ How to pass value of list in sageblock to variable used in \forloop -- Priyanka Kapoor http://kapoorpriyanka.in Linux User Group, Ludhiana -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Array and Loop in Sagetex
How to pass value of list in sageblock to variable used in \forloop may be it can help http://mathematics.nsetzer.com/latex/latex_for_loop.html It just tell how to apply forloop. -- Priyanka Kapoor http://kapoorpriyanka.in Linux User Group, Ludhiana -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Drawing Circle using simple equation of circle
You might want to use implicit_plot instead: var('x,y') b = x^2+y^2==4 c = implicit_plot(b,(x,-2,2),(y,-2,2),color='blue') c.save('ram.png') It gives the following error TypeError: 'tuple' object is not callable -- Priyanka Kapoor http://kapoorpriyanka.in Linux User Group, Ludhiana -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Drawing Circle using simple equation of circle
Please note that I wrote b = x^2+y^2==4 I got a plot.thank you. Sir , can't we draw it using plot() function. -- Priyanka Kapoor http://kapoorpriyanka.in Linux User Group, Ludhiana -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Array and Loop in Sagetex
I tried this plot using sage with Latex. \documentclass{article} \title{Curve Tracing by SAGE in \LaTeX} \author{Priyanka Kapoor} \usepackage{sagetex} \begin{document} \maketitle Plot the curve for sin(X) \begin{sageblock} f(x) = sin(x) \end{sageblock} Here's a plot of $f$ from $-2$ to $2$: \sageplot[width=10cm]{plot(f,(x, -2, 2),legend_label='sin(x)',aspect_ratio =1)} \end{document} How to use Array and Loop in this program around \sageplot portion. I tried this: \begin{sageblock} v= [x^2, sin(x)] \end{sageblock} Here's a plot of $f$ from $-2$ to $2$: for i in range(2): \sageplot[width=10cm]{plot(v[i],(x, -2,2),legend_label='sin(x)',aspect_ratio =1)} \end{document} It doesn't work :-( Where to apply loop then. In sageblock or in latex body? please help. -- Priyanka Kapoor http://kapoorpriyanka.in Linux User Group, Ludhiana -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Re: %cython failing in notebook because of accessing the wrong directory
On Tue, Apr 3, 2012 at 1:31 AM, Maarten Derickx m.derickx.stud...@gmail.com wrote: In your setup everything worked ok. You just defined a function called hello. The function was never executed so you didn't see anything. To execute the function try the following: hello() Ok Considdering you are new with sage I suggest first learn how to use python (and don't use the %cython). Only after you are familiar with that it might be good to start learning cython. And then would only need it if you wrote some code that calls some fast functions in a smal for loop that is annoyingly slow. Thanks for guidance. I will definately follow. :-) -- Priyanka Kapoor http://kapoorpriyanka.in Linux User Group, Ludhiana -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Re: %cython failing in notebook because of accessing the wrong directory
When I run code : %cython cdef hello(): print 'hello world!' I got two files , one is html file and another is C file. Html contents are: 1: 2: include interrupt.pxi # ctrl-c interrupt block support 3: include stdsage.pxi # ctrl-c interrupt block support 4: 5: include cdefs.pxi 6: cdef hello(): 7: print 'hello world!' I am new to sage. I dont know much about it. Can you clarify now? Whats the problem in actual? I also wish to know what is the problem and how the desired output hello world will come. -- Priyanka Kapoor http://kapoorpriyanka.in Linux User Group, Ludhiana -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Display intermediate steps of a question in sagemath
Hello everyone, I want a help from you all regarding sagemath. How to get full steps solution to any problem in sage? Like I gave statement in sagemath: sage: x= var('x') sage: f = exp(x) * log(x) sage: f.diff(x, 3) O/P e^x*log(x) + 3*e^x/x - 3*e^x/x^2 + 2*e^x/x^3 I want to display the intermediate steps also. Like firstly it give step wise solution for derivative of order one then derivative of order two and three. Please help. Thanks in advance -- Priyanka Kapoor http://kapoorpriyanka.in Linux User Group, Ludhiana -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org