﻿ doubly stochastic matrix debug doubly stochastic matrix debug Update 2017-07-27

this file is dbstochn.htm , not dbstochm.htm
dbstochn.htm open all debug print ; dbstochn.htm has error output
dbstochm.htm close all debug print ; dbstochm.htm NO error output
dbstochn.htm has error-on-purpose buttons
1/686 = 0.0014577259475218658 code return 2/686 error-on-purpose !

If click and get infinite loop . ill one example has
α=[2.5, 2.4, 1.5, 1.5, 0.1] , β=[3.0, 2.6, 1.2, 1.0, 0.2]
2.5+2.4+1.5+1.5 > 3.0+2.6+1.2+1.0 an error-on-purpose

decimal to fraction calculator decimalFraction ; Unicode
doubly stochastic matrix program code follow next textbook.
The Cauchy-Schwarz Master Class   J. Michael Steele   ★★★★★ ;
This file is personal home work. No one proofread. Cannot promise correctness.
If you suspect any view point wrong, please ask a math expert near by.
Freeman 2009-06-19-10-46
Please use MSIE browser to read this file.
Example ;
jkCheck2(): ,, ; ill ,,
α more average and β more diverse both descending order
 α seq. α more average α=dsm*β OK 0.688... β seq. β more diverse β=dsm*α NO decimal
RUN 11 ☞ , output 0.9333333333333332
Box11 output doubly stochastic Matrix ; , ,

Box12 doubly stochastic Matrix HTML table ; ;

RUN 11 ☞ a606281529 2nd button ; ≺ ≻ ≼ ≽ ≾ ≿ ⊀ ⊁ more
Box13 ; Ⅱ doublStochMat() ; verify

Box14 ; Ⅲ jkCheck2() ; Ⅳ robinMatrixf()

Box15 Ⅴ function matMVecf() , Ⅵ function permutef() run [t69 Debug] & [i1] infinite loop !
Box15 debug ; Dbg 18 ☞ output to box11

Box16 debug ; Ⅶ function s2a() string2Array

QBboxc16.value='' ;
2017-06-28-16-51 &#8544;＝Ⅰ;&#8545;＝Ⅱ;&#8546;＝Ⅲ;&#8547;＝Ⅳ;&#8548;＝Ⅴ;
&#8549;＝Ⅵ;&#8550;＝Ⅶ;&#8551;＝Ⅷ;&#8552;＝Ⅸ;&#8553;＝Ⅹ;&#8554;＝Ⅺ;&#8555;＝Ⅻ

<a name=UnicodeSymbol>
UnicodeSymbol : ℂ ℍ ℕ ℙ ℚ ℝ ℤ ℽ ℾ ℿ ⅀ ⅅ ⅆ ⅇ ⅈ ⅉ ; × ÷ ° ◦ º ¹ ² ³
≦ ≠ ≧ ＜ ＝ ＞ ± ≡ ≈ ≌ ≒ ∏ ∑ √ ∛ ∜ ∝ → ∞ ∈ ∀ ∂ ⊥ ∃ ∋ ∆ ∇ ⊿ ∟ ∠ ∫ ∬ ∭ ∮ ∥
≺ ≻ ≼ ≽ ≾ ≿ ⊀ ⊁ ≭ ≮ ≯ ≰ ≱ ≲ ≳ ≴ ≵ ≶ ≷ ≸ ≹ ∧ ∨ ∩ ∪ ∴ ∵ ∶ ∷ ⊂ ⊃ ⊄ ⊅ ⊆ ⊇
Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ ΢ Σ Τ Υ Φ Χ Ψ Ω , ＋ － ＊ ／
α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ ς σ τ υ φ χ ψ ω
2017-06-20-20-44 Liu,Hsinhan access en.wikipedia.org
https://en.wikipedia.org/wiki/List_of_mathematical_symbols
en.wikipedia.org-wiki-List_of_mathematical_symbols.htm
∧,⇒,−,∖,√,≥,≤,∓,⋅,⁄,⇔,∈,ℤ,ℝ,φ,π,∑,∫, ,∮,∯,∰,…,⋯,⋮,⋰,⋱,∴,∵,≠
˜ ,∝,∞,■,□,∎,▮,‣,≈,≃,≅,♎,≒,△,≡,≜,≝,≐,↔,≪,≫,≦,≧,≺,≻,◅,▻,→,⊃,⊆
⊂,∩,ℕ,ℚ,⊇,∪,↦,•,⊧,∨,⊢,⟨,⟩,ψ,α,β,–,‖,⌊,⌉,⌋,⌈,ℂ,∗,∣,∤,∥,∦,⋕,⊥
∃,≀,↯,※,⇐,⊕,⊻,∐,′,∀,∂,∉,∌,∋,ℍ,ω,○,∘,∅,ℙ,†,⊤,—,⊗,⋉,⋊,⋈,​,ℵ,ℶ
δ,∆,⊖,Δ,ƒ,∇,∏,σ,

```
<a name="docN001">
2017-07-09-15-15
This is slower dbstochn.htm all debug active
not the faster dbstochm.htm all debug inactive.
http://freeman2.com/dbstochm.htm

dbstochn.htm print debug value for writing
doubly stochastic matrix study notes
http://freeman2.com/tute0069.htm

<a name="docN002">
2017-07-09-10-46 in dbstochn.htm
rearrange debug value output label and output box
old debug summary      vs  new debug summary
[[
Box12 Ⅱ doublStochMat()   ☼ Box13 Ⅱ doublStochMat()
Box14 Ⅴ jkCheck2()        ☼ Box14 Ⅲ jkCheck2()
Box15 Ⅳ robinMatrixf()    ☼ Box14 Ⅳ robinMatrixf()
Box15 Ⅵ matMVecf()        ☼ Box15 Ⅴ matMVecf()
Box15 Ⅴ s2a()             ☼ Box15 Ⅵ permutef()
QHboxb14.value=dbg0 s2a()Ⅴ☼ Box16 Ⅶ s2a()
Box13 Ⅲ permutef()        ☼ Box16 Ⅶ s2a() QHboxb14.value=dbg0
]]
2017-07-09-15-26

<a name="docN003">
2017-07-16-12-25
Update 2017-07-16 re-use two error code found
earlier. They are
error code
n0=parseInt(i0*aa+addone); //a606181808 +addone
//above line error on purpose 2017-07-16-11-15
Why a606181808 code is error for 1/686 case?
User input aa=0.0014577259475218658 = 1/686
when i0 iterate to i0=686 , i0*aa =0.99999999999999999999
if parseInt(0.99999999999999999999) drop all
digits right to '.' and return 0, in this case
addone=1, parseInt(i0*aa+addone)=
parseInt(0.99999999999999999999+1) return 1 correct.

<a name="docN004">
But function parseInt() has different behavior
parseInt(1.9999999999999997)=1
parseInt(1.99999999999999997)=2
This is a surprise to Liu,Hsinhan
Blue (first) line case need addone=1 to get right asnwer.
Red (second) line case need addone=0 to get right asnwer.

<a name="docN005">
//next new code lines return '1/686'
//A  n1=bb.indexOf('.'); //a607121258
//B  if(n1>=0) n2=bb.substring(0,n1);
//C  else n2=bb; //a607121319 if() else
//D  n0=parseInt(n2)+addone; //a607121259
Line '//A' n1 locate '.' in 1.9999999999999997
Line '//B' if find '.' let n2='1',
drop '.9999999999999997'
Line '//C' if not find '.' let n2='1',
whole string is '1', nothing to drop.
Line '//D' use function parseInt() change
string '1' to integer 1 then +addone
In this case parseInt() never see '.99999'
then parseInt() behavior is predictable.

dbstochn.htm ignore correct code on purpose

<a name="docN006">
Second error code 're-used' is actually drop
a correct code on purpose.

one example is
α sequence = [ 10, 7, 6, 5, 2 ] ---eqn.BX001
β sequence = [ 12,10, 5, 2, 1 ] ---eqn.BX002

α seq. and β seq. have inequality relation
α[1] ≦ β[1] ---eqn.BX010
α[1]+α[2] ≦ β[1]+β[2] ---eqn.BX011
.....
α[1]+α[2]+α[3]+...+α[n-1] ≦ β[1]+β[2]+β[3]+...+β[n-1] ---eqn.BX012
α[1]+α[2]+α[3]+...+α[n] = β[1]+β[2]+β[3]+...+β[n] ---eqn.BX013
If above condition violated, program should discard
ill α, discard ill β . Correct handling is return .
Wrong handling is break from for() loop continue
the following code.

<a name="docN007">
in function    doublStochMat(aStr, bStr) KEEP   code
in function t69doublStochMat(aStr, bStr) delete code
delete code is next
for(i0=0;i0<alfa.length;i0++)
{
asum+=alfa[i0];
bsum+=beta[i0];

//if(asum>bsum)
//a606162054
if((asum-bsum)>1.0e-10)
{
QBboxc13.value+='[t69 Debug] error on purpose, see what happen. a607160927 \n'
+'t69doublStochMat() error 07. α, β not in majoring order.//a607160929 \n'
+'Alpha sequence=['+aStr+'] first '+(i0+1)+' sum to '+asum+'.\n'
+' Beta sequence=['+bStr+'] first '+(i0+1)+' sum to '+bsum+'.\n'
+'Correct data should be Beta sum >= Alpha sum. Now reverse.\n'
break; //Wrong handling
}
//..... other code
} //for(i0=0;i0<alfa.length;i0++)

<a name="docN008">
If click  and  get infinite loop .
This ill condition is produced on purpose, Let
LiuHH see what happen if violate eqn.BX012.
Reader should download healthy files
http://freeman2.com/dbstochm.htm
http://freeman2.com/dec2frac.htm
If reader do not study eqn.BX012 violation
then do not touch
http://freeman2.com/dbstochn.htm
Liu,Hsinhan 2017-07-16-13-07

<a name=docN009>
2017-07-27-18-10
Update 2017-07-27 change function bye09() error.
error code line change to new a607211645 line.
//if(nine0<0)nine0--; // negative integer minus one
if(in09<0)nine0--; //a607211645
After correction, program change -0.99999999999
to -1 . (Error code change to +1)
2017-07-27-18-13

[=][][]```

Javascript index
http://freeman2.com/jsindex2.htm   local
Save graph code to same folder as htm files.
http://freeman2.com/jsgraph2.js   local

doubly stochastic matrix : 雙隨機(矩)陣 //a606131521

Majorization transformation between two sequences.
http://freeman2.com/jsmajor2.htm
First Upload 2010-06-29

doubly stochastic matrix calculator
http://freeman2.com/dbstochm.htm
dbstochm.htm first upload 2017-06-13
(related material see tute0047.htm)

decimal to fraction calculator
http://freeman2.com/dec2frac.htm
dec2frac.htm First Upload 2017-06-24

doubly stochastic matrix debug, very slow , all debug active
for writing doubly stochastic matrix study notes tute0069.htm
This debug page
http://freeman2.com/dbstochn.htm
dbstochn.htm first upload 2017-07-12

Thank you for visiting Freeman's page.
Freeman Liu,HsinHan 劉鑫漢 2017-07-09-15-02

2017-06-27-21-05 copy dbstochm.htm dbstochn.htm