#11549: Arithmetic with symbolic vectors always creates a new
FreeModuleElement_generic_dense
-------------------------+--------------------------------------------------
   Reporter:  jvkersch   |          Owner:  burcin                             
       Type:  defect     |         Status:  needs_work                         
   Priority:  major      |      Milestone:  sage-4.7.2                         
  Component:  symbolics  |       Keywords:  vector, symbolic, arithmetic       
Work_issues:             |       Upstream:  N/A                                
   Reviewer:  David Roe  |         Author:  Joris Vankerschaver, Jeroen Demeyer
     Merged:             |   Dependencies:                                     
-------------------------+--------------------------------------------------
Changes (by newvalueoldvalue):

  * status:  positive_review => needs_work
  * author:  => Joris Vankerschaver, Jeroen Demeyer


Old description:

> Arithmetic with symbolic vectors (addition, scalar multiplication)
> produces an instance of `FreeModuleElement_generic_dense` instead of a
> new symbolic vector:
>
> {{{
> sage: v = vector(SR, [1])
> sage: w = vector(SR, [x])
> sage: type(v)
> <class 'sage.modules.vector_symbolic_dense.Vector_symbolic_dense'>
> sage: type(w)
> <class 'sage.modules.vector_symbolic_dense.Vector_symbolic_dense'>
> sage: type(v + w)
> <type 'sage.modules.free_module_element.FreeModuleElement_generic_dense'>
> }}}
>
> As David Roe pointed out, the problem is due to the constructor in
> `FreeModuleElement_generic_dense` hard-coding the class, so that
> arithmetic operations with symbolic vectors ends up being a
> `FreeModuleElement_generic_dense` rather than an instance of
> `Vector_symbolic_dense`.
>
> See the discussion at https://groups.google.com/group/sage-
> devel/browse_thread/thread/b20559a111041c3b

New description:

 Arithmetic with symbolic vectors (addition, scalar multiplication)
 produces an instance of `FreeModuleElement_generic_dense` instead of a new
 symbolic vector:

 {{{
 sage: v = vector(SR, [1])
 sage: w = vector(SR, [x])
 sage: type(v)
 <class 'sage.modules.vector_symbolic_dense.Vector_symbolic_dense'>
 sage: type(w)
 <class 'sage.modules.vector_symbolic_dense.Vector_symbolic_dense'>
 sage: type(v + w)
 <type 'sage.modules.free_module_element.FreeModuleElement_generic_dense'>
 }}}

 As David Roe pointed out, the problem is due to the constructor in
 `FreeModuleElement_generic_dense` hard-coding the class, so that
 arithmetic operations with symbolic vectors ends up being a
 `FreeModuleElement_generic_dense` rather than an instance of
 `Vector_symbolic_dense`.

 See the discussion at https://groups.google.com/group/sage-
 devel/browse_thread/thread/b20559a111041c3b

 Apply [attachment:trac_11549_symbolic_vector_arithmetic.patch] and
 [attachment:11549_doc.patch]

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11549#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to