[sage-support] Re: Solving and plotting the solution of ODE

2012-10-16 Thread ancienthart
Another good resource is: ask.sagemath.org Joal Heagney On Friday, 12 October 2012 08:37:50 UTC+10, Doaa El-Sakout wrote: > > I try to solve an ODE and plot the result as follows, > > > x,t,a=var('x,t,a') > a=0.29 > x = function('x', t) > S=desolve(diff(x,t)-x*(1-x)+a* > (1+sin(2*pi*t)),x,contr

[sage-support] Re: Solving and plotting the solution of ODE

2012-10-16 Thread ancienthart
A way to get these new parameters from maxima is as follows: soln = S[0][0][1] soln.arguments() to get the argument names, (Which are t and u), then t,u = soln.arguments() Once you've done this, you can replace u with a value as follows: soln.subs(u == 0.5) Which returns: -0.145*sin(2*pi*t) - 0

Re: [sage-support] Re: How to substitute a list of equalities into a formula?

2012-04-12 Thread ancienthart
On Wednesday, 11 April 2012 03:11:03 UTC+10, Michael Orlitzky wrote: > > On 04/09/12 22:18, ancienthart wrote: > > Hah. Thanks Michael and P. I first learnt Python in the 1.5 era, so > > there's a few of the nice new syntax features I'm still not up to speed > on. &

Re: [sage-support] Re: How to substitute a list of equalities into a formula?

2012-04-09 Thread ancienthart
Hah. Thanks Michael and P. I first learnt Python in the 1.5 era, so there's a few of the nice new syntax features I'm still not up to speed on. Any reason why .subs doesn't accept multiple arguments? Would there be any point in requesting .subs_expr become the new default on trac? Joal Heagney

[sage-support] Re: Weird behaviour in integrate code

2012-03-24 Thread ancienthart
Or rather, the limit syntax seems to be completely out of whack. This seems to be promising, except that minus needs to be replaced by -Infinity, and then I get an error message relating to the limit function. > > -- To post to this group, send email to sage-support@googlegroups.com To unsubscr

[sage-support] Re: Weird behaviour in integrate code

2012-03-24 Thread ancienthart
Hi kcrisman, just some followups: Have added the following to ask.sagemath.org http://ask.sagemath.org/question/1265/how-to-dynamically-substitute-a-variable-in-a Have applied the http://trac.sagemath.org/sage_trac/ticket/11143 patch (along with this patch as well http://trac.sagemath.org/sage_

[sage-support] Re: Weird behaviour in integrate code

2012-03-22 Thread ancienthart
t the result back here. Will take care of the other points as you have suggested. Again thank you for your help, Joal Heagney On Friday, 23 March 2012 00:12:27 UTC+10, kcrisman wrote: > > > > On Thursday, March 22, 2012 5:46:58 AM UTC-4, ancienthart wrote: >> >> On Wednesday,

[sage-support] Re: Weird behaviour in integrate code

2012-03-22 Thread ancienthart
On Wednesday, 21 March 2012 22:42:16 UTC+10, kcrisman wrote: > > >> fracintegral(x,1/2) >>> >> >>> >> 4/15*x^(5/2)/sqrt(pi) >> > Though you should get a deprecation error. > Yeah, I do. I don't know the correct way to collect a variable argument from inside a function call, and apply

[sage-support] Weird behaviour in integrate code

2012-03-21 Thread ancienthart
Hi everyone, I've got the following behaviour in sage 4.8. First I define the following function to calculate the fractional integral of a function: def fracintegral(func,n, x=x,a=0): > var('t') > assume(t > a) > assume(x > a) > return integrate((x-t)^n*func(t),t,a,x)/gamma(n) >

Re: [sage-support] Flipping an equation/inequality

2012-02-21 Thread ancienthart
I've opened an enhancement ticket here: http://trac.sagemath.org/sage_trac/ticket/12554 and given you the credit for the example implementation. My approach used a dictionary, but your implementation has the advantage that if an earlier test returns True, the additional test logic doesn't have to

Re: [sage-support] Flipping an equation/inequality

2012-02-21 Thread ancienthart
Yup, that's very similar to a solution I came up with. Just checking that there isn't a pre-existing method or function I missed. Think I'll go write an enhancement ticket at sage trac. :/ Joal Heagney -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from th

[sage-support] Flipping an equation/inequality

2012-02-20 Thread ancienthart
Guys, is there a method or function to flip an equation or inequality? I'd like to turn 2*x + 3*y < 8 into 8 > 2*x + 3*y automatically. Joal Heagney -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@goog

[sage-support] Re: Integrate 0 doesn't give zero.

2011-10-08 Thread ancienthart
Yes, but if you post integrate(0,x) directly into a cell, it evaluates to a constant. Any idea why it doesn't do so in this case? Joal Heagney -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegrou

[sage-support] Integrate 0 doesn't give zero.

2011-10-07 Thread ancienthart
The following happens when I enter the following in 4.7.1 y = function('y',x) a = 1 + diff(y,x) == 0 integrate(a,x) I get: x + y(x) == c2 + integrate(0, x) Any idea why sage doesn't reduce integrate(0,x) to zero in this case? If it's not a simple "feature", I'll enter this in trac. Joal Heagne

Re: [sage-support] Log log plots in sage.

2011-06-14 Thread ancienthart
Thanks Rajeev. Incidently, doing plt.savefig('./a.png') will allow notepad to display the resultant file. Joal Heagney -- 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,

[sage-support] Log log plots in sage.

2011-06-12 Thread ancienthart
Aaah. I've found plenty of evidence stating that sage can do log-log plots, but can someone please give me a code example on how to actually achieve it? Joal Heagney -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to

[sage-support] Re: solve does not consider all a_x which are in the equation

2011-05-31 Thread ancienthart
Normally solve(e == m, a_x, to_poly_solve='force') works, but interestingly, not for your equation. Joal Heagney -- 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, visi

[sage-support] Re: Cython Problem

2011-05-30 Thread ancienthart
I know it's a silly question, but do you have the standard c++ libraries installed? sudo apt-get install g++ Joal Heagney -- 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 opt

Re: [sage-support] Python and Sage

2011-05-28 Thread ancienthart
Yup, Robert's right, IDLE's just a GUI. It does some rewriting of code, but that's just so that IDLE's onboard debugger tools can capture exceptions and output. If you want faster code, you may want to look at the following blog post: http://sagemath.blogspot.com/2010/11/getting-started-with-cyt

[sage-support] Re: Plots using R in sage notebook appear later

2011-05-26 Thread ancienthart
And then there's Jason's beautiful little time-saving method if you use a lot of graphics: *from contextlib import contextmanager @contextmanager def r_graphics(r): r.png() yield r.dev_off() with r_graphics(r): r.boxplot() r.some_other_plot()* This and further discussion can be found at: http:

[sage-support] Re: Plots using R in sage notebook appear later

2011-05-25 Thread ancienthart
A good tutorial for R/sage is available at: http://www.sagenb.org/home/pub/2232/ Joal Heagney -- 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

[sage-support] Re: Plots using R in sage notebook appear later

2011-05-24 Thread ancienthart
Can you try the following for us please? png() hist(x) dev.off() and png() plot(x,y) def.off() Joal Heagney -- 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 th

[sage-support] Re: Plot in Sage

2011-05-10 Thread ancienthart
var('x,y,z') A = implicit_plot3d(x^2 + y^2 + z^2 == 1, (x,-1,1),(y,-1,1),(z,-1,1),opacity=0.5) B = implicit_plot3d(x^2 + 2*y^2 + 2*z^2 == 1, (x,-1,1),(y,-1,1),(z,-1,1),color='red') show(A+B) -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, se

[sage-support] Re: Are there people using today any of the three recommended solutions for Windows on the sage site?

2011-04-28 Thread ancienthart
The ticket is open at #11266 Joal Heagney -- 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://

[sage-support] Re: Are there people using today any of the three recommended solutions for Windows on the sage site?

2011-04-27 Thread ancienthart
I've just joined sage-trac-account, requested an account and will post a new ticket once I have approval. As for trellis/lattice packages, this highlights what could be a big problem with R, as there are literally thousands of different packages, a good few that create plots. If we create a lis

[sage-support] Re: Are there people using today any of the three recommended solutions for Windows on the sage site?

2011-04-25 Thread ancienthart
True, but I'd like something a little more ... pythonic. I was thinking of a wrapper that acts like the following: graph = Rgraphic(arguments passed to R.Cairo) graph.boxplot(arguments) graph.histogram(arguments) graph.etc.. show(graph) All method calls that aren't defined in the Rgraphic c

[sage-support] Re: Are there people using today any of the three recommended solutions for Windows on the sage site?

2011-04-24 Thread ancienthart
kcrisman? :P I'm not actually sure if the r.png( ) in the system I have set up uses the system png libraries or cairo, but having the tcl/tk R package installer is handy. What I'd like to see in sage is a rewrite of the r.png( ) functionality Currently, to include a R graphic object in the

[sage-support] Re: Are there people using today any of the three recommended solutions for Windows on the sage site?

2011-04-22 Thread ancienthart
These two posts explain what I do. https://groups.google.com/d/topic/sage-devel/s1hI8JnHY6k/discussion https://groups.google.com/d/topic/sage-release/ilYqmm2QyHc/discussion It's a bit unclear, but basically I install jpeg-dev and png-dev libraries and everything else I can think of to cover my b

[sage-support] Re: Are there people using today any of the three recommended solutions for Windows on the sage site?

2011-04-21 Thread ancienthart
Kelvin's suggestion is the easiest. This is how I run sage on my windows work machine, inside virtualbox on ubuntu. The vmware image provided on the website lacks R png support, so I like to roll my own. Joal Heagney -- To post to this group, send email to sage-support@googlegroups.com To unsu

[sage-support] Re: assumptions so that x^n -> 0?

2011-04-15 Thread ancienthart
(Respectfully) Then why does splitting the range of values for x into positive, zero and negative ranges work? Joal Heagney -- 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 opt

[sage-support] Re: Unable to Solve Simple Problem

2011-04-11 Thread ancienthart
Now THAT seriously needs to be made clearer in the documentation, including some examples. Also, how to use use_grobner because use_grobner=True don't work. Joal Heagney -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-sup

[sage-support] Re: Unable to Solve Simple Problem

2011-04-10 Thread ancienthart
Here's a one liner to filter the solutions. filter((lambda x: n(eq.subs(x).lhs()) == n(eq.subs(x).rhs())),solns) -- 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

[sage-support] Re: Unable to Solve Simple Problem

2011-04-10 Thread ancienthart
Here's a one-liner to filter the solutions: filter((lambda x: n(eq.subs(x).lhs()) == n(eq.subs(x).rhs())),solns -- 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 t

[sage-support] Re: Unable to Solve Simple Problem

2011-04-09 Thread ancienthart
Which is why I did the sanity checking in the last step. I admit n( ) on lhs() and rhs() is ugly, but I'm sure others could suggest ways to check for equality in an equation. On the other hand, you didn't mention in the original problem that x had to be in the reals. :D Joal Heagney -- To pos

Re: [sage-support] Unable to Solve Simple Problem

2011-04-09 Thread ancienthart
I think sage solving is based on maxima, and I've noticed that Maxima has always had this problem with non-linear equations. If you set it up as follows: eq = x == sqrt(1 + x) solns = solve(eq^2,x); solns You will get: [x == -1/2*sqrt(5) + 1/2, x == 1/2*sqrt(5) + 1/2] Of course, then you have

[sage-support] Re: Problem with solve and complex numbers: incorrect answer

2011-03-31 Thread ancienthart
Would it be possible to add a post-maxima check to ensure the answers are in the same domain as the inputs? Joal Heagney -- 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 option

[sage-support] Re: Substitute vectors into a symbolic equation

2011-03-26 Thread ancienthart
Drat. I have been playing around with things a little with this in mind. The best I can get, is to define a normal python function, with the s, v and k terms passed in as arguments, and have it return a vector of equations. Results are italic. var('t') def returneqn(v_t,v_0,k,s_0): return t*

[sage-support] Substitute vectors into a symbolic equation

2011-03-25 Thread ancienthart
Hi guys, back again. It seems that I can never find what I look for in the reference documents, but it always becomes embarrassingly easy once someone explains it to me. I've been playing around with the displacement reaction for viscous drag ballistics, and have derived the following equation:

[sage-support] Re: simplify_full on matrices.

2011-01-27 Thread ancienthart
Yeah, I spotted that after I posted my above post. Well, not spotted, more that I finally understood the line. The first time I read it, I didn't notice that the second lambda didn't have an x before the : Thanks, Joal Heagney -- To post to this group, send email to sage-support@googlegroups.

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-26 Thread ancienthart
Hah hah. This get's close to desirable behaviour in pure python. class Test: def __init__(self,seq): self.seq = seq def __repr__(self): return "Test(%s)" % self.seq def apply_map(self,function): newseq = map(function,self.seq) return Test(newseq) def

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-26 Thread ancienthart
Should have noted that this was for proposal one. I kinda prefer it to proposal two myself - will be almost invisible in use. Joal Heagney -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.co

Re: [sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-26 Thread ancienthart
Sorry, all the suggestions I've put below are for proposal one. Joal Heagney -- 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.c

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-26 Thread ancienthart
I'm relying on the fact that __getattr__ is only called if the attribute is missing from the matrix class. I was of the opinion that this would completely avoid raising an AttributeError in the first place. This (should?) mean that the currently defined simplify_ methods on the matrices will st

Re: [sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-25 Thread ancienthart
My current path of research involves giving the Matrix class a __getattr__ method with argument *missing_method*, that returns a callable object. The callable object then returns the matrix result of .apply_map(lambda x: getattr(x,*missing_method*)) Still having some fun ironing out the wrinkle

Re: [sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-24 Thread ancienthart
Eeeeggg. Working on it. I'm currently investigating using getters and setters to pull attributes from matrix or it's contents. My current idea looks something like this: def map(self, function): try: : http://groups.google.com/group/sage-support URL: ht

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-22 Thread ancienthart
This tip, which seems the most effective and least likely to blow up, has made it to the following blog. http://doxdrum.wordpress.com/2011/01/22/sage-tip-simplifying-a-matrix/ So is it possible that this could become an approach to matrices, either automagically, or by a smarter map function? P

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-22 Thread ancienthart
*sigh* Which is why I put the comment about how it was likely I'd missed something in the documentation. Nice to know that I'm at least right about that. :P Hmmm. My matrix is based on SR (Symbolic Ring), which doesn't have any simplify methods, which suggests my idea of exposing element method

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-21 Thread ancienthart
A possible approach for my proposed (mega) simplify method is outlined below. Since several objects have these defined as methods, would the following approach work? sage: D [-(e^3 + 2)/(e^3 - 1) + (2*e^3 + 1)/(e^3 - 1) 1] [ 2

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-21 Thread ancienthart
Since several objects have these defined as methods, would the following approach work? sage: D [-(e^3 + 2)/(e^3 - 1) + (2*e^3 + 1)/(e^3 - 1) 1] [ 2 0] I then defined the following function: def mysimplify(obj): try:

Re: [sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-19 Thread ancienthart
Attempting to use this on my matrix, I end up with the following results (D is my matrix): D.apply_map(simplify_full) Traceback (most recent call last): File "", line 1, in File "_sage_input_61.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n