https://en.formulasearchengine.com/api.php?action=feedcontributions&user=190.60.93.218&feedformat=atomformulasearchengine - User contributions [en]2022-12-04T11:58:07ZUser contributionsMediaWiki 1.39.0-wmf.22https://en.formulasearchengine.com/index.php?title=Trigonal_planar_molecular_geometry&diff=9022Trigonal planar molecular geometry2013-09-11T19:01:57Z<p>190.60.93.218: </p>
<hr />
<div>[[Image:AX3E0-3D-balls.png|thumb|left|200px|Idealized structure of a compound with trigonal planar coordination geometry.]]<br />
[[Image:Boron-trifluoride-3D-vdW.png|thumb|right|200px|Structure of [[boron trifluoride]], an example of a molecule with trigonal planar geometry.]]<br />
In [[chemistry]], '''trigonal planar''' is a [[molecular geometry]] model with one atom at the center and three atoms at the corners of a triangle, called peripheral atoms, all in one plane.<ref name=March>Jerry March Advanced Organic Chemistry 3rd Ed.</ref> In an ideal trigonal planar species, all three ligands are identical and all bond angles are 120° or <math style="height: 1.6em;">\frac{2\pi}{3}</math> radians. Such species belong to the [[point group]] D<sub>3h</sub>. Molecules where the three ligands are not identical, such as [[formaldehyde|H<sub>2</sub>CO]], deviate from this idealized geometry. Examples of [[molecule]]s with trigonal planar geometry include [[boron trifluoride]] (BF<sub>3</sub>), [[formaldehyde]] (H<sub>2</sub>CO), [[phosgene]] (COCl<sub>2</sub>), and [[sulfur trioxide]] (SO<sub>3</sub>). Some ions with trigonal planar geometry include [[nitrate]] (NO<sub>3</sub><sup>−</sup>), [[carbonate]] ion (CO<sub>3</sub><sup>2−</sup>), and [[guanidine|guanidinium]] C(NH<sub>2</sub>)<sub>3</sub><sup>+</sup>. In organic chemistry, planar, three-connected carbon centers that are trigonal planar are often described as having [[orbital hybridisation|sp<sup>2</sup> hybridization]].<ref>Holleman, A. F.; Wiberg, E. "Inorganic Chemistry" Academic Press: San Diego, 2001. ISBN 0-12-352651-5.</ref><ref>G. L. Miessler and D. A. Tarr “Inorganic Chemistry” 3rd Ed, Pearson/Prentice Hall publisher, ISBN 0-13-035471-6.</ref><br />
<br />
[[Nitrogen inversion]] is the distortion of pyramidal [[amine]]s through a transition state that is trigonal planar.<br />
<br />
'''Pyramidalization''' is a distortion of this molecular shape towards a [[tetrahedral molecular geometry]]. One way to observe this distortion is in [[pyramidal alkene]]s.<ref name=March /><br />
<br />
==See also==<br />
*[[AXE method]]<br />
*[[Molecular geometry]]<br />
*[[VSEPR theory]]<br />
<br />
==References==<br />
<references/><br />
<br />
==External links==<br />
*[http://www.3dchem.com/ 3D Chem Chemistry, Structures, and 3D Molecules]<br />
*[http://www.iumsc.indiana.edu/ Indiana University Molecular Structure Center]<br />
*[http://www.phys.ncl.ac.uk/staff/njpg/symmetry/Molecules_l3d.html Point Group Symmetry Interactive Examples]<br />
*[http://chemlab.truman.edu/CHEM121Labs/MolecularModeling1.htm Molecular Modeling]<br />
*[http://intro.chem.okstate.edu/1314F97/Chapter9/3BP.html Animated Trigonal Planar Visual]<br />
<br />
{{MolecularGeometry}}<br />
<br />
[[Category:Stereochemistry]]<br />
[[Category:Molecular geometry]]</div>190.60.93.218https://en.formulasearchengine.com/index.php?title=Reference_desk/Archives/Computing/2013_September_4&diff=282684Reference desk/Archives/Computing/2013 September 42013-09-09T17:54:35Z<p>190.60.93.218: /* Lorem Ipsum for computer code? */</p>
<hr />
<div><noinclude><!-- From archive header--><br />
{{#ifeq:{{PAGENAME}}|Special:Undelete| |{{#if:|<div style="display:none;">}} {{#ifeq:{{NAMESPACE}}|Wikipedia|{{#switch:{{NAMESPACE}}|= |<div style="display:none;">}}|{{error:not substituted|Archive header}}<div style="display:none;">}}}} {{#if:|</div></div>}}{| width = "100%"<br />
|-<br />
! colspan="3" align="center" | [[Wikipedia:Reference desk/Computing|Computing desk]]<br />
|-<br />
! width="20%" align="left" | &lt; [[Wikipedia:Reference desk/Archives/Computing/2013 September 3|September 3]]<br />
! width="25%" align="center"|&lt;&lt; [[Wikipedia:Reference desk/Archives/Computing/August 2013|Aug]] | [[Wikipedia:Reference desk/Archives/Computing/September 2013|September]] | [[Wikipedia:Reference desk/Archives/Computing/October 2013|Oct]] &gt;&gt;<br />
! width="20%" align="right" |{{#ifexist:Wikipedia:Reference desk/Archives/Computing/2013 September 5|[[Wikipedia:Reference desk/Archives/Computing/2013 September 5|September 5]]|[[Wikipedia:Reference desk/Computing|Current desk]]}} &gt;<br />
|}<br />
{| align=center width=95% style="background: #FFFFFF; border: 1px solid #003EBA;" cellpadding="8" cellspacing="0"<br />
|-<br />
! style="background: #5D7CBA; text-align: center;" align="center" | <font face="Arial" color="#FFFFFF">'''Welcome to the Wikipedia Computing Reference Desk Archives'''</font><br />
|-<br />
| The page you are currently viewing is {{#ifexist:Wikipedia:Reference desk/Archives/Computing/2013 September 14|an archive page|a [[Wikipedia:Transclusion|transcluded]] archive page}}. While you can leave answers for any questions shown below, please ask new questions on one of the [[Wikipedia:Reference desk|current reference desk]] pages.<br />
|}<br />
<br />
<br />
__TOC__<br />
</noinclude><br />
= September 4 =<br />
<br />
== CPU/RAM question ==<br />
<br />
So i was recommended to look at the performance monitor on Windows 7 (64 bit). I have no idea what i'm actually looking at here. Any tips? I was trying to figure out if my system ideally needs more ram or a better processor.<br />
I also looked at the Windows Experience Index, which puts my system at:<br />
*Processor: '''5'''<br />
*Memory (RAM): '''7.1'''<br />
*Graphics: '''4.3'''<br />
*Gaming graphics: '''4.5'''<br />
*Primary hard disk: '''5.9'''<br />
I use it for gaming a bit, which is where i have the odd problem. It does everything else just fine. Thanks '''[[User:Jenova20|ツ <span style="background:pink"><span style="color:crimson; font-family:comic sans ms">Jenova</span>]][[User_talk:Jenova20|<span style="color:red">20</span>]]</span> <sup>([[Special:EmailUser/Jenova20|email]])</sup>''' 08:19, 4 September 2013 (UTC)<br />
:How much RAM do you have a the moment? As far as I recall, the WIE measures the RAM speed, and doesn't give much weight to the amount (so long as it is sufficient to run Windows). It also depends a little on what games you intend to play, some will be heavily graphics limited (e.g. many FPS games), some RAM limited (e.g. turn based strategy games), and some CPU limited (e.g. RTS games), so different upgrades will help different games. Actually telling us you current specs is likely to be more useful than the WIE. Anoher question would be how much difference changing graphics options makes to how the games run, you may be better off changing your video card, rather than either of the opitions you gave. Or your computer might just be getting on a bit, and benefit from reinsalling windows (after ensuring everything is backed up first of course) [[User:MChesterMC|MChesterMC]] ([[User talk:MChesterMC|talk]]) 08:55, 4 September 2013 (UTC)<br />
<br />
::Without much detailed info on me at the moment, i know it currently has 6GB of DDR3 Ram. I'm not sure about the processor. I got it january/february 2012, so it's not ancient, it just struggles to keep up with some RTS and FPS games (Minecraft and Anno 2070) very well (even with graphics at bare minimum). I could give more detailed specs later if necessary. Thanks '''[[User:Jenova20|ツ <span style="background:pink"><span style="color:crimson; font-family:comic sans ms">Jenova</span>]][[User_talk:Jenova20|<span style="color:red">20</span>]]</span> <sup>([[Special:EmailUser/Jenova20|email]])</sup>''' 10:14, 4 September 2013 (UTC)<br />
<br />
:::Assuming you're using Windows 7, hit the Start Button, highlight "computer", then right-click and select "Properties". Look down the page that appears for the row "Processor", and tell us what is listed there. Also, if you can, click "Device Manager" in the top-left of that window, then doubleclick the item that says "Display adapters", and tell us that as well. That will help us determine your major components. -- [[Special:Contributions/140.202.10.134|140.202.10.134]] ([[User talk:140.202.10.134|talk]]) 15:43, 4 September 2013 (UTC)<br />
<br />
::::Acer Asprire 5349<br />
::::Intel(R) Celeron(R) CPU B800 @ 1.50GHz 1.50 GHz<br />
::::Also looked into the "display adaptors" properties but there was very little there interesting (unless you can be more specific about which section i should post up here?). <br />
::::Is this any use? Thanks '''[[User:Jenova20|ツ <span style="background:pink"><span style="color:crimson; font-family:comic sans ms">Jenova</span>]][[User_talk:Jenova20|<span style="color:red">20</span>]]</span> <sup>([[Special:EmailUser/Jenova20|email]])</sup>''' 17:19, 4 September 2013 (UTC)<br />
<br />
:::Without looking at the actual specs (since I'm at work, and can't look it up easily), that sounds like a CPU problem. Minecraft in particular is infamous for thrashing the CPU, and RTS games tend to have high CPU usage due to the large number of units moving simultaneously. 6GB of RAM should be enough. But I agree with StuRat's suggestion below. [[User:MChesterMC|MChesterMC]] ([[User talk:MChesterMC|talk]]) 09:24, 5 September 2013 (UTC)<br />
<br />
:I suggest you use Start + Control Panel + Desktop Gadgets + CPU Meter. Then use your computer in the usual way until it slows to a crawl, then tell us which of the meters is near 100%. That will tell us where the problem is. [[User:StuRat|StuRat]] ([[User talk:StuRat|talk]]) 06:43, 5 September 2013 (UTC)<br />
<br />
::My RAM meter stays steady at 20-40%, but CPU fluctuates wildly and hits the high 80s when gaming. I also get a lot of frame skips gaming. Does that narrow it down? Thanks '''[[User:Jenova20|ツ <span style="background:pink"><span style="color:crimson; font-family:comic sans ms">Jenova</span>]][[User_talk:Jenova20|<span style="color:red">20</span>]]</span> <sup>([[Special:EmailUser/Jenova20|email]])</sup>''' 18:01, 5 September 2013 (UTC)<br />
<br />
:::Yes, we can definitely eliminate low RAM as the problem. I'm not sure if it's the CPU, though, since you say it never makes it into the 90's. So, what's left ? Maybe your internet connection speed, if these are online games ? [[User:StuRat|StuRat]] ([[User talk:StuRat|talk]]) 23:04, 5 September 2013 (UTC)<br />
<br />
:::We still don't know anything about your video card. There is another way of figuring it out rather than using the device manager. Right-click your desktop and select "Screen resolution...". From there, click the "Advanced settings" link. There should be an "Adapter" tab that tells what sort of video adapter you have. Also, have you tried turning down the graphics settings in your games? [[User:JessRyanA|I don&#39;t have a name]] ([[User talk:JessRyanA|talk]]) 12:42, 6 September 2013 (UTC)<br />
<br />
::::The graphics settings can't go any lower on Minecraft or Anno 2070. Minecraft is almost completely unplayable as there are too many frame skips. Anno 2070 gets them too, but not as badly. I'll post up the info for adapters later. Thanks '''[[User:Jenova20|ツ <span style="background:pink"><span style="color:crimson; font-family:comic sans ms">Jenova</span>]][[User_talk:Jenova20|<span style="color:red">20</span>]]</span> <sup>([[Special:EmailUser/Jenova20|email]])</sup>''' 14:49, 6 September 2013 (UTC)<br />
<br />
::::Chip Type: Intel(R) HD Graphics Family<br />
::::DAC Type: Internal<br />
::::Adapter String: Intel(R) HD Graphics<br />
::::Bios Information: Intel Video BIOS<br />
::::Total available graphics memory: 1760 MB<br />
::::Dedicated video memory: 128 MB<br />
::::System video memory: 0 MB<br />
::::Shared sytem memory: 1632 MB<br />
::::Thanks '''[[User:Jenova20|ツ <span style="background:pink"><span style="color:crimson; font-family:comic sans ms">Jenova</span>]][[User_talk:Jenova20|<span style="color:red">20</span>]]</span> <sup>([[Special:EmailUser/Jenova20|email]])</sup>''' 17:24, 6 September 2013 (UTC)<br />
:::::Hmm... above you mention that the computer is an "Acer Asprire 5349" which is a Laptop - so I think its very unlikely you'll be able to upgrade either CPU or Graphics Card. Sorry, [[User:davidprior|<font color="#000000">'''d'''</font><font color="#808080">avid</font><font color="#000000">'''p'''</font><font color="#808080">rior</font>]] [[User talk:Davidprior|<sup>t</sup>]]/[[Special:Contributions/DavidPrior|<sub>c</sub>]] 18:49, 7 September 2013 (UTC)<br />
<br />
::::::That's a shame, but thanks a lot for the responses '''[[User:Jenova20|ツ <span style="background:pink"><span style="color:crimson; font-family:comic sans ms">Jenova</span>]][[User_talk:Jenova20|<span style="color:red">20</span>]]</span> <sup>([[Special:EmailUser/Jenova20|email]])</sup>''' 12:40, 9 September 2013 (UTC)<br />
<br />
== How do I see all my questions in the reference desk on Wikipedia? ==<br />
<br />
How do I see all my questions in the reference desk on Wikipedia? This applies to the whole world. [[Special:Contributions/78.156.109.166|78.156.109.166]] ([[User talk:78.156.109.166|talk]]) 18:15, 4 September 2013 (UTC)<br />
<br />
:This is a little tricky because you're an IP address. If you were registered, then you could just search your username in the archives page and it would bring up all the threads (though not completely useful if you happen to ''answer'' other people's questions in addition to asking your own!) The issue here is that you probably have a dynamic IP address (it's always changing) so, clicking on [[Special:Contributions/78.156.109.166]], you could scroll through to see all the questions you had asked ''with that particular IP address''. Or, you could go to [[Wikipedia:Reference Desk/Archive]] and go to the search bar on that page and search "78.156.109.166"; but, once again, this will only find threads that you had contributed to under that one address. If your IP doesn't change (static) then either of those methods would find ''all'' your questions. --[[User:Yellow1996|<span style="text-decoration: overline underline;">'''.Yellow1996.'''</span>]]<sup><small>([[User talk:Yellow1996|ЬMИED¡]])</small></sup> 01:17, 5 September 2013 (UTC)<br />
::I have an user: [[Special:Contributions/Pubserv|Pubserv]] ([[User talk:Pubserv|talk]]). [[Special:Contributions/78.156.109.166|78.156.109.166]] ([[User talk:78.156.109.166|talk]]) 08:38, 5 September 2013 (UTC)<br />
<br />
:::Okay - then go to [[Wikipedia:Reference Desk/Archive]]. On the page, there's a search bar; search "Pubserv" and all the threads you've participated in while logged into that account should show up. --[[User:Yellow1996|<span style="text-decoration: overline underline;">'''.Yellow1996.'''</span>]]<sup><small>([[User talk:Yellow1996|ЬMИED¡]])</small></sup> 02:05, 6 September 2013 (UTC)<br />
<br />
== mIRC ==<br />
<br />
What does the "m" mean? This applies to the whole world. [[Special:Contributions/78.156.109.166|78.156.109.166]] ([[User talk:78.156.109.166|talk]]) 19:19, 4 September 2013 (UTC)<br />
:Khaled has always said that it ''could'' mean [[moo]] or [[Mu (negative)|Mu]] (an in-joke, it means 'nothing').[http://www.mirc.com/pfaq.html] No-one really knows. [[User:Nanonic|Nanonic]] ([[User talk:Nanonic|talk]]) 20:39, 4 September 2013 (UTC)<br />
<br />
== New Virus ==<br />
<br />
I have a H.P. laptop that I have been operating daily for years, with no problems. Yesterday it started to have problems. It will not see the shortcuts, that I have been using all these years. It pops up in the lower right corner a Norton message "Auto Protect is processing security risk Suspicious.Cloud.7.EP." I assume this is a virus. I am suspecious it has affected the operation of the laptop. I ran Virus Scan with no viruses showing. Is this a harmful virus and how do I get rid of it so my shortcuts will operate correctly. Seems like there was also another message that said something to the effect of a Run100.dll not operating correctly. How do I replace it? Perhaps my shortcuts will operate correctly then again.--[[User:Doug Coldwell|Doug Coldwell]] ([[User talk:Doug Coldwell|talk]]) 19:21, 4 September 2013 (UTC)<br />
<br />
:Get a decent antivirus. I've cleaned computers of trojans and viruses for many friends and family members. Norton was on quite a few and is useless. It's also quite difficult to remove in a lot of cases and bulky. That's not to say that you have a virus, but prevention is better than cure. Personally i'm running Avast! and Winpatrol at all times and do monthly scans with Malwarebytes and Spybot S&D. Take a trip to CNET and read some reviews for the top rated antivirus products. The free ones are pretty good and score very well in most tests, while Norton spends their money on advertising by comparison. Good luck '''[[User:Jenova20|ツ <span style="background:pink"><span style="color:crimson; font-family:comic sans ms">Jenova</span>]][[User_talk:Jenova20|<span style="color:red">20</span>]]</span> <sup>([[Special:EmailUser/Jenova20|email]])</sup>''' 20:13, 4 September 2013 (UTC)<br />
<br />
:I second Jenova's notion of getting another AV program. Personally, I suggest [[AVG]]... I've used it for many years with only ''one'' problem. However, there are some people that just don't like AVG; and to those people I would suggest [[Ad-Aware]]. --[[User:Yellow1996|<span style="text-decoration: overline underline;">'''.Yellow1996.'''</span>]]<sup><small>([[User talk:Yellow1996|ЬMИED¡]])</small></sup> 01:20, 5 September 2013 (UTC)<br />
<br />
::I recently switched from AVG Free after 5+ years of reliable protection. I got tired of each version bugging me to upgrade or install their crappy toolbar. I like Avast!, and it blocked a malicious link for me just yesterday (my first since i installed it). I'm very happy with it. Thanks '''[[User:Jenova20|ツ <span style="background:pink"><span style="color:crimson; font-family:comic sans ms">Jenova</span>]][[User_talk:Jenova20|<span style="color:red">20</span>]]</span> <sup>([[Special:EmailUser/Jenova20|email]])</sup>''' 08:51, 5 September 2013 (UTC)<br />
:::Strange as I've never once been prompted to install any toolbars etc... the one problem I ''did'' encounter is documented right here in the ref desk archives, sometime in April for those interested. --[[User:Yellow1996|<span style="text-decoration: overline underline;">'''.Yellow1996.'''</span>]]<sup><small>([[User talk:Yellow1996|ЬMИED¡]])</small></sup> 02:08, 6 September 2013 (UTC)<br />
<br />
::::When you install it it asks if you want their toolbar, which slows your internet speed down, redirects your searches, and changes your homepage. It is difficult to remove and uninstalling does not revert these setting changes. So there's a lot of complaints on their forums because of it. Thanks '''[[User:Jenova20|ツ <span style="background:pink"><span style="color:crimson; font-family:comic sans ms">Jenova</span>]][[User_talk:Jenova20|<span style="color:red">20</span>]]</span> <sup>([[Special:EmailUser/Jenova20|email]])</sup>''' 08:50, 6 September 2013 (UTC)<br />
<br />
:::::That's strange, because when I had to reinstall AVG (due to the aforementioned problem) the toolbar disappeared, and I didn't notice any change in internet speed (though it may just have been subtle); but that's just my experience with it. --[[User:Yellow1996|<span style="text-decoration: overline underline;">'''.Yellow1996.'''</span>]]<sup><small>([[User talk:Yellow1996|ЬMИED¡]])</small></sup> 02:59, 7 September 2013 (UTC)<br />
:'Yellow' I think you meant [[AVG (software)]], "AVG" links to a disambiguation page. I'd also suggest trying [[Malwarebytes' Anti-Malware]]. (I see Jenova20 has suggested it already, but there's the link) --[[user:220 of Borg|'''220''']] [[Special:Contributions/220 of Borg|''<small>of</small>'']] <sup>[[User talk:220 of Borg|''Borg'']]</sup> 13:21, 5 September 2013 (UTC)<br />
::Yeah - thanks for catching that. I meant to check the link but didn't; I'll be more careful next time! ;) --[[User:Yellow1996|<span style="text-decoration: overline underline;">'''.Yellow1996.'''</span>]]<sup><small>([[User talk:Yellow1996|ЬMИED¡]])</small></sup> 02:08, 6 September 2013 (UTC)<br />
:A simple search reveals that "Suspicious.Cloud.7.EP" is indeed a trojan which adds your machine a botnet and downloads additional malware. A good anti-virus product should be able to remove it. However, it uses techniques which can hide it from Windows and make it resistant to removal attempts, or make you think it has gone, only to come back at the next reboot. [http://malwaretips.com/blogs/suspicious-cloud-7-ep-removal/ This page has detailed manual removal instructions] if you fancy giving that a go. [[User:Astronaut|Astronaut]] ([[User talk:Astronaut|talk]]) 19:08, 5 September 2013 (UTC)<br />
<br />
::Although it's good advice you gave, i'd be very wary of any site which recommends installing 8 different products to clean up one trojan. That's an accident waiting to happen and could create some serious conflicts, even from reliable vendors. Thanks '''[[User:Jenova20|ツ <span style="background:pink"><span style="color:crimson; font-family:comic sans ms">Jenova</span>]][[User_talk:Jenova20|<span style="color:red">20</span>]]</span> <sup>([[Special:EmailUser/Jenova20|email]])</sup>''' 08:58, 6 September 2013 (UTC)<br />
<br />
== Lorem Ipsum for computer code? ==<br />
<br />
Anyone know of a way to create dummy code? Something like Lorem Ipsum, but for different programming languages? I just need something that looks like different programming code (C, Python, C+, Java, etc) but doesn't contain any runnable code. --[[Special:Contributions/208.185.21.102|208.185.21.102]] ([[User talk:208.185.21.102|talk]]) 20:54, 4 September 2013 (UTC)<br />
:You could try [http://www.hackertyper.com/ hacker typer], just press some keys and copy the code out. It's a joke site, but produces "code like" output. Might be suitable for what you are after. [[User:Vespine|Vespine]] ([[User talk:Vespine|talk]]) 22:59, 4 September 2013 (UTC)<br />
<br />
:: That's not ''code like'', that's code - it's the source of [https://github.com/torvalds/linux/blob/master/kernel/groups.c groups.c], part of the Linux kernel. -- [[User:Finlay McWalter|Finlay McWalter]]'''ჷ'''[[User talk:Finlay McWalter|Talk]] 23:34, 4 September 2013 (UTC)<br />
<br />
:::Also IIRC you can change the language that hacker typer is using... like C/C++/Python etc. --[[User:Yellow1996|<span style="text-decoration: overline underline;">'''.Yellow1996.'''</span>]]<sup><small>([[User talk:Yellow1996|ЬMИED¡]])</small></sup> 01:21, 5 September 2013 (UTC)<br />
<br />
:Here's a small program I wrote a long time ago that finds the 1000th prime number, in a few languages:<br />
<br />
<source lang=python><br />
#!/usr/bin/python3<br />
from math import sqrt, ceil<br />
<br />
primes = [2]<br />
number = 3<br />
<br />
def check(number):<br />
for x in range(2, int(ceil(sqrt(number)))+1):<br />
if not number % x:<br />
return False<br />
return True<br />
<br />
if __name__ == "__main__":<br />
while len(primes) < 1001:<br />
if check(number):<br />
print("{} is a prime number.\r".format(number), end="")<br />
primes.append(number)<br />
number += 1<br />
print("\n{} is the 1000th prime number!".format(primes[999]))<br />
</source><br />
<br />
in C:<br />
<br />
<source lang=c><br />
#include <stdio.h><br />
#include <stdlib.h><br />
#include <math.h><br />
#include <stdbool.h><br />
<br />
bool check(int number) {<br />
for (int x = 2; x < (int) ceil(sqrt(number)) + 1; x++) {<br />
if (number % x == 0) {<br />
return false;<br />
}<br />
}<br />
return true;<br />
}<br />
<br />
int main(int argc, char *argv[]) {<br />
int num = 3;<br />
int i = 1;<br />
int *primes = malloc(1 * sizeof(int));<br />
primes[0] = 2;<br />
while (i < 1000) {<br />
if (check(num)) {<br />
printf("%d is a prime number.\r", num);<br />
primes = (int*) realloc(primes, (i+1) * sizeof(int));<br />
primes[i++] = num;<br />
}<br />
num++;<br />
}<br />
printf("\n%d is the 1000th prime number!\n", primes[999]);<br />
free(primes); primes = NULL;<br />
return 0;<br />
}<br />
</source><br />
<br />
in Perl:<br />
<br />
<source lang=perl><br />
#!/usr/bin/perl<br />
<br />
use strict;<br />
use warnings;<br />
use constant {True => 1, False => 0, None => undef};<br />
use POSIX qw(sqrt ceil);<br />
<br />
my @primes = (); push @primes, 2;<br />
my $number = 2;<br />
<br />
sub check {<br />
my $num = shift;<br />
for (my $x = 2; $x < int(ceil(sqrt($num)) + 1); $x += 1) {<br />
return False if ($num % $x eq 0);<br />
}<br />
return True;<br />
}<br />
<br />
while (scalar @primes < 1000) {<br />
if (check $number) {<br />
push @primes, $number;<br />
print "$number is a prime number.\r";<br />
}<br />
$number++;<br />
}<br />
print "\n$primes[999] is the 1000th prime number!\n";<br />
</source><br />
<br />
in Java:<br />
<br />
<source lang=java><br />
import java.lang.Math;<br />
import java.util.*;<br />
<br />
public class Java {<br />
public static void main(String[] args) {<br />
List primes = new ArrayList();<br />
primes.add(2);<br />
int number = 3;<br />
while (primes.size() < 1000) {<br />
if (check(number)) {<br />
primes.add(number);<br />
System.out.print(number + " is a prime number.\r");<br />
}<br />
number += 1;<br />
}<br />
System.out.print("\n" + primes.get(999) + " is the 1000th prime number!\n");<br />
}<br />
<br />
public static boolean check(int number) {<br />
for (int i = 2; i < Math.ceil(Math.sqrt(number)) + 1; i++) {<br />
if (number % i == 0) {<br />
return false;<br />
}<br />
}<br />
return true;<br />
}<br />
}<br />
</source><br />
<br />
<span style="font-family:Euclid Fraktur; background:white;">→[[User:Σ|<font color="#BA0000">Σ</font>]][[User talk:Σ|<font color="#036">σ</font>]][[Special:Contributions/Σ|<font color="#036">ς</font>]].&nbsp;<small>([[User:Σ|Sigma]])</small></span> 23:28, 4 September 2013 (UTC)<br />
<br />
:Thanks for all the samples. I really like the stair step paragraph indention used in the Mass Effect 2 hacking sequences [http://images2.wikia.nocookie.net/__cb20100828200944/masseffect/images/d/d5/Hacking.png]. Does it look like any real language? --[[Special:Contributions/208.185.21.102|208.185.21.102]] ([[User talk:208.185.21.102|talk]]) 20:09, 5 September 2013 (UTC)<br />
::The next time you want code samples try [http://rosettacode.org/wiki/Fibonacci_sequence RosettaCode] it's quite amazing the languages it does support. [[Special:Contributions/190.60.93.218|190.60.93.218]] ([[User talk:190.60.93.218|talk]]) 17:26, 6 September 2013 (UTC)<br />
:::That's terrific for short bits of code! Thank you. Sometimes I want something longer. Still haven't found a perfect solution... like Lorem Ipsum for source code. --[[Special:Contributions/208.185.21.102|208.185.21.102]] ([[User talk:208.185.21.102|talk]]) 00:29, 7 September 2013 (UTC)<br />
::::Just find a longer task and you will find longer code. [[Special:Contributions/190.60.93.218|190.60.93.218]] ([[User talk:190.60.93.218|talk]]) 17:54, 9 September 2013 (UTC)<br />
<br />
== SQL query ==<br />
<br />
I've got an SQL database table containing information about wireless networks. I want to select all rows with a non-unique ESSID. Is it possible to do this in SQL, and if so, how? --[[User:Carnildo|Carnildo]] ([[User talk:Carnildo|talk]]) 21:22, 4 September 2013 (UTC)<br />
<br />
: My SQL is poor, but this (with table and data, so we're talking about the same thing) does what I think you want:<br />
<source lang="sql"><br />
CREATE TABLE wifi (essid VARCHAR(30),<br />
location VARCHAR(30),<br />
note VARCHAR(30));<br />
<br />
INSERT INTO wifi VALUES<br />
('office', 'Frankfurt', 'my office'),<br />
('homenet', 'Essen', 'fins home'),<br />
('office', 'Llanddewi Brefi', 'head office'),<br />
('foonet', 'Cleveland, OH', 'hotel in cleveland'),<br />
('barnet', 'Oakland, CA', 'moms house'),<br />
('foonet', 'unknown', 'oops'),<br />
('office', 'Tokyo', 'asahi networks');<br />
<br />
SELECT * FROM wifi WHERE essid IN<br />
( SELECT essid from wifi GROUP BY essid HAVING count(*)>1 )<br />
ORDER BY essid;<br />
</source><br />
: That works okay for me in Sqlite3 -- [[User:Finlay McWalter|Finlay McWalter]]'''ჷ'''[[User talk:Finlay McWalter|Talk]] 22:20, 4 September 2013 (UTC)<br />
<br />
::Thanks. --[[User:Carnildo|Carnildo]] ([[User talk:Carnildo|talk]]) 22:39, 5 September 2013 (UTC)</div>190.60.93.218https://en.formulasearchengine.com/index.php?title=Talk:Exponentiation_by_squaring&diff=287496Talk:Exponentiation by squaring2013-09-09T17:32:37Z<p>190.60.93.218: /* Programming */</p>
<hr />
<div>{{maths rating|class=Start|priority=Low|field=basics}}<br />
Maybe you should add a link to the Peasant multiplication in [[Ancient_Egyptian_multiplication]]<br />
---- <small>—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/85.250.163.119|85.250.163.119]] ([[User talk:85.250.163.119|talk]]) 10:21, 23 August 2008 (UTC)</small><!-- Template:UnsignedIP --> <!--Autosigned by SineBot--><br />
<br />
I guess we should present the iterative version of this algorithm:<br />
<br />
power(x,n) is computed as long as n is not negative<br />
assign 1 to result<br />
as long as n is positive<br />
assign result*x to result if n is odd<br />
assign x*x to x<br />
assign the truncated to next integer of n diveded by 2 to n<br />
return result<br />
<br />
<br />
[[User:Robert Dober|Robert Dober]] 2003-07-05 MEDST<br />
<br />
This is the 2^k-ary method with k=1 so it is covered. However, the current presentation hides this; when I have time, I will improve it.[[User:Fizban99|Fizban99]] ([[User talk:Fizban99|talk]]) 11:07, 23 January 2010 (UTC)<br />
<br />
----<br />
<br />
Never mind, and there is even an error in my algorithm, really well done Robert,<br />
sorry for the noise :(<br />
<br />
[[User:Robert Dober|Robert Dober]] 2003-07-05 MEDST<br />
<br />
----<br />
<br />
== Article incomplete ==<br />
<br />
One aspect of this subject not mentioned is that this binary algorithm doesn't get to the exponent as fast as possible. For example: <br />
<br />
1. x^62 => x^31*x^31<br />
2. x^31 => x*x^30<br />
3. x^30 => x^15*x^15<br />
4. x^15 => x*x^14<br />
5. x^14 => x^7*x^7<br />
6. x^7 => x*x^6<br />
7. x^6 => x^3*x^3<br />
8. x^3 => x*x^2<br />
9. x^2 => x*x<br />
<br />
but assuming we remember all exponents we've previously created... <br />
<br />
1. x*x => x^2<br />
2. x^2*x^2 => x^4<br />
3. x^4*x^4 => x^8<br />
4. x^8*x^8 => x^16<br />
5. x^4*x^16 => x^20<br />
6. x^20*x^20 => x^40<br />
7. x^20*x^40 => x^60<br />
8. x^2*x^60 => x^62<br />
<br />
This takes one step less. I have some more information on this if it would be interesting to have here. This isn't exactally exponentiating by squaring, but along the same lines.<br />
<br />
---Jay<br />
<br />
Yes, this would be interesting!<br />
Especially if there is (as I would expect) a quick systematic way to get at the fastest method, then this should be mentioned in the article as a ''variation''.<br />
(And even if there's not a fast alternative algorithm, then this fact can still be mentioned.)<br />
Is this the [[addition chain exponentiation]] that [[User:Henrygb|Henrygb]] linked?<br />
-- [[User:Toby Bartels|Toby Bartels]] 19:58, 7 Aug 2004 (UTC)<br />
<br />
: Yes, both of these are considered [[addition chain]]s. It is considered hard to generate minimal addition chains (where one takes the absolute least number of steps required to perform the exponentiation). In other words, there's a ton of setup that goes into generating these minimal chains, but they execute faster than any other addition chain. That makes them useless when only a single exponentiation is being performed, as so much time is spent in the setup. Binary addition chains (which is what this article is about) require no setup and are close enough to minimal to make them useful. Note that in the above example, there was only a one step difference. Such a binary addition chain executes somewhat more slowly than a minimal-length chain, but the time saved in skipping initial setup causes the net speed to be in the binary chain's favor. -- [[User:Vesta|Vesta]] 09:12, 16 Aug 2004 (UTC)<br />
<br />
: As an aside, by definition exponentiation by squaring is a variation of addition chain exponentiation, not the other way around. :) -- [[User:Vesta|Vesta]] 09:14, 16 Aug 2004 (UTC)<br />
<br />
==Iterative version useful?==<br />
<br />
''It doesn't use recursion, which increases the speed even further.''<br />
<br />
Is it useful at all, though? To take the example from the article, x^1000000 requires 41 multiplications (and even fewer recursive calls than that). If you calculate x^1000000 for any x bigger than 1, the relative time spent on calls will be completely negligible. [[User:Fredrik|Fredrik]] | [[User talk:Fredrik|talk]] 16:40, 17 Feb 2005 (UTC)<br />
:If the function is executed every millisecond or so, it's probably very useful. [[Special:Contributions/190.60.93.218|190.60.93.218]] ([[User talk:190.60.93.218|talk]]) 17:27, 9 September 2013 (UTC)<br />
<br />
== Those code snippets are "yowch" ==<br />
<br />
The following Haskell code implements this algorithm in just 3 lines of code:<br />
<br />
power b 0 = 1<br />
power b e | even e = power (b*b) (e `div` 2)<br />
power b e | odd e = b * power (b*b) (e `div` 2)<br />
<br />
The following code is tail-recursive, so it uses less stack space:<br />
<br />
power' r b 0 = r<br />
power' r b e | even e = power' r (b*b) (e `div` 2)<br />
power' r b e | odd e = power' (r*b) (b*b) (e `div` 2)<br />
power b e = power' 1 b e<br />
<br />
The above will work for any type of b that the * operator is defined on (any type in the Num class). It can be generalized to use any function in place of multiplication:<br />
<br />
power f r b 0 = r<br />
power f r b e | even e = power' r (f b b) (e `div` 2)<br />
power f r b e | odd e = power' (f r b) (f b b) (e `div` 2)<br />
<br />
The original function is now power (*) 1, and, say, multiplication can be implemented as power (+) 0. --[[User:Ihope127|Ihope127]] 02:13, 12 April 2006 (UTC) (edited 14:43, 12 April 2006 (UTC))<br />
<br />
== Far too many examples ==<br />
<br />
The article needs to be severely cut down. Most wikipedia math articles could use more examples, but this page has ''far'' too many examples. The same ground is covered repeatedly. [[User:165.189.91.148|165.189.91.148]] 20:54, 10 May 2006 (UTC)<br />
<br />
== Text Concatenation ==<br />
<br />
This algorithm is unsuitable for text concatenation. Instead, the following algorithm is more efficient:<br />
<br />
function repeat ( s, n ) {<br />
if ( s == "" || n < 1 )<br />
return "";<br />
if ( n == 1 )<br />
return s;<br />
var res = s;<br />
for ( var i = 2 ; i < n ; i *= 2 )<br />
res = res + res;<br />
return res + res.substr( 0, s.length * n - res.length );<br />
}<br />
<br />
== Results of binary decomposition assume a slightly different algorithm ==<br />
<br />
The case for n=1 is missing in the original definition of the algorithm. I realize it's probably obvious, but it should probably be included for completeness. In fact, why bother with restricting the odd case to n>2 at all (since it reduces to 'x' anyway for n=1) and just use what's below instead?<br />
<br />
:<math><br />
\mbox{Power}(x,\,n)=<br />
\begin{cases} 1, & \mbox{if }n\mbox{ = 0} \\ <br />
\mbox{Power}(x^2,\,n/2), & \mbox{if }n\mbox{ is even} \\<br />
x\times\mbox{Power}(x^2,\,(n-1)/2), & \mbox{if }n\mbox{ is odd}<br />
\end{cases}<br />
</math><br />
<br />
But I have a bigger concern, and that's the fact that the definition given above doesn't result in an expression with the same economy that the binary decomposition does. When I found that the binary decomposition of the expression results in one with fewer multiplications, I was confused. I asked myself why a better definition wasn't given instead, one which results in the same number of multiplications as the binary decomposition, but without the intermediate expression. It seems cumbersome to apply the above definition to get one expression, then go through the manual process of binary decomposition of that to get a more economical expression (which is the way it was done in the examples in the article). So why not use the following definition instead:<br />
<br />
:<math><br />
\mbox{Power}(x,\,n)=<br />
\begin{cases} 1, & \mbox{if }n\mbox{ = 0} \\ <br />
(\mbox{Power}(x,\,n/2))^2, & \mbox{if }n\mbox{ is even} \\<br />
x\times(\mbox{Power}(x,\,(n-1)/2))^2, & \mbox{if }n\mbox{ is odd}<br />
\end{cases}<br />
</math><br />
<br />
For instance, in the case of x<sup>100</sup>, the expression it produces requries 8 multiplications, while the expression produced by the first definition requires 15 multiplications. (For either definition, an extra multiplication is saved by recognizing that <s>Power(x,n)=x</s> Power(x,1)=x (sorry, typo), and treating it as a fourth case.)<br />
<br />
Does anyone have any objections to me updating the definition in the article with this updated one? I think it would reduce some confusion.<br />
<br />
--[[User:Pdelong|Paul]] 06:53, 7 March 2007 (UTC)<br />
<br />
Agreed. Also I fail to see the need for multiple recursive definitions on the page. I merged the content.[[User:Fizban99|Fizban99]] ([[User talk:Fizban99|talk]]) 10:54, 23 January 2010 (UTC)<br />
<br />
== Text application ==<br />
<br />
I don't understand at all how the text application applies at all to the article. I recommend deletion.<br />
<br />
[[User:R00723r0|R00723r0]] 08:58, 15 July 2007 (UTC)<br />
<br />
Exponentiation can be viewed as multiplying exponents. Multiplying can be viewed as adding exponents (i.e., logarithms). The text application leverages this by viewing concatenation as a variant of multiplication. Then the same techniques that are used for exponentiation (and thus that are available to multiplying exponents where "multiplying exponents" is just another name for exponentiation) are now available to multiplying strings. Thus it is quite related and should stay as is. —[[User:Optikos|optikos]] ([[User talk:Optikos|talk]]) 03:48, 17 June 2008 (UTC)<br />
<br />
No R00723r0 is quite correct. This is original research that is not related to exponentiation. Please provide a citation of where it has been published before that shows the relation. Furthermore it is a terrible way to do string repetition as it assumes that the copy/append operations are unit-time, where-as in most implementations they would be linear time over the length of the operands. As a result, in any run-time where the linear component dominates over the fixed start-up cost, or in any run-time over large enough operands (ie asymptotically) this method is *slower* than the naive approach of allocating a buffer and then looping over the repeated string to fill it. I have removed this section pending some sort of citation to show that it is not original research. [[User:Amoss|Amoss]] ([[User talk:Amoss|talk]]) 12:38, 9 April 2009 (UTC)<br />
<br />
== Programming ==<br />
<br />
I think it would be a good idea to stick to one programming language throughout the article, or even just a pseudo-language. Furthermore, I don't think most people can benefit from Javascript examples.<br />
<br />
[[User:R00723r0|R00723r0]] 09:03, 15 July 2007 (UTC)<br />
<br />
:I agree, please just use [[pseudo-code]]. Binary exponentiation is simple enough that we hardly need to get into the syntax of any particular programming language ''du jour''. [[User:24.61.43.18|24.61.43.18]] 15:36, 14 August 2007 (UTC)<br />
::Your comment did benefit me ironically, since you said there was a JavaScript implementation out there thus making me search for this implementation and helping me out understand [[Special:Contributions/190.60.93.218|190.60.93.218]] ([[User talk:190.60.93.218|talk]]) 17:32, 9 September 2013 (UTC)<br />
<br />
==Simpler==<br />
Why unroll the recursion manually?<br />
This is simpler:<br />
:<math><br />
\mbox{Power}(x,\,n)=<br />
\begin{cases} 1, & \mbox{if }n\mbox{ = 0} \\ <br />
x\times\mbox{Power}(x,\,n-1), & \mbox{if }n\mbox{ is odd} \\<br />
\mbox{Power}(x,\,n/2)^2, & \mbox{if }n\mbox{ is even}<br />
\end{cases}<br />
</math><br />
For "n=0" and "n is odd", this is standard recursive exponentiation. Just "n is even" case is optimized, according to:<br />
:<math><br />
x^n=x^{n/2} \times x^{n/2}<br />
</math><br />
[[User:Exe|exe]] ([[User talk:Exe|talk]]) 18:08, 22 May 2008 (UTC)<br />
<br />
I believe the reason is that the former emphasizes you get precisely lg n calls to the function, facilitating the analysis.[[User:Fizban99|Fizban99]] ([[User talk:Fizban99|talk]]) 10:48, 23 January 2010 (UTC)<br />
<br />
== Underlying idea: I'd like to add one logical step ==<br />
<br />
This is the current version:<br />
<math><br />
x^n= <br />
\begin{cases}<br />
1, & \mbox{if } n = 0 \\ <br />
1/x^{-n}, & \mbox{if } n < 0 \\ <br />
x \cdot \left( x^{\frac{n-1}{2}} \right)^2, & \mbox{if } n \mbox { is odd} \\<br />
\left( x^{\frac{n}{2}} \right)^2, & \mbox{if }n\mbox{ is even}<br />
\end{cases}<br />
</math><br />
<br />
But I feel that the third equation could be modified to say<br />
<br />
<br />
<math><br />
x^n= <br />
\begin{cases}<br />
1, & \mbox{if } n = 0 \\ <br />
1/x^{-n}, & \mbox{if } n < 0 \\ <br />
x \cdot x^{n-1}, & \mbox{if } n \mbox { is odd, i.e. } n - 1 \mbox{ is even} \\<br />
\left( x^{\frac{n}{2}} \right)^2, & \mbox{if }n\mbox{ is even}<br />
\end{cases}<br />
</math><br />
<br />
That would make this equation a lot clearer, and the next step follows by the fourth equation, instead of having both in one step. It should be noted that the algorithm makes both steps at once for increased performance, though. <span style="font-size: smaller;" class="autosigned">—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/134.96.57.229|134.96.57.229]] ([[User talk:134.96.57.229|talk]]) 18:03, 6 February 2011 (UTC)</span><!-- Template:UnsignedIP --> <!--Autosigned by SineBot--><br />
<br />
I didn't really see the post above, so sorry for that. I'm still all for the change though, especially now that we're talking about "underlying idea" instead of the actual algorithm used lateron. Also, for the logarithmic time you don't need to divide the argument by 2 on every iteration; You merely have to do so every O(1) steps. <br />
--[[Special:Contributions/134.96.57.229|134.96.57.229]] ([[User talk:134.96.57.229|talk]]) 18:09, 6 February 2011 (UTC)<br />
<br />
== Underlying idea: Negative Exponent ==<br />
<br />
Seeing how there is an edit war between those who believe that<br />
<br />
<math><br />
x^n = 1/{x^n}<br />
</math><br />
<br />
And those who know that <br />
<br />
<math><br />
x^n = 1/{x^{-n}}<br />
</math><br />
<br />
Just look at this:<br />
<br />
<math>x^n = 1/x^{-n}</math> <br />
<br />
Multiply both sides by <math> x^{-n}</math> and you get<br />
<br />
<math>x^n \cdot x^{-n} = 1</math><br />
<br />
Product with same base allows contraction of exponents, such that <br />
<br />
<math>x^{n + \left(-n\right)} = 1</math><br />
<br />
Performing the addition yields <br />
<br />
<math>x^0 = 1 = 1</math><br />
<br />
which is true by reflexivity.<br />
<br />
The other one only works for <math>n=0</math> or <math>x=1</math>.<br />
<br />
--[[Special:Contributions/134.96.57.229|134.96.57.229]] ([[User talk:134.96.57.229|talk]]) 18:43, 6 February 2011 (UTC)</div>190.60.93.218