I tried both attempts, but unfortunately both fail:
the first one (using the denominator function) leads to this error:
/TypeError: lcm function not defined for elements of the base ring/
Does this happen, because i have variables in my term?
In this case i would be enough to get a * b as result of lcm(a,b) for
the variable a,b, even if they are not coprime.

and the second one (using QQ.content) to this:
TypeError: Unable to coerce (-b*c/((1/b - 1)*b*c - 1) + c/((1/b - 1)*b*c
- 1) - 1/((1/b - 1)*b*c - 1) - 1) (<type
'sage.modules.free_module_element.FreeModuleElement_generic_dense'>) to
Rational
This sounds comprehensible, because there are some Elements, wich are
not in ZZ because they are variables, even if i allow them just to be
from ZZ. But i don't know where or how i can add this condition. Father
more, I dont know in how far this condition would help

greatz Johannes

Am 27.09.2010 21:16, schrieb Johannes:
> thnx, luis,
> thats nearly what I'm looking for, but i missed something in my first post.
> in my fractions i work with some variable (with are all integer, that's
> why I missed this in the beginning)
> I'd like to have something like this:
>
> a,b = var('a,b')
> v = vector([2/a, 1/ab])
> and with the results:
> vector_of_nums = (2b,1)
> common_denom = ab
>
> but I've to test if this is possible with you or yanns solution.
>
> Johannes
>
> Am 27.09.2010 17:53, schrieb luisfe:
>   
>> On Sep 27, 3:34 pm, Johannes <dajo.m...@web.de> wrote:
>>   
>>     
>>> Hi list,
>>> is there a way to get a sum of fraction to a common devisor? or even
>>> better into a product of a fraction like \frac{1}{something here} and a
>>> sum of integers?
>>> and my next step would be this, i dont have a single value, which i want
>>> to get as the above produkt, but i've got a vector for wich i want to
>>> write as produkt of a skalar times an integervektor.
>>> how can i do this?
>>>
>>> greatz Johannes
>>>     
>>>       
>> Hi,
>>
>> Is this what you want?
>>
>> sage: v = vector([2/3,1/4,0])
>> sage: common_denom = denominator(v)
>> sage: common_denom
>> 12
>> sage: vector_of_nums = v * common_denom
>> sage: vector_of_nums
>> (8, 3, 0)
>>
>> note that here, internally, vector of nums is a vector with rational
>> entries. If you want a vector of sage integers you could do
>>
>> sage: vector_of_nums = vector_of_nums.change_ring(ZZ)
>>
>> And you will have a vector with Integer entries, if you need this last
>> command or not depends on what do you want to do with your vector.
>>
>> Luis
>>
>>   
>>     
>   

-- 
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://www.sagemath.org

Reply via email to