No BSD License
-
bern(n)
Bern Bernoulli number
-
betad(z)
BETAD Dirichlet Beta function
-
binomial(n,d)
BINOMIAL calculate the binomial coefficient
-
deta(z,k)
DETA Calculates Dirichlet functions of the form
-
erfz(zz)
ERFZ Error function for complex inputs
-
eta(z)
ETA Dirichlet Eta function
-
euler(n)
Euler Euler number
-
eulergamma
Euler-Mascheroni constant = -Psi(1) = 0.5772156649015328606...
-
fact(n)
FACT Vectorized Factorial function
-
factd(n)
FACTD Double Factorial function = n!!
-
gamma(z)
GAMMA Gamma function valid in the entire complex plane.
-
gammaln(z)
GAMMALOG Natural Log of the Gamma function valid in the entire complex plane.
-
genocchi(z)
Genocchi number
-
harm(z)
Harm Harmonic sum function valid in the entire (complex) plane.
-
lambda(z)
LAMBDA Dirichlet Lambda function
-
poch(z,n)
-
psi(z)
Psi Psi (or Digamma) function valid in the entire complex plane.
-
psin(n,z)
Psin Arbitrary order Polygamma function valid in the entire complex plane.
-
totient(n)
TOTIENT calculates the totient function (also
-
zeta(z)
ZETA Riemann Zeta function
-
View all files
from
Special Functions math library
by Paul Godfrey
Collection of Special Functions programs.
|
| euler(n) |
function [bb] = euler(n)
%Euler Euler number
% f = Euler(n) returns the nth Euler number(s)
% Euler(n)=0 for all odd n
%
% An asymptotic 3 term recurrence relationship is:
%
% ( 2*E(n) E(n-2) 32 )
% E(n+2) ~= E(n)*( ------ - ------ - -----)
% ( E(n-2) E(n-4) pi*pi)
%
%
% The first 186 Euler numbers generated by this
% function are exact, values for n>186 will probably
% be larger than REALMAX for your machine.
% Use the above reccurence relationship for n>186
%
% n can be any size
%
% Usage: f = Euler(n)
%
% Tested under version 5.3.1
%
%see also BERN
%Paul Godfrey
%pgodfrey@conexant.com
%June13, 2000
nmax=188;
[r c]=size(n);
n=n(:);
siz=max(nmax,r*c);
e=zeros(siz+1,1);
e(1) =1;
e(3) =-1;
e(5) =5;
e(7) =-61;
e(9) =1385;
e(11) =-50521;
e(13) =2702765;
e(15) =-199360981;
e(17) =19391512145;
e(19) =-2404879675441;
e(21) =370371188237525;
e(23) =-69348874393137901;
e(25) =15514534163557086905;
e(27) =-4087072509293123892361;
e(29) =1252259641403629865468285;
e(31) =-441543893249023104553682821;
e(33) =177519391579539289436664789665;
e(35) =-80723299235887898062168247453281;
e(37) =41222060339517702122347079671259045;
e(39) =-23489580527043108252017828576198947741;
e(41) =14851150718114980017877156781405826684425;
e(43) =-10364622733519612119397957304745185976310201;
e(45) =7947579422597592703608040510088070619519273805;
e(47) =-6667537516685544977435028474773748197524107684661;
e(49) =6096278645568542158691685742876843153976539044435185;
e(51) =-6053285248188621896314383785111649088103498225146815121;
e(53) =6506162486684608847715870634080822983483644236765385576565;
e(55) =-7546659939008739098061432565889736744212240024711699858645581;
e(57) =9420321896420241204202286237690583227209388852599646009394905945;
e(59) =-12622019251806218719903409237287489255482341061191825594069964920041;
e(61) =18108911496579230496545807741652158688733487349236314106008095454231325;
e(63) =-27757101702071580597366980908371527449233019594800917578033782766889782501;
e(65) =45358103330017889174746887871567762366351861519470368881468843837919695760705;
e(67) =-78862842066617894181007207422399904239478162972003768932709757494857167945376961;
e(69) =145618443801396315007150470094942326661860812858314932986447697768064595488862902085;
e(71) =-285051783223697718732198729556739339504255241778255239879353211106980427546235397447421;
e(73) =590574720777544365455135032296439571372033016181822954929765972153659805050264501891063465;
e(75) =-1292973664187864170497603235938698754076170519123672606411370597343787035331808195731850937881;
e(77) =2986928183284576950930743652217140605692922369370680702813812833466898038172015655808960288452845;
e(79) =-7270601714016864143803280651699281851647234288049207905108309583687335688017641546191095009395592341;
e(81) =18622915758412697044482492303043126011920010194518556063577101095681956123546201442832293837005396878225;
e(83) =-50131049408109796612908693678881009420083336722220539765973596236561571401154699761552253189084809951554801;
e(85) =141652557597856259916722069410021670405475845492837912390700146845374567994390844977125987675020436380612547605;
e(87) =-419664316404024471322573414069418891818962628391683907039212228549032921853217838146608053808786365440570254969261;
e(89) =1302159590524046398125858691330818681356757613986610030678095758242404286633729262297123677199743591748006204646868985;
e(91) =-4227240686139909064705589929214593102933845388672369082676644542650248228369590525634078984302153217507945782396923579721;
e(93) =14343212791976583406133682640578565858579882148843159111106574955509790196812618254848857854461550714631444034921517907250365;
e(95) =-50817990724580425164559757643090736003482435671513413926813239886828210876247074897752122164140484881907534297068189565042330181;
e(97) =187833293645293026402007579184179892539001444997005361637080870116823642645755601678579681159136078780812233831035373097528077899745;
e(99) =-723653438103385777657187661736782292986259565181067232760712431055015669043224647591792236141452770950810842191949814198134897708964641;
e(101) =2903528346661097497054603834764435875077553006646158945080492319146997643370625023889353447129967354174648294748510553528692457632980625125;
e(103) =-12122937378929218210539295497856098807695880456925359878374031252051425324802983023259164661895562465602169682143385407744646483057903979627101;
e(105) =52630642496169907060022407358423666139200442518073843505404940449800003302063127338662338497391497609499419661748773660506383501215821938795634505;
e(107) =-237407307193676634703461698760652651633454428419287776842645279528164787872297417395385346705721704571478255056084593759586258920375695854688654461561;
e(109) =1111890094248282302497023358817578932825829534468708403452929407174064284980244814331727650672071012464829426226669534375777258933146494169710719722335885;
e(111) =-5403078659795293205619115494263476990474882718296420197408516010249814711845963278802717760330206627628886347827381068652979312079075986736179581399343212021;
e(113) =27223410855722270213715341445890954891150192452564467008366005911126658490094311265116229345791312467273661582061462389296672527429047120477605834230481160137265;
e(115) =-142130105480096698118085204572231882248930706699532629917096701279605797073330019342069486123313307158077690567828653038008322871113514777576211651539204744250822481;
e(117) =768426182064690265317095628366647793640120107733727644086704205408475538272770397647212368961686021466396893832789095280670677561989835334271110534014930150192489246645;
e(119)=-4299621925439749642818890336486327550230296183651057083536623360354334771425729606583055234978935336116864465814878673654837862352124705254397361106883186269500698123036941;
e(121)=24883915747829871631690245540848940823728670907090814055549996853018422439857255460434636907179279971030115914025391078487144429408300462747699810654037377064816073847531472025;
e(123)=-148875820890620408401048810913362395915478793564083833973207237459816306501767343796140793737097206398217384861379191422469834206918345616804639191657370276470685113028113791999401;
e(125)=920261411885209418840864126560312709303188948754786396791215222653149731663432347100659323257330657824214531723965200565829728484354443523626140017386856515799079310476245590771021405;
e(127)=-5874244457292435607478065500517984430211674718162917379004377873044017144926171891266074084469461144112736852192606411496471264275390680348174759064256336391461933148218214049172761853861;
e(129)=38701335541759272489972612533946579961352365553523768738072135618177504244633546143840403169376492579607451638909625298032991497065209765804220290008687022549327267049867240582378815415302785;
e(131)=-263038464627282201918918005755736144830032766236489151905754681577981916252171316354973105486693742840216041344801990544825902436415863797115667159863613239597675722668781930227771509440274344321;
e(133)=1843421861906816432167393181032769665893649202553086673267697133400715329732610535132157060489416615730057631236849420277623544223308406050150049799386558982851267671436620884430088317515295375724165;
e(135)=-13315007608319975977798961906119591948409991994360182770848972097447201015445473110217825457685126268173968861952162736998351819924050543324674977645504022076111979662987053574616656318380157138294414781;
e(137)=99077340794640997027571994159414814352766157448188315407641572135205372433534236192424515676072423075561333548313166135347683467200999487267074099854449273061324576815951156531081456210665221369757248493545;
e(139)=-759161615376086554230567716763177263596944504514401890020970373192868465823452797551910845855011701531872230496643502087821632708042485735973318858027365853586062132254080496505748002294983034498658913855809241;
e(141)=5987386904215954780609340300928990507458814865030864762440959127489603790251637145749604626534662068704764148470130069641596881837375711869240420745498089109837751540966769902924250247702626992182004595330375418925;
e(143)=-48585315368052700716602256744577433881085302499382663900836359958053978334679521678499235910862547923367522652693577120760677663074098391609655555981666832137542638488228486996579524820945684901178997088057060206671701;
e(145)=405474737750791455464680535308584710004101929169563905467638405199707140521827004885932487194196311384629842084483076219540852954566975387306730824214150387836999985900790862094369844554013935010614141726715992833064708305;
e(147)=-3478923713390906014155853271332923403541090203929311448899155714127815582861789055632949031284778695873663565420214533346695135750726198835095396041501642366149906765137230219951898327177614490241412422254951219744444195146161;
e(149)=30674973882510848944914435747946116083220899412955570785330782125085850822994275592137937387166344104853428704382523982556306276256496841127419594437788971414267195014927164088859438013568143250274310527345494536583779461051769685;
e(151)=-277857404780457414987248665136951661385802997430099285750035845293762404084709969434016870389430000091054914408044748463535290871776626229195061384515613583189227656542091580147189163312909279754107124154692415552717409356305334976621;
e(153)=2584656039027118150988150827308379115174812407188367803116872758991930250566541562544589073989950578909935058466885562351129428635550443922611127558529813801436817726453531944624537906808585432270433693391096422761986801214468540280011065;
e(155)=-24681704804636405045563113396740422284913963613553381119310714464086897710328935966343204704821215011220396889041957887977272838988705114952616785989353166602294179183185568410133533879320450255743187047640813787854468601259236495019991107081;
e(157)=241875397603671333264713788326666700197340671860996631175487477066149092945173527219287017153434893262996063114359308897474705967957820772263285333425790096468917055702203670672158362936004666044597880710441727543177247110710982971270790081640445;
e(159)=-2431692647091072771710367899825329042978312858255265849158106543369003845838171255990749023878827646026837755570989027633721272578260760823216194666305433150677044259166657997395157392763097373982550910734972959189271202613947473869254971668125281541;
e(161)=25071830005737144960191522234762834423570096759890580082823874229833831690163136732846143787945517516134004403918012093742445562612207991873892705782881588541832155633594558800737824587847195977958539176361385963043761572318045891668199089009014838465825;
e(163)=-265025200052581375350895159803901659831186509795804976877103932177542318020045779086519791106794538569945733045234377251046033088600368744492574825867396946527628023569009258037862311192069917055607116562400084986721097342260635717067052951262238000041644001;
e(165)=2871301973166679684929916211003699350355491665017882386576590810781414905230946265312174490667829805944220519593098737669793312212344655925347962998276676335569668032112763438792820788122201865888588272479167270021118497953360503208862391552292341523102202695205;
e(167)=-31873602162354110469925167469864420834098442078376136286226148140338287017035197695328756656809299667273307907347165190625178484077234250517204540656593113024059121265558241036200035381298702075631555671297449641204531137714340685546565807854440168759599776572338461;
e(169)=362424164505845624987618515668413679297368428470959430419177372722357715496048789904222294162298755472011811233179520097862835432818460155300478788728230612306992230546368708538380883202464365353259572681219213078461599999667716627989875973031221525692129832253957736585;
e(171)=-4220005513130260808256874149121608869388378226451438744419711766672691776484360898579943327229799071566569220799418193734460802563701559836740994854234132201397018022945474085831250467336792289975504710405831631768298471319957990591150241176345336500257174834567448143108921;
e(173)=50303455785315004160948142070710660439593901544551597080356572244210205075773159284826676928099940270939872774526099418212704602457883015550880609374839741032031206179280983823453694340619758267342883548028892341280034602479976747749715703194419086815449426273168058911598997965;
e(175)=-613696178494213385049453688204944204636835041666802209740192483994522535138197632032027876728439620218036076551166502472414087724628932609227576010540315789096026864349046503109733067745459186861716167337508369354851430550336742702533171567967843591218910874037226619687146158899381;
e(177)=7660628138463373238117993486913117308562407748239554636851645244118393096760642580070132782182835772493668906831994962418261329110184210711316709924323071512994727850216635598213049818871992930602710048380205776270646645138991027539523682417662144159357039711639395335257387062714687345;
e(179)=-97817801128396745489203682500546803403872360255612057472290995814028940657569551872612602635030289576006285112163460487006788750275459045674761339526892435304437523912608229784910115289726075080865329433014362080464452506657150132777910025357685051079641459420210025598173827232784149453841;
e(181)=1277331663671980642072877732151869284598756140342756862203699204780475335159504968151690204213663447105620949434717932676191266292193883436288813754387946456540481384238565159064871619288178168239418776112961210567471496320773832611346566378550845636826548410755837970746928546952030526246612725;
e(183)=-17053514185447205217802426378725362724508399481812665196183185839469158011648800766414345172492040882144780940250055450502103811937337627649553535279031334409027446814293963189746329859680133956137807801542189159104678231823917756570426736742078313409641795708676878010710355206142559271906114916301;
e(185)=232725003482003005917234767874590750828843210540078047886281880700396232654117603097887120350825606802684020540169008897758864075968133355897378097264320973459346754734349027374313232867002671030368528250677028109112619357305414420227914198997205241323025418795823117397360370536618314153609214710982105;
e(187)=-3245547458389246952777103278832933845184956449666944106748081221098004971979502254066582528906284770073761549543383103906303927727715342889541355685586978553240908139221233064498655969984337576192317823239580542304520495782233845892636036159572214042726477145501581518761100340306057999006722621375511430761;
e(189)=46243177258265190424323902925304114170042407076432117483933721161583024270375494907464953195040624432240322320524712189124876144822622634965765704667430207111740179646363567338066782394601826449410342985107494978904849450964415996016936759144300290944854767428786461007606000519224362860938359096378859459203485;
L=find(n<=nmax);
U=find(n> nmax);
even=(n/2==round(n/2));
UU=find(n>=nmax & ~even);
bb(L)=e(n(L)+1);
if length(U)>0
bb(U)=Inf;
% warning('n is out of range!')
end
bb(UU)=0;
S=find(isinf(bb.') & ~(n/4==round(n/4)));
bb(S)=-bb(S);
bb=reshape(bb,r,c);
return
|
|
Contact us at files@mathworks.com