On Oct 13, 2009, at 1:24 PM, lutusp wrote:

> I'm aware there has been some discussion of this issue in the past,
> but I would like to renew it. I understand that canonical DE notation
> isn't on everyone's short list of high priorities, but I think
> students and those with little Sage exposure would appreciate the
> ability to enter a textbook equation with few changes.
>
> It would be great to see this user entry:
>
> y'(x) + y - 1
>
> Automatically become this Sage syntax:
>
> diff(y,x) + y - 1
>
> And I wrote this simple Python code to do it:
>
> import de
>
> def parsediffeq(s):
>  """
>  Convert differential equation syntax
>  from standard to Sage:
>       y'(x) -> y.diff(x,1)
>      y''(x) -> y.diff(x,2)
>      etc.
>  """
>  for n in range(1,6):
>    ds = "'" * n
>    s = re.sub("(\w+)%s\((\w+)\)" % ds,"\\1.diff(\\2,%d)" % n,s)
>  return s
>
> The conversion is not very difficult, and it would make working with
> DEs a great deal easier, especially for those unfamiliar with Sage  
> and/
> or who want to solve published problems expressed in canonical DE
> notation.
>
> Does this issue have any traction? I sometimes read posts from people
> who won't use Sage for lack of this syntax (perhaps not many).

I agree that this notation is nice. One issue with this approach is  
that the single quote is already used in Python. For example,

sage: u'(x) + y'
  u'(x) + y'

sage: type(_)
  <type 'unicode'>

sage: r'''(t)'''
  '(t)'

How would one distinguish between the uses?

- Robert


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to