Hi Laurent, Thank you for your answer. I am trying to understand your code (I started to use sage just yesterday, so it can be a problem for me). The first 2 lines looks like you want to execute the commands in as a shell script. This assumptions is also supported by by a fact that I have to make the with the code executable. Is my assumption correct.
Next, you write that sage is just a Python module. I guess it means that I can run sage code like a python code (if I connect the module in a appropriate way). I assume that the module can be connected by the following line: from sage.all import * But because of some reason it does not work. I create a file called "test.py". I put there just one line "from sage.all import *" and then I execute this code as a Python program "python test.py". Then I get the following: File "test.py", line 1, in <module> from sage.all import * ImportError: No module named sage.all Anyway, if I do not try to guess and just use the code given by you in a described (by you) way I get the following: bash: ./test.sh: /usr/bin/sage: bad interpreter: No such file or directory For mode details, I put the code in "test.sh". I make this file executable "chmod +x test.sh". Then I run it in the shell command line "./test.sh". On May 29, 7:33 am, Laurent <moky.m...@gmail.com> wrote: > Sage is a python module. > > The following is an example which defines a class from which you can > manipulate functions : > > ------------------------------------------------- > > #! /usr/bin/sage -python > # -*- coding: utf8 -*- > > from sage.all import * > > class MaClasse(object): > def __init__(self,exp): > self.sage = exp > self.sageFast = self.sage._fast_float_(x) > def Derr(self): > return MaClasse(self.sage.derivative()) > def Evaluation(self,xe): > return numerical_approx(self.sageFast(xe)) > > var('x,y') > f = MaClasse(x**2+2) > > print f.Derr().sage > print f.Derr().Evaluation(3) > print f.Evaluation(8) > > -------------------------------------- > > Copy-paste it in a text file, make it executable, and enjoy ! > > Laurent --~--~---------~--~----~------------~-------~--~----~ 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 URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---