Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » sci.math.* » sci.math.symbolic.independent

Topic: Another question about Factor
Replies: 13   Last Post: Nov 23, 2012 6:11 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Peter Pein

Posts: 1,147
Registered: 5/4/05
Re: Another question about Factor
Posted: Nov 23, 2012 7:29 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Am 23.11.2012 05:28, schrieb Tang Laoya:
> On Friday, November 23, 2012 9:35:01 AM UTC+8, Nasser M. Abbasi wrote:
>> On 11/22/2012 7:10 PM, Tang Laoya wrote:
>>
>>
>>

>>>
>>
>>> k11 = 1/60 (b1^2 + c1^2 + d1^2)
>>
>>> k11 = HornerForm[k11]
>>
>>>
>>
>>> The outputs are:
>>
>>> 1/60 (b1^2 + c1^2 + d1^2)
>>
>>> b1^2/60 + c1^2/60 + d1^2/60
>>
>>>
>>
>>> respectively.
>>
>>>
>>
>>> How to do to let the numbers are also been combined?
>>
>>>
>>
>>
>>
>>
>>
>> In[25]:= Simplify[k11]
>>
>> Out[25]= 1/60 (b1^2+c1^2+d1^2)

>
> Dear Nasser,
>
> Thank you very much for your kindly reply. What I mean is that 'Simplify' conflicts with 'HornerForm'. I wish both variables and numbers be combined, which could lead to smallest number of floating operations.
>
> Thanks,
> Tang Laoya
>


Hi!

I do not see a (very) simple approach, but the following seems to work:

In[1]:= vv =
Det[{{1, 1, 1, 1}, {x1, x2, x3, x4}, {y1, y2, y3, y4}, {z1, z2, z3,
z4}}];

In[2]:= hf = HornerForm[vv/60, Sort[Variables[vv]]]

Out[2]= x4*(y3*(z1/60 - z2/60) + y1*(z2/60 - z3/60) +
y2*(-(z1/60) + z3/60)) +
x2*(y4*(z1/60 - z3/60) + y1*(z3/60 - z4/60) +
y3*(-(z1/60) + z4/60)) +
x3*(y4*(-(z1/60) + z2/60) + y2*(z1/60 - z4/60) +
y1*(-(z2/60) + z4/60)) +
x1*(y4*(-(z2/60) + z3/60) + y3*(z2/60 - z4/60) +
y2*(-(z3/60) + z4/60))

In[3]:= hf //. (a_.)*(x_) + (b_.)*(y_) /;
Abs[a] == Abs[b] && a^2 != 1 :>
Block[{aa = Abs[a]}, aa*((a*x)/aa + (b*y)/aa)]

Out[3]= (1/60)*(x4*(y3*(z1 - z2) + y1*(z2 - z3) + y2*(-z1 + z3)) +
x2*(y4*(z1 - z3) + y1*(z3 - z4) + y3*(-z1 + z4)) +
x3*(y4*(-z1 + z2) + y2*(z1 - z4) + y1*(-z2 + z4)) +
x1*(y4*(-z2 + z3) + y3*(z2 - z4) + y2*(-z3 + z4)))

HTH,
Peter



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.