Chapter17: Arithmetic
435
17 Arithmetic
Unlessotherwisenoted,allofthefunctionsdescribedinthischapterwillworkforrealand
complex scalar,vector, , or r matrix arguments. . Functions s describedas s mappingfunctions
applythegivenoperationindividuallytoeachelementwhengivenamatrixargument.For
example:
sin ([1, 2; 3, 4])
)
0.84147
0.90930
0.14112 -0.75680
17.1 ExponentsandLogarithms
[MappingFunction]
exp
(
x
)
Computee
x
foreachelementofx.
Tocomputethematrixexponential,seeChapter18[LinearAlgebra],page465.
Seealso: [log],page435.
[MappingFunction]
expm1
(
x
)
Computee
x
1accuratelyintheneighborhoodofzero.
Seealso: [exp],page435.
[MappingFunction]
log
(
x
)
Computethenaturallogarithm,ln(x);foreachelementofx.
Tocomputethematrixlogarithm,seeChapter18[LinearAlgebra],page465.
See also: [exp], page 435[log1p], page 435[log2], page 435[log10], page 435,
[logspace],page420.
[FunctionFile]
reallog
(
x
)
Returnthereal-valuednaturallogarithmofeachelementofx.
Ifanyelementresultsinacomplexreturnvaluereallogabortsandissuesanerror.
Seealso: [log],page435,[realpow],page436,[realsqrt],page436.
[MappingFunction]
log1p
(
x
)
Computeln(1+x)accuratelyintheneighborhoodofzero.
Seealso: [log],page435,[exp],page435,[expm1],page435.
[MappingFunction]
log10
(
x
)
Computethebase-10logarithmofeachelementofx.
Seealso: [log],page435,[log2],page435,[logspace],page420,[exp],page435.
[MappingFunction]
log2
(
x
)
[MappingFunction]
[f, e] ] = = log2
(
x
)
Computethebase-2logarithmofeachelementofx.
Ifcalledwithtwooutputarguments,split x x intobinary y mantissaandexponent so
that
1
2
jfj<1andeisaninteger.Ifx=0,f=e=0.
Seealso: [pow2],page436,[log],page435,[log10],page435,[exp],page435.
Break password pdf - Split, seperate PDF into multiple files in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Explain How to Split PDF Document in Visual C#.NET Application
acrobat split pdf bookmark; pdf format specification
Break password pdf - VB.NET PDF File Split Library: Split, seperate PDF into multiple files in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET PDF Document Splitter Control to Disassemble PDF Document
pdf split and merge; break a pdf file into parts
436
GNUOctave
[FunctionFile]
pow2
(
x
)
[FunctionFile]
pow2
(
f
,
e
)
Withoneinputargument,compute2
x
foreachelementofx.
Withtwoinputarguments,returnf2
e
.
Seealso: [log2],page435,[nextpow2],page436,[power],page146.
[FunctionFile]
nextpow2
(
x
)
Computetheexponentforthesmallestpoweroftwolargerthantheinput.
Foreachelementintheinputarrayx,returnthefirstintegernsuchthat2
n
jxj.
Seealso: [pow2],page436,[log2],page435.
[FunctionFile]
realpow
(
x
,
y
)
Computethereal-valued,element-by-elementpoweroperator.
Thisisequivalenttox.^y,exceptthatrealpowreportsanerrorifanyreturnvalue
iscomplex.
Seealso: [power],page146,[reallog],page435,[realsqrt],page436.
[MappingFunction]
sqrt
(
x
)
Computethesquarerootofeachelementofx.
Ifxisnegative,acomplexresultisreturned.
Tocomputethematrixsquareroot,seeChapter18[LinearAlgebra],page465.
Seealso: [realsqrt],page436,[nthroot],page436.
[FunctionFile]
realsqrt
(
x
)
Returnthereal-valuedsquarerootofeachelementofx.
Ifanyelementresultsinacomplexreturnvaluerealsqrtabortsandissuesanerror.
Seealso: [sqrt],page436,[realpow],page436,[reallog],page435.
[MappingFunction]
cbrt
(
x
)
Computetherealcuberootofeachelementofx.
Unlikex^(1/3),theresultwillbenegativeifxisnegative.
Seealso: [nthroot],page436.
[FunctionFile]
nthroot
(
x
,
n
)
Computethereal(non-complex)n-throotofx.
x musthaveallrealentriesandnmustbeascalar. . Ifnisanevenintegerandxhas
negativeentriesthennthrootabortsandissuesanerror.
Example:
nthroot (-1, 3)
) -1
(-1) ^ (1 / 3)
) 0.50000 0 - 0.86603i
Seealso: [realsqrt],page436,[sqrt],page436,[cbrt],page436.
C# PDF Convert: How to Convert Jpeg, Png, Bmp, & Gif Raster Images
Success"); break; case ConvertResult.FILE_TYPE_UNSUPPORT: Console.WriteLine("Fail: can not convert to PDF, file type unsupport"); break; case ConvertResult
pdf separate pages; cannot select text in pdf
C# Image Convert: How to Convert Word to Jpeg, Png, Bmp, and Gif
RasterEdge.XDoc.PDF.dll. FileType.IMG_JPEG); switch (result) { case ConvertResult. NO_ERROR: Console.WriteLine("Success"); break; case ConvertResult
break pdf into single pages; reader split pdf
Chapter17: Arithmetic
437
17.2 ComplexArithmetic
Inthedescriptionsofthefollowingfunctions,z isthecomplexnumber x+iy,whereiis
definedas
p
1.
[MappingFunction]
abs
(
z
)
Computethemagnitudeofz.
Themagnitudeisdefinedasjzj=
p
x
2
+y
2
.
Forexample:
abs (3 + + 4i)
)
5
Seealso: [arg],page437.
[MappingFunction]
arg
(
z
)
[MappingFunction]
angle
(
z
)
Computetheargument,i.e.,angleofz.
Thisisdefinedas,=atan2(y;x);inradians.
Forexample:
arg (3 + + 4i)
) 0.92730
Seealso: [abs],page437.
[MappingFunction]
conj
(
z
)
Returnthecomplexconjugateofz.
Thecomplexconjugateisdefinedas¯z=x iy.
Seealso: [real],page438,[imag],page437.
[FunctionFile]
cplxpair
(
z
)
[FunctionFile]
cplxpair
(
z
,
tol
)
[FunctionFile]
cplxpair
(
z
,
tol
,
dim
)
Sortthenumberszintocomplexconjugatepairsorderedbyincreasingrealpart.
Thenegativeimaginarycomplexnumbersareplacedfirstwithineachpair. Allreal
numbers(thosewithabs(imag(z)/z)<tol)areplacedafterthecomplexpairs.
Iftolisunspecifiedthedefaultvalueis100*eps.
Bydefaultthecomplexpairsaresortedalongthefirstnon-singletondimensionofz.
Ifdimisspecified,thenthecomplexpairsaresortedalongthisdimension.
Signalanerror ifsomecomplexnumberscouldnotbepaired. . Signalanerrorifall
complex numbers are not exact conjugates (to within n tol). . Note e that there is s no
definedorderforpairswithidenticalrealpartsbutdifferingimaginaryparts.
cplxpair (exp(2i*pi*[0:4]’/5)) == exp(2i*pi*[3; 2; ; 4; 1; 0]/5)
[MappingFunction]
imag
(
z
)
Returntheimaginarypartofz asarealnumber.
Seealso: [real],page438,[conj],page437.
VB.NET PDF Page Insert Library: insert pages into PDF file in vb.
Forms. Support adding PDF page number. Offer PDF page break inserting function. Free SDK library for Visual Studio .NET. Independent
break apart a pdf; pdf file specification
C# PDF Page Insert Library: insert pages into PDF file in C#.net
Ability to add PDF page number in preview. Offer PDF page break inserting function. Free components and online source codes for .NET framework 2.0+.
pdf no pages selected; can print pdf no pages selected
438
GNUOctave
[MappingFunction]
real
(
z
)
Returntherealpartofz.
Seealso: [imag],page437,[conj],page437.
17.3 Trigonometry
Octaveprovidesthefollowingtrigonometricfunctionswhereanglesarespecifiedinradians.
Toconvertfromdegreestoradiansmultiplyby=180(e.g.,sin(30*pi/180)returnsthe
sineof30degrees). Asanalternative,Octaveprovidesanumberoftrigonometricfunctions
whichworkdirectlyonanargumentspecifiedindegrees.Thesefunctionsarenamedafter
the basetrigonometricfunction witha ‘d’suffix. . For r example, , sin n expects anangle in
radianswhilesindexpectsanangleindegrees.
Octave usestheClibrary trigonometricfunctions. . Itis s expectedthat these functions
aredefinedby theISO/IEC 9899Standard. . ThisStandardisavailableat: http://www.
open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf. Section n F.9.1deals with the
trigonometricfunctions. Thebehaviorofmostofthefunctionsisrelativelystraightforward.
However, there are some e exceptions s to the standard d behavior. . Many y of f the exceptions
involvethebehaviorfor-0. Themostcomplexcaseis s atan2. . Octaveexactlyimplements
thebehaviorgivenintheStandard. Includingatan2(0; 0)returns.
Itshouldbenotedthatmatlabusesdifferentdefinitionswhichapparentlydonotdis-
tinguish-0.
[MappingFunction]
sin
(
x
)
Computethesineforeachelementofxinradians.
Seealso: [asin],page439,[sind],page440,[sinh],page439.
[MappingFunction]
cos
(
x
)
Computethecosineforeachelementofxinradians.
Seealso: [acos],page439,[cosd],page440,[cosh],page439.
[MappingFunction]
tan
(
z
)
Computethetangentforeachelementofxinradians.
Seealso: [atan],page439,[tand],page441,[tanh],page439.
[MappingFunction]
sec
(
x
)
Computethesecantforeachelementofxinradians.
Seealso: [asec],page439,[secd],page441,[sech],page439.
[MappingFunction]
csc
(
x
)
Computethecosecantforeachelementofxinradians.
Seealso: [acsc],page439,[cscd],page441,[csch],page439.
[MappingFunction]
cot
(
x
)
Computethecotangentforeachelementofx inradians.
Seealso: [acot],page439,[cotd],page441,[coth],page439.
C# TWAIN - Query & Set Device Abilities in C#
device.TwainTransferMode = method; break; } if (method == TwainTransferMethod.TWSX_FILE) device.TransferMethod = method; } // If it's not supported tell stop.
acrobat split pdf pages; pdf split pages in half
C# TWAIN - Install, Deploy and Distribute XImage.Twain Control
RasterEdge.XDoc.PDF.dll. device.TwainTransferMode = method; break; } if (method == TwainTransferMethod.TWSX_FILE) device.TransferMethod = method; } // If it's
break password on pdf; pdf splitter
Chapter17: Arithmetic
439
[MappingFunction]
asin
(
x
)
Computetheinversesineinradiansforeachelementofx.
Seealso: [sin],page438,[asind],page441.
[MappingFunction]
acos
(
x
)
Computetheinversecosineinradiansforeachelementofx.
Seealso: [cos],page438,[acosd],page441.
[MappingFunction]
atan
(
x
)
Computetheinversetangentinradiansforeachelementofx.
Seealso: [tan],page438,[atand],page441.
[MappingFunction]
asec
(
x
)
Computetheinversesecantinradiansforeachelementofx.
Seealso: [sec],page438,[asecd],page441.
[MappingFunction]
acsc
(
x
)
Computetheinversecosecantinradiansforeachelementofx.
Seealso: [csc],page438,[acscd],page441.
[MappingFunction]
acot
(
x
)
Computetheinversecotangentinradiansforeachelementofx.
Seealso: [cot],page438,[acotd],page441.
[MappingFunction]
sinh
(
x
)
Computethehyperbolicsineforeachelementofx.
Seealso: [asinh],page440,[cosh],page439,[tanh],page439.
[MappingFunction]
cosh
(
x
)
Computethehyperboliccosineforeachelementofx.
Seealso: [acosh],page440,[sinh],page439,[tanh],page439.
[MappingFunction]
tanh
(
x
)
Computehyperbolictangentforeachelementofx.
Seealso: [atanh],page440,[sinh],page439,[cosh],page439.
[MappingFunction]
sech
(
x
)
Computethehyperbolicsecantofeachelementofx.
Seealso: [asech],page440.
[MappingFunction]
csch
(
x
)
Computethehyperboliccosecantofeachelementofx.
Seealso: [acsch],page440.
[MappingFunction]
coth
(
x
)
Computethehyperboliccotangentofeachelementofx.
Seealso: [acoth],page440.
C# TWAIN - Specify Size and Location to Scan
foreach (TwainStaticFrameSizeType frame in frames) { if (frame == TwainStaticFrameSizeType.LetterUS) { this.device.FrameSize = frame; break; } } }.
add page break to pdf; c# print pdf to specific printer
C# TWAIN - Acquire or Save Image to File
RasterEdge.XDoc.PDF.dll. if (device.Compression != TwainCompressionMode.Group4) device.Compression = TwainCompressionMode.Group3; break; } } acq.FileTranfer
break a pdf password; break a pdf apart
440
GNUOctave
[MappingFunction]
asinh
(
x
)
Computetheinversehyperbolicsineforeachelementofx.
Seealso: [sinh],page439.
[MappingFunction]
acosh
(
x
)
Computetheinversehyperboliccosineforeachelementofx.
Seealso: [cosh],page439.
[MappingFunction]
atanh
(
x
)
Computetheinversehyperbolictangentforeachelementofx.
Seealso: [tanh],page439.
[MappingFunction]
asech
(
x
)
Computetheinversehyperbolicsecantofeachelementofx.
Seealso: [sech],page439.
[MappingFunction]
acsch
(
x
)
Computetheinversehyperboliccosecantofeachelementofx.
Seealso: [csch],page439.
[MappingFunction]
acoth
(
x
)
Computetheinversehyperboliccotangentofeachelementofx.
Seealso: [coth],page439.
[MappingFunction]
atan2
(
y
,
x
)
Computeatan(y /x)forcorrespondingelementsofy andx.
y andx mustmatchinsizeandorientation.
Seealso: [tan],page438,[tand],page441,[tanh],page439,[atanh],page440.
Octaveprovidesthefollowingtrigonometricfunctionswhereanglesarespecifiedinde-
grees.Thesefunctionsproducetruezerosattheappropriateintervalsratherthanthesmall
round-offerrorthatoccurswhenusingradians.Forexample:
cosd (90)
) 0
cos (pi/2)
) 6.1230e-17
[FunctionFile]
sind
(
x
)
Computethesineforeachelementofxindegrees.
Returnszeroforelementswherex/180isaninteger.
Seealso: [asind],page441,[sin],page438.
[FunctionFile]
cosd
(
x
)
Computethecosineforeachelementofxindegrees.
Returnszeroforelementswhere(x-90)/180isaninteger.
Seealso: [acosd],page441,[cos],page438.
Chapter17: Arithmetic
441
[FunctionFile]
tand
(
x
)
Computethetangentforeachelementofxindegrees.
Returns zero o for r elements s where e x/180 is s an n integer and Inf for r elements s where
(x-90)/180isaninteger.
Seealso: [atand],page441,[tan],page438.
[FunctionFile]
secd
(
x
)
Computethesecantforeachelementofxindegrees.
Seealso: [asecd],page441,[sec],page438.
[FunctionFile]
cscd
(
x
)
Computethecosecantforeachelementofxindegrees.
Seealso: [acscd],page441,[csc],page438.
[FunctionFile]
cotd
(
x
)
Computethecotangentforeachelementofx indegrees.
Seealso: [acotd],page441,[cot],page438.
[FunctionFile]
asind
(
x
)
Computetheinversesineindegreesforeachelementofx.
Seealso: [sind],page440,[asin],page439.
[FunctionFile]
acosd
(
x
)
Computetheinversecosineindegreesforeachelementofx.
Seealso: [cosd],page440,[acos],page439.
[FunctionFile]
atand
(
x
)
Computetheinversetangentindegreesforeachelementofx.
Seealso: [tand],page441,[atan],page439.
[FunctionFile]
atan2d
(
y
,
x
)
Computeatan2(y /x)indegreesforcorrespondingelementsfromy andx.
Seealso: [tand],page441,[atan2],page440.
[FunctionFile]
asecd
(
x
)
Computetheinversesecantindegreesforeachelementofx.
Seealso: [secd],page441,[asec],page439.
[FunctionFile]
acscd
(
x
)
Computetheinversecosecantindegreesforeachelementofx.
Seealso: [cscd],page441,[acsc],page439.
[FunctionFile]
acotd
(
x
)
Computetheinversecotangentindegreesforeachelementofx.
Seealso: [cotd],page441,[acot],page439.
442
GNUOctave
17.4 SumsandProducts
[Built-inFunction]
sum
(
x
)
[Built-inFunction]
sum
(
x
,
dim
)
[Built-inFunction]
sum
(...,
"
native
"
)
[Built-inFunction]
sum
(...,
"
double
"
)
[Built-inFunction]
sum
(...,
"
extra
"
)
Sumofelementsalongdimensiondim.
Ifdimisomitted,itdefaultstothefirstnon-singletondimension.
Theoptional"type"inputdeterminestheclassofthevariableusedforcalculations.
Iftheargument"native"isgiven,thentheoperationisperformedinthesametype
astheoriginalargument,ratherthanthedefaultdoubletype.
Forexample:
sum ([true, true])
) 2
sum ([true, true], "native")
) true
Onthecontrary,if"double"isgiven,thesumisperformedindoubleprecisioneven
forsingleprecisioninputs.
Fordoubleprecisioninputs,the"extra"optionwilluseamoreaccuratealgorithm
thanstraightforwardsummation. Forsingleprecisioninputs,"extra"isthesameas
"double". Otherwise,"extra"hasnoeffect.
Seealso: [cumsum],page442,[sumsq],page443,[prod],page442.
[Built-inFunction]
prod
(
x
)
[Built-inFunction]
prod
(
x
,
dim
)
[Built-inFunction]
prod
(...,
"
native
"
)
[Built-inFunction]
prod
(...,
"
double
"
)
Productofelementsalongdimensiondim.
Ifdimisomitted,itdefaultstothefirstnon-singletondimension.
Theoptional"type"inputdeterminestheclassofthevariableusedforcalculations.
Iftheargument"native"isgiven,thentheoperationisperformedinthesametype
astheoriginalargument,ratherthanthedefaultdoubletype.
Forexample:
prod ([true, true])
) 1
prod ([true, true], , "native")
) true
Onthecontrary,if"double"isgiven,theoperationisperformedindoubleprecision
evenforsingleprecisioninputs.
Seealso: [cumprod],page443,[sum],page442.
[Built-inFunction]
cumsum
(
x
)
[Built-inFunction]
cumsum
(
x
,
dim
)
Chapter17: Arithmetic
443
[Built-inFunction]
cumsum
(...,
"
native
"
)
[Built-inFunction]
cumsum
(...,
"
double
"
)
[Built-inFunction]
cumsum
(...,
"
extra
"
)
Cumulativesumofelementsalongdimensiondim.
Ifdimisomitted,itdefaultstothefirstnon-singletondimension.
See sum for an n explanation of the optional parameters "native", , "double", and
"extra".
Seealso: [sum],page442,[cumprod],page443.
[Built-inFunction]
cumprod
(
x
)
[Built-inFunction]
cumprod
(
x
,
dim
)
Cumulativeproductofelementsalongdimensiondim.
Ifdimisomitted,itdefaultstothefirstnon-singletondimension.
Seealso: [prod],page442,[cumsum],page442.
[Built-inFunction]
sumsq
(
x
)
[Built-inFunction]
sumsq
(
x
,
dim
)
Sumofsquaresofelementsalongdimensiondim.
Ifdimisomitted,itdefaultstothefirstnon-singletondimension.
Thisfunctionisconceptuallyequivalenttocomputing
sum (x .* conj (x), , dim)
butituseslessmemoryandavoidscallingconjifxisreal.
Seealso: [sum],page442,[prod],page442.
17.5 UtilityFunctions
[MappingFunction]
ceil
(
x
)
Returnthesmallestintegernotlessthanx.
Thisisequivalenttoroundingtowardspositiveinfinity.
Ifxiscomplex,returnceil(real(x))+ceil(imag(x))*I.
ceil ([-2.7, 2.7])
)
-2
3
Seealso: [floor],page444,[round],page444,[fix],page443.
[MappingFunction]
fix
(
x
)
Truncatefractionalportionofx andreturntheintegerportion.
Thisisequivalenttoroundingtowardszero. Ifxiscomplex,returnfix(real(x))
+fix(imag(x))*I.
fix ([-2.7, 2.7])
)
-2
2
Seealso: [ceil],page443,[floor],page444,[round],page444.
444
GNUOctave
[MappingFunction]
floor
(
x
)
Returnthelargestintegernotgreaterthanx.
Thisisequivalenttoroundingtowardsnegativeinfinity. Ifxiscomplex,returnfloor
(real(x))+floor(imag(x))*I.
floor ([-2.7, 2.7])
) -3
2
Seealso: [ceil],page443,[round],page444,[fix],page443.
[MappingFunction]
round
(
x
)
Returntheintegernearesttox.
Ifx iscomplex,returnround(real(x))+round(imag(x))*I. . Iftherearetwo
nearestintegers,returntheonefurtherawayfromzero.
round ([-2.7, 2.7])
) -3
3
Seealso: [ceil],page443,[floor],page444,[fix],page443,[roundb],page444.
[MappingFunction]
roundb
(
x
)
Returntheintegernearesttox.Iftherearetwonearestintegers,returntheevenone
(banker’srounding).
Ifxiscomplex,returnroundb(real(x))+roundb(imag(x))*I.
Seealso: [round],page444.
[Built-inFunction]
max
(
x
)
[Built-inFunction]
max
(
x
,
[]
,
dim
)
[Built-inFunction]
[w, iw] ] = max
(
x
)
[Built-inFunction]
max
(
x
,
y
)
Findmaximumvaluesinthearrayx.
Foravectorargument,returnthemaximumvalue.Foramatrixargument,returna
rowvectorwiththemaximumvalueofeachcolumn. Foramulti-dimensionalarray,
maxoperatesalongthefirstnon-singletondimension.
Iftheoptionalthirdargumentdimispresentthenoperatealongthisdimension. In
thiscasethesecondargumentisignoredandshouldbesettotheemptymatrix.
Fortwomatrices(oramatrixandascalar),returnthepairwisemaximum.
Thus,
max (max x (x))
returnsthelargestelementofthe2-Dmatrixx,and
max (2:5, pi)
)
3.1416 3.1416 4.0000 5.0000
compares eachelement of therange 2:5 withpi,andreturns arow vector of the
maximumvalues.
Forcomplexarguments,themagnitudeoftheelements areusedforcomparison. . If
themagnitudesareidentical,thentheresultsareorderedbyphaseangleintherange
(-pi,pi].Hence,
Documents you may be interested
Documents you may be interested