Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #9885 > unrolled thread
| Started by | Vladimir M <vladimir7523@gmail.com> |
|---|---|
| First post | 2012-04-30 08:44 +0000 |
| Last post | 2012-05-03 08:33 +0000 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Struggling to prove simple triangle inequality Vladimir M <vladimir7523@gmail.com> - 2012-04-30 08:44 +0000
Re: Struggling to prove simple triangle inequality danl@wolfram.com - 2012-05-01 19:00 +0000
Re: Struggling to prove simple triangle inequality Murray Eisenberg <murray@math.umass.edu> - 2012-05-02 09:46 +0000
Re: Struggling to prove simple triangle inequality Murray Eisenberg <murray@math.umass.edu> - 2012-05-03 08:33 +0000
| From | Vladimir M <vladimir7523@gmail.com> |
|---|---|
| Date | 2012-04-30 08:44 +0000 |
| Subject | Struggling to prove simple triangle inequality |
| Message-ID | <jnljcu$n5b$1@smc.vnet.net> |
Greetings!
Given two 3D vectors A and B, I want to prove that length of their sum
is less or equal than the sum of their lengths:
length[v_] := Sqrt[v.v];
a = {ax, ay, az};
b = {bx, by, bz};
inequality = length[a + b] <= length[a] + length[b];
This is famous, well-known and quite obvious: triangle side is shorter
than the sum of other sides, straight line is shorter than non-
straight, etc. However, proving it formally is hard.
This fails:
assum = Element[ax | ay | az | bx | by | bz, Reals];
FullSimplify[inequality, assum]
This takes ages on a high-end PC with unknown result:
vars = {ax, ay, az, bx, by, bz};
Reduce[inequality, vars, Reals]
Anyone can help? I think Reduce should somehow make it because it
actually succeeds at least with 2D vectors.
--
All the best,
Vladimir
[toc] | [next] | [standalone]
| From | danl@wolfram.com |
|---|---|
| Date | 2012-05-01 19:00 +0000 |
| Message-ID | <jnpbs9$aie$1@smc.vnet.net> |
| In reply to | #9885 |
On Monday, April 30, 2012 3:44:14 AM UTC-5, Vladimir M wrote:
> Greetings!
>
> Given two 3D vectors A and B, I want to prove that length of their sum
> is less or equal than the sum of their lengths:
>
> length[v_] := Sqrt[v.v];
> a = {ax, ay, az};
> b = {bx, by, bz};
> inequality = length[a + b] <= length[a] + length[b];
>
> This is famous, well-known and quite obvious: triangle side is shorter
> than the sum of other sides, straight line is shorter than non-
> straight, etc. However, proving it formally is hard.
>
> This fails:
>
> assum = Element[ax | ay | az | bx | by | bz, Reals];
> FullSimplify[inequality, assum]
>
>
> This takes ages on a high-end PC with unknown result:
>
> vars = {ax, ay, az, bx, by, bz};
> Reduce[inequality, vars, Reals]
>
> Anyone can help? I think Reduce should somehow make it because it
> actually succeeds at least with 2D vectors.
>
>
> --
> All the best,
> Vladimir
You can make it easier by squaring to remove many of the radicals.
In[305]:= length[v_] := Sqrt[v.v];
a = {ax, ay, az};
b = {bx, by, bz};
inequalityb = Expand[length[a + b]^2 - (length[a] + length[b])^2] <= 0;
vars = Variables[{a, b}];
Timing[Reduce[inequalityb, vars, Reals]]
Out[310]= {2.98, True}
Daniel Lichtblau
Wolfram Research
[toc] | [prev] | [next] | [standalone]
| From | Murray Eisenberg <murray@math.umass.edu> |
|---|---|
| Date | 2012-05-02 09:46 +0000 |
| Message-ID | <jnqvp3$j6n$1@smc.vnet.net> |
| In reply to | #9885 |
On my system (OS X), Timing[Reduce[inequalityb, vars, Reals]] gives
1.0295. But if you try instead to prove the Cauchy-Schwartz Inequality,
which is equivalent to the Triangle Inequality ...
Reduce[Abs[a.b]^2 <= (a.a) (b.b), Variables[{a, b}], Reals] // Timing
... the timing is 0.18544, which is 10-fold faster!
On 5/1/12 2:58 PM, danl@wolfram.com wrote:
> On Monday, April 30, 2012 3:44:14 AM UTC-5, Vladimir M wrote:
>>
>> ...Given two 3D vectors A and B, I want to prove that length of their sum
>> is less or equal than the sum of their lengths:
>>
>> length[v_] := Sqrt[v.v];
>> a = {ax, ay, az};
>> b = {bx, by, bz};
>> inequality = length[a + b]<= length[a] + length[b];
>>
>> This is famous, well-known and quite obvious: triangle side is shorter
>> than the sum of other sides, straight line is shorter than non-
>> straight, etc. However, proving it formally is hard....
>>
>> This takes ages on a high-end PC with unknown result:
>>
>> vars = {ax, ay, az, bx, by, bz};
>> Reduce[inequality, vars, Reals]
>>
>> Anyone can help? I think Reduce should somehow make it because it
>> actually succeeds at least with 2D vectors.
>
> You can make it easier by squaring to remove many of the radicals.
>
> In[305]:= length[v_] := Sqrt[v.v];
> a = {ax, ay, az};
> b = {bx, by, bz};
> inequalityb = Expand[length[a + b]^2 - (length[a] + length[b])^2]<= 0;
> vars = Variables[{a, b}];
> Timing[Reduce[inequalityb, vars, Reals]]
>
> Out[310]= {2.98, True}
--
Murray Eisenberg murray@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
[toc] | [prev] | [next] | [standalone]
| From | Murray Eisenberg <murray@math.umass.edu> |
|---|---|
| Date | 2012-05-03 08:33 +0000 |
| Message-ID | <jntftm$t89$1@smc.vnet.net> |
| In reply to | #9885 |
On my system (OS X), Timing[Reduce[inequalityb, vars, Reals]] gives
1.0295. But if you try instead to prove the Cauchy-Schwartz Inequality,
which is equivalent to the Triangle Inequality ...
Reduce[Abs[a.b]^2 <= (a.a) (b.b), Variables[{a, b}], Reals] // Timing
... the timing is 0.18544, which is 10-fold faster!
On 5/1/12 2:58 PM, danl@wolfram.com wrote:
> On Monday, April 30, 2012 3:44:14 AM UTC-5, Vladimir M wrote:
>>
>> ...Given two 3D vectors A and B, I want to prove that length of their sum
>> is less or equal than the sum of their lengths:
>>
>> length[v_] := Sqrt[v.v];
>> a = {ax, ay, az};
>> b = {bx, by, bz};
>> inequality = length[a + b]<= length[a] + length[b];
>>
>> This is famous, well-known and quite obvious: triangle side is shorter
>> than the sum of other sides, straight line is shorter than non-
>> straight, etc. However, proving it formally is hard....
>>
>> This takes ages on a high-end PC with unknown result:
>>
>> vars = {ax, ay, az, bx, by, bz};
>> Reduce[inequality, vars, Reals]
>>
>> Anyone can help? I think Reduce should somehow make it because it
>> actually succeeds at least with 2D vectors.
>
> You can make it easier by squaring to remove many of the radicals.
>
> In[305]:= length[v_] := Sqrt[v.v];
> a = {ax, ay, az};
> b = {bx, by, bz};
> inequalityb = Expand[length[a + b]^2 - (length[a] + length[b])^2]<= 0;
> vars = Variables[{a, b}];
> Timing[Reduce[inequalityb, vars, Reals]]
>
> Out[310]= {2.98, True}
--
Murray Eisenberg murray@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web