Regnearternes hierarki: Forskelle mellem versioner
Content deleted Content added
Glenn (diskussion | bidrag) m →Definition: wiki |
m Typo fixing, typos fixed: istedet → i stedet ved brug af AWB |
||
Linje 35:
===Blandet division og multiplikation===
:''i dette afsnit anvendes det engelske divisionssymbol "÷"''
Der kan være flertydighed i anvendelsen af [[Skråstreg#
: {{nowrap|1 ÷ 2 × ''x'' {{=}} 1 × {{sfrac|1|2}} × ''x'' {{=}} {{sfrac|1|2}} × ''x''}}.
Med denne fortolkning {{nowrap|1 ÷ 2''x''}} er det lig med {{nowrap|(1 ÷ 2)''x''}}.<ref name="Bronstein_1987"/><ref name="Rules">{{cite web |url=http://www.mathcentre.ac.uk/resources/uploaded/mc-ty-rules-2009-1.pdf |title=Rules of arithmetic |website=Mathcentre.ac.uk |access-date=2019-08-02}}</ref> Men i en del akademisk litteratur, anvendes [[underforstået multiplikation]], som bliver fortolket som havende højere præcedens end division, sådan at {{nowrap|1 ÷ 2''x''}} er lig {{nowrap|1 ÷ (2''x'')}}, ikke {{nowrap|(1 ÷ 2)''x''}}.
Fx er manuskript indsendelsesinstruktionerne for tidsskriftet ''[[Physical Review]]'' at (kun underforstået?) multiplikation har højere præcedens end division med en skråstreg,<ref name="APS_2012">{{cite web |url=https://publish.aps.org/files/styleguide-pr.pdf |title=Physical Review Style and Notation Guide |publisher=[[American Physical Society]] |access-date=2012-08-05 |at=Section IV–E–2–e}}</ref> og dette er også konventionen observeret i prominente fysikbøger såsom ''[[Course of Theoretical Physics]]'' af [[Lev Landau|Landau]] og [[Evgeny Lifshitz|Lifshitz]] - og ''[[Feynman Lectures on Physics]]''.<ref name="NB1">For example, the third edition of ''Mechanics'' by [[Landau and Lifshitz (book)|Landau and Lifshitz]] contains expressions such as ''hP''<sub>''z''</sub>/2{{pi}} (p. 22), and the first volume of the ''[[Feynman Lectures]]'' contains expressions such as 1/2{{sqrt|''N''}} [http://www.feynmanlectures.caltech.edu/I_06.html (p. 6–7)]. In both books, these expressions are written with the convention that the [[Slash (punctuation)|solidus]] is evaluated last. This also implies that an expression like 8/2(4) has solution 1 as the omission of the [[
<ref name="NB2">"Of" is equivalent to division or multiplication, and commonly used especially at primary school level, as in "Half ''of'' fifty".</ref>
Linje 50:
Nogle [[programmeringssprog]] anvender regnearternes hierarki, som er kompatibel med hvad der anvendes i matematik,<ref name="VanWinkle_2016">{{cite web |title=Exponentiation Associativity and Standard Math Notation |author-first=Lewis |author-last=Van Winkle |work=Codeplea - Random thoughts on programming |date=2016-08-23 |url=https://codeplea.com/exponentiation-associativity-options |access-date=2016-09-20 |url-status=live |archive-url=https://web.archive.org/web/20200628215506/https://codeplea.com/exponentiation-associativity-options |archive-date=2020-06-28}}</ref> selvom andre, såsom [[APL]], [[Smalltalk (programmeringssprog)|Smalltalk]], [[Occam]] and [[Mary (programmeringssprog)|Mary]], ikke har operator præcedens regler (i APL er evaluering striks fra højre til venstre; i Smalltalk osv. er det striks venstre til højre).
Yderligere, fordi mange operatorer ikke er associative, er præcedensen indenfor ethvert enkelt niveau sædvanligvis defineret ved at gruppere venstre til højre så at <code>16/4/4</code> fortolkes som {{nowrap|(16/4)/4 {{=}} 1}}
[[
{| class="wikitable"
|