Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How can I get better solution for this...?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120058] Re: How can I get better solution for this...?
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Thu, 7 Jul 2011 07:31:06 -0400 (EDT)
  • References: <201107060939.FAA29377@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

The distinction between parameters and variables is a matter of intention  
or context. Either way, they are not constants unless you know their  
values (or can compute them).

We already told Solve to find sx, sy, gx, and gy IN TERMS OF the other  
symbols... but it can't, and I showed why it cannot.

Some progress can be made, in that exactly two d values are allowable for  
each {p00, p01, p11} combination.

(I'm assuming positive reals, below.)

soln = Quiet@
    Solve[{sx^2 (1 + gx gy)^2 + sx^2 gy^2 == p00,
      sx sy gx (1 + gx gy) + sx sy gy == p01,
      sy^2 (1 + gx^2) == p11}, {sx, sy, gx, gy}];
allowable =
   d /. Solve[sx sy == d, d] /. soln // Simplify // PowerExpand //
     Flatten // Union;
allowable = Simplify[allowableD, Thread[{p00, p01, p11} > 0]]
Plus @@ %

{Sqrt[-p01^2 + p00 p11], -Sqrt[-p01^2 + p00 p11]}

0

They always add to zero, so we can concentrate on the first solution.

allowable = First@allowable

Sqrt[-p01^2 + p00 p11]

Here are d values in a few example cases:

allowable /. Thread[{p00, p01, p11} -> Range@3]

I

allowable /. Thread[{p00, p01, p11} -> x + {0, 1, 2}] // Simplify

I

allowable /. Thread[{p00, p01, p11} -> x + {2, 5, 3}] // Simplify

Sqrt[-19 - 5 x]

allowable /. Thread[{p00, p01, p11} -> RandomInteger[10, 3]]

0

allowable /. Thread[{p00, p01, p11} -> RandomInteger[10, 3]]

I Sqrt[51]

Et cetera. Maybe you have a physical interpretation of Sqrt[-p01^2 + p00  
p11] that gets you farther.

Bobby

On Wed, 06 Jul 2011 13:28:06 -0500, Siddharth Srivastava  
<siddys at gmail.com> wrote:

> Hi Bobby,
>      The P matrix and D are constants, the values of which I will know at
> the time of the evaluation. Maybe
> the mistake I made was in not "somehow" specifying that the elements of P
> and D itself are constants?
> How is this fact specified in Mathematica? i.e, for a given P and D,  
> solve
> for sx, sy, gx and gy..... In light of this,
> maybe, new information, would you be kind enough to re-evaluate the  
> problem?
> Or if you can let me know,
> I can try it myself....
> Thanks again for all your help, and time
> #
>
> On Wed, Jul 6, 2011 at 11:18 AM, DrMajorBob <btreat1 at austin.rr.com>  
> wrote:
>
>> Someone else may have more insight into "the decomposition of an Affine
>> transformation matrix into scale (sx sy) and shear (gx gy) components",  
>> but
>> there IS no alternative way to solve that system of equations, nor any
>> system equivalent to it, with d and the p parameters variable.
>>
>> Bobby
>>
>>
>> On Wed, 06 Jul 2011 13:05:39 -0500, Siddharth Srivastava  
>> <siddys at gmail.com>
>> wrote:
>>
>>  Hi Bobby,
>>>     Thanks for the quick reply. What I am trying to do is to get an
>>> analytical form for
>>> the decomposition of an Affine transformation matrix into scale (sx sy)
>>> and
>>> shear
>>> (gx gy) components. Maybe if you have an alternative way to get this,  
>>> that
>>> would
>>> be helpful too...
>>> Thanks,
>>> #
>>>
>>> On Wed, Jul 6, 2011 at 10:36 AM, DrMajorBob <btreat1 at austin.rr.com>
>>> wrote:
>>>
>>>  Ah yes... I misread your post in the heat of the moment.
>>>>
>>>> The first three equations determine sy, gx, and gy in terms of p00,  
>>>> p01,
>>>> p11, and sx:
>>>>
>>>> soln = Quiet@
>>>>
>>>>  Solve[{sx^2 (1 + gx gy)^2 + sx^2 gy^2 == p00,
>>>>    sx sy gx (1 + gx gy) + sx sy gy == p01,
>>>>    sy^2 (1 + gx^2) == p11}, {sx, sy, gx, gy}];
>>>> soln[[All, All, 1]]
>>>>
>>>> {{sy, gx, gy}, {sy, gx, gy}, {sy, gx, gy}, {sy, gx, gy}}
>>>>
>>>> giving four solutions. If the fourth equation is also true, each of  
>>>> these
>>>> solutions determines a value for d:
>>>>
>>>> Solve[sx sy == d, d] /. soln
>>>>
>>>> (four solutions)
>>>>
>>>> Hence, your four equations have no solution with d free to vary.
>>>>
>>>>
>>>> Solve[{sx^2 (1 + gx gy)^2 + sx^2 gy^2 == p00,
>>>>  sx sy gx (1 + gx gy) + sx sy gy == p01, sy^2 (1 + gx^2) == p11,
>>>>  sx sy == d}, {gx}]
>>>>
>>>> {}
>>>>
>>>> Bobby
>>>>
>>>>
>>>> On Wed, 06 Jul 2011 11:50:17 -0500, Siddharth Srivastava <
>>>> siddys at gmail.com>
>>>> wrote:
>>>>
>>>>  Hi Bobby,
>>>>
>>>>>   Thanks. I actually wanted sx, sy, gx and gy in terms of the P  
>>>>> coeff.
>>>>> The
>>>>> solution
>>>>> you gave is just the equation that I wanted to solve!
>>>>> #
>>>>>
>>>>> On Wed, Jul 6, 2011 at 9:18 AM, DrMajorBob <btreat1 at austin.rr.com>
>>>>> wrote:
>>>>>
>>>>>  Solve[{sx^2 (1 + gx gy)^2 + sx^2 gy^2 == p00,
>>>>>
>>>>>>  sx sy gx (1 + gx gy) + sx sy gy == p01, sy^2 (1 + gx^2) == p11,
>>>>>>  sx sy == d}, {p00, p01, p11, d}]
>>>>>>
>>>>>> {{p00 -> sx^2 + 2 gx gy sx^2 + gy^2 sx^2 + gx^2 gy^2 sx^2,
>>>>>>  p01 -> gx sx sy + gy sx sy + gx^2 gy sx sy, p11 -> (1 + gx^2) sy^2,
>>>>>>  d -> sx sy}}
>>>>>>
>>>>>> Bobby
>>>>>>
>>>>>> On Wed, 06 Jul 2011 04:39:55 -0500, sid <siddys at gmail.com> wrote:
>>>>>>
>>>>>>  Hi all,
>>>>>>
>>>>>>   I am trying to solve the following for {sx,sy,gx,gy}
>>>>>>>
>>>>>>>   sx^2 (1 + gx gy)^2 + sx^2 gy^2 = P00 ........(1)
>>>>>>>   sx sy gx (1 + gx gy) + sx sy gy = P01 .......(2)
>>>>>>>   sy^2 ( 1 + gx^2) = P11 ..............................******.(3)
>>>>>>>   sx sy  = D ..............................**
>>>>>>> ****..................(4)
>>>>>>>
>>>>>>> in terms of P00,P01,P11, and D.
>>>>>>>
>>>>>>> When I use Solve[] , I get a huge output containing the P terms up
>>>>>>> till the order of 16 (i.e P00^16 etc..), which
>>>>>>> I know is not correct. I do not think I am specifying the problem
>>>>>>> correctly, and being a non-expert in Mathematica, would appreciate
>>>>>>> some help. Specifically
>>>>>>> 1) should I specify the simultaneous equation using && operator? I
>>>>>>> have tried it, and I get different (but huge) output
>>>>>>> 2) can I break the problem into parts? how?
>>>>>>> Thanks,
>>>>>>> s.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>  --
>>>>>> DrMajorBob at yahoo.com
>>>>>>
>>>>>>
>>>>>>
>>>> --
>>>> DrMajorBob at yahoo.com
>>>>
>>>>
>>
>> --
>> DrMajorBob at yahoo.com
>>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: How to write a "proper" math document
  • Next by Date: Re: Numerical accuracy/precision - this is a bug or a feature?
  • Previous by thread: Re: How can I get better solution for this...?
  • Next by thread: R: Symbolic replacement of scalar products