Robert Bradshaw wrote:
> On Aug 22, 2009, at 3:13 AM, Mani chandra wrote:
>
>   
>> Mani chandra wrote:
>>     
>>> Hi,
>>>
>>>     How does one define a variable in sage and make sure the it's
>>> conjugate is the same as the variable itself?
>>>
>>> Thanks,
>>> Mani chandra
>>>
>>>       
>>>       
>> Hi,
>>
>>     Perhaps I wasn't specific.
>>
>> sage: var('a')
>> sage: a.conjugate()
>> conjugate(a)
>>
>> What I want is for SAGE to return a, instead of conjugate(a). Does  
>> "var"
>> take any arguments that forces a variable to be real?
>>     
>
> You have to invoke simplify for it to look at assumptions.
>
> sage: var('a')
> sage: assume(a, 'real')
> sage: a.conjugate().simplify()
> a
>
> - Robert
>
>
> >
>
>   
There seems to be something wrong with this implementation:
sage: var('a, b')
(a, b)
sage: assume(a, 'real')
sage: assume(b, 'real')
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/mc/<ipython console> in <module>()

/opt/sage/sage/local/lib/python2.6/site-packages/sage/symbolic/assumptions.pyc 
in assume(*args)
    194         else:
    195             try:
--> 196                 x.assume()
    197             except KeyError:
    198                 raise TypeError, "assume not defined for objects 
of type '%s'"%type(x)

/opt/sage/sage/local/lib/python2.6/site-packages/sage/symbolic/assumptions.pyc 
in assume(self)
     96             maxima.set("context", cur)
     97            
---> 98         if not self in _assumptions:
     99             maxima.activate(self._context)
    100             _assumptions.append(self)

/opt/sage/sage/local/lib/python2.6/site-packages/sage/symbolic/assumptions.pyc 
in __cmp__(self, other)
     70         if isinstance(self, GenericDeclaration) and 
isinstance(other, GenericDeclaration):
     71             return cmp( (self._var, self._assumption),
---> 72                         (other._var, other._assumption) )
     73         else:
     74             return cmp(type(self), type(other))

/opt/sage/sage/local/lib/python2.6/site-packages/sage/symbolic/expression.so 
in sage.symbolic.expression.Expression.__nonzero__ 
(sage/symbolic/expression.cpp:7506)()

AttributeError: 'GenericDeclaration' object has no attribute 'variables'


Looks like it can define only one variable in the namespace as real. 
This is pretty strange.

--Mani chandra

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to