Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
{def linearcomb
|
||||
{def linearcomb.r
|
||||
{lambda {:a :n :i}
|
||||
{if {= :i :n}
|
||||
then
|
||||
else {let { {:e e({+ :i 1})}
|
||||
{:v {abs {A.get :i :a}}}
|
||||
{:s {if {< {A.get :i :a} 0} then - else +}}
|
||||
} {if {= :v 0} then else
|
||||
{if {= :v 1} then :s :e else :s :v*:e}}}
|
||||
{linearcomb.r :a :n {+ :i 1}} }}}
|
||||
{lambda {:a}
|
||||
{S.replace _LAMB_[^\s]+ by 0 in
|
||||
{let { {:r {linearcomb.r {A.new :a} {S.length :a} 0}}
|
||||
} {if {W.equal? {S.first :r} +} then {S.rest :r} else :r} }}}}
|
||||
-> linearcomb
|
||||
|
||||
{linearcomb 1 2 3} -> e(1) + 2*e(2) + 3*e(3)
|
||||
{linearcomb -1 -2 0 -3} -> - e(1) - 2*e(2) - 3*e(4)
|
||||
{linearcomb 0 1 2 3} -> e(2) + 2*e(3) + 3*e(4)
|
||||
{linearcomb 1 0 3 4} -> e(1) + 3*e(3) + 4*e(4)
|
||||
{linearcomb 1 2 0} -> e(1) + 2*e(2)
|
||||
{linearcomb 0 0 0} -> 0
|
||||
{linearcomb 0} -> 0
|
||||
{linearcomb 1 1 1} -> e(1) + e(2) + e(3)
|
||||
{linearcomb -1 -1 -1} -> - e(1) - e(2) - e(3)
|
||||
{linearcomb -1} -> - e(1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue