url
stringlengths
6
1.61k
fetch_time
int64
1,368,856,904B
1,726,893,854B
content_mime_type
stringclasses
3 values
warc_filename
stringlengths
108
138
warc_record_offset
int32
9.6k
1.74B
warc_record_length
int32
664
793k
text
stringlengths
45
1.04M
token_count
int32
22
711k
char_count
int32
45
1.04M
metadata
stringlengths
439
443
score
float64
2.52
5.09
int_score
int64
3
5
crawl
stringclasses
93 values
snapshot_type
stringclasses
2 values
language
stringclasses
1 value
language_score
float64
0.06
1
https://forums.welltrainedmind.com/topic/490797-needed-math-manipulative-for-singapore-math-2/?tab=comments#comment-5245136
1,632,683,632,000,000,000
text/html
crawl-data/CC-MAIN-2021-39/segments/1631780057913.34/warc/CC-MAIN-20210926175051-20210926205051-00712.warc.gz
300,435,799
31,692
needed math manipulative for Singapore Math 2 Recommended Posts Hello! Through Singapore Primary math 1 we pretty much had the manipulatives on hand, mostly using c-rods, number cards, and 100 chart.  Now for 2 (we're using Standards Edition) I found I didn't have everything needed for the lessons.  If you use this curriculum, which math manipulatives are essential? I will list what the HIG says I need here: whiteboard - got it multilink cubes - we have these from another math curriculum, but don't use them base-10 set - we have 2 sets of c-rods place-value discs - I just made some of these up using counters since we got to a lesson that needed them place-value chart - just made one of these, too counters - now I've got 'em. hundred chart - got it number cubes - how often will I use this?  I don't have one number cards - got these from our RS math games place-value cards meter stick/yard stick, ruler, measuring tape - got it around the house scale - we have a kitchen scale kilogram, gram, pound, ounce weights - I need to get these fact cards (for addition, subtraction, multiplication and division) - does anyone use these with SM?  Where can I find them?  I don't want to make them all. Share on other sites My son has found Base-10 blocks to be super useful in doing addition and subtraction of larger numbers. He has trouble "visualizing" what 452 would look like, so the Base-10 blocks have been great. I made fact cards from 3x5 note cards, but have just done the addition and subtraction ones so far. If you don't want to make them, there are a number of places you can buy them (Jo-Anns, Target, Walgreens, Walmart, etc). Share on other sites For place value cards, you could make them from index cards.  I think I made 4 sizes: (1) smallest size:  each card is numbered 0-9 (2) next size up:  each card is numbered 10, 20, 30,...90 (3) next size up:  each card is numbered 100, 200, 300,...900 (4) largest size:  each card is numbered 1000, 2000, 3000,...9000 See the link for a picture:  http://www.singaporemath.com/Place_Value_Strips_4_Digit_1_3_p/mnpvs-4d.htm For the scale, I recommend a balance scale in addition to your kitchen scale.  I know some levels of Singapore had you use a balance scale to measure weights of objects by making it balance and also comparing the weight of things in the baskets.  Here's the one we used... http://www.amazon.com/Learning-Resources-Baby-Bear-Balance/dp/B000P7MALK   We also learned about different units of measure by doing activities like this:  place a hotwheels car on one side of the balance and see how many paper clips it weighs, then see how many counting bears it weighs. I don't remember using "number cubes" at all though we did use the mathlink cubes occasionally. HTH! Share on other sites Thanks to you both! For the scale, I recommend a balance scale in addition to your kitchen scale.  I know some levels of Singapore had you use a balance scale to measure weights of objects by making it balance and also comparing the weight of things in the baskets.  Here's the one we used... http://www.amazon.com/Learning-Resources-Baby-Bear-Balance/dp/B000P7MALK   We also learned about different units of measure by doing activities like this:  place a hotwheels car on one side of the balance and see how many paper clips it weighs, then see how many counting bears it weighs. That scale looks great!  I only have a super simple (cheap?) scale that hardly holds any counting bears so it was difficult to use unless we had tiny things to weigh or compare...  I appreciate the link! :) Share on other sites Hello! Through Singapore Primary math 1 we pretty much had the manipulatives on hand, mostly using c-rods, number cards, and 100 chart.  Now for 2 (we're using Standards Edition) I found I didn't have everything needed for the lessons.  If you use this curriculum, which math manipulatives are essential? I will list what the HIG says I need here: ....fact cards (for addition, subtraction, multiplication and division) - does anyone use these with SM?  Where can I find them?  I don't want to make them all. They are easy to make, and you can even print them if you want to, though a sharpie and a pack of 3x5 cards will take you pretty far also. If you really just want to buy them you can get math fact cards at WalMart, CVS, Walgreens, Target, DollarTree, Dollar General, Dollar Shack, Hoopers, Krogers, Publix, Eckerds (do they still have this store??) Amazon.com, Used bookstores, Books-A-Million, Teacher supply stores such as Lakeshore, and even some gas stations. You can even have the kids make them. Its good practice. Share on other sites The things I use most with SM are white board place value chart and the discs 100 chart base 10 c-rods (I use both quite a lot. Base 10 are better for some things, c-rods for others. I wouldn't be without either) Teaching clock counters maybe a bucket balance, but it isn't the end of the world if you don't have one. But, my sons really did enjoy doing their own 'experiments' with one. Everything, such as the teaching clock, have their unit or season, but the base ten and c-rods get the most work. After those I would say the place value chart and the discs. Join the conversation You can post now and register later. If you have an account, sign in now to post with your account. ×   Pasted as rich text.   Paste as plain text instead Only 75 emoji are allowed.
1,365
5,456
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.125
3
CC-MAIN-2021-39
latest
en
0.946991
https://hackerthink.com/solutions/why-not-use-larger-cipher-keys/
1,642,816,418,000,000,000
text/html
crawl-data/CC-MAIN-2022-05/segments/1642320303729.69/warc/CC-MAIN-20220122012907-20220122042907-00621.warc.gz
328,161,911
38,363
Home » Why not use larger cipher keys? # Why not use larger cipher keys? ## Solutons: The reason why RSA keys are so small is that: With every doubling of the RSA key length, decryption is 6-7 times times slower. So this is just another of the security-convenience tradeoffs. Here’s a graph: Source: http://www.javamex.com/tutorials/cryptography/rsa_key_length.shtml I dug out my copy of Applied Cryptography to answer this concerning symmetric crypto, 256 is plenty and probably will be for a long long time. Schneier explains; Longer key lengths are better, but only up to a point. AES will have 128-bit, 192-bit, and 256-bit key lengths. This is far longer than needed for the foreseeable future. In fact, we cannot even imagine a world where 256-bit brute force searches are possible. It requires some fundamental breakthroughs in physics and our understanding of the universe. One of the consequences of the second law of thermodynamics is that a certain amount of energy is necessary to represent information. To record a single bit by changing the state of a system requires an amount of energy no less than kT, where T is the absolute temperature of the system and k is the Boltzman constant. (Stick with me; the physics lesson is almost over.) Given that k = 1.38 × 10−16 erg/K, and that the ambient temperature of the universe is 3.2 Kelvin, an ideal computer running at 3.2 K would consume 4.4 × 10−16 ergs every time it set or cleared a bit. To run a computer any colder than the cosmic background radiation would require extra energy to run a heat pump. Now, the annual energy output of our sun is about 1.21 × 1041 ergs. This is enough to power about 2.7 × 1056 single bit changes on our ideal computer; enough state changes to put a 187-bit counter through all its values. If we built a Dyson sphere around the sun and captured all its energy for 32 years, without any loss, we could power a computer to count up to 2192. Of course, it wouldn’t have the energy left over to perform any useful calculations with this counter. But that’s just one star, and a measly one at that. A typical supernova releases something like 1051 ergs. (About a hundred times as much energy would be released in the form of neutrinos, but let them go for now.) If all of this energy could be channeled into a single orgy of computation, a 219-bit counter could be cycled through all of its states. These numbers have nothing to do with the technology of the devices; they are the maximums that thermodynamics will allow. And they strongly imply that brute-force attacks against 256-bit keys will be infeasible until computers are built from something other than matter and occupy something other than space. The boldness is my own addition. Remark: Note that this example assumes that there is a ‘perfect’ encryption algorithm. If you can exploit weaknesses in the algorithm, the key space might shrink and you’d end up with effectively less bits of your key. It also assumes that the key generation is perfect – yielding 1 bit of entropy per bit of key. This is often difficult to achieve in a computational setting. An imperfect generation mechanism might yield 170 bits of entropy for a 256 bit key. In this case, if the key generation mechanism is known, the size of the brute-force space is reduced to 170 bits. Assuming quantum computers are feasible, however, any RSA key will be broken using Shor’s algorithm. (See https://security.stackexchange.com/a/37638/18064) For one AES is built for three key sizes `128, 192 or 256 bits`. Currently, brute-forcing 128 bits is not even close to feasible. Hypothetically, if an AES Key had 129 bits, it would take twice as long to brute-force a 129 bit key than a 128 bit key. This means larger keys of 192 bits and 256 bits would take much much much longer to attack. It would take so incredibly long to brute-force one of these keys that the sun would stop burning before the key was realized. `2^256=115792089237316195423570985008687907853269984665640564039457584007913129639936` That’s a big freaking number. That’s how many possibly keys there are. Assuming the key is random, if you divide that by 2 then you have how many keys it will take on average to brute-force AES-256 In a sense we do have the really big cipher keys you are talking of. The whole point of a symmetric key is to make it unfeasible to brute-force. In the future, if attacking a 256bit key becomes possible then keysizes will surely increase, but that is quite a ways down the road. The reason RSA keys are much larger than AES keys is because they are two completely different types of encryption. This means a person would not attack a RSA key the same as they would attack an AES Key. Attacking symmetric keys is easy. 1. Start with a bitstring `000...` 2. Decrypt ciphertext with that bitstring. 3. If you can read it, you succeeded. 4. If you cannot read it then increment the bitstring Attacking an RSA key is different…because RSA encryption/decryption works with big semi-prime numbers…the process is mathy. With RSA, you don’t have to try every possible bit string. You try far fewer than `2^1024` or `2^2048` bitstrings…but it’s still not possible to bruteforce. This is why RSA and AES keys differ in size.[1] To sum up everything and answer your question in 1 sentence. We don’t need ridiculously big symmetric keys because we already have ridiculously big symmetric keys. 256 bit encryption sounds wimpy compared to something like a 2048 bit RSA Key, but the algorithms are different and can’t really be compared ‘bit to bit’ like that. In the future if there is a need to longer keys then there will be new algorithms developed to handle larger keys. And if we ever wanted to go bigger on current hardware, it’s simply a time tradeoff. Bigger key means longer decryption time means slower communication. This is especially important for a cipher since your internet browser will establish and then use a symmetric key to send information. ## Extract file from docker image? You can extract files from an image with the following commands: docker create \$image # returns container ID docker cp \$container_id:\$source_path \$destination_path docker rm \$container_id According to the docker create documentation, this doesn't run the... ## Transfer files using scp: permission denied Your commands are trying to put the new Document to the root (/) of your machine. What you want to do is to transfer them to your home directory (since you have no permissions to write to /). If path to your home is something like /home/erez try the following:... ## What’s the purpose of DH Parameters? What exactly is the purpose of these DH Parameters? These parameters define how OpenSSL performs the Diffie-Hellman (DH) key-exchange. As you stated correctly they include a field prime p and a generator g. The purpose of the availability to customize these... ## How to rsync multiple source folders You can pass multiple source arguments. rsync -a /etc/fstab /home/user/download bkp This creates bkp/fstab and bkp/download, like the separate commands you gave. It may be desirable to preserve the source structure instead. To do this, use / as the source and... ## Benefits of Structured Logging vs basic logging There are two fundamental advances with the structured approach that can't be emulated using text logs without (sometimes extreme levels of) additional effort. Event Types When you write two events with log4net like: log.Debug("Disk quota {0} exceeded by user... ## Interfaces vs Types in TypeScript 2019 Update The current answers and the official documentation are outdated. And for those new to TypeScript, the terminology used isn't clear without examples. Below is a list of up-to-date differences. 1. Objects / Functions Both can be used to describe the... ## Get total as you type with added column (append) using jQuery One issue if that the newly-added column id's are missing the id number. If you look at the id, it only shows "price-", when it should probably be "price-2-1", since the original ones are "price-1", and the original ones should probably be something like... ## Determining if a file is a hard link or symbolic link? Jim's answer explains how to test for a symlink: by using test's -L test. But testing for a "hard link" is, well, strictly speaking not what you want. Hard links work because of how Unix handles files: each file is represented by a single inode. Then a single... ## How to restrict a Google search to results of a specific language? You can do that using the advanced search options: http://www.googleguide.com/sharpening_queries.html I also found this, which might work for you: http://www.searchenginejournal.com/how-to-see-google-search-results-for-other-locations/25203/ Just wanted to add... ## Random map generation Among the many other related questions on the site, there's an often linked article for map generation: Polygonal Map Generation for Games you can glean some good strategies from that article, but it can't really be used as is. While not a tutorial, there's an... ## Difference in sites-available vs sites-enabled vs conf.d directories (Nginx)? The sites-* folders are managed by nginx_ensite and nginx_dissite. For Apache httpd users who find this with a search, the equivalents is a2ensite/a2dissite. The sites-available folder is for storing all of your vhost configurations, whether or not they're... ## How to prettyprint a JSON file? The json module already implements some basic pretty printing in the dump and dumps functions, with the indent parameter that specifies how many spaces to indent by: >>> import json >>> >>> your_json = '["foo", {"bar":["baz", null,... ## How can I avoid the battery charging when connected via USB? I have an Android 4.0.3 phone without root access so can't test any of this but let me point you to /sys/class/power_supply/battery/ which gives some info/control over charging issues. In particular there is charging_enabled which gives the current state (0 not... ## How to transform given dataset in python? [closed] From your expected result, it appears that each "group" is based on contiguous id values. For this, you can use the compare-cumsum-groupby pattern, and then use agg to get the min and max values. # Sample data. df = pd.DataFrame( {'id': [1, 2, 2, 2, 2, 2, 1, 1,... ## Output of the following C++ Program [closed] It works exactly like this non-recursive translation: int func_0() { return 2; } int func_1() { return 3; } int func_2() { return func_1() + func_0(); } // Returns 3 + 2 = 5 int func_3() { return func_2() + func_1(); } // Returns 5 + 3 = 8 int func_4() { return... ## Making a circle out of . (periods) [closed] Here's the maths and even an example program in C: http://pixwiki.bafsoft.com/mags/5/articles/circle/sincos.htm (link no longer exists). And position: absolute, left and top will let you draw: http://www.w3.org/TR/CSS2/visuren.html#choose-position Any further... ## Should I use a code converter (Python to C++)? Generally it's an awful way to write code, and does not guarantee that it will be any faster. Things which are simple and fast in one language can be complex and slow in another. You're better off either learning how to write fast Python code or learning C++... ## tkinter: cannot concatenate ‘str’ and ‘float’ objects This one line is more than enough to cause the problem: text="რეგულარი >> "+2.23+ 'GEL' 2.23 is a floating-point value; 'GEL' is a string. What does it mean to add an arithmetic value and a string of letters? If you want the string label 'რეგულარი... ## Java regex for removing all single letters except “a” and “i” from string [closed] Code See regex in use here (?:^| )[b-hj-z](?= |\$) Usage See code in use here import java.util.regex.Matcher; import java.util.regex.Pattern; class Ideone { public static void main (String[] args) throws java.lang.Exception { final String regex = "(?:^|... ## How to make a file (e.g. a .sh script) executable, so it can be run from a terminal You can mark the file as executable: chmod +x filename.sh You can then execute it like this: ./filename.sh If you want to use a different command to start it, you can add an alias: gedit ~/.bashrc Add this at the end of the file: alias <new...
2,876
12,307
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.8125
3
CC-MAIN-2022-05
latest
en
0.909455
https://www.justintools.com/unit-conversion/time.php?k1=gigaseconds&k2=callippic-cycles
1,718,725,666,000,000,000
text/html
crawl-data/CC-MAIN-2024-26/segments/1718198861762.73/warc/CC-MAIN-20240618140737-20240618170737-00412.warc.gz
740,023,622
26,796
Please support this site by disabling or whitelisting the Adblock for "justintools.com". I've spent over 10 trillion microseconds (and counting), on this project. This site is my passion, and I regularly adding new tools/apps. Users experience is very important, that's why I use non-intrusive ads. Any feedback is appreciated. Thank you. Justin XoXo :) # TIME Units Conversiongigaseconds to callippic-cycles 1 Gigaseconds = 0.4169485238688 Callippic Cycles Category: time Conversion: Gigaseconds to Callippic Cycles The base unit for time is seconds (SI Unit) [Gigaseconds] symbol/abbrevation: (Gs) [Callippic Cycles] symbol/abbrevation: (cali) How to convert Gigaseconds to Callippic Cycles (Gs to cali)? 1 Gs = 0.4169485238688 cali. 1 x 0.4169485238688 cali = 0.4169485238688 Callippic Cycles. Always check the results; rounding errors may occur. Definition: In relation to the base unit of [time] => (seconds), 1 Gigaseconds (Gs) is equal to 1000000000 seconds, while 1 Callippic Cycles (cali) = 2398377600 seconds. 1 Gigaseconds to common time units 1 Gs = 1000000000 seconds (s) 1 Gs = 16666666.666667 minutes (min) 1 Gs = 277777.77777778 hours (hr) 1 Gs = 11574.074074074 days (day) 1 Gs = 1653.4391534392 weeks (wk) 1 Gs = 31.709791983765 years (yr) 1 Gs = 380.51750380518 months (mo) 1 Gs = 3.1705770450222 decades (dec) 1 Gs = 0.31705770450222 centuries (cent) 1 Gs = 0.031705770450222 millenniums (mill) Gigasecondsto Callippic Cycles (table conversion) 1 Gs = 0.4169485238688 cali 2 Gs = 0.8338970477376 cali 3 Gs = 1.2508455716064 cali 4 Gs = 1.6677940954752 cali 5 Gs = 2.084742619344 cali 6 Gs = 2.5016911432128 cali 7 Gs = 2.9186396670816 cali 8 Gs = 3.3355881909504 cali 9 Gs = 3.7525367148192 cali 10 Gs = 4.169485238688 cali 20 Gs = 8.338970477376 cali 30 Gs = 12.508455716064 cali 40 Gs = 16.677940954752 cali 50 Gs = 20.84742619344 cali 60 Gs = 25.016911432128 cali 70 Gs = 29.186396670816 cali 80 Gs = 33.355881909504 cali 90 Gs = 37.525367148192 cali 100 Gs = 41.69485238688 cali 200 Gs = 83.38970477376 cali 300 Gs = 125.08455716064 cali 400 Gs = 166.77940954752 cali 500 Gs = 208.4742619344 cali 600 Gs = 250.16911432128 cali 700 Gs = 291.86396670816 cali 800 Gs = 333.55881909504 cali 900 Gs = 375.25367148192 cali 1000 Gs = 416.9485238688 cali 2000 Gs = 833.8970477376 cali 4000 Gs = 1667.7940954752 cali 5000 Gs = 2084.742619344 cali 7500 Gs = 3127.113929016 cali 10000 Gs = 4169.485238688 cali 25000 Gs = 10423.71309672 cali 50000 Gs = 20847.42619344 cali 100000 Gs = 41694.85238688 cali 1000000 Gs = 416948.5238688 cali 1000000000 Gs = 416948523.8688 cali (Gigaseconds) to (Callippic Cycles) conversions :)
1,045
2,642
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.953125
3
CC-MAIN-2024-26
latest
en
0.605046
https://www.doorsteptutor.com/Exams/IMO/Class-10/Questions/Topic-Quadratic-Equations-3/Part-13.html
1,500,562,458,000,000,000
text/html
crawl-data/CC-MAIN-2017-30/segments/1500549423222.65/warc/CC-MAIN-20170720141821-20170720161821-00713.warc.gz
759,005,701
14,825
# Quadratic Equations (IMO- Mathematics Olympiad Class 10): Questions 68 - 70 of 80 Get 1 year subscription: Access detailed explanations (illustrated with images and videos) to 958 questions. Access all new questions we will add tracking exam-pattern and syllabus changes. View Sample Explanation or View Features. Rs. 450.00 or ## Question number: 68 MCQ▾ ### Question In a bangle shop, if the shopkeeper displays the bangles in the form of a square then he is left with 15 bangles with him. If he wanted to increase the size of square by one unit each side of the square he found that 16 bangles fall short of in completing the square. The actual number of bangles which he had with him in the shop was ________ ### Choices Choice (4) Response a. 310 b. 240 c. 290 d. 260 ## Question number: 69 MCQ▾ ### Question In the Maths Olympiad of 2030 at X Planet, two representatives from the Sejm’s side, while solving a quadratic equation, committed the following mistakes: 1. One of them made a mistake in the constant term and got the roots as -14 and 6. 2. Another one committed an error in the coefficient of x and he got the roots as 3 and -6 But in the meantime, they realized that they are wrong and they managed to get it right jointly. Find the quadratic equation. ### Choices Choice (4) Response a. b. c. d. ## Question number: 70 MCQ▾ ### Question One of the two students, while solving a quadratic equation in x, copied the constant term incorrectly and got the roots -5 and 6. The other copied the constant term and coefficient of correctly as and respectively. The correct roots are ### Choices Choice (4) Response a. b. c. d. f Page
418
1,683
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.015625
3
CC-MAIN-2017-30
longest
en
0.897608
http://www.maa.org/press/periodicals/convergence/a-plague-of-ratios-musical-logarithms
1,498,425,744,000,000,000
text/html
crawl-data/CC-MAIN-2017-26/segments/1498128320582.2/warc/CC-MAIN-20170625203122-20170625223122-00425.warc.gz
596,529,167
21,485
# A Plague of Ratios - Musical Logarithms Author(s): Benjamin Wardhaugh Logarithms were invented in Scotland in 1614; and they held the solution to the problem of 'dividing' one ratio by another. We were interested in how many times one ratio goes into another, that is how many times it must be 'added' to itself – really multiplied by itself – to give the other ratio. That is, Ax = B, where A and B are ratios, and we are to find x. If we take logarithms of both sides: x log A = log B. So, x = log B / log A. What that means is that we can 'divide' ratios by (really) dividing their logarithms. (We can also 'add' ratios by adding their logarithms, and 'subtract' ratios by subtracting their logarithms: you might like to think about why this works.) The exact number of tones (9:8) in an octave (2:1) is given by log(2/1)/log(9/8), which is about 5.88. Mercator did calculations like this in his notebooks, and in his later English manuscripts. Thus he was able to work out the exact relationship between different musical intervals: 5.88 tones in an octave, 3.44 tones in a fifth, and so on. To get an approximation that could be used for dividing up the octave to make a useable scale, he didn't divide the octave into twelve. Instead he tried to find a division of the octave that would give a good approximation for the fourth and fifth within it. He found that the ratio of the octave to the fifth is about 1.710, which is close to 53/31. So he proposed dividing the octave into 53 parts, of which a perfect fifth would be 31. This is a closer approximation than the equal tempered scale we saw above, where the fifth is made to equal 7/12 of an octave. Mercator went through the whole of one of the popular tuning systems in use in the seventeenth century – the meantone temperament – and showed how each of its notes could be approximated by one of the 53 steps in his octave. Better and better approximations could be found, but only by dividing the octave into more and more small parts, which would be impractical for real musical instruments. Mercator proved his point, even if it was only in manuscripts that circulated privately, that ratios could still be useful for studying music, and indeed that musical problems could be a stimulus for new developments in the handling of ratios. It is a shame that he didn't publish his musical work – there is a good deal more to it than I have written about here – he was certainly planning to at one stage, and it seems as though the plague was to blame for disrupting that plan. He re-used some of the same ideas in the 1660s to provide a commentary on some new musical theories that were causing a stir at the Royal Society: but again, nothing was published. Only one copy is now left of Mercator's prospectus, the Rationes mathematicae, published in Copenhagen in 1653. It's in Paris, and I've never seen the actual book. But these days it's rather easier to get things across the English Channel, and the Bibliothèque Nationale mailed page images to me on a CD. It's a pity that Mercator didn’t have that option. Benjamin Wardhaugh, "A Plague of Ratios - Musical Logarithms," Convergence (July 2010)
758
3,177
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.78125
4
CC-MAIN-2017-26
latest
en
0.977849
https://cryptoyvlu.web.app/sauriol87899xyw/revenue-compound-average-growth-rate-xyse.html
1,632,144,121,000,000,000
text/html
crawl-data/CC-MAIN-2021-39/segments/1631780057039.7/warc/CC-MAIN-20210920131052-20210920161052-00132.warc.gz
238,905,613
5,963
## Revenue compound average growth rate 13 Jun 2019 It is essentially a number that describes the rate at which an investment would have grown if it had grown the same rate every year and the profits CAGR is counted with an assumption that profits are reinvested at the end of each year of its time horizon. You should be aware that the compound annual growth  Learn everything you need to know about CAGR (Compound Annual Growth Rate) The Compound Annual Growth Rate (CAGR) is the average rate at which a roughly give you the number of years to double the starting revenues ( Rule of  CAGR is useful for comparison of growth rates from different data sets such as revenue growth of companies in the same industry. Let us see how CAGR works:. Compound annual growth rate (CAGR) is a financial investment calculation that This means that if we could smooth out the earnings and make them equal  Compound Annual Growth Rate (CAGR) is typically used as a tool for growth rate, which more simply measures the average change in revenue or profit of an   been done to understand how important revenue growth is to software and 60 percent two-year compound annual growth rate (CAGR) at the time they reach ## Compound annual growth rate (CAGR) is a business and investing specific term for the geometric progression ratio that provides a constant rate of return over the time period. CAGR is not an accounting term, but it is often used to describe some element of the business, for example revenue, units delivered, registered users, etc. CAGR dampens the effect of volatility of periodic returns that can render arithmetic means irrelevant. It is particularly useful to compare growth rates from various dat It’s important to remember that the compound annual growth rate percentage isn’t the actual annual rate of return. It’s an average of all the annual returns the investment has produced. It evens all the years’ rates out to make it easier compare the returns to other investment opportunities. On this page is a compound annual growth rate calculator, also known as CAGR.It takes a final dollar amount as input, along with a time frame and starting amount. The tool automatically calculates the average return per year (or period) as a geometric mean.. The Compound Annual Growth Rate Calculator The Compound Annual Growth rate is a useful tool for comparing a variety of investments over a similar investment horizon. One of CAGR’s advantages over an average annualized rate of return Internal Rate of Return (IRR) The Internal Rate of Return (IRR) is the discount rate that makes the net present value Compound annual growth represents growth over a period of years, with each year's growth added to the original value. Sometimes called compound interest, the compound annual growth rate (CAGR) indicates the average annual rate of growth when you reinvest the returns over a number of years. Average annual return ignores the effects of compounding and it can overestimate the growth of an investment. CAGR, on the other hand, is a geometric average that represents the one, consistent rate at which the investment would have grown if the investment had compounded at the same rate each year. The compound annual growth rate, or CAGR for short, is the average rate at which some value (investment) grows over a certain period of time assuming the value has been compounding over that time period. ### 30 Nov 2016 From these, we are able to study the annual revenue growth The average company forecasts a growth rate of 178% in revenues for their first Five-year compound annual growth rate in revenue. Analysis. The following section summarizes insights on Euronet Worldwide, Inc.'s Revenue CAGR (5y):. To calculate the Compound Annual Growth Rate in Excel, there is a basic formula =((End Value/Start Value)^(1/Periods) -1. And we can easily apply this formula  Compounded Annual Growth rate (CAGR) is a business and investing of the business, for example revenue, units delivered, registered users, etc. Formula. Download scientific diagram | 6 Sales Revenues and Compound Annual Growth Rate (CAGR) for LED Packages by Application from 2016 to 2021 Source:  CAGR is counted with an assumption that profits are reinvested at the end of each year of its time horizon. You should be aware that the compound annual growth  Learn everything you need to know about CAGR (Compound Annual Growth Rate) The Compound Annual Growth Rate (CAGR) is the average rate at which a roughly give you the number of years to double the starting revenues ( Rule of ### 30 Nov 2016 From these, we are able to study the annual revenue growth The average company forecasts a growth rate of 178% in revenues for their first 21 Jun 2016 Once we normalized the revenue data we used it to build models that calculated the compound annual growth rates (CAGR) for the ten ## Download scientific diagram | 6 Sales Revenues and Compound Annual Growth Rate (CAGR) for LED Packages by Application from 2016 to 2021 Source: 11 Dec 2019 CAGR or compound annual growth rate allows you to measure the returns earned by an investment over a complete period of time. Learn how Five-year compound annual growth rate in revenue. Analysis. The following section summarizes insights on Euronet Worldwide, Inc.'s Revenue CAGR (5y):. To calculate the Compound Annual Growth Rate in Excel, there is a basic formula =((End Value/Start Value)^(1/Periods) -1. And we can easily apply this formula  Compounded Annual Growth rate (CAGR) is a business and investing of the business, for example revenue, units delivered, registered users, etc. Formula.
1,167
5,616
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.90625
3
CC-MAIN-2021-39
latest
en
0.951782
https://rosettacode.org/wiki/Isqrt_(integer_square_root)_of_X
1,702,123,380,000,000,000
text/html
crawl-data/CC-MAIN-2023-50/segments/1700679100909.82/warc/CC-MAIN-20231209103523-20231209133523-00440.warc.gz
541,789,186
128,488
# Isqrt (integer square root) of X Isqrt (integer square root) of X You are encouraged to solve this task according to the task description, using any language you may know. Sometimes a function is needed to find the integer square root of   X,   where   X   can be a real non─negative number. Often   X   is actually a non─negative integer. For the purposes of this task,   X   can be an integer or a real number,   but if it simplifies things in your computer programming language,   assume it's an integer. One of the most common uses of   `Isqrt`   is in the division of an integer by all factors   (or primes)   up to the    X    of that integer,   either to find the factors of that integer,   or to determine primality. An alternative method for finding the   `Isqrt`   of a number is to calculate:       floor( sqrt(X) ) •   where   sqrt    is the   square root   function for non─negative real numbers,   and •   where   floor   is the   floor   function for real numbers. If the hardware supports the computation of (real) square roots,   the above method might be a faster method for small numbers that don't have very many significant (decimal) digits. However, floating point arithmetic is limited in the number of   (binary or decimal)   digits that it can support. For this task, the integer square root of a non─negative number will be computed using a version of   quadratic residue,   which has the advantage that no   floating point   calculations are used,   only integer arithmetic. Furthermore, the two divisions can be performed by bit shifting,   and the one multiplication can also be be performed by bit shifting or additions. The disadvantage is the limitation of the size of the largest integer that a particular computer programming language can support. Pseudo─code of a procedure for finding the integer square root of   X       (all variables are integers): ``` q ◄── 1 /*initialize Q to unity. */ /*find a power of 4 that's greater than X.*/ perform while q <= x /*perform while Q <= X. */ q ◄── q * 4 /*multiply Q by four. */ end /*perform*/ /*Q is now greater than X.*/ z ◄── x /*set Z to the value of X.*/ r ◄── 0 /*initialize R to zero. */ perform while q > 1 /*perform while Q > unity. */ q ◄── q ÷ 4 /*integer divide by four. */ t ◄── z - r - q /*compute value of T. */ r ◄── r ÷ 2 /*integer divide by two. */ if t >= 0 then do z ◄── t /*set Z to value of T. */ r ◄── r + q /*compute new value of R. */ end end /*perform*/ /*R is now the Isqrt(X). */ /* Sidenote: Also, Z is now the remainder after square root (i.e. */ /* R^2 + Z = X, so if Z = 0 then X is a perfect square). */ ``` Another version for the (above)   1st   perform   is: ``` perform until q > X /*perform until Q > X. */ q ◄── q * 4 /*multiply Q by four. */ end /*perform*/ ``` Integer square roots of some values: ```Isqrt( 0) is 0 Isqrt(60) is 7 Isqrt( 99) is 9 Isqrt( 1) is 1 Isqrt(61) is 7 Isqrt(100) is 10 Isqrt( 2) is 1 Isqrt(62) is 7 Isqrt(102) is 10 Isqrt( 3) is 1 Isqrt(63) is 7 Isqrt( 4) is 2 Isqrt(64) is 8 Isqet(120) is 10 Isqrt( 5) is 2 Isqrt(65) is 8 Isqrt(121) is 11 Isqrt( 6) is 2 Isqrt(66) is 8 Isqrt(122) is 11 Isqrt( 7) is 2 Isqrt(67) is 8 Isqrt( 8) is 2 Isqrt(68) is 8 Isqrt(143) is 11 Isqrt( 9) is 3 Isqrt(69) is 8 Isqrt(144) is 12 Isqrt(10) is 3 Isqrt(70) is 8 Isqrt(145) is 12 ``` •   the `Isqrt` of the     integers     from     0 ───► 65    (inclusive), shown in a horizontal format. •   the `Isqrt` of the   odd powers  from   71 ───► 773   (inclusive), shown in a   vertical   format. •   use commas in the displaying of larger numbers. You can show more numbers for the 2nd requirement if the displays fits on one screen on Rosetta Code. If your computer programming language only supports smaller integers,   show what you can. ## 11l Translation of: D ```F commatize(number, step = 3, sep = ‘,’) V s = reversed(String(number)) String r = s[0] L(i) 1 .< s.len I i % step == 0 r ‘’= sep r ‘’= s[i] R reversed(r) F isqrt(BigInt x) assert(x >= 0) V q = BigInt(1) L q <= x q *= 4 V z = x V r = BigInt(0) L q > 1 q I/= 4 V t = z - r - q r I/= 2 I t >= 0 z = t r += q R r print(‘The integer square root of integers from 0 to 65 are:’) L(i) 66 print(isqrt(BigInt(i)), end' ‘ ’) print() print(‘The integer square roots of powers of 7 from 7^1 up to 7^73 are:’) print(‘power 7 ^ power integer square root’) print(‘----- --------------------------------------------------------------------------------- -----------------------------------------’) V pow7 = BigInt(7) V bi49 = BigInt(49) L(i) (1..73).step(2) print(‘#2 #84 #41’.format(i, commatize(pow7), commatize(isqrt(pow7)))) pow7 *= bi49``` Output: ```The integer square root of integers from 0 to 65 are: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 The integer square roots of powers of 7 from 7^1 up to 7^73 are: power 7 ^ power integer square root ----- --------------------------------------------------------------------------------- ----------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802 ``` ```with Ada.Text_Io; procedure Integer_Square_Root is function Isqrt (X : Big_Integer) return Big_Integer is Q : Big_Integer := 1; Z, T, R : Big_Integer; begin while Q <= X loop Q := Q * 4; end loop; Z := X; R := 0; while Q > 1 loop Q := Q / 4; T := Z - R - Q; R := R / 2; if T >= 0 then Z := T; R := R + Q; end if; end loop; return R; end Isqrt; function Commatize (N : Big_Integer; Width : Positive) return String is S : constant String := To_String (N, Width); Image : String (1 .. Width + Width / 3) := (others => ' '); Pos : Natural := Image'Last; begin for I in S'Range loop Image (Pos) := S (S'Last - I + S'First); exit when Image (Pos) = ' '; Pos := Pos - 1; if I mod 3 = 0 and S (S'Last - I + S'First - 1) /= ' ' then Image (Pos) := '''; Pos := Pos - 1; end if; end loop; return Image; end Commatize; type Mode_Kind is (Tens, Ones, Spacer, Result); begin Put_Line ("Integer square roots of integers 0 .. 65:"); for Mode in Mode_Kind loop for N in 0 .. 65 loop case Mode is when Tens => Put ((if N / 10 = 0 then " " else Natural'Image (N / 10))); when Ones => Put (Natural'Image (N mod 10)); when Spacer => Put ("--"); when Result => Put (To_String (Isqrt (To_Big_Integer (N)))); end case; end loop; New_Line; end loop; New_Line; declare package Integer_Io is new Ada.Text_Io.Integer_Io (Natural); N : Integer := 1; P, R : Big_Integer; begin Put_Line ("| N|" & 80 * " " & "7**N|" & 30 * " " & "isqrt (7**N)|"); Put_Line (133 * "="); loop P := 7**N; R := Isqrt (P); Put ("|"); Integer_Io.Put (N, Width => 3); Put ("|"); Put (Commatize (P, Width => 63)); Put ("|"); Put (Commatize (R, Width => 32)); Put ("|"); New_Line; exit when N >= 73; N := N + 2; end loop; Put_Line (133 * "="); end; end Integer_Square_Root; ``` Output: ```Integer square roots of integers 0 .. 65: 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 ------------------------------------------------------------------------------------------------------------------------------------ 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 | N| 7**N| isqrt (7**N)| ===================================================================================================================================== | 1| 7| 2| | 3| 343| 18| | 5| 16'807| 129| | 7| 823'543| 907| | 9| 40'353'607| 6'352| | 11| 1'977'326'743| 44'467| | 13| 96'889'010'407| 311'269| | 15| 4'747'561'509'943| 2'178'889| | 17| 232'630'513'987'207| 15'252'229| | 19| 11'398'895'185'373'143| 106'765'608| | 21| 558'545'864'083'284'007| 747'359'260| | 23| 27'368'747'340'080'916'343| 5'231'514'822| | 25| 1'341'068'619'663'964'900'807| 36'620'603'758| | 27| 65'712'362'363'534'280'139'543| 256'344'226'312| | 29| 3'219'905'755'813'179'726'837'607| 1'794'409'584'184| | 31| 157'775'382'034'845'806'615'042'743| 12'560'867'089'291| | 33| 7'730'993'719'707'444'524'137'094'407| 87'926'069'625'040| | 35| 378'818'692'265'664'781'682'717'625'943| 615'482'487'375'282| | 37| 18'562'115'921'017'574'302'453'163'671'207| 4'308'377'411'626'977| | 39| 909'543'680'129'861'140'820'205'019'889'143| 30'158'641'881'388'842| | 41| 44'567'640'326'363'195'900'190'045'974'568'007| 211'110'493'169'721'897| | 43| 2'183'814'375'991'796'599'109'312'252'753'832'343| 1'477'773'452'188'053'281| | 45| 107'006'904'423'598'033'356'356'300'384'937'784'807| 10'344'414'165'316'372'973| | 47| 5'243'338'316'756'303'634'461'458'718'861'951'455'543| 72'410'899'157'214'610'812| | 49| 256'923'577'521'058'878'088'611'477'224'235'621'321'607| 506'876'294'100'502'275'687| | 51| 12'589'255'298'531'885'026'341'962'383'987'545'444'758'743| 3'548'134'058'703'515'929'815| | 53| 616'873'509'628'062'366'290'756'156'815'389'726'793'178'407| 24'836'938'410'924'611'508'707| | 55| 30'226'801'971'775'055'948'247'051'683'954'096'612'865'741'943| 173'858'568'876'472'280'560'953| | 57| 1'481'113'296'616'977'741'464'105'532'513'750'734'030'421'355'207| 1'217'009'982'135'305'963'926'677| | 59| 72'574'551'534'231'909'331'741'171'093'173'785'967'490'646'405'143| 8'519'069'874'947'141'747'486'745| | 61| 3'556'153'025'177'363'557'255'317'383'565'515'512'407'041'673'852'007| 59'633'489'124'629'992'232'407'216| | 63| 174'251'498'233'690'814'305'510'551'794'710'260'107'945'042'018'748'343| 417'434'423'872'409'945'626'850'517| | 65| 8'538'323'413'450'849'900'970'017'037'940'802'745'289'307'058'918'668'807| 2'922'040'967'106'869'619'387'953'625| | 67| 418'377'847'259'091'645'147'530'834'859'099'334'519'176'045'887'014'771'543| 20'454'286'769'748'087'335'715'675'381| | 69| 20'500'514'515'695'490'612'229'010'908'095'867'391'439'626'248'463'723'805'607| 143'180'007'388'236'611'350'009'727'669| | 71| 1'004'525'211'269'079'039'999'221'534'496'697'502'180'541'686'174'722'466'474'743| 1'002'260'051'717'656'279'450'068'093'686| | 73| 49'221'735'352'184'872'959'961'855'190'338'177'606'846'542'622'561'400'857'262'407| 7'015'820'362'023'593'956'150'476'655'802| ===================================================================================================================================== ``` ## ALGOL 68 Works with: ALGOL 68G version Any - tested with release 2.8.3.win32 ```BEGIN # Integer square roots # PR precision 200 PR # returns the integer square root of x; x must be >= 0 # PROC isqrt = ( LONG LONG INT x )LONG LONG INT: IF x < 0 THEN print( ( "Negative number in isqrt", newline ) );stop ELIF x < 2 THEN x ELSE # x is greater than 1 # # find a power of 4 that's greater than x # LONG LONG INT q := 1; WHILE q <= x DO q *:= 4 OD; # find the root # LONG LONG INT z := x; LONG LONG INT r := 0; WHILE q > 1 DO q OVERAB 4; LONG LONG INT t = z - r - q; r OVERAB 2; IF t >= 0 THEN z  := t; r +:= q FI OD; r FI; # isqrt # # returns a string representation of n with commas # PROC commatise = ( LONG LONG INT n )STRING: BEGIN STRING result  := ""; STRING unformatted = whole( n, 0 ); INT ch count  := 0; FOR c FROM UPB unformatted BY -1 TO LWB unformatted DO IF ch count <= 2 THEN ch count +:= 1 ELSE ch count  := 1; "," +=: result FI; unformatted[ c ] +=: result OD; result END; # commatise # # left-pads a string to at least n characters # PROC pad left = ( STRING s, INT n )STRING: BEGIN STRING result := s; WHILE ( UPB result - LWB result ) + 1 < n DO " " +=: result OD; result print( ( "Integer square roots of 0..65", newline ) ); FOR i FROM 0 TO 65 DO print( ( " ", whole( isqrt( i ), 0 ) ) ) OD; print( ( newline ) ); # integer square roots of odd powers of 7 # print( ( "Integer square roots of 7^n", newline ) ); print( ( " n|", pad left( "7^n", 82 ), "|", pad left( "isqrt(7^n)", 42 ), newline ) ); LONG LONG INT p7 := 7; FOR p BY 2 TO 73 DO print( ( whole( p, -2 ) , "|" , pad left( commatise( p7 ), 82 ) , "|" , pad left( commatise( isqrt( p7 ) ), 42 ) , newline ) ); p7 *:= 49 OD END``` Output: ```Integer square roots of 0..65 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Integer square roots of 7^n n| 7^n| isqrt(7^n) 1| 7| 2 3| 343| 18 5| 16,807| 129 7| 823,543| 907 9| 40,353,607| 6,352 11| 1,977,326,743| 44,467 13| 96,889,010,407| 311,269 15| 4,747,561,509,943| 2,178,889 17| 232,630,513,987,207| 15,252,229 19| 11,398,895,185,373,143| 106,765,608 21| 558,545,864,083,284,007| 747,359,260 23| 27,368,747,340,080,916,343| 5,231,514,822 25| 1,341,068,619,663,964,900,807| 36,620,603,758 27| 65,712,362,363,534,280,139,543| 256,344,226,312 29| 3,219,905,755,813,179,726,837,607| 1,794,409,584,184 31| 157,775,382,034,845,806,615,042,743| 12,560,867,089,291 33| 7,730,993,719,707,444,524,137,094,407| 87,926,069,625,040 35| 378,818,692,265,664,781,682,717,625,943| 615,482,487,375,282 37| 18,562,115,921,017,574,302,453,163,671,207| 4,308,377,411,626,977 39| 909,543,680,129,861,140,820,205,019,889,143| 30,158,641,881,388,842 41| 44,567,640,326,363,195,900,190,045,974,568,007| 211,110,493,169,721,897 43| 2,183,814,375,991,796,599,109,312,252,753,832,343| 1,477,773,452,188,053,281 45| 107,006,904,423,598,033,356,356,300,384,937,784,807| 10,344,414,165,316,372,973 47| 5,243,338,316,756,303,634,461,458,718,861,951,455,543| 72,410,899,157,214,610,812 49| 256,923,577,521,058,878,088,611,477,224,235,621,321,607| 506,876,294,100,502,275,687 51| 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743| 3,548,134,058,703,515,929,815 53| 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407| 24,836,938,410,924,611,508,707 55| 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943| 173,858,568,876,472,280,560,953 57| 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207| 1,217,009,982,135,305,963,926,677 59| 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143| 8,519,069,874,947,141,747,486,745 61| 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007| 59,633,489,124,629,992,232,407,216 63| 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343| 417,434,423,872,409,945,626,850,517 65| 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807| 2,922,040,967,106,869,619,387,953,625 67| 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543| 20,454,286,769,748,087,335,715,675,381 69| 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607| 143,180,007,388,236,611,350,009,727,669 71| 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743| 1,002,260,051,717,656,279,450,068,093,686 73|49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407| 7,015,820,362,023,593,956,150,476,655,802 ``` ## ALGOL W Algol W integers are restricted to signed 32-bit, so only the roots of the powers of 7 up to 7^9 are shown (7^11 will fit in 32-bits but the smallest power of 4 higher than 7^11 will overflow). ```begin % Integer square roots by quadratic residue  % % returns the integer square root of x - x must be >= 0  % integer procedure iSqrt ( integer value x ) ; if x < 0 then begin assert x >= 0; 0 end else if x < 2 then x else begin % x is greater than 1  % integer q, r, t, z; % find a power of 4 that's greater than x  % q := 1; while q <= x do q := q * 4; % find the root  % z := x; r := 0; while q > 1 do begin q := q div 4; t := z - r - q; r := r div 2; if t >= 0 then begin z := t; r := r + q end if_t_ge_0 end while_q_gt_1 ; r end isqrt; % writes n in 14 character positions with separator commas  % procedure writeonWithCommas ( integer value n ) ; begin string(10) decDigits; string(14) r; integer v, cPos, dCount; decDigits  := "0123456789"; v  := abs n; r  := " "; r( 13 // 1 ) := decDigits( v rem 10 // 1 ); v  := v div 10; cPos  := 12; dCount  := 1; while cPos > 0 and v > 0 do begin r( cPos // 1 ) := decDigits( v rem 10 // 1 ); v  := v div 10; cPos  := cPos - 1; dCount := dCount + 1; if v not = 0 and dCount = 3 then begin r( cPos // 1 ) := ","; cPos  := cPos - 1; dCount := 0 end if_v_ne_0_and_dCount_eq_3 end for_cPos; r( cPos // 1 ) := if n < 0 then "-" else " "; writeon( s_w := 0, r ) end writeonWithCommas ; begin % task test cases  % integer prevI, prevR, root, p7; write( "Integer square roots of 0..65 (values the same as the previous one not shown):" ); write(); prevR := prevI := -1; for i := 0 until 65 do begin root := iSqrt( i ); if root not = prevR then begin prevR := root; prevI := i; writeon( i_w := 1, s_w := 0, " ", i, ":", root ) end else if prevI = i - 1 then writeon( "..." ); end for_i ; write(); % integer square roots of odd powers of 7  % write( "Integer square roots of 7^n, odd n" ); write( " n| 7^n| isqrt(7^n)" ); write( " -+--------------+--------------" ); p7 := 7; for p := 1 step 2 until 9 do begin write( i_w := 2, s_w := 0, p ); writeon( s_w := 0, "|" ); writeonWithCommas( p7 ); writeon( s_w := 0, "|" ); writeonWithCommas( iSqrt( p7 ) ); p7 := p7 * 49 end for_p end.``` Output: ```Integer square roots of 0..65 (values the same as the previous one not shown): 0:0 1:1... 4:2... 9:3... 16:4... 25:5... 36:6... 49:7... 64:8... Integer square roots of 7^n, odd n n| 7^n| isqrt(7^n) -+--------------+-------------- 1| 7| 2 3| 343| 18 5| 16,807| 129 7| 823,543| 907 9| 40,353,607| 6,352 ``` ## ALGOL-M The code presented here follows the task description. But be warned: there is a bug lurking in the algorithm as presented. The statement q := q * 4 in the first while loop will overflow the limits of ALGOL-M's integer data type (-16,383 to +16,383) for any value of x greater than 4095 and trigger an endless loop. The output has been put into columnar form to avoid what would otherwise be an ugly mess on a typical 80 column display. ```BEGIN COMMENT RETURN INTEGER SQUARE ROOT OF N USING QUADRATIC RESIDUE ALGORITHM. WARNING: THE FUNCTION WILL FAIL FOR X GREATER THAN 4095; INTEGER FUNCTION ISQRT(X); INTEGER X; BEGIN INTEGER Q, R, Z, T; Q := 1; WHILE Q <= X DO Q := Q * 4;  % WARNING! OVERFLOW YIELDS 0 % Z := X; R := 0; WHILE Q > 1 DO BEGIN Q := Q / 4; T := Z - R - Q; R := R / 2; IF T >= 0 THEN BEGIN Z := T; R := R + Q; END; END; ISQRT := R; END; COMMENT - LET'S EXERCISE THE FUNCTION; INTEGER I, COL; WRITE("INTEGER SQUARE ROOT OF FIRST 65 NUMBERS:"); WRITE(""); COL := 1; FOR I := 1 STEP 1 UNTIL 65 DO BEGIN WRITEON(ISQRT(I)); COL := COL + 1; IF COL > 10 THEN BEGIN WRITE(""); COL := 1; END; END; WRITE(""); WRITE(" N 7^N ISQRT"); WRITE("--------------------"); COMMENT - ODD POWERS OF 7 GREATER THAN 3 WILL CAUSE OVERFLOW; FOR I := 1 STEP 2 UNTIL 3 DO BEGIN INTEGER POW7; POW7 := 7**I; WRITE(I, POW7, ISQRT(POW7)); END; WRITE("THAT'S ALL. GOODBYE."); END``` An alternative to the quadratic residue approach will allow calculation of the integer square root for the full range of signed integer values supported by ALGOL-M. (The output is identical.) ```% RETURN INTEGER SQUARE ROOT OF N % INTEGER FUNCTION ISQRT(N); INTEGER N; BEGIN INTEGER R1, R2; R1 := N; R2 := 1; WHILE R1 > R2 DO BEGIN R1 := (R1+R2) / 2; R2 := N / R1; END; ISQRT := R1; END;``` Output: ```INTEGER SQUARE ROOT OF FIRST 65 NUMBERS: 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 N 7^N ISQRT -------------------- 1 7 2 3 343 18 THAT'S ALL. GOODBYE. ``` ## AppleScript The odd-powers-of-7 part of the task is limited by the precision of AppleScript reals. ```on isqrt(x) set q to 1 repeat until (q > x) set q to q * 4 end repeat set z to x set r to 0 repeat while (q > 1) set q to q div 4 set t to z - r - q set r to r div 2 if (t > -1) then set z to t set r to r + q end if end repeat return r end isqrt on intToText(n, separator) set output to "" repeat until (n < 1000) set output to separator & (text 2 thru 4 of ((1000 + (n mod 1000) as integer) as text)) & output set n to n div 1000 end repeat return (n as integer as text) & output end intToText -- Get the integer and power results. set {integerResults, powerResults} to {{}, {}} repeat with x from 0 to 65 set end of integerResults to isqrt(x) end repeat repeat with p from 1 to 73 by 2 set x to 7 ^ p if (x > 1.0E+15) then exit repeat -- Beyond the precision of AppleScript reals. set end of powerResults to "7^" & p & tab & "(" & intToText(x, ",") & "):" & (tab & tab & intToText(isqrt(x), ",")) end repeat -- Format and output. set astid to AppleScript's text item delimiters set AppleScript's text item delimiters to space set output to {"Isqrts of integers from 0 to 65:", space & integerResults, ¬ "Isqrts of odd powers of 7 from 1 to " & (p - 2) & ":", powerResults} set AppleScript's text item delimiters to linefeed set output to output as text set AppleScript's text item delimiters to astid return output ``` Output: ```"Isqrts of integers from 0 to 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Isqrts of odd powers of 7 from 1 to 17: 7^1 (7): 2 7^3 (343): 18 7^5 (16,807): 129 7^7 (823,543): 907 7^9 (40,353,607): 6,352 7^11 (1,977,326,743): 44,467 7^13 (96,889,010,407): 311,269 7^15 (4,747,561,509,943): 2,178,889 7^17 (232,630,513,987,207): 15,252,229" ``` ## APL Works in Dyalog APL ``` i←{x←⍵ q←(×∘4)⍣{⍺>x}⊢1 ⊃{ r z q←⍵ q←⌊q÷4 t←(z-r)-q r←⌊r÷2 z←z t[1+t≥0] r←r+q×t≥0 r z q }⍣{ r z q←⍺ q≤1 }⊢0 x q } ``` Output: ``` i¨⍳65 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 (⎕fr⎕pp)←1287 34 ↑{⍵ (7*⍵) (i 7*⍵)}¨1,1+2×⍳10 1 7 2 3 343 18 5 16807 129 7 823543 907 9 40353607 6352 11 1977326743 44467 13 96889010407 311269 15 4747561509943 2178889 17 232630513987207 15252229 19 11398895185373143 106765608 21 558545864083284007 747359260 ``` ## Arturo ```commatize: function [x][ reverse join.with:"," map split.every: 3 split reverse to :string x => join ] isqrt: function [x][ num: new x q: new 1 r: new 0 while [q =< num]-> shl.safe 'q 2 while [q > 1][ shr 'q 2 t: (num-r)-q shr 'r 1 if t >= 0 [ num: t r: new r+q ] ] return r ] print map 0..65 => isqrt loop range 1 .step: 2 72 'n -> print [n "\t" commatize isqrt 7^n] ``` Output: ```0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 1 2 3 18 5 129 7 907 9 6,352 11 44,467 13 311,269 15 2,178,889 17 15,252,229 19 106,765,608 21 747,359,260 23 5,231,514,822 25 36,620,603,758 27 256,344,226,312 29 1,794,409,584,184 31 12,560,867,089,291 33 87,926,069,625,040 35 615,482,487,375,282 37 4,308,377,411,626,977 39 30,158,641,881,388,842 41 211,110,493,169,721,897 43 1,477,773,452,188,053,281 45 10,344,414,165,316,372,973 47 72,410,899,157,214,610,812 49 506,876,294,100,502,275,687 51 3,548,134,058,703,515,929,815 53 24,836,938,410,924,611,508,707 55 173,858,568,876,472,280,560,953 57 1,217,009,982,135,305,963,926,677 59 8,519,069,874,947,141,747,486,745 61 59,633,489,124,629,992,232,407,216 63 417,434,423,872,409,945,626,850,517 65 2,922,040,967,106,869,619,387,953,625 67 20,454,286,769,748,087,335,715,675,381 69 143,180,007,388,236,611,350,009,727,669 71 1,002,260,051,717,656,279,450,068,093,686``` ## ATS Big integers are achieved via the GNU Multiple Precision interface, which enforces proper memory management, without the need for a garbage collector. I felt that, in ATS, using GMP would be almost as simple as writing isqrt only for machine-native integers. One has to try it, to see the advantage of using a compiler that tells you when you have left out an initialization or a "free". One might note the construction of a "comma'd numeral" by consing of a linked list. This method will work in any Lisp, ML, etc., also. Here the lists are of type "list_vt" and so enforce proper memory management, even in absence of a garbage collector. ```(* Compile with "myatscc isqrt.dats", thus obtaining an executable called "isqrt". ##myatsccdef=\ patscc -O2 \ -I"\${PATSHOME}/contrib/atscntrb" \ -IATS "\${PATSHOME}/contrib/atscntrb" \ -D_GNU_SOURCE -DATS_MEMALLOC_LIBC \ -o \$fname(\$1) \$1 -lgmp *) (* An interface to GNU Multiple Precision. The type system will help ensure that you do "mpz_clear" on whatever you allocate. *) (* As of this writing, gmp.dats is empty, but it does no harm to fn find_a_power_of_4_greater_than_x (x : &mpz, (* Input. *) q : &mpz? >> mpz) (* Output. *) : void = let fun loop (x : &mpz, q : &mpz) : void = if 0 <= mpz_cmp (x, q) then begin mpz_mul (q, 4u); loop (x, q) end in mpz_init_set (q, 1u); loop (x, q) end fn isqrt_and_remainder (x : &mpz, (* Input. *) r : &mpz? >> mpz, (* Output: square root. *) z : &mpz? >> mpz) (* Output: remainder. *) : void = let fun loop (q : &mpz, z : &mpz, r : &mpz, t : &mpz) : void = if 0 < mpz_cmp (q, 1u) then begin mpz_tdiv_q (q, 4u); mpz_set_mpz (t, z); mpz_sub (t, r); mpz_sub (t, q); mpz_tdiv_q (r, 2u); if 0 <= mpz_cmp (t, 0u) then begin mpz_set_mpz (z, t); end; loop (q, z, r, t); end var q : mpz var t : mpz in find_a_power_of_4_greater_than_x (x, q); mpz_init_set (z, x); mpz_init_set (r, 0u); mpz_init (t); loop (q, z, r, t); mpz_clear (q); mpz_clear (t); end fn isqrt (x : &mpz, (* Input. *) r : &mpz? >> mpz) (* Output: square root. *) : void = let var z : mpz in isqrt_and_remainder (x, r, z); mpz_clear (z); end fn print_n_spaces (n : uint) : void = let var i : [i : nat] uint i in for (i := 0u; i < n; i := succ i) print! (" ") end fn print_with_commas (n  : &mpz, num_columns : uint) : void = let fun make_list (q  : &mpz, r  : &mpz, lst : List0_vt char, i  : uint) : List_vt char = if mpz_cmp (q, 0u) = 0 then lst else let val _ = mpz_tdiv_qr (q, r, 10u) val ones_place = mpz_get_int (r) val digit = int2char0 (ones_place + char2i '0') in if i = 3u then let val lst = list_vt_cons (',', lst) val lst = list_vt_cons (digit, lst) in make_list (q, r, lst, 1u) end else let val lst = list_vt_cons (digit, lst) in make_list (q, r, lst, succ i) end end var q : mpz var r : mpz val _ = mpz_init_set (q, n) val _ = mpz_init (r) val char_lst = make_list (q, r, list_vt_nil (), 0u) val _ = mpz_clear (q) val _ = mpz_clear (r) fun print_and_consume_lst (char_lst : List0_vt char) : void = case+ char_lst of | ~ list_vt_nil () => () | ~ list_vt_cons (head, tail) => begin print_and_consume_lst (tail); end prval _ = lemma_list_vt_param (char_lst) val len = i2u (list_vt_length (char_lst)) in assertloc (len <= num_columns); print_n_spaces (num_columns - len); print_and_consume_lst (char_lst) end fn do_the_roots_of_0_to_65 () : void = let var i : mpz in mpz_init_set (i, 0u); while (mpz_cmp (i, 65u) <= 0) let var r : mpz in isqrt (i, r); fprint (stdout_ref, r); print! (" "); mpz_clear (r); end; mpz_clear (i); end fn do_the_roots_of_odd_powers_of_7 () : void = let var seven : mpz var seven_raised_i : mpz var i_mpz : mpz var i : [i : pos] uint i in mpz_init_set (seven, 7u); mpz_init (seven_raised_i); mpz_init (i_mpz); for (i := 1u; i <= 73u; i := succ (succ i)) let var r : mpz in mpz_pow_uint (seven_raised_i, seven, i); isqrt (seven_raised_i, r); mpz_set_uint (i_mpz, i); print_with_commas (i_mpz, 2u); print! (" "); print_with_commas (seven_raised_i, 84u); print! (" "); print_with_commas (r, 43u); print! ("\n"); mpz_clear (r); end; mpz_clear (seven); mpz_clear (seven_raised_i); mpz_clear (i_mpz); end implement main0 () = begin print! ("isqrt(i) for 0 <= i <= 65:\n\n"); do_the_roots_of_0_to_65 (); print! ("\n\n\n"); print! ("isqrt(7**i) for 1 <= i <= 73, i odd:\n\n"); print! (" i 7**i sqrt(7**i)\n"); print! ("-----------------------------------------------------------------------------------------------------------------------------------\n"); do_the_roots_of_odd_powers_of_7 (); end``` Output: ```\$ myatscc isqrt.dats \$ ./isqrt isqrt(i) for 0 <= i <= 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 isqrt(7**i) for 1 <= i <= 73, i odd: i 7**i sqrt(7**i) ----------------------------------------------------------------------------------------------------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802``` ## BASIC256 ```print "Integer square root of first 65 numbers:" for n = 1 to 65 print ljust(isqrt(n),3); next n print : print print "Integer square root of odd powers of 7" print " n 7^n isqrt" print "-"*36 for n = 1 to 21 step 2 pow7 = int(7 ^ n) print rjust(n,3);rjust(pow7,20);rjust(isqrt(pow7),12) next n end function isqrt(x) q = 1 while q <= x q *= 4 end while r = 0 while q > 1 q /= 4 t = x - r - q r /= 2 if t >= 0 then x = t r += q end if end while return int(r) end function``` ## C Translation of: C++ Up to 64-bit limits with no big int library. ```#include <stdint.h> #include <stdio.h> int64_t isqrt(int64_t x) { int64_t q = 1, r = 0; while (q <= x) { q <<= 2; } while (q > 1) { int64_t t; q >>= 2; t = x - r - q; r >>= 1; if (t >= 0) { x = t; r += q; } } return r; } int main() { int64_t p; int n; printf("Integer square root for numbers 0 to 65:\n"); for (n = 0; n <= 65; n++) { printf("%lld ", isqrt(n)); } printf("\n\n"); printf("Integer square roots of odd powers of 7 from 1 to 21:\n"); printf(" n | 7 ^ n | isqrt(7 ^ n)\n"); p = 7; for (n = 1; n <= 21; n += 2, p *= 49) { printf("%2d | %18lld | %12lld\n", n, p, isqrt(p)); } } ``` Output: ```Integer square root for numbers 0 to 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Integer square roots of odd powers of 7 from 1 to 21: n | 7 ^ n | isqrt(7 ^ n) 1 | 7 | 2 3 | 343 | 18 5 | 16807 | 129 7 | 823543 | 907 9 | 40353607 | 6352 11 | 1977326743 | 44467 13 | 96889010407 | 311269 15 | 4747561509943 | 2178889 17 | 232630513987207 | 15252229 19 | 11398895185373143 | 106765608 21 | 558545864083284007 | 747359260``` ## C++ Library: Boost ```#include <iomanip> #include <iostream> #include <sstream> #include <boost/multiprecision/cpp_int.hpp> using big_int = boost::multiprecision::cpp_int; template <typename integer> integer isqrt(integer x) { integer q = 1; while (q <= x) q <<= 2; integer r = 0; while (q > 1) { q >>= 2; integer t = x - r - q; r >>= 1; if (t >= 0) { x = t; r += q; } } return r; } std::string commatize(const big_int& n) { std::ostringstream out; out << n; std::string str(out.str()); std::string result; size_t digits = str.size(); result.reserve(4 * digits/3); for (size_t i = 0; i < digits; ++i) { if (i > 0 && i % 3 == digits % 3) result += ','; result += str[i]; } return result; } int main() { std::cout << "Integer square root for numbers 0 to 65:\n"; for (int n = 0; n <= 65; ++n) std::cout << isqrt(n) << ' '; std::cout << "\n\n"; std::cout << "Integer square roots of odd powers of 7 from 1 to 73:\n"; const int power_width = 83, isqrt_width = 42; std::cout << " n |" << std::setw(power_width) << "7 ^ n" << " |" << std::setw(isqrt_width) << "isqrt(7 ^ n)" << '\n'; std::cout << std::string(6 + power_width + isqrt_width, '-') << '\n'; big_int p = 7; for (int n = 1; n <= 73; n += 2, p *= 49) { std::cout << std::setw(2) << n << " |" << std::setw(power_width) << commatize(p) << " |" << std::setw(isqrt_width) << commatize(isqrt(p)) << '\n'; } return 0; } ``` Output: ```Integer square root for numbers 0 to 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Integer square roots of odd powers of 7 from 1 to 73: n | 7 ^ n | isqrt(7 ^ n) ----------------------------------------------------------------------------------------------------------------------------------- 1 | 7 | 2 3 | 343 | 18 5 | 16,807 | 129 7 | 823,543 | 907 9 | 40,353,607 | 6,352 11 | 1,977,326,743 | 44,467 13 | 96,889,010,407 | 311,269 15 | 4,747,561,509,943 | 2,178,889 17 | 232,630,513,987,207 | 15,252,229 19 | 11,398,895,185,373,143 | 106,765,608 21 | 558,545,864,083,284,007 | 747,359,260 23 | 27,368,747,340,080,916,343 | 5,231,514,822 25 | 1,341,068,619,663,964,900,807 | 36,620,603,758 27 | 65,712,362,363,534,280,139,543 | 256,344,226,312 29 | 3,219,905,755,813,179,726,837,607 | 1,794,409,584,184 31 | 157,775,382,034,845,806,615,042,743 | 12,560,867,089,291 33 | 7,730,993,719,707,444,524,137,094,407 | 87,926,069,625,040 35 | 378,818,692,265,664,781,682,717,625,943 | 615,482,487,375,282 37 | 18,562,115,921,017,574,302,453,163,671,207 | 4,308,377,411,626,977 39 | 909,543,680,129,861,140,820,205,019,889,143 | 30,158,641,881,388,842 41 | 44,567,640,326,363,195,900,190,045,974,568,007 | 211,110,493,169,721,897 43 | 2,183,814,375,991,796,599,109,312,252,753,832,343 | 1,477,773,452,188,053,281 45 | 107,006,904,423,598,033,356,356,300,384,937,784,807 | 10,344,414,165,316,372,973 47 | 5,243,338,316,756,303,634,461,458,718,861,951,455,543 | 72,410,899,157,214,610,812 49 | 256,923,577,521,058,878,088,611,477,224,235,621,321,607 | 506,876,294,100,502,275,687 51 | 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 | 3,548,134,058,703,515,929,815 53 | 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 | 24,836,938,410,924,611,508,707 55 | 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 | 173,858,568,876,472,280,560,953 57 | 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 | 1,217,009,982,135,305,963,926,677 59 | 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 | 8,519,069,874,947,141,747,486,745 61 | 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 | 59,633,489,124,629,992,232,407,216 63 | 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 | 417,434,423,872,409,945,626,850,517 65 | 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 | 2,922,040,967,106,869,619,387,953,625 67 | 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 | 20,454,286,769,748,087,335,715,675,381 69 | 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 | 143,180,007,388,236,611,350,009,727,669 71 | 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 | 1,002,260,051,717,656,279,450,068,093,686 73 | 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 | 7,015,820,362,023,593,956,150,476,655,802 ``` ## C# ```using System; using static System.Console; using BI = System.Numerics.BigInteger; class Program { static BI isqrt(BI x) { BI q = 1, r = 0, t; while (q <= x) q <<= 2; while (q > 1) { q >>= 2; t = x - r - q; r >>= 1; if (t >= 0) { x = t; r += q; } } return r; } static void Main() { const int max = 73, smax = 65; int power_width = ((BI.Pow(7, max).ToString().Length / 3) << 2) + 3, isqrt_width = (power_width + 1) >> 1; WriteLine("Integer square root for numbers 0 to {0}:", smax); for (int n = 0; n <= smax; ++n) Write("{0} ", (n / 10).ToString().Replace("0", " ")); WriteLine(); for (int n = 0; n <= smax; ++n) Write("{0} ", n % 10); WriteLine(); WriteLine(new String('-', (smax << 1) + 1)); for (int n = 0; n <= smax; ++n) Write("{0} ", isqrt(n)); WriteLine("\n\nInteger square roots of odd powers of 7 from 1 to {0}:", max); string s = string.Format("[0,2] |[1,{0}:n0] |[2,{1}:n0]", power_width, isqrt_width).Replace("[", "{").Replace("]", "}"); WriteLine(s, "n", "7 ^ n", "isqrt(7 ^ n)"); WriteLine(new String('-', power_width + isqrt_width + 6)); BI p = 7; for (int n = 1; n <= max; n += 2, p *= 49) WriteLine (s, n, p, isqrt(p)); } } ``` Output: ```Integer square root for numbers 0 to 65: 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 ----------------------------------------------------------------------------------------------------------------------------------- 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Integer square roots of odd powers of 7 from 1 to 73: n | 7 ^ n | isqrt(7 ^ n) ----------------------------------------------------------------------------------------------------------------------------------- 1 | 7 | 2 3 | 343 | 18 5 | 16,807 | 129 7 | 823,543 | 907 9 | 40,353,607 | 6,352 11 | 1,977,326,743 | 44,467 13 | 96,889,010,407 | 311,269 15 | 4,747,561,509,943 | 2,178,889 17 | 232,630,513,987,207 | 15,252,229 19 | 11,398,895,185,373,143 | 106,765,608 21 | 558,545,864,083,284,007 | 747,359,260 23 | 27,368,747,340,080,916,343 | 5,231,514,822 25 | 1,341,068,619,663,964,900,807 | 36,620,603,758 27 | 65,712,362,363,534,280,139,543 | 256,344,226,312 29 | 3,219,905,755,813,179,726,837,607 | 1,794,409,584,184 31 | 157,775,382,034,845,806,615,042,743 | 12,560,867,089,291 33 | 7,730,993,719,707,444,524,137,094,407 | 87,926,069,625,040 35 | 378,818,692,265,664,781,682,717,625,943 | 615,482,487,375,282 37 | 18,562,115,921,017,574,302,453,163,671,207 | 4,308,377,411,626,977 39 | 909,543,680,129,861,140,820,205,019,889,143 | 30,158,641,881,388,842 41 | 44,567,640,326,363,195,900,190,045,974,568,007 | 211,110,493,169,721,897 43 | 2,183,814,375,991,796,599,109,312,252,753,832,343 | 1,477,773,452,188,053,281 45 | 107,006,904,423,598,033,356,356,300,384,937,784,807 | 10,344,414,165,316,372,973 47 | 5,243,338,316,756,303,634,461,458,718,861,951,455,543 | 72,410,899,157,214,610,812 49 | 256,923,577,521,058,878,088,611,477,224,235,621,321,607 | 506,876,294,100,502,275,687 51 | 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 | 3,548,134,058,703,515,929,815 53 | 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 | 24,836,938,410,924,611,508,707 55 | 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 | 173,858,568,876,472,280,560,953 57 | 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 | 1,217,009,982,135,305,963,926,677 59 | 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 | 8,519,069,874,947,141,747,486,745 61 | 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 | 59,633,489,124,629,992,232,407,216 63 | 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 | 417,434,423,872,409,945,626,850,517 65 | 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 | 2,922,040,967,106,869,619,387,953,625 67 | 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 | 20,454,286,769,748,087,335,715,675,381 69 | 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 | 143,180,007,388,236,611,350,009,727,669 71 | 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 | 1,002,260,051,717,656,279,450,068,093,686 73 | 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 | 7,015,820,362,023,593,956,150,476,655,802 ``` ## CLU ```% This program uses the 'bigint' cluster from PCLU's 'misc.lib' % Integer square root of a bigint isqrt = proc (x: bigint) returns (bigint) % Initialize a couple of bigints we will reuse own zero: bigint := bigint\$i2bi(0) own one: bigint := bigint\$i2bi(1) own two: bigint := bigint\$i2bi(2) own four: bigint := bigint\$i2bi(4) q: bigint := one while q <= x do q := q * four end t: bigint z: bigint := x r: bigint := zero while q>one do q := q / four t := z - r - q r := r / two if t >= zero then z := t r := r + q end end return(r) end isqrt % Format a bigint using commas fmt = proc (x: bigint) returns (string) own zero: bigint := bigint\$i2bi(0) own ten: bigint := bigint\$i2bi(10) if x=zero then return("0") end out: array[char] := array[char]\$[] ds: int := 0 while x>zero do array[char]\$addl(out, char\$i2c(bigint\$bi2i(x // ten) + 48)) x := x / ten ds := ds + 1 if x~=zero cand ds//3=0 then end end return(string\$ac2s(out)) end fmt start_up = proc () po: stream := stream\$primary_output() % print square roots from 0..65 stream\$putl(po, "isqrt of 0..65:") for i: int in int\$from_to(0, 65) do stream\$puts(po, fmt(isqrt(bigint\$i2bi(i))) || " ") end % print square roots of odd powers stream\$putl(po, "\n\nisqrt of odd powers of 7:") seven: bigint := bigint\$i2bi(7) for p: int in int\$from_to_by(1, 73, 2) do stream\$puts(po, "isqrt(7^") stream\$putright(po, int\$unparse(p), 2) stream\$puts(po, ") = ") stream\$putright(po, fmt(isqrt(seven ** bigint\$i2bi(p))), 41) stream\$putl(po, "") end end start_up``` Output: ```isqrt of 0..65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 isqrt of odd powers of 7: isqrt(7^ 1) = 2 isqrt(7^ 3) = 18 isqrt(7^ 5) = 129 isqrt(7^ 7) = 907 isqrt(7^ 9) = 6,352 isqrt(7^11) = 44,467 isqrt(7^13) = 311,269 isqrt(7^15) = 2,178,889 isqrt(7^17) = 15,252,229 isqrt(7^19) = 106,765,608 isqrt(7^21) = 747,359,260 isqrt(7^23) = 5,231,514,822 isqrt(7^25) = 36,620,603,758 isqrt(7^27) = 256,344,226,312 isqrt(7^29) = 1,794,409,584,184 isqrt(7^31) = 12,560,867,089,291 isqrt(7^33) = 87,926,069,625,040 isqrt(7^35) = 615,482,487,375,282 isqrt(7^37) = 4,308,377,411,626,977 isqrt(7^39) = 30,158,641,881,388,842 isqrt(7^41) = 211,110,493,169,721,897 isqrt(7^43) = 1,477,773,452,188,053,281 isqrt(7^45) = 10,344,414,165,316,372,973 isqrt(7^47) = 72,410,899,157,214,610,812 isqrt(7^49) = 506,876,294,100,502,275,687 isqrt(7^51) = 3,548,134,058,703,515,929,815 isqrt(7^53) = 24,836,938,410,924,611,508,707 isqrt(7^55) = 173,858,568,876,472,280,560,953 isqrt(7^57) = 1,217,009,982,135,305,963,926,677 isqrt(7^59) = 8,519,069,874,947,141,747,486,745 isqrt(7^61) = 59,633,489,124,629,992,232,407,216 isqrt(7^63) = 417,434,423,872,409,945,626,850,517 isqrt(7^65) = 2,922,040,967,106,869,619,387,953,625 isqrt(7^67) = 20,454,286,769,748,087,335,715,675,381 isqrt(7^69) = 143,180,007,388,236,611,350,009,727,669 isqrt(7^71) = 1,002,260,051,717,656,279,450,068,093,686 isqrt(7^73) = 7,015,820,362,023,593,956,150,476,655,802``` ## COBOL The COBOL compiler used here is limited to 18-digit math, meaning 7^19 is the largest odd power of 7 that can be calculated. ``` IDENTIFICATION DIVISION. PROGRAM-ID. I-SQRT. DATA DIVISION. WORKING-STORAGE SECTION. 03 X PIC 9(18). 03 Q PIC 9(18). 03 Z PIC 9(18). 03 T PIC S9(18). 03 R PIC 9(18). 01 TO-65-VARS. 03 ISQRT-N PIC 99. 03 DISP-LN PIC X(22) VALUE SPACES. 03 DISP-FMT PIC Z9. 03 PTR PIC 99 VALUE 1. 01 BIG-SQRT-VARS. 03 POW-7 PIC 9(18) VALUE 7. 03 POW-N PIC 99 VALUE 1. 03 POW-N-OUT PIC Z9. 03 POW-7-OUT PIC Z(10). PROCEDURE DIVISION. BEGIN. PERFORM SQRTS-TO-65. PERFORM BIG-SQRTS. STOP RUN. SQRTS-TO-65. PERFORM DISP-SMALL-SQRT VARYING ISQRT-N FROM 0 BY 1 UNTIL ISQRT-N IS GREATER THAN 65. DISP-SMALL-SQRT. MOVE ISQRT-N TO X. PERFORM ISQRT. MOVE R TO DISP-FMT. STRING DISP-FMT DELIMITED BY SIZE INTO DISP-LN WITH POINTER PTR. IF PTR IS GREATER THAN 22, DISPLAY DISP-LN, MOVE 1 TO PTR. BIG-SQRTS. PERFORM BIG-SQRT 10 TIMES. BIG-SQRT. MOVE POW-7 TO X. PERFORM ISQRT. MOVE POW-N TO POW-N-OUT. MOVE R TO POW-7-OUT. DISPLAY "ISQRT(7^" POW-N-OUT ") = " POW-7-OUT. MULTIPLY 49 BY POW-7. ISQRT. MOVE 1 TO Q. PERFORM MUL-Q-BY-4 UNTIL Q IS GREATER THAN X. MOVE X TO Z. MOVE ZERO TO R. PERFORM ISQRT-STEP UNTIL Q IS NOT GREATER THAN 1. MUL-Q-BY-4. MULTIPLY 4 BY Q. ISQRT-STEP. DIVIDE 4 INTO Q. COMPUTE T = Z - R - Q. DIVIDE 2 INTO R. IF T IS NOT LESS THAN ZERO, MOVE T TO Z, ``` Output: ``` 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 ISQRT(7^ 1) = 2 ISQRT(7^ 3) = 18 ISQRT(7^ 5) = 129 ISQRT(7^ 7) = 907 ISQRT(7^ 9) = 6352 ISQRT(7^11) = 44467 ISQRT(7^13) = 311269 ISQRT(7^15) = 2178889 ISQRT(7^17) = 15252229 ISQRT(7^19) = 106765608``` ## Common Lisp Translation of: Scheme The program is wrapped in a Roswell script. On a POSIX system with Roswell installed, you can simply run the script. The code is an "imperative" translation of the "functional" Scheme. Side notes: • Straight translations from Scheme to Common Lisp run the risk of running properly with some CL compilers but not others, due to the prevalence of tail calls in Scheme. Common Lisp does not require proper tail calls, although CL compilers do optimize such calls, to varying degrees depending on the compiler. • The simple program here would not require tail call optimization at all; the depth of recursion would be too small. I felt it better to write the CL in "imperative" style nonetheless. • Not all Scheme compilers make all tail calls proper, either, at least by default. This, however, is nonstandard behavior. ```#!/bin/sh #|-*- mode:lisp -*-|# #| exec ros -Q -- \$0 "\$@" |# (progn ;;init forms (ros:ensure-asdf) ) (defpackage :ros.script.isqrt.3860764029 (:use :cl)) (in-package :ros.script.isqrt.3860764029) ;; ;; The Rosetta Code integer square root task, in Common Lisp. ;; ;; I translate the tail recursions of the Scheme as regular loops in ;; Common Lisp, although CL compilers most often can optimize tail ;; recursions of the kind. They are not required to, however. ;; ;; As a result, the CL is actually closer to the task's pseudocode ;; than is the Scheme. ;; ;; (The Scheme, by the way, could have been written much as follows, ;; using "set!" where the CL has "setf", and with other such ;; "linguistic" changes.) ;; (defun find-a-power-of-4-greater-than-x (x) (let ((q 1)) (loop until (< x q) do (setf q (* 4 q))) q)) (defun isqrt+remainder (x) (let ((q (find-a-power-of-4-greater-than-x x)) (z x) (r 0)) (loop until (= q 1) do (progn (setf q (/ q 4)) (let ((z1 (- z r q))) (setf r (/ r 2)) (when (<= 0 z1) (setf z z1) (setf r (+ r q)))))) (values r z))) (defun rosetta_code_isqrt (x) (nth-value 0 (isqrt+remainder x))) (defun main (&rest argv) (declare (ignorable argv)) (format t "isqrt(i) for ~D <= i <= ~D:~2%" 0 65) (loop for i from 0 to 64 do (format t "~D " (isqrt i))) (format t "~D~3%" (isqrt 65)) (format t "isqrt(7**i) for ~D <= i <= ~D, i odd:~2%" 1 73) (format t "~2@A ~84@A ~43@A~%" "i" "7**i" "sqrt(7**i)") (format t "~A~%" (make-string 131 :initial-element #\-)) (loop for i from 1 to 73 by 2 for 7**i = (expt 7 i) for root = (rosetta_code_isqrt 7**i) do (format t "~2D ~84:D ~43:D~%" i 7**i root))) ;;; vim: set ft=lisp lisp: ``` Output: ```\$ sh isqrt.ros isqrt(i) for 0 <= i <= 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 isqrt(7**i) for 1 <= i <= 73, i odd: i 7**i sqrt(7**i) ----------------------------------------------------------------------------------------------------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802``` ## Cowgol ```include "cowgol.coh"; # Integer square root sub isqrt(x: uint32): (x0: uint32) is x0 := x >> 1; if x0 == 0 then x0 := x; return; end if; loop var x1 := (x0 + x/x0) >> 1; if x1 >= x0 then break; end if; x0 := x1; end loop; end sub; # Power sub pow(x: uint32, n: uint8): (r: uint32) is r := 1; while n > 0 loop r := r * x; n := n - 1; end loop; end sub; # Print integer square roots of 0..65 var n: uint32 := 0; var col: uint8 := 11; while n <= 65 loop print_i32(isqrt(n)); col := col - 1; if col == 0 then print_nl(); col := 11; else print_char(' '); end if; n := n + 1; end loop; # Cowgol only supports 32-bit integers out of the box, so only powers of 7 # up to 7^11 are printed var x: uint8 := 0; while x <= 11 loop print("isqrt(7^"); print_i8(x); print(") = "); print_i32(isqrt(pow(7, x))); print_nl(); x := x + 1; end loop;``` Output: ```0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 isqrt(7^0) = 1 isqrt(7^1) = 2 isqrt(7^2) = 7 isqrt(7^3) = 18 isqrt(7^4) = 49 isqrt(7^5) = 129 isqrt(7^6) = 343 isqrt(7^7) = 907 isqrt(7^8) = 2401 isqrt(7^9) = 6352 isqrt(7^10) = 16807 isqrt(7^11) = 44467``` ## Craft Basic ```alert "integer square root of first 65 numbers:" for n = 1 to 65 let x = n gosub isqrt print r next n alert "integer square root of odd powers of 7" cls cursor 1, 1 for n = 1 to 21 step 2 let x = 7 ^ n gosub isqrt print "isqrt of 7 ^ ", n, " = ", r next n end sub isqrt let q = 1 do if q <= x then let q = q * 4 endif wait loop q <= x let r = 0 do if q > 1 then let q = q / 4 let t = x - r - q let r = r / 2 if t >= 0 then let x = t let r = r + q endif endif loop q > 1 let r = int(r) return ``` Output: ```integer square root of first 65 numbers: 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 integer square root of odd powers of 7: isqrt of 7 ^ 1 = 2 isqrt of 7 ^ 3 = 18 isqrt of 7 ^ 5 = 129 isqrt of 7 ^ 7 = 907 isqrt of 7 ^ 9 = 6352``` ## D Translation of: Kotlin ```import std.bigint; import std.conv; import std.exception; import std.range; import std.regex; import std.stdio; auto commatize(in char[] txt, in uint start=0, in uint step=3, in string ins=",") @safe in { assert(step > 0); } body { if (start > txt.length || step > txt.length) { return txt; } // First number may begin with digit or decimal point. Exponents ignored. enum decFloField = ctRegex!("[0-9]*\\.[0-9]+|[0-9]+"); auto matchDec = matchFirst(txt[start .. \$], decFloField); if (!matchDec) { return txt; } // Within a decimal float field: // A decimal integer field to commatize is positive and not after a point. enum decIntField = ctRegex!("(?<=\\.)|[1-9][0-9]*"); // A decimal fractional field is preceded by a point, and is only digits. enum decFracField = ctRegex!("(?<=\\.)[0-9]+"); return txt[0 .. start] ~ matchDec.pre ~ matchDec.hit .replace!(m => m.hit.retro.chunks(step).join(ins).retro)(decIntField) .replace!(m => m.hit.chunks(step).join(ins))(decFracField) ~ matchDec.post; } auto commatize(BigInt v) { return commatize(v.to!string); } BigInt sqrt(BigInt x) { enforce(x >= 0); auto q = BigInt(1); while (q <= x) { q <<= 2; } auto z = x; auto r = BigInt(0); while (q > 1) { q >>= 2; auto t = z; t -= r; t -= q; r >>= 1; if (t >= 0) { z = t; r += q; } } return r; } void main() { writeln("The integer square root of integers from 0 to 65 are:"); foreach (i; 0..66) { write(sqrt(BigInt(i)), ' '); } writeln; writeln("The integer square roots of powers of 7 from 7^1 up to 7^73 are:"); writeln("power 7 ^ power integer square root"); writeln("----- --------------------------------------------------------------------------------- -----------------------------------------"); auto pow7 = BigInt(7); immutable bi49 = BigInt(49); for (int i = 1; i <= 73; i += 2) { writefln("%2d %84s %41s", i, pow7.commatize, sqrt(pow7).commatize); pow7 *= bi49; } } ``` Output: ```The integer square root of integers from 0 to 65 are: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 The integer square roots of powers of 7 from 7^1 up to 7^73 are: power 7 ^ power integer square root ----- --------------------------------------------------------------------------------- ----------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802``` See #Pascal. ## Draco Because all the intermediate values have to fit in a signed 32-bit integer, the largest power of 7 for which the square root can be calculated is 7^10. ```/* Integer square root using quadratic residue method */ proc nonrec isqrt(ulong x) ulong: ulong q, z, r; long t; q := 1; while q <= x do q := q << 2 od; z := x; r := 0; while q > 1 do q := q >> 2; t := z - r - q; r := r >> 1; if t >= 0 then z := t; r := r + q fi od; r corp proc nonrec main() void: byte x; ulong pow7; /* print isqrt(0) ... isqrt(65) */ for x from 0 upto 65 do write(isqrt(x):2); if x % 11 = 10 then writeln() fi od; /* print isqrt(7^0) thru isqrt(7^10) */ pow7 := 1; for x from 0 upto 10 do writeln("isqrt(7^", x:2, ") = ", isqrt(pow7):5); pow7 := pow7 * 7 od corp``` Output: ``` 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 isqrt(7^ 0) = 1 isqrt(7^ 1) = 2 isqrt(7^ 2) = 7 isqrt(7^ 3) = 18 isqrt(7^ 4) = 49 isqrt(7^ 5) = 129 isqrt(7^ 6) = 343 isqrt(7^ 7) = 907 isqrt(7^ 8) = 2401 isqrt(7^ 9) = 6352 isqrt(7^10) = 16807``` ## EasyLang Translation of: Lua ```func isqrt x . q = 1 while q <= x q *= 4 . while q > 1 q = q div 4 t = x - r - q r = r div 2 if t >= 0 x = t r = r + q . . return r . print "Integer square roots from 0 to 65:" for n = 0 to 65 write isqrt n & " " . print "" print "" print "Integer square roots of 7^n" p = 7 n = 1 while n <= 21 print n & " " & isqrt p n = n + 2 p = p * 49 .``` ## F# ```// Find Integer Floor sqrt of a Large Integer. Nigel Galloway: July 17th., 2020 let Isqrt n=let rec fN i g l=match(l>0I,i-g-l) with (true,e) when e>=0I->fN e (g/2I+l) (l/4I) |(true,_) ->fN i (g/2I) (l/4I) |_ ->g fN n 0I (let rec fG g=if g>n then g/4I else fG (g*4I) in fG 1I) [0I..65I]|>Seq.iter(Isqrt>>string>>printf "%s "); printfn "\n" let fN n=7I**n in [1..2..73]|>Seq.iter(fN>>Isqrt>>printfn "%a" (fun n g -> n.Write("{0:#,#}", g))) ``` Output: ```0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 2 18 129 907 6,352 44,467 311,269 2,178,889 15,252,229 106,765,608 747,359,260 5,231,514,822 36,620,603,758 256,344,226,312 1,794,409,584,184 12,560,867,089,291 87,926,069,625,040 615,482,487,375,282 4,308,377,411,626,977 30,158,641,881,388,842 211,110,493,169,721,897 1,477,773,452,188,053,281 10,344,414,165,316,372,973 72,410,899,157,214,610,812 506,876,294,100,502,275,687 3,548,134,058,703,515,929,815 24,836,938,410,924,611,508,707 173,858,568,876,472,280,560,953 1,217,009,982,135,305,963,926,677 8,519,069,874,947,141,747,486,745 59,633,489,124,629,992,232,407,216 417,434,423,872,409,945,626,850,517 2,922,040,967,106,869,619,387,953,625 20,454,286,769,748,087,335,715,675,381 143,180,007,388,236,611,350,009,727,669 1,002,260,051,717,656,279,450,068,093,686 7,015,820,362,023,593,956,150,476,655,802 ``` ## Factor The `isqrt` word is a straightforward translation of the pseudocode from the task description using lexical variables. Works with: Factor version 0.99 2020-07-03 ```USING: formatting io kernel locals math math.functions math.ranges prettyprint sequences tools.memory.private ; :: isqrt ( x -- n ) 1 :> q! [ q x > ] [ q 4 * q! ] until x 0 :> ( z! r! ) [ q 1 > ] [ q 4 /i q! z r - q - :> t r -1 shift r! t 0 >= [ t z! r q + r! ] when ] while r ; "Integer square root for numbers 0 to 65 (inclusive):" print 66 <iota> [ bl ] [ isqrt pprint ] interleave nl nl : align ( str str str -- ) "%2s%85s%44s\n" printf ; : show ( n -- ) dup 7 swap ^ dup isqrt [ commas ] tri@ align ; "x" "7^x" "isqrt(7^x)" align "-" "---" "----------" align 1 73 2 <range> [ show ] each ``` Output: ```Integer square root for numbers 0 to 65 (inclusive): 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 x 7^x isqrt(7^x) - --- ---------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802 ``` ## Fish A function (isolated stack; remove the 1[ and ] instructions to create "inline" version) that calculates and outputs the square root of the top of the stack/input number. ```1[:>:r:@@:@,\; ]~\$\!?={:,2+/n ``` ## Forth Only handles odd powers of 7 up to 7^21. ```: d., ( n -- ) \ write double precision int, commatized. tuck dabs <# begin 2dup 1.000 d> while # # # [char] , hold repeat #s rot sign #> type space ; : ., ( n -- ) \ write integer commatized. s>d d., ; : 4* s" 2 lshift" evaluate ; immediate : 4/ s" 2 rshift" evaluate ; immediate : isqrt-mod ( n -- z r ) \ n = r^2 + z 1 begin 2dup >= while 4* repeat 0 locals| r q z | begin q 1 > while q 4/ to q z r - q - \ t r 2/ to r dup 0>= if to z r q + to r else drop then repeat z r ; : isqrt isqrt-mod nip ; ." Integer square roots from 0 to 65:" cr 66 0 do i isqrt . loop cr ; ." Integer square roots of 7^n" cr 7 11 0 do i 2* 1+ 2 .r 3 spaces dup isqrt ., cr 49 * loop ; ``` This version of the core word does not require locals. ```: sqrt-rem ( n -- sqrt rem) >r 0 1 begin dup r@ > 0= while 4 * repeat begin \ find a power of 4 greater than TORS dup 1 > \ compute while greater than unity while 2/ 2/ swap over over + negate r@ + \ integer divide by 4 dup 0< if drop 2/ else r> drop >r 2/ over + then swap repeat drop r> ( sqrt rem) ; : isqrt-mod sqrt-rem swap ; ``` Output: ```Integer square roots from 0 to 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Integer square roots of 7^n 1 2 3 18 5 129 7 907 9 6,352 11 44,467 13 311,269 15 2,178,889 17 15,252,229 19 106,765,608 21 747,359,260 ``` ## Fortran ```MODULE INTEGER_SQUARE_ROOT IMPLICIT NONE CONTAINS ! Convert string representation number to string with comma digit separation FUNCTION COMMATIZE(NUM) RESULT(OUT_STR) INTEGER(16), INTENT(IN) :: NUM INTEGER(16) I CHARACTER(83) :: TEMP, OUT_STR WRITE(TEMP, '(I0)') NUM OUT_STR = "" DO I=0, LEN_TRIM(TEMP)-1 IF (MOD(I, 3) .EQ. 0 .AND. I .GT. 0 .AND. I .LT. LEN_TRIM(TEMP)) THEN OUT_STR = "," // TRIM(OUT_STR) END IF OUT_STR = TEMP(LEN_TRIM(TEMP)-I:LEN_TRIM(TEMP)-I) // TRIM(OUT_STR) END DO END FUNCTION COMMATIZE ! Calculate the integer square root for a given integer FUNCTION ISQRT(NUM) INTEGER(16), INTENT(IN) :: NUM INTEGER(16) :: ISQRT INTEGER(16) :: Q, Z, R, T Q = 1 Z = NUM R = 0 T = 0 DO WHILE (Q .LE. NUM) Q = Q * 4 END DO DO WHILE (Q .GT. 1) Q = Q / 4 T = Z - R - Q R = R / 2 IF (T .GE. 0) THEN Z = T R = R + Q END IF END DO ISQRT = R END FUNCTION ISQRT END MODULE INTEGER_SQUARE_ROOT ! Demonstration of integer square root for numbers 0-65 followed by odd powers of 7 ! from 1-73. Currently this demo takes significant time for numbers above 43 PROGRAM ISQRT_DEMO USE INTEGER_SQUARE_ROOT IMPLICIT NONE INTEGER(16), PARAMETER :: MIN_NUM_HZ = 0 INTEGER(16), PARAMETER :: MAX_NUM_HZ = 65 INTEGER(16), PARAMETER :: POWER_BASE = 7 INTEGER(16), PARAMETER :: POWER_MIN = 1 INTEGER(16), PARAMETER :: POWER_MAX = 73 INTEGER(16), DIMENSION(MAX_NUM_HZ-MIN_NUM_HZ+1) :: VALUES INTEGER(16) :: I WRITE(*,'(A, I0, A, I0)') "Integer square root for numbers ", MIN_NUM_HZ, " to ", MAX_NUM_HZ DO I=1, SIZE(VALUES) VALUES(I) = ISQRT(MIN_NUM_HZ+I) END DO WRITE(*,'(100I2)') VALUES WRITE(*,*) NEW_LINE('A') WRITE(*,*) REPEAT("-", 8+83*2) DO I=POWER_MIN,POWER_MAX, 2 WRITE(*,'(I2, A, A, A, A)') I, " | " // COMMATIZE(7**I), " | ", COMMATIZE(ISQRT(7**I)) END DO END PROGRAM ISQRT_DEMO ``` ```Integer square root for numbers 0 to 65 0 1 1 1 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 n | 7^n | isqrt(7^n) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 1 | 7 | 2 3 | 343 | 18 5 | 16,807 | 129 7 | 823,543 | 907 9 | 40,353,607 | 6,352 11 | 1,977,326,743 | 44,467 13 | 96,889,010,407 | 311,269 15 | 4,747,561,509,943 | 2,178,889 17 | 232,630,513,987,207 | 15,252,229 19 | 11,398,895,185,373,143 | 106,765,608 21 | 558,545,864,083,284,007 | 747,359,260 23 | 27,368,747,340,080,916,343 | 5,231,514,822 25 | 1,341,068,619,663,964,900,807 | 36,620,603,758 27 | 65,712,362,363,534,280,139,543 | 256,344,226,312 29 | 3,219,905,755,813,179,726,837,607 | 1,794,409,584,184 31 | 157,775,382,034,845,806,615,042,743 | 12,560,867,089,291 33 | 7,730,993,719,707,444,524,137,094,407 | 87,926,069,625,040 35 | 378,818,692,265,664,781,682,717,625,943 | 615,482,487,375,282 37 | 18,562,115,921,017,574,302,453,163,671,207 | 4,308,377,411,626,977 39 | 909,543,680,129,861,140,820,205,019,889,143 | 30,158,641,881,388,842 41 | 44,567,640,326,363,195,900,190,045,974,568,007 | 211,110,493,169,721,897 43 | 2,183,814,375,991,796,599,109,312,252,753,832,343 | 1,477,773,452,188,053,281 ``` ## FreeBASIC Odd powers up to 7^21 are shown; more would require an arbitrary precision library that would just add bloat without being illustrative. ```function isqrt( byval x as ulongint ) as ulongint dim as ulongint q = 1, r dim as longint t while q <= x q = q shl 2 wend while q > 1 q = q shr 2 t = x - r - q r = r shr 1 if t >= 0 then x = t r += q end if wend return r end function function commatize( byval N as string ) as string dim as string bloat = "" dim as uinteger c = 0 while N<>"" bloat = right(N,1) + bloat N = left(N, len(N)-1) c += 1 if c mod 3 = 0 and N<>"" then bloat = "," + bloat wend return bloat end function for i as ulongint = 0 to 65 print isqrt(i);" "; next i print dim as string ns for i as uinteger = 1 to 22 step 2 ns = str(isqrt(7^i)) print i, commatize(ns) next i``` Output: ```0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 1 2 3 18 5 129 7 907 9 6,352 11 44,467 13 311,269 15 2,178,889 17 15,252,229 19 106,765,608 21 747,359,260``` ## FutureBasic ```include "NSLog.incl" local fn IntSqrt( x as SInt64 ) as SInt64 SInt64 q = 1, z = x, r = 0, t do q = q * 4 until ( q > x ) while( q > 1 ) q = q / 4 : t = z - r - q : r = r / 2 if ( t > -1 ) then z = t : r = r + q wend end fn = r SInt64 p NSInteger n CFNumberRef tempNum CFStringRef tempStr NSLog( @"Integer square root for numbers 0 to 65:" ) for n = 0 to 65 NSLog( @"%lld \b", fn IntSqrt( n ) ) next NSLog( @"\n" ) NSLog( @"Integer square roots of odd powers of 7 from 1 to 21:" ) NSLog( @" n | 7 ^ n | fn IntSqrt(7 ^ n)" ) p = 7 for n = 1 to 21 step 2 tempNum = fn NumberWithLongLong( fn IntSqrt(p) ) tempStr = fn NumberDescriptionWithLocale( tempNum, fn LocaleCurrent ) NSLog( @"%2d | %18lld | %12s", n, p, fn StringUTF8String( tempStr ) ) p = p * 49 next HandleEvents``` Output: ```Integer square root for numbers 0 to 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Integer square roots of odd powers of 7 from 1 to 21: n | 7 ^ n | fn IntSqrt(7 ^ n) 1 | 7 | 2 3 | 343 | 18 5 | 16807 | 129 7 | 823543 | 907 9 | 40353607 | 6,352 11 | 1977326743 | 44,467 13 | 96889010407 | 311,269 15 | 4747561509943 | 2,178,889 17 | 232630513987207 | 15,252,229 19 | 11398895185373143 | 106,765,608 21 | 558545864083284007 | 747,359,260 ``` ## Go Go's big.Int type already has a built-in integer square root function but, as the point of this task appears to be to compute it using a particular algorithm, we re-code it from the pseudo-code given in the task description. ```package main import ( "fmt" "log" "math/big" ) var zero = big.NewInt(0) var one = big.NewInt(1) func isqrt(x *big.Int) *big.Int { if x.Cmp(zero) < 0 { log.Fatal("Argument cannot be negative.") } q := big.NewInt(1) for q.Cmp(x) <= 0 { q.Lsh(q, 2) } z := new(big.Int).Set(x) r := big.NewInt(0) for q.Cmp(one) > 0 { q.Rsh(q, 2) t := new(big.Int) t.Sub(t, r) t.Sub(t, q) r.Rsh(r, 1) if t.Cmp(zero) >= 0 { z.Set(t) } } return r } func commatize(s string) string { le := len(s) for i := le - 3; i >= 1; i -= 3 { s = s[0:i] + "," + s[i:] } return s } func main() { fmt.Println("The integer square roots of integers from 0 to 65 are:") for i := int64(0); i <= 65; i++ { fmt.Printf("%d ", isqrt(big.NewInt(i))) } fmt.Println() fmt.Println("\nThe integer square roots of powers of 7 from 7^1 up to 7^73 are:\n") fmt.Println("power 7 ^ power integer square root") fmt.Println("----- --------------------------------------------------------------------------------- -----------------------------------------") pow7 := big.NewInt(7) bi49 := big.NewInt(49) for i := 1; i <= 73; i += 2 { fmt.Printf("%2d %84s %41s\n", i, commatize(pow7.String()), commatize(isqrt(pow7).String())) pow7.Mul(pow7, bi49) } } ``` Output: ```The integer square roots of integers from 0 to 65 are: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 The integer square roots of powers of 7 from 7^1 up to 7^73 are: power 7 ^ power integer square root ----- --------------------------------------------------------------------------------- ----------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802 ``` ```import Data.Bits isqrt :: Integer -> Integer isqrt n = go n 0 (q `shiftR` 2) where q = head \$ dropWhile (< n) \$ iterate (`shiftL` 2) 1 go z r 0 = r go z r q = let t = z - r - q in if t >= 0 then go t (r `shiftR` 1 + q) (q `shiftR` 2) else go z (r `shiftR` 1) (q `shiftR` 2) main = do print \$ isqrt <\$> [1..65] mapM_ print \$ zip [1,3..73] (isqrt <\$> iterate (49 *) 7) ``` ```*Main> main [0,1,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8] (1,2) (3,18) (5,129) (7,907) (9,6352) (11,44467) (13,311269) (15,2178889) (17,15252229) (19,106765608) (21,747359260) (23,5231514822) (25,36620603758) (27,256344226312) (29,1794409584184) (31,12560867089291) (33,87926069625040) (35,615482487375282) (37,4308377411626977) (39,30158641881388842) (41,211110493169721897) (43,1477773452188053281) (45,10344414165316372973) (47,72410899157214610812) (49,506876294100502275687) (51,3548134058703515929815) (53,24836938410924611508707) (55,173858568876472280560953) (57,1217009982135305963926677) (59,8519069874947141747486745) (61,59633489124629992232407216) (63,417434423872409945626850517) (65,2922040967106869619387953625) (67,20454286769748087335715675381) (69,143180007388236611350009727669) (71,1002260051717656279450068093686) (73,7015820362023593956150476655802)``` ## Icon ```link numbers # For the "commas" procedure. procedure main () write ("isqrt(i) for 0 <= i <= 65:") write () roots_of_0_to_65() write () write () write ("isqrt(7**i) for 1 <= i <= 73, i odd:") write () printf ("%2s %84s %43s\n", "i", "7**i", "sqrt(7**i)") write (repl("-", 131)) roots_of_odd_powers_of_7() end procedure roots_of_0_to_65 () local i every i := 0 to 64 do writes (isqrt(i), " ") write (isqrt(65)) end procedure roots_of_odd_powers_of_7 () local i, power_of_7, root every i := 1 to 73 by 2 do { power_of_7 := 7^i root := isqrt(power_of_7) printf ("%2d %84s %43s\n", i, commas(power_of_7), commas(root)) } end procedure isqrt (x) local q, z, r, t q := find_a_power_of_4_greater_than_x (x) z := x r := 0 while 1 < q do { q := ishift(q, -2) t := z - r - q r := ishift(r, -1) if 0 <= t then { z := t r +:= q } } return r end procedure find_a_power_of_4_greater_than_x (x) local q q := 1 while q <= x do q := ishift(q, 2) return q end ``` Output: ```\$ icont -s -u -o isqrt isqrt-in-Icon.icn && ./isqrt isqrt(i) for 0 <= i <= 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 isqrt(7**i) for 1 <= i <= 73, i odd: i 7**i sqrt(7**i) ----------------------------------------------------------------------------------------------------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802``` ## J Three implementations given. The floating point method is best for small square roots, Newton's method is fastest for extended integers. isqrt adapted from the page preamble. Note that the "floating point method" is exact when arbitrary precision integers or rational numbers are used. ```isqrt_float=: <.@:%: isqrt_newton=: 9&\$: :(x:@:<.@:-:@:(] + x:@:<.@:%)^:_&>~&:x:) align=: (|.~ i.&' ')"1 comma=: (' ' -.~ [: }: [: , [: (|.) _3 (',' ,~ |.)\ |.)@":&> While=: {{ u^:(0-.@:-:v)^:_ }} isqrt=: 3 :0&> y =. x: y NB. q is a power of 4 that's greater than y. Append 0 0 under binary representation q =. y (,&0 0x&.:#:@:])While>: 1x z =. y NB. set z to the value of y. r =. 0x NB. initialize r to zero. while. 1 < q do. NB. perform while q > unity. q =. _2&}.&.:#: q NB. integer divide by 4 (-2 drop under binary representation) t =. (z - r) - q NB. compute value of t. r =. }:&.:#: r NB. integer divide by two. (curtail under binary representation) if. 0 <: t do. z =. t NB. set z to value of t r =. r + q NB. compute new value of r end. end. NB. r is now the isqrt(y). (most recent value computed) NB. Sidenote: Also, Z is now the remainder after square root NB. ie. r^2 + z = y, so if z = 0 then x is a perfect square NB. r , z ) ``` The first line here shows that the simplest approach (the "floating point square root") is treated specially by J. ``` <.@%: 1000000000000000000000000000000000000000000000000x 1000000000000000000000000 (,. isqrt_float) 7x ^ 20 21x 79792266297612001 282475249 558545864083284007 747359260 (,. isqrt_newton) 7x ^ 20 21x 79792266297612001 282475249 558545864083284007 747359260 align comma (,. isqrt) 7 ^&x: 1 2 p. i. 37 7 2 343 18 16,807 129 823,543 907 40,353,607 6,352 1,977,326,743 44,467 96,889,010,407 311,269 4,747,561,509,943 2,178,889 232,630,513,987,207 15,252,229 11,398,895,185,373,143 106,765,608 558,545,864,083,284,007 747,359,260 27,368,747,340,080,916,343 5,231,514,822 1,341,068,619,663,964,900,807 36,620,603,758 65,712,362,363,534,280,139,543 256,344,226,312 3,219,905,755,813,179,726,837,607 1,794,409,584,184 157,775,382,034,845,806,615,042,743 12,560,867,089,291 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802 NB. isqrt_float is exact for large integers align comma (,.isqrt_float),7^73x 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802 NB. Newton's method result matches isqrt (isqrt_newton -: isqrt)7 ^&x: 1 2 p. i. 37 1 NB. An order of magnitude faster and one tenth the space, in j timespacex 'isqrt_newton 7 ^&x: 1 2 p. i. 37' 0.038085 39552 timespacex 'isqrt 7 ^&x: 1 2 p. i. 37' 0.367744 319712 NB. but not as fast as isqrt_float, nor as space efficient timespacex 'isqrt_float 7 ^&x: 1 2 p. i. 37' 0.0005145 152192``` Note that isqrt_float (`<.@%:`) is, mechanically, a different operation from floating point square root followed by floor. This difference is probably best thought of as a type issue. For example, `<.%:7^73x` (without the `@`) produces a result which has the comma delimited integer representation of 7,015,820,362,023,594,877,495,225,090 rather than the 7,015,820,362,023,593,956,150,476,655,802 which we would get from integer square root. ## Java Translation of: Kotlin ```import java.math.BigInteger; public class Isqrt { private static BigInteger isqrt(BigInteger x) { if (x.compareTo(BigInteger.ZERO) < 0) { throw new IllegalArgumentException("Argument cannot be negative"); } var q = BigInteger.ONE; while (q.compareTo(x) <= 0) { q = q.shiftLeft(2); } var z = x; var r = BigInteger.ZERO; while (q.compareTo(BigInteger.ONE) > 0) { q = q.shiftRight(2); var t = z; t = t.subtract(r); t = t.subtract(q); r = r.shiftRight(1); if (t.compareTo(BigInteger.ZERO) >= 0) { z = t; } } return r; } public static void main(String[] args) { System.out.println("The integer square root of integers from 0 to 65 are:"); for (int i = 0; i <= 65; i++) { System.out.printf("%s ", isqrt(BigInteger.valueOf(i))); } System.out.println(); System.out.println("The integer square roots of powers of 7 from 7^1 up to 7^73 are:"); System.out.println("power 7 ^ power integer square root"); System.out.println("----- --------------------------------------------------------------------------------- -----------------------------------------"); var pow7 = BigInteger.valueOf(7); var bi49 = BigInteger.valueOf(49); for (int i = 1; i < 74; i += 2) { System.out.printf("%2d %,84d %,41d\n", i, pow7, isqrt(pow7)); pow7 = pow7.multiply(bi49); } } } ``` Output: ```The integer square root of integers from 0 to 65 are: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 The integer square roots of powers of 7 from 7^1 up to 7^73 are: power 7 ^ power integer square root ----- --------------------------------------------------------------------------------- ----------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802``` ## jq Translation of: Julia The following program takes advantage of the support for unbounded-precision integer arithmetic provided by gojq, the Go implementation of jq, but it can also be run, with different numerical results, using the C implementation. ```# For gojq def idivide(\$j): . as \$i | (\$i % \$j) as \$mod | (\$i - \$mod) / \$j ; # input should be non-negative def isqrt: . as \$x | 1 | until(. > \$x; . * 4) as \$q | {\$q, \$x, r: 0} | until( .q <= 1; .q |= idivide(4) | .t = .x - .r - .q | .r |= idivide(2) | if .t >= 0 then .x = .t | .r += .q else . end).r ; def power(\$n): . as \$in | reduce range(0;\$n) as \$i (1; . * \$in); def lpad(\$len): tostring | (\$len - length) as \$l | (" " * \$l)[:\$l] + .; "The integer square roots of integers from 0 to 65 are:", [range(0;66) | isqrt], "", "The integer square roots of odd powers of 7 from 7^1 up to 7^73 are:", ("power" + " "*16 + "7 ^ power" + " "*70 + "integer square root"), (range( 1;74;2) as \$i | (7 | power(\$i)) as \$p Output: Invocation: gojq -ncr -f isqrt.jq ```The integer square roots of integers from 0 to 65 are: [0,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8] The integer square roots of odd powers of 7 from 7^1 up to 7^73 are: power 7 ^ power integer square root 1 7 2 3 343 18 5 16807 129 7 823543 907 9 40353607 6352 11 1977326743 44467 13 96889010407 311269 15 4747561509943 2178889 17 232630513987207 15252229 19 11398895185373143 106765608 21 558545864083284007 747359260 23 27368747340080916343 5231514822 25 1341068619663964900807 36620603758 27 65712362363534280139543 256344226312 29 3219905755813179726837607 1794409584184 31 157775382034845806615042743 12560867089291 33 7730993719707444524137094407 87926069625040 35 378818692265664781682717625943 615482487375282 37 18562115921017574302453163671207 4308377411626977 39 909543680129861140820205019889143 30158641881388842 41 44567640326363195900190045974568007 211110493169721897 43 2183814375991796599109312252753832343 1477773452188053281 45 107006904423598033356356300384937784807 10344414165316372973 47 5243338316756303634461458718861951455543 72410899157214610812 49 256923577521058878088611477224235621321607 506876294100502275687 51 12589255298531885026341962383987545444758743 3548134058703515929815 53 616873509628062366290756156815389726793178407 24836938410924611508707 55 30226801971775055948247051683954096612865741943 173858568876472280560953 57 1481113296616977741464105532513750734030421355207 1217009982135305963926677 59 72574551534231909331741171093173785967490646405143 8519069874947141747486745 61 3556153025177363557255317383565515512407041673852007 59633489124629992232407216 63 174251498233690814305510551794710260107945042018748343 417434423872409945626850517 65 8538323413450849900970017037940802745289307058918668807 2922040967106869619387953625 67 418377847259091645147530834859099334519176045887014771543 20454286769748087335715675381 69 20500514515695490612229010908095867391439626248463723805607 143180007388236611350009727669 71 1004525211269079039999221534496697502180541686174722466474743 1002260051717656279450068093686 73 49221735352184872959961855190338177606846542622561400857262407 7015820362023593956150476655802 ``` ## Julia Translation of: Go Julia also has a built in isqrt() function which works on integer types, but the function integer_sqrt is shown for the task. ```using Formatting function integer_sqrt(x) @assert(x >= 0) q = one(x) while q <= x q <<= 2 end z, r = x, zero(x) while q > 1 q >>= 2 t = z - r - q r >>= 1 if t >= 0 z = t r += q end end return r end println("The integer square roots of integers from 0 to 65 are:") println(integer_sqrt.(collect(0:65))) println("\nThe integer square roots of odd powers of 7 from 7^1 up to 7^73 are:\n") println("power", " "^36, "7 ^ power", " "^60, "integer square root") println("----- ", "-"^80, " ------------------------------------------") pow7 = big"7" for i in 1:2:73 end ``` Output: ```The integer square roots of integers from 0 to 65 are: [0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8] The integer square roots of odd powers of 7 from 7^1 up to 7^73 are: power 7 ^ power integer square root ----- -------------------------------------------------------------------------------- ------------------------------------------ 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802 ``` ## Kotlin Translation of: Go ```import java.math.BigInteger fun isqrt(x: BigInteger): BigInteger { if (x < BigInteger.ZERO) { throw IllegalArgumentException("Argument cannot be negative") } var q = BigInteger.ONE while (q <= x) { q = q.shiftLeft(2) } var z = x var r = BigInteger.ZERO while (q > BigInteger.ONE) { q = q.shiftRight(2) var t = z t -= r t -= q r = r.shiftRight(1) if (t >= BigInteger.ZERO) { z = t r += q } } return r } fun main() { println("The integer square root of integers from 0 to 65 are:") for (i in 0..65) { print("\${isqrt(BigInteger.valueOf(i.toLong()))} ") } println() println("The integer square roots of powers of 7 from 7^1 up to 7^73 are:") println("power 7 ^ power integer square root") println("----- --------------------------------------------------------------------------------- -----------------------------------------") var pow7 = BigInteger.valueOf(7) val bi49 = BigInteger.valueOf(49) for (i in (1..73).step(2)) { println("%2d %,84d %,41d".format(i, pow7, isqrt(pow7))) pow7 *= bi49 } } ``` Output: ```The integer square root of integers from 0 to 65 are: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 The integer square roots of powers of 7 from 7^1 up to 7^73 are: power 7 ^ power integer square root ----- --------------------------------------------------------------------------------- ----------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802``` ## Lua Translation of: C ```function isqrt(x) local q = 1 local r = 0 while q <= x do q = q << 2 end while q > 1 do q = q >> 2 local t = x - r - q r = r >> 1 if t >= 0 then x = t r = r + q end end return r end print("Integer square root for numbers 0 to 65:") for n=0,65 do io.write(isqrt(n) .. ' ') end print() print() print("Integer square roots of oddd powers of 7 from 1 to 21:") print(" n | 7 ^ n | isqrt(7 ^ n)") local p = 7 local n = 1 while n <= 21 do print(string.format("%2d | %18d | %12d", n, p, isqrt(p))) ---------------------- n = n + 2 p = p * 49 end ``` Output: ```Integer square root for numbers 0 to 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Integer square roots of oddd powers of 7 from 1 to 21: n | 7 ^ n | isqrt(7 ^ n) 3 | 343 | 18 5 | 16807 | 129 7 | 823543 | 907 9 | 40353607 | 6352 11 | 1977326743 | 44467 13 | 96889010407 | 311269 15 | 4747561509943 | 2178889 17 | 232630513987207 | 15252229 19 | 11398895185373143 | 106765608 21 | 558545864083284007 | 747359260``` ## M2000 Interpreter Using various types up to 7^35 ```module integer_square_root (f=-2) { function IntSqrt(x as long long) { long long q=1, z=x, t, r do q*=4&& : until (q>x) while q>1&& q|div 4&&:t=z-r-q:r|div 2&& if t>-1&& then z=t:r+= q end while =r } long i print #f, "The integer square root of integers from 0 to 65 are:" for i=0 to 65 print #f, IntSqrt(i)+" "; next print #f print #f, "Using Long Long Type" print #f, "The integer square roots of powers of 7 from 7^1 up to 7^21 are:" for i=1 to 21 step 2 { print #f, "IntSqrt(7^"+i+")="+(IntSqrt(7&&^i))+" of 7^"+i+" ("+(7&&^I)+")" } print #f function IntSqrt(x as decimal) { decimal q=1, z=x, t, r do q*=4 : until (q>x) while q>1 q/=4:t=z-r-q:r/=2 if t>-1 then z=t:r+= q end while =r } print #f, "Using Decimal Type" print #f, "The integer square roots of powers of 7 from 7^23 up to 7^33 are:" decimal j,p for i=23 to 33 step 2 { p=1:for j=1 to i:p*=7@:next print #f, "IntSqrt(7^"+i+")="+(IntSqrt(p))+" of 7^"+i+" ("+p+")" } print #f function IntSqrt(x as double) { double q=1, z=x, t, r do q*=4 : until (q>x) while q>1 q/=4:t=z-r-q:r/=2 if t>-1 then z=t:r+= q end while =r } print #f, "Using Double Type" print #f, "The integer square roots of powers of 7 from 7^19 up to 7^35 are:" for i=19 to 35 step 2 { print #f, "IntSqrt(7^"+i+")="+(IntSqrt(7^i))+" of 7^"+i+" ("+(7^i)+")" } print #f } open "" for output as #f // f = -2 now, direct output to screen integer_square_root close #f open "out.txt" for output as #f integer_square_root f close #f Output: ```The integer square root of integers from 0 to 65 are: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Using Long Long Type The integer square roots of powers of 7 from 7^1 up to 7^21 are: IntSqrt(7^1)=2 of 7^1 (7) IntSqrt(7^3)=18 of 7^3 (343) IntSqrt(7^5)=129 of 7^5 (16807) IntSqrt(7^7)=907 of 7^7 (823543) IntSqrt(7^9)=6352 of 7^9 (40353607) IntSqrt(7^11)=44467 of 7^11 (1977326743) IntSqrt(7^13)=311269 of 7^13 (96889010407) IntSqrt(7^15)=2178889 of 7^15 (4747561509943) IntSqrt(7^17)=15252229 of 7^17 (232630513987207) IntSqrt(7^19)=106765608 of 7^19 (11398895185373143) IntSqrt(7^21)=747359260 of 7^21 (558545864083284007) Using Decimal Type The integer square roots of powers of 7 from 7^23 up to 7^33 are: IntSqrt(7^23)=5231514822 of 7^23 (27368747340080916343) IntSqrt(7^25)=36620603758 of 7^25 (1341068619663964900807) IntSqrt(7^27)=256344226312 of 7^27 (65712362363534280139543) IntSqrt(7^29)=1794409584184 of 7^29 (3219905755813179726837607) IntSqrt(7^31)=12560867089291 of 7^31 (157775382034845806615042743) IntSqrt(7^33)=87926069625040 of 7^33 (7730993719707444524137094407) Using Double Type The integer square roots of powers of 7 from 7^19 up to 7^35 are: IntSqrt(7^19)=106765608 of 7^19 (1.13988951853731E+16) IntSqrt(7^21)=747359260 of 7^21 (5.58545864083284E+17) IntSqrt(7^23)=5231514822 of 7^23 (2.73687473400809E+19) IntSqrt(7^25)=36620603758 of 7^25 (1.34106861966396E+21) IntSqrt(7^27)=256344226312 of 7^27 (6.57123623635343E+22) IntSqrt(7^29)=1794409584184 of 7^29 (3.21990575581318E+24) IntSqrt(7^31)=12560867089291 of 7^31 (1.57775382034846E+26) IntSqrt(7^33)=87926069625040 of 7^33 (7.73099371970744E+27) IntSqrt(7^35)=615482487375282 of 7^35 (3.78818692265665E+29) ``` ``` NORMAL MODE IS INTEGER R INTEGER SQUARE ROOT OF X INTERNAL FUNCTION(X) ENTRY TO ISQRT. Q = 1 FNDPW4 WHENEVER Q.LE.X Q = Q * 4 TRANSFER TO FNDPW4 END OF CONDITIONAL Z = X R = 0 FNDRT WHENEVER Q.G.1 Q = Q / 4 T = Z - R - Q R = R / 2 WHENEVER T.GE.0 Z = T R = R + Q END OF CONDITIONAL TRANSFER TO FNDRT END OF CONDITIONAL FUNCTION RETURN R END OF FUNCTION R PRINT INTEGER SQUARE ROOTS OF 0..65 THROUGH SQ65, FOR N=0, 11, N.G.65 SQ65 PRINT FORMAT N11, ISQRT.(N), ISQRT.(N+1), ISQRT.(N+2), 0 ISQRT.(N+3), ISQRT.(N+4), ISQRT.(N+5), ISQRT.(N+6), 1 ISQRT.(N+7), ISQRT.(N+8), ISQRT.(N+9), ISQRT.(N+10) VECTOR VALUES N11 = \$11(I1,S1)*\$ R MACHINE WORD SIZE ON IBM 704 IS 36 BITS R PRINT UP TO AND INCLUDING ISQRT(7^12) POW7 = 1 THROUGH SQ7P12, FOR I=0, 1, I.G.12 PRINT FORMAT SQ7, I, ISQRT.(POW7) SQ7P12 POW7 = POW7 * 7 VECTOR VALUES SQ7 = \$9HISQRT.(7^,I2,4H) = ,I6*\$ END OF PROGRAM``` Output: ```0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 ISQRT.(7^ 0) = 1 ISQRT.(7^ 1) = 2 ISQRT.(7^ 2) = 7 ISQRT.(7^ 3) = 18 ISQRT.(7^ 4) = 49 ISQRT.(7^ 5) = 129 ISQRT.(7^ 6) = 343 ISQRT.(7^ 7) = 907 ISQRT.(7^ 8) = 2401 ISQRT.(7^ 9) = 6352 ISQRT.(7^10) = 16807 ISQRT.(7^11) = 44467 ISQRT.(7^12) = 117649``` ## Mathematica/Wolfram Language ```ClearAll[ISqrt] ISqrt[x_Integer?NonNegative] := Module[{q = 1, z, r, t}, While[q <= x, q *= 4 ]; z = x; r = 0; While[q > 1, q = Quotient[q, 4]; t = z - r - q; r /= 2; If[t >= 0, z = t; r += q ]; ]; r ] ISqrt /@ Range[65] Column[ISqrt /@ (7^Range[1, 73])] ``` Output: ```{1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8} 2 7 18 49 129 343 907 2401 6352 16807 44467 117649 311269 823543 2178889 5764801 15252229 40353607 106765608 282475249 747359260 1977326743 5231514822 13841287201 36620603758 96889010407 256344226312 678223072849 1794409584184 4747561509943 12560867089291 33232930569601 87926069625040 232630513987207 615482487375282 1628413597910449 4308377411626977 11398895185373143 30158641881388842 79792266297612001 211110493169721897 558545864083284007 1477773452188053281 3909821048582988049 10344414165316372973 27368747340080916343 72410899157214610812 191581231380566414401 506876294100502275687 1341068619663964900807 3548134058703515929815 9387480337647754305649 24836938410924611508707 65712362363534280139543 173858568876472280560953 459986536544739960976801 1217009982135305963926677 3219905755813179726837607 8519069874947141747486745 22539340290692258087863249 59633489124629992232407216 157775382034845806615042743 417434423872409945626850517 1104427674243920646305299201 2922040967106869619387953625 7730993719707444524137094407 20454286769748087335715675381 54116956037952111668959660849 143180007388236611350009727669 378818692265664781682717625943 1002260051717656279450068093686 2651730845859653471779023381601 7015820362023593956150476655802``` ## Maxima ```/* -*- Maxima -*- */ /* The Rosetta Code integer square root task, in Maxima. I have not tried to make the output conform quite to the task description, because Maxima is not a general purpose programming language. Perhaps someone else will care to do it. I *do* check that the Rosetta Code routine gives the same results as the built-in function. */ /* pow4gtx -- find a power of 4 greater than x. */ pow4gtx (x) := block ( [q], q : 1, while q <= x do q : bit_lsh (q, 2), q ) \$ /* rosetta_code_isqrt -- find the integer square root. */ rosetta_code_isqrt (x) := block ( [q, z, r, t], q : pow4gtx (x), z : x, r : 0, while 1 < q do ( q : bit_rsh (q, 2), t : z - r - q, r : bit_rsh (r, 1), if 0 <= t then ( z : t, r : r + q ) ), r ) \$ for i : 0 thru 65 do ( display (rosetta_code_isqrt (i), is (equal (rosetta_code_isqrt (i), isqrt (i)))) ) \$ for i : 1 thru 73 step 2 do ( display (7**i, rosetta_code_isqrt (7**i), is (equal (rosetta_code_isqrt (7**i), isqrt (7**i)))) ) \$ ``` Output: ```\$ maxima -q -b isqrt.mac (%i1) batch("isqrt.mac") (%i2) pow4gtx(x):=block([q],q:1,while q <= x do q:bit_lsh(q,2),q) (%i3) rosetta_code_isqrt(x):=block([q,z,r,t],q:pow4gtx(x),z:x,r:0, while 1 < q do (q:bit_rsh(q,2),t:z-r-q,r:bit_rsh(r,1), if 0 <= t then (z:t,r:r+q)),r) (%i4) for i from 0 thru 65 do display(rosetta_code_isqrt(i), is(equal(rosetta_code_isqrt(i),isqrt(i)))) rosetta_code_isqrt(0) = 0 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(1) = 1 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(2) = 1 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(3) = 1 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(4) = 2 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(5) = 2 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(6) = 2 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(7) = 2 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(8) = 2 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(9) = 3 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(10) = 3 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(11) = 3 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(12) = 3 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(13) = 3 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(14) = 3 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(15) = 3 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(16) = 4 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(17) = 4 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(18) = 4 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(19) = 4 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(20) = 4 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(21) = 4 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(22) = 4 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(23) = 4 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(24) = 4 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(25) = 5 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(26) = 5 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(27) = 5 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(28) = 5 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(29) = 5 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(30) = 5 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(31) = 5 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(32) = 5 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(33) = 5 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(34) = 5 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(35) = 5 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(36) = 6 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(37) = 6 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(38) = 6 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(39) = 6 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(40) = 6 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(41) = 6 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(42) = 6 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(43) = 6 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(44) = 6 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(45) = 6 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(46) = 6 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(47) = 6 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(48) = 6 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(49) = 7 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(50) = 7 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(51) = 7 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(52) = 7 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(53) = 7 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(54) = 7 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(55) = 7 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(56) = 7 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(57) = 7 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(58) = 7 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(59) = 7 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(60) = 7 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(61) = 7 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(62) = 7 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(63) = 7 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(64) = 8 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true rosetta_code_isqrt(65) = 8 is(equal(rosetta_code_isqrt(i), isqrt(i))) = true (%i5) for i step 2 thru 73 do display(7^i,rosetta_code_isqrt(7^i), is(equal(rosetta_code_isqrt(7^i),isqrt(7^i)))) 1 7 = 7 rosetta_code_isqrt(7) = 2 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 3 7 = 343 rosetta_code_isqrt(343) = 18 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 5 7 = 16807 rosetta_code_isqrt(16807) = 129 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 7 7 = 823543 rosetta_code_isqrt(823543) = 907 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 9 7 = 40353607 rosetta_code_isqrt(40353607) = 6352 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 11 7 = 1977326743 rosetta_code_isqrt(1977326743) = 44467 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 13 7 = 96889010407 rosetta_code_isqrt(96889010407) = 311269 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 15 7 = 4747561509943 rosetta_code_isqrt(4747561509943) = 2178889 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 17 7 = 232630513987207 rosetta_code_isqrt(232630513987207) = 15252229 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 19 7 = 11398895185373143 rosetta_code_isqrt(11398895185373143) = 106765608 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 21 7 = 558545864083284007 rosetta_code_isqrt(558545864083284007) = 747359260 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 23 7 = 27368747340080916343 rosetta_code_isqrt(27368747340080916343) = 5231514822 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 25 7 = 1341068619663964900807 rosetta_code_isqrt(1341068619663964900807) = 36620603758 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 27 7 = 65712362363534280139543 rosetta_code_isqrt(65712362363534280139543) = 256344226312 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 29 7 = 3219905755813179726837607 rosetta_code_isqrt(3219905755813179726837607) = 1794409584184 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 31 7 = 157775382034845806615042743 rosetta_code_isqrt(157775382034845806615042743) = 12560867089291 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 33 7 = 7730993719707444524137094407 rosetta_code_isqrt(7730993719707444524137094407) = 87926069625040 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 35 7 = 378818692265664781682717625943 rosetta_code_isqrt(378818692265664781682717625943) = 615482487375282 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 37 7 = 18562115921017574302453163671207 rosetta_code_isqrt(18562115921017574302453163671207) = 4308377411626977 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 39 7 = 909543680129861140820205019889143 rosetta_code_isqrt(909543680129861140820205019889143) = 30158641881388842 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 41 7 = 44567640326363195900190045974568007 rosetta_code_isqrt(44567640326363195900190045974568007) = 211110493169721897 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 43 7 = 2183814375991796599109312252753832343 rosetta_code_isqrt(2183814375991796599109312252753832343) = 1477773452188053281 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 45 7 = 107006904423598033356356300384937784807 rosetta_code_isqrt(107006904423598033356356300384937784807) = 10344414165316372973 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 47 7 = 5243338316756303634461458718861951455543 rosetta_code_isqrt(5243338316756303634461458718861951455543) = 72410899157214610812 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 49 7 = 256923577521058878088611477224235621321607 rosetta_code_isqrt(256923577521058878088611477224235621321607) = 506876294100502275687 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 51 7 = 12589255298531885026341962383987545444758743 rosetta_code_isqrt(12589255298531885026341962383987545444758743) = 3548134058703515929815 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 53 7 = 616873509628062366290756156815389726793178407 rosetta_code_isqrt(616873509628062366290756156815389726793178407) = 24836938410924611508707 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 55 7 = 30226801971775055948247051683954096612865741943 rosetta_code_isqrt(30226801971775055948247051683954096612865741943) = 173858568876472280560953 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 57 7 = 1481113296616977741464105532513750734030421355207 rosetta_code_isqrt(1481113296616977741464105532513750734030421355207) = 1217009982135305963926677 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 59 7 = 72574551534231909331741171093173785967490646405143 rosetta_code_isqrt(72574551534231909331741171093173785967490646405143) = 8519069874947141747486745 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 61 7 = 3556153025177363557255317383565515512407041673852007 rosetta_code_isqrt(3556153025177363557255317383565515512407041673852007) = 59633489124629992232407216 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 63 7 = 174251498233690814305510551794710260107945042018748343 rosetta_code_isqrt(174251498233690814305510551794710260107945042018748343) = 417434423872409945626850517 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 65 7 = 8538323413450849900970017037940802745289307058918668807 rosetta_code_isqrt(8538323413450849900970017037940802745289307058918668807) = 2922040967106869619387953625 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 67 7 = 418377847259091645147530834859099334519176045887014771543 rosetta_code_isqrt(418377847259091645147530834859099334519176045887014771543 ) = 20454286769748087335715675381 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 69 7 = 20500514515695490612229010908095867391439626248463723805607 rosetta_code_isqrt(20500514515695490612229010908095867391439626248463723805607 ) = 143180007388236611350009727669 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 71 7 = 1004525211269079039999221534496697502180541686174722466474743 rosetta_code_isqrt(10045252112690790399992215344966975021805416861747224664747\ 43) = 1002260051717656279450068093686 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true 73 7 = 49221735352184872959961855190338177606846542622561400857262407 rosetta_code_isqrt(49221735352184872959961855190338177606846542622561400857262\ 407) = 7015820362023593956150476655802 i i is(equal(rosetta_code_isqrt(7 ), isqrt(7 ))) = true (%o6) /home/trashman/src/chemoelectric/rosettacode-contributions/isqrt.mac``` ## Mercury Translation of: Prolog Works with: Mercury version 20.06.1 ```:- module isqrt_in_mercury. :- interface. :- import_module io. :- pred main(io, io). :- mode main(di, uo) is det. :- implementation. :- import_module char. :- import_module exception. :- import_module int. :- import_module integer.  % Integers of arbitrary size. :- import_module list. :- import_module string. :- func four = integer. four = integer(4). :- func seven = integer. seven = integer(7). %% Find a power of 4 greater than X. :- func pow4gtx(integer) = integer. pow4gtx(X) = Q :- pow4gtx_(X, one, Q). %% The tail recursion for pow4gtx. :- pred pow4gtx_(integer, integer, integer). :- mode pow4gtx_(in, in, out) is det. pow4gtx_(X, A, Q) :- if (X < A) then (Q = A) else (A1 = A * four, pow4gtx_(X, A1, Q)). %% Integer square root function. :- func isqrt(integer) = integer. isqrt(X) = Root :- isqrt(X, Root, _). %% Integer square root and remainder. :- pred isqrt(integer, integer, integer). :- mode isqrt(in, out, out) is det. isqrt(X, Root, Remainder) :- Q = pow4gtx(X), isqrt_(X, Q, zero, X, Root, Remainder). %% The tail recursion for isqrt. :- pred isqrt_(integer, integer, integer, integer, integer, integer). :- mode isqrt_(in, in, in, in, out, out) is det. isqrt_(X, Q, R0, Z0, R, Z) :- if (X < zero) then throw("isqrt of a negative integer") else if (Q = one) then (R = R0, Z = Z0) else (Q1 = Q // four, T = Z0 - R0 - Q1, (if (T >= zero) then (R1 = (R0 // two) + Q1, isqrt_(X, Q1, R1, T, R, Z)) else (R1 is R0 // two, isqrt_(X, Q1, R1, Z0, R, Z)))). %% Insert a character, every three digits, into (what presumably is) %% an integer numeral. (The name "commas" is not very good.) :- func commas(string, char) = string. commas(S, Comma) = T :- RCL = to_rev_char_list(S), commas_(RCL, Comma, 0, [], CL), T = from_char_list(CL). %% The tail recursion for commas. :- pred commas_(list(char), char, int, list(char), list(char)). :- mode commas_(in, in, in, in, out) is det. commas_([], _, _, L, CL) :- L = CL. commas_([C | Tail], Comma, I, L, CL) :- if (I = 3) then commas_([C | Tail], Comma, 0, [Comma | L], CL) else (I1 = I + 1, commas_(Tail, Comma, I1, [C | L], CL)). :- pred roots_m_to_n(integer, integer, io, io). :- mode roots_m_to_n(in, in, di, uo) is det. roots_m_to_n(M, N, !IO) :- if (N < M) then true else (write_string(to_string(isqrt(M)), !IO), (if (M \= N) then write_string(" ", !IO) else true), M1 = M + one, roots_m_to_n(M1, N, !IO)). :- pred roots_of_odd_powers_of_7(integer, integer, io, io). :- mode roots_of_odd_powers_of_7(in, in, di, uo) is det. roots_of_odd_powers_of_7(M, N, !IO) :- if (N < M) then true else (Pow7 = pow(seven, M), Isqrt = isqrt(Pow7), format("%2s %84s %43s", [s(commas(to_string(M), (','))), s(commas(to_string(Pow7), (','))), s(commas(to_string(Isqrt), (',')))], !IO), nl(!IO), M1 = M + two, roots_of_odd_powers_of_7(M1, N, !IO)). main(!IO) :- write_string("isqrt(i) for 0 <= i <= 65:", !IO), nl(!IO), nl(!IO), roots_m_to_n(zero, integer(65), !IO), nl(!IO), nl(!IO), nl(!IO), write_string("isqrt(7**i) for 1 <= i <= 73, i odd:", !IO), nl(!IO), nl(!IO), format("%2s %84s %43s", [s("i"), s("7**i"), s("isqrt(7**i)")], !IO), nl(!IO), write_string(duplicate_char(('-'), 131), !IO), nl(!IO), roots_of_odd_powers_of_7(one, integer(73), !IO). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Instructions for GNU Emacs-- %%% local variables: %%% mode: mercury %%% prolog-indent-width: 2 %%% end: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%``` Output: ```\$ mmc --warn-non-tail-recursion=self-and-mutual -o isqrt isqrt_in_mercury.m && ./isqrt isqrt(i) for 0 <= i <= 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 isqrt(7**i) for 1 <= i <= 73, i odd: i 7**i isqrt(7**i) ----------------------------------------------------------------------------------------------------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802``` ## Modula-2 Uses the algorithm in the task description, with two modifications: (1) As noted in the ALGOL-M solution, the original algorithm can lead to integer overflow when trying to find a power of 4 greater than the argument X. The modified algorithm avoids overflow. (2) In the original algorithm, the variable t can be negative. In the modified algorithm, all variables remain non-negative, and can therefore be declared as unsigned integers if desired. TopSpeed Modula-2 supports no integers larger than unsigned 32-bit, which means that the second part of the task stops at 7^11. There seems to be no option to insert commas into long numbers as requested. ```MODULE IntSqrt; IMPORT IO; (* Procedure to find integer square root of a 32-bit unsigned integer. *) PROCEDURE Isqrt( X : LONGCARD) : LONGCARD; VAR Xdiv4, q, r, s, z : LONGCARD; BEGIN Xdiv4 := X DIV 4; q := 1; WHILE q <= Xdiv4 DO q := 4*q; END; z := X; r := 0; REPEAT s := q + r; r := r DIV 2; IF z >= s THEN DEC(z, s); INC(r, q); END; q := q DIV 4; UNTIL q = 0; RETURN r; END Isqrt; (* Main program *) CONST (* constants for Part 1 of the task *) Max_n = 65; NrPerLine = 22; VAR n : LONGCARD; arr_n, arr_i : ARRAY[0..NrPerLine - 1] OF LONGCARD; (* for display *) j, k : INTEGER; BEGIN (* Part 1 *) k := 0; (* index into arrays *) FOR n := 0 TO Max_n DO arr_n[k] := n; arr_i[k] := Isqrt(n); INC(k); IF (k = NrPerLine) OR (n = Max_n) THEN IO.WrStr( 'Number: '); FOR j := 0 TO k - 1 DO IO.WrLngCard(arr_n[j], 3); END; IO.WrLn(); IO.WrStr( 'Isqrt: '); FOR j := 0 TO k - 1 DO IO.WrLngCard(arr_i[j], 3); END; IO.WrLn(); k := 0; END; END; IO.WrLn(); (* Part 2 *) IO.WrStr( 'Isqrt of odd powers of 7'); IO.WrLn(); n := 7; FOR k := 1 TO 11 BY 2 DO IF k > 1 THEN n := n*49; END; IO.WrInt( k, 2); IO.WrStr( ' --> '); IO.WrLngCard( n, 10); IO.WrStr(' --> '); IO.WrLngCard( Isqrt(n), 5); IO.WrLn(); END; END IntSqrt. ``` Output: ```Number: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 Isqrt: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 Number: 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 Isqrt: 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 Number: 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 Isqrt: 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Isqrt of odd powers of 7 1 --> 7 --> 2 3 --> 343 --> 18 5 --> 16807 --> 129 7 --> 823543 --> 907 9 --> 40353607 --> 6352 11 --> 1977326743 --> 44467 ``` ## Nim Library: bignum This Nim implementation provides an `isqrt` function for signed integers and for big integers. ```import strformat, strutils import bignum func isqrt*[T: SomeSignedInt | Int](x: T): T = ## Compute integer square root for signed integers ## and for big integers. when T is Int: result = newInt() var q = newInt(1) else: result = 0 var q = T(1) while q <= x: q = q shl 2 var z = x while q > 1: q = q shr 2 let t = z - result - q result = result shr 1 if t >= 0: z = t result += q when isMainModule: echo "Integer square root for numbers 0 to 65:" for n in 0..65: stdout.write ' ', isqrt(n) echo "\n" echo "Integer square roots of odd powers of 7 from 7^1 to 7^73:" echo " n" & repeat(' ', 82) & "7^n" & repeat(' ', 34) & "isqrt(7^n)" echo repeat("—", 131) var x = newInt(7) for n in countup(1, 73, 2): echo &"{n:>2} {insertSep(\$x, ','):>82} {insertSep(\$isqrt(x), ','):>41}" x *= 49 ``` Output: ```Integer square root for numbers 0 to 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Integer square roots of odd powers of 7 from 7^1 to 7^73: n 7^n isqrt(7^n) ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802``` ## ObjectIcon Translation of: Icon The only changes needed to make the Icon version work in Object Icon were to "import io" and to import the IPL modules in a different way. ("write" and "writes" are supported by the io module, presumably for compatibility with Icon and to ease migration of the IPL.) ```# -*- ObjectIcon -*- import io import ipl.numbers # For the "commas" procedure. import ipl.printf procedure main () write ("isqrt(i) for 0 <= i <= 65:") write () roots_of_0_to_65() write () write () write ("isqrt(7**i) for 1 <= i <= 73, i odd:") write () printf ("%2s %84s %43s\n", "i", "7**i", "sqrt(7**i)") write (repl("-", 131)) roots_of_odd_powers_of_7() end procedure roots_of_0_to_65 () local i every i := 0 to 64 do writes (isqrt(i), " ") write (isqrt(65)) end procedure roots_of_odd_powers_of_7 () local i, power_of_7, root every i := 1 to 73 by 2 do { power_of_7 := 7^i root := isqrt(power_of_7) printf ("%2d %84s %43s\n", i, commas(power_of_7), commas(root)) } end procedure isqrt (x) local q, z, r, t q := find_a_power_of_4_greater_than_x (x) z := x r := 0 while 1 < q do { q := ishift(q, -2) t := z - r - q r := ishift(r, -1) if 0 <= t then { z := t r +:= q } } return r end procedure find_a_power_of_4_greater_than_x (x) local q q := 1 while q <= x do q := ishift(q, 2) return q end``` Output: ```\$ oit -s -o isqrt isqrt-in-OI.icn && ./isqrt isqrt(i) for 0 <= i <= 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 isqrt(7**i) for 1 <= i <= 73, i odd: i 7**i sqrt(7**i) ----------------------------------------------------------------------------------------------------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802``` ## OCaml Translation of: Scheme Library: Zarith ```(* The Rosetta Code integer square root task, in OCaml, using Zarith for large integers. Compile with, for example: ocamlfind ocamlc -package zarith -linkpkg -o isqrt isqrt.ml Translated from the Scheme. *) let find_a_power_of_4_greater_than_x x = let open Z in let rec loop q = if x < q then q else loop (q lsl 2) in loop one let isqrt x = let open Z in let rec loop q z r = if q = one then r else let q = q asr 2 in let t = z - r - q in let r = r asr 1 in if t < zero then loop q z r else loop q t (r + q) in let q0 = find_a_power_of_4_greater_than_x x in let z0 = x in let r0 = zero in loop q0 z0 r0 let insert_separators s sep = let rec loop revchars i newchars = match revchars with | [] -> newchars | revchars when i = 3 -> loop revchars 0 (sep :: newchars) | c :: tail -> loop tail (i + 1) (c :: newchars) in let revchars = List.rev (List.of_seq (String.to_seq s)) in String.of_seq (List.to_seq (loop revchars 0 [])) let commas s = insert_separators s ',' let main () = Printf.printf "isqrt(i) for 0 <= i <= 65:\n\n"; for i = 0 to 64 do Printf.printf "%s " Z.(to_string (isqrt (of_int i))) done; Printf.printf "%s\n" Z.(to_string (isqrt (of_int 65))); Printf.printf "\n\n"; Printf.printf "isqrt(7**i) for 1 <= i <= 73, i odd:\n\n"; Printf.printf "%2s %84s %43s\n" "i" "7**i" "isqrt(7**i)"; for i = 1 to 131 do Printf.printf "-" done; Printf.printf "\n"; for j = 0 to 36 do let i = j + j + 1 in let power = Z.(of_int 7 ** i) in let root = isqrt power in Printf.printf "%2d %84s %43s\n" i (commas (Z.to_string power)) (commas (Z.to_string root)) done ;; main () ``` Output: ```\$ ocamlfind ocamlc -package zarith -linkpkg -o isqrt isqrt.ml && ./isqrt isqrt(i) for 0 <= i <= 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 isqrt(7**i) for 1 <= i <= 73, i odd: i 7**i isqrt(7**i) ----------------------------------------------------------------------------------------------------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802``` ## Ol ```(print "Integer square roots of 0..65") (for-each (lambda (x) (display (isqrt x)) (display " ")) (iota 66)) (print) (print "Integer square roots of 7^n") (for-each (lambda (x) (print "x: " x ", isqrt: " (isqrt x))) (map (lambda (i) (expt 7 i)) (iota 73 1))) (print) ``` Output: ```Integer square roots of 0..65 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Integer square roots of 7^n x: 7, isqrt: 2 x: 49, isqrt: 7 x: 343, isqrt: 18 x: 2401, isqrt: 49 x: 16807, isqrt: 129 x: 117649, isqrt: 343 x: 823543, isqrt: 907 x: 5764801, isqrt: 2401 x: 40353607, isqrt: 6352 x: 282475249, isqrt: 16807 x: 1977326743, isqrt: 44467 x: 13841287201, isqrt: 117649 x: 96889010407, isqrt: 311269 x: 678223072849, isqrt: 823543 x: 4747561509943, isqrt: 2178889 x: 33232930569601, isqrt: 5764801 x: 232630513987207, isqrt: 15252229 x: 1628413597910449, isqrt: 40353607 x: 11398895185373143, isqrt: 106765608 x: 79792266297612001, isqrt: 282475249 x: 558545864083284007, isqrt: 747359260 x: 3909821048582988049, isqrt: 1977326743 x: 27368747340080916343, isqrt: 5231514822 x: 191581231380566414401, isqrt: 13841287201 x: 1341068619663964900807, isqrt: 36620603758 x: 9387480337647754305649, isqrt: 96889010407 x: 65712362363534280139543, isqrt: 256344226312 x: 459986536544739960976801, isqrt: 678223072849 x: 3219905755813179726837607, isqrt: 1794409584184 x: 22539340290692258087863249, isqrt: 4747561509943 x: 157775382034845806615042743, isqrt: 12560867089291 x: 1104427674243920646305299201, isqrt: 33232930569601 x: 7730993719707444524137094407, isqrt: 87926069625040 x: 54116956037952111668959660849, isqrt: 232630513987207 x: 378818692265664781682717625943, isqrt: 615482487375282 x: 2651730845859653471779023381601, isqrt: 1628413597910449 x: 18562115921017574302453163671207, isqrt: 4308377411626977 x: 129934811447123020117172145698449, isqrt: 11398895185373143 x: 909543680129861140820205019889143, isqrt: 30158641881388842 x: 6366805760909027985741435139224001, isqrt: 79792266297612001 x: 44567640326363195900190045974568007, isqrt: 211110493169721897 x: 311973482284542371301330321821976049, isqrt: 558545864083284007 x: 2183814375991796599109312252753832343, isqrt: 1477773452188053281 x: 15286700631942576193765185769276826401, isqrt: 3909821048582988049 x: 107006904423598033356356300384937784807, isqrt: 10344414165316372973 x: 749048330965186233494494102694564493649, isqrt: 27368747340080916343 x: 5243338316756303634461458718861951455543, isqrt: 72410899157214610812 x: 36703368217294125441230211032033660188801, isqrt: 191581231380566414401 x: 256923577521058878088611477224235621321607, isqrt: 506876294100502275687 x: 1798465042647412146620280340569649349251249, isqrt: 1341068619663964900807 x: 12589255298531885026341962383987545444758743, isqrt: 3548134058703515929815 x: 88124787089723195184393736687912818113311201, isqrt: 9387480337647754305649 x: 616873509628062366290756156815389726793178407, isqrt: 24836938410924611508707 x: 4318114567396436564035293097707728087552248849, isqrt: 65712362363534280139543 x: 30226801971775055948247051683954096612865741943, isqrt: 173858568876472280560953 x: 211587613802425391637729361787678676290060193601, isqrt: 459986536544739960976801 x: 1481113296616977741464105532513750734030421355207, isqrt: 1217009982135305963926677 x: 10367793076318844190248738727596255138212949486449, isqrt: 3219905755813179726837607 x: 72574551534231909331741171093173785967490646405143, isqrt: 8519069874947141747486745 x: 508021860739623365322188197652216501772434524836001, isqrt: 22539340290692258087863249 x: 3556153025177363557255317383565515512407041673852007, isqrt: 59633489124629992232407216 x: 24893071176241544900787221684958608586849291716964049, isqrt: 157775382034845806615042743 x: 174251498233690814305510551794710260107945042018748343, isqrt: 417434423872409945626850517 x: 1219760487635835700138573862562971820755615294131238401, isqrt: 1104427674243920646305299201 x: 8538323413450849900970017037940802745289307058918668807, isqrt: 2922040967106869619387953625 x: 59768263894155949306790119265585619217025149412430681649, isqrt: 7730993719707444524137094407 x: 418377847259091645147530834859099334519176045887014771543, isqrt: 20454286769748087335715675381 x: 2928644930813641516032715844013695341634232321209103400801, isqrt: 54116956037952111668959660849 x: 20500514515695490612229010908095867391439626248463723805607, isqrt: 143180007388236611350009727669 x: 143503601609868434285603076356671071740077383739246066639249, isqrt: 378818692265664781682717625943 x: 1004525211269079039999221534496697502180541686174722466474743, isqrt: 1002260051717656279450068093686 x: 7031676478883553279994550741476882515263791803223057265323201, isqrt: 2651730845859653471779023381601 x: 49221735352184872959961855190338177606846542622561400857262407, isqrt: 7015820362023593956150476655802 ``` ## Pascal [1] Translation of: C++ ```//************************************************// // // // Thanks for rvelthuis for BigIntegers library // // https://github.com/rvelthuis/DelphiBigNumbers // // // //************************************************// {\$APPTYPE CONSOLE} {\$R *.res} uses System.SysUtils, Velthuis.BigIntegers; function isqrt(x: BigInteger): BigInteger; var q, r, t: BigInteger; begin q := 1; r := 0; while (q <= x) do q := q shl 2; while (q > 1) do begin q := q shr 2; t := x - r - q; r := r shr 1; if (t >= 0) then begin x := t; r := r + q; end; end; Result := r; end; function commatize(const n: BigInteger; size: Integer): string; var str: string; digits: Integer; i: Integer; begin Result := ''; str := n.ToString; digits := str.Length; for i := 1 to digits do begin if ((i > 1) and (((i - 1) mod 3) = (digits mod 3))) then Result := Result + ','; Result := Result + str[i]; end; if Result.Length < size then Result := string.Create(' ', size - Result.Length) + Result; end; const POWER_WIDTH = 83; ISQRT_WIDTH = 42; var n, i: Integer; f: TextFile; p: BigInteger; begin AssignFile(f, 'output.txt'); rewrite(f); Writeln(f, 'Integer square root for numbers 0 to 65:'); for n := 0 to 65 do Write(f, isqrt(n).ToString, ' '); Writeln(f, #10#10'Integer square roots of odd powers of 7 from 1 to 73:'); Write(f, ' n |', string.Create(' ', 78), '7 ^ n |', string.Create(' ', 30), 'isqrt(7 ^ n)'#10); Writeln(f, string.Create('-', 17 + POWER_WIDTH + ISQRT_WIDTH)); p := 7; n := 1; repeat Writeln(f, Format('%2d', [n]), ' |', commatize(p, power_width), ' |', commatize(isqrt(p), isqrt_width)); inc(n, 2); p := p * 49; until (n > 73); CloseFile(f); end. ``` ## Perl Translation of: Julia ```# 20201029 added Perl programming solution use strict; use warnings; use bigint; use CLDR::Number 'decimal_formatter'; sub integer_sqrt { ( my \$x = \$_[0] ) >= 0 or die; my \$q = 1; while (\$q <= \$x) { \$q <<= 2 } my (\$z, \$r) = (\$x, 0); while (\$q > 1) { \$q >>= 2; my \$t = \$z - \$r - \$q; \$r >>= 1; if (\$t >= 0) { \$z = \$t; \$r += \$q; } } return \$r } print "The integer square roots of integers from 0 to 65 are:\n"; print map { ( integer_sqrt \$_ ) . ' ' } (0..65); my \$cldr = CLDR::Number->new(); my \$decf = \$cldr->decimal_formatter; print "\nThe integer square roots of odd powers of 7 from 7^1 up to 7^73 are:\n"; print "power", " "x36, "7 ^ power", " "x60, "integer square root\n"; print "----- ", "-"x79, " ------------------------------------------\n"; for (my \$i = 1; \$i < 74; \$i += 2) { printf("%2s ", \$i); printf("%82s", \$decf->format( 7**\$i ) ); printf("%44s", \$decf->format( integer_sqrt(7**\$i) ) ) ; print "\n"; } ``` Output: ```The integer square roots of integers from 0 to 65 are: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 The integer square roots of odd powers of 7 from 7^1 up to 7^73 are: power 7 ^ power integer square root ----- ------------------------------------------------------------------------------- ------------------------------------------ 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802 ``` ## Phix See also Integer_roots#Phix for a simpler and shorter example using the mpz_root() routine, or better yet just use mpz_root() directly (that is, rather than the isqrt() below). ```with javascript_semantics include mpfr.e function isqrt(mpz x) if mpz_cmp_si(x,0)<0 then crash("Argument cannot be negative.") end if mpz q = mpz_init(1), r = mpz_init(0), t = mpz_init(), z = mpz_init_set(x) while mpz_cmp(q,x)<= 0 do mpz_mul_si(q,q,4) end while while mpz_cmp_si(q,1)>0 do assert(mpz_fdiv_q_ui(q, q, 4)=0) mpz_sub(t,z,r) mpz_sub(t,t,q) assert(mpz_fdiv_q_ui(r, r, 2)=0) if mpz_cmp_si(t,0) >= 0 then mpz_set(z,t) end if end while string star = iff(mpz_cmp_si(z,0)=0?"*":" ") return shorten(mpz_get_str(r,10,true))&star end function printf(1,"The integer square roots of integers from 0 to 65 are:\n") for i=0 to 65 do printf(1,"%s ", {trim(isqrt(mpz_init(i)))}) end for printf(1,"\n\npower 7 ^ power integer square root\n") printf(1,"----- --------------------------------------------------------- ----------------------------------------------------------\n") mpz pow7 = mpz_init(7) for i=1 to 9000 do if (i<=73 and remainder(i,2)=1) or (i<100 and remainder(i,10)=5) or (i<1000 and remainder(i,100)=0) or remainder(i,1000)=0 then printf(1,"%4d %58s %61s\n", {i, shorten(mpz_get_str(pow7,10,true)),isqrt(pow7)}) end if mpz_mul_si(pow7,pow7,7) end for ``` Output: Perfect squares are denoted with an asterisk. ```The integer square roots of integers from 0 to 65 are: 0* 1* 1 1 2* 2 2 2 2 3* 3 3 3 3 3 3 4* 4 4 4 4 4 4 4 4 5* 5 5 5 5 5 5 5 5 5 5 6* 6 6 6 6 6 6 6 6 6 6 6 6 7* 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8* 8 power 7 ^ power integer square root ----- --------------------------------------------------------- ---------------------------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,8...,987,545,444,758,743 (44 digits) 3,548,134,058,703,515,929,815 53 616,873,509,628,062,...,389,726,793,178,407 (45 digits) 24,836,938,410,924,611,508,707 55 30,226,801,971,775,0...,096,612,865,741,943 (47 digits) 173,858,568,876,472,280,560,953 57 1,481,113,296,616,97...,734,030,421,355,207 (49 digits) 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,9...,967,490,646,405,143 (50 digits) 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,36...,407,041,673,852,007 (52 digits) 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,...,945,042,018,748,343 (54 digits) 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,84...,307,058,918,668,807 (55 digits) 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,...,045,887,014,771,543 (57 digits) 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,4...,248,463,723,805,607 (59 digits) 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,07...,174,722,466,474,743 (61 digits) 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,8...,561,400,857,262,407 (62 digits) 7,015,820,362,023,593,956,150,476,655,802 75 2,411,865,032,257,05...,508,642,005,857,943 (64 digits) 49,110,742,534,165,157,693,053,336,590,618 85 681,292,175,541,205,...,256,581,907,552,807 (72 digits) 825,404,249,771,713,805,347,147,428,078,522,216 95 192,448,176,927,753,...,224,874,137,973,943 (81 digits) 13,872,569,225,913,193,926,469,506,823,715,722,892,042 100 3,234,476,509,624,75...,459,636,928,060,001 (85 digits) 1,798,465,042,647,41...,569,649,349,251,249 (43 digits)* 200 10,461,838,291,314,3...,534,637,456,120,001 (170 digits) 3,234,476,509,624,75...,459,636,928,060,001 (85 digits)* 300 33,838,570,200,749,1...,841,001,584,180,001 (254 digits) 5,817,092,933,824,34...,721,127,496,191,249 (127 digits)* 400 109,450,060,433,611,...,994,729,312,240,001 (339 digits) 10,461,838,291,314,3...,534,637,456,120,001 (170 digits)* 500 354,013,649,449,525,...,611,820,640,300,001 (423 digits) 18,815,250,448,759,0...,761,742,043,131,249 (212 digits)* 600 1,145,048,833,231,02...,308,275,568,360,001 (508 digits) 33,838,570,200,749,1...,841,001,584,180,001 (254 digits)* 700 3,703,633,553,458,98...,700,094,096,420,001 (592 digits) 60,857,485,599,217,6...,075,492,990,071,249 (296 digits)* 800 11,979,315,728,921,1...,403,276,224,480,001 (677 digits) 109,450,060,433,611,...,994,729,312,240,001 (339 digits)* 900 38,746,815,326,573,9...,033,821,952,540,001 (761 digits) 196,842,107,605,496,...,046,380,337,011,249 (381 digits)* 1000 125,325,663,996,571,...,207,731,280,600,001 (846 digits) 354,013,649,449,525,...,611,820,640,300,001 (423 digits)* 2000 15,706,522,056,181,6...,351,822,561,200,001 (1,691 digits) 125,325,663,996,571,...,207,731,280,600,001 (846 digits)* 3000 1,968,430,305,767,76...,432,273,841,800,001 (2,536 digits) 44,366,995,681,111,4...,787,731,920,900,001 (1,268 digits)* 4000 246,694,835,101,319,...,449,085,122,400,001 (3,381 digits) 15,706,522,056,181,6...,351,822,561,200,001 (1,691 digits)* 5000 30,917,194,013,597,6...,402,256,403,000,001 (4,226 digits) 5,560,323,193,268,32...,900,003,201,500,001 (2,113 digits)* 6000 3,874,717,868,664,96...,291,787,683,600,001 (5,071 digits) 1,968,430,305,767,76...,432,273,841,800,001 (2,536 digits)* 7000 485,601,589,689,818,...,117,678,964,200,001 (5,916 digits) 696,851,196,231,891,...,948,634,482,100,001 (2,958 digits)* 8000 60,858,341,665,667,3...,879,930,244,800,001 (6,761 digits) 246,694,835,101,319,...,449,085,122,400,001 (3,381 digits)* 9000 7,627,112,078,979,99...,578,541,525,400,001 (7,606 digits) 87,333,338,874,567,2...,933,625,762,700,001 (3,803 digits)* ``` (Note that pre-0.8.2 the "(NNN digits)" count includes commas) ## Prolog Works with: SWI-Prolog version 8.5.9 ```%%% -*- Prolog -*- %%% %%% The Rosetta Code integer square root task, for SWI Prolog. %%% %% pow4gtx/2 -- Find a power of 4 greater than X. pow4gtx(X, Q) :- pow4gtx(X, 1, Q), !. pow4gtx(X, A, Q) :- X < A, Q is A. pow4gtx(X, A, Q) :- A1 is A * 4, pow4gtx(X, A1, Q). %% isqrt/2 -- Find integer square root. %% isqrt/3 -- Find integer square root and remainder. isqrt(X, R) :- isqrt(X, R, _). isqrt(X, R, Z) :- pow4gtx(X, Q), isqrt(X, Q, 0, X, R, Z). isqrt(_, 1, R0, Z0, R, Z) :- R is R0, Z is Z0. isqrt(X, Q, R0, Z0, R, Z) :- Q1 is Q // 4, T is Z0 - R0 - Q1, (T >= 0 -> R1 is (R0 // 2) + Q1, isqrt(X, Q1, R1, T, R, Z) ; R1 is R0 // 2, isqrt(X, Q1, R1, Z0, R, Z)). roots(N) :- roots(0, N). roots(I, N) :- isqrt(I, R), write(R), (I =:= N; write(" ")), I1 is I + 1, (N < I1, !; roots(I1, N)). rootspow7(N) :- rootspow7(1, N). rootspow7(I, N) :- Pow7 is 7**I, isqrt(Pow7, R), format("~t~D~2|~t~D~87|~t~D~131|~n", [I, Pow7, R]), I1 is I + 2, (N < I1, !; rootspow7(I1, N)). main :- format("isqrt(i) for 0 <= i <= 65:~2n"), roots(65), format("~3n"), format("isqrt(7**i) for 1 <= i <= 73, i odd:~2n"), format("~t~s~2|~t~s~87|~t~s~131|~n", ["i", "7**i", "isqrt(7**i)"]), format("-----------------------------------------------------------------------------------------------------------------------------------~n"), rootspow7(73), halt. :- initialization(main). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Instructions for GNU Emacs-- %%% local variables: %%% mode: prolog %%% prolog-indent-width: 2 %%% end: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ``` Output: ```\$ swipl isqrt.pl isqrt(i) for 0 <= i <= 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 isqrt(7**i) for 1 <= i <= 73, i odd: i 7**i isqrt(7**i) ----------------------------------------------------------------------------------------------------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802``` ## Python Works with: Python version 2.7 ```def isqrt ( x ): q = 1 while q <= x : q *= 4 z,r = x,0 while q > 1 : q /= 4 t,r = z-r-q,r/2 if t >= 0 : z,r = t,r+q return r print ' '.join( '%d'%isqrt( n ) for n in xrange( 66 )) print '\n'.join( '{0:114,} = isqrt( 7^{1:3} )'.format( isqrt( 7**n ),n ) for n in range( 1,204,2 )) ``` Output: ```0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 2 = isqrt( 7^ 1 ) 18 = isqrt( 7^ 3 ) 129 = isqrt( 7^ 5 ) 907 = isqrt( 7^ 7 ) 6,352 = isqrt( 7^ 9 ) 44,467 = isqrt( 7^ 11 ) 311,269 = isqrt( 7^ 13 ) 2,178,889 = isqrt( 7^ 15 ) 15,252,229 = isqrt( 7^ 17 ) 106,765,608 = isqrt( 7^ 19 ) 747,359,260 = isqrt( 7^ 21 ) 5,231,514,822 = isqrt( 7^ 23 ) 36,620,603,758 = isqrt( 7^ 25 ) 256,344,226,312 = isqrt( 7^ 27 ) 1,794,409,584,184 = isqrt( 7^ 29 ) 12,560,867,089,291 = isqrt( 7^ 31 ) 87,926,069,625,040 = isqrt( 7^ 33 ) 615,482,487,375,282 = isqrt( 7^ 35 ) 4,308,377,411,626,977 = isqrt( 7^ 37 ) 30,158,641,881,388,842 = isqrt( 7^ 39 ) 211,110,493,169,721,897 = isqrt( 7^ 41 ) 1,477,773,452,188,053,281 = isqrt( 7^ 43 ) 10,344,414,165,316,372,973 = isqrt( 7^ 45 ) 72,410,899,157,214,610,812 = isqrt( 7^ 47 ) 506,876,294,100,502,275,687 = isqrt( 7^ 49 ) 3,548,134,058,703,515,929,815 = isqrt( 7^ 51 ) 24,836,938,410,924,611,508,707 = isqrt( 7^ 53 ) 173,858,568,876,472,280,560,953 = isqrt( 7^ 55 ) 1,217,009,982,135,305,963,926,677 = isqrt( 7^ 57 ) 8,519,069,874,947,141,747,486,745 = isqrt( 7^ 59 ) 59,633,489,124,629,992,232,407,216 = isqrt( 7^ 61 ) 417,434,423,872,409,945,626,850,517 = isqrt( 7^ 63 ) 2,922,040,967,106,869,619,387,953,625 = isqrt( 7^ 65 ) 20,454,286,769,748,087,335,715,675,381 = isqrt( 7^ 67 ) 143,180,007,388,236,611,350,009,727,669 = isqrt( 7^ 69 ) 1,002,260,051,717,656,279,450,068,093,686 = isqrt( 7^ 71 ) 7,015,820,362,023,593,956,150,476,655,802 = isqrt( 7^ 73 ) 49,110,742,534,165,157,693,053,336,590,618 = isqrt( 7^ 75 ) 343,775,197,739,156,103,851,373,356,134,328 = isqrt( 7^ 77 ) 2,406,426,384,174,092,726,959,613,492,940,298 = isqrt( 7^ 79 ) 16,844,984,689,218,649,088,717,294,450,582,086 = isqrt( 7^ 81 ) 117,914,892,824,530,543,621,021,061,154,074,602 = isqrt( 7^ 83 ) 825,404,249,771,713,805,347,147,428,078,522,216 = isqrt( 7^ 85 ) 5,777,829,748,401,996,637,430,031,996,549,655,515 = isqrt( 7^ 87 ) 40,444,808,238,813,976,462,010,223,975,847,588,606 = isqrt( 7^ 89 ) 283,113,657,671,697,835,234,071,567,830,933,120,245 = isqrt( 7^ 91 ) 1,981,795,603,701,884,846,638,500,974,816,531,841,720 = isqrt( 7^ 93 ) 13,872,569,225,913,193,926,469,506,823,715,722,892,042 = isqrt( 7^ 95 ) 97,107,984,581,392,357,485,286,547,766,010,060,244,299 = isqrt( 7^ 97 ) 679,755,892,069,746,502,397,005,834,362,070,421,710,095 = isqrt( 7^ 99 ) 4,758,291,244,488,225,516,779,040,840,534,492,951,970,665 = isqrt( 7^101 ) 33,308,038,711,417,578,617,453,285,883,741,450,663,794,661 = isqrt( 7^103 ) 233,156,270,979,923,050,322,173,001,186,190,154,646,562,631 = isqrt( 7^105 ) 1,632,093,896,859,461,352,255,211,008,303,331,082,525,938,421 = isqrt( 7^107 ) 11,424,657,278,016,229,465,786,477,058,123,317,577,681,568,950 = isqrt( 7^109 ) 79,972,600,946,113,606,260,505,339,406,863,223,043,770,982,651 = isqrt( 7^111 ) 559,808,206,622,795,243,823,537,375,848,042,561,306,396,878,562 = isqrt( 7^113 ) 3,918,657,446,359,566,706,764,761,630,936,297,929,144,778,149,940 = isqrt( 7^115 ) 27,430,602,124,516,966,947,353,331,416,554,085,504,013,447,049,581 = isqrt( 7^117 ) 192,014,214,871,618,768,631,473,319,915,878,598,528,094,129,347,071 = isqrt( 7^119 ) 1,344,099,504,101,331,380,420,313,239,411,150,189,696,658,905,429,502 = isqrt( 7^121 ) 9,408,696,528,709,319,662,942,192,675,878,051,327,876,612,338,006,515 = isqrt( 7^123 ) 65,860,875,700,965,237,640,595,348,731,146,359,295,136,286,366,045,605 = isqrt( 7^125 ) 461,026,129,906,756,663,484,167,441,118,024,515,065,954,004,562,319,241 = isqrt( 7^127 ) 3,227,182,909,347,296,644,389,172,087,826,171,605,461,678,031,936,234,687 = isqrt( 7^129 ) 22,590,280,365,431,076,510,724,204,614,783,201,238,231,746,223,553,642,811 = isqrt( 7^131 ) 158,131,962,558,017,535,575,069,432,303,482,408,667,622,223,564,875,499,679 = isqrt( 7^133 ) 1,106,923,737,906,122,749,025,486,026,124,376,860,673,355,564,954,128,497,756 = isqrt( 7^135 ) 7,748,466,165,342,859,243,178,402,182,870,638,024,713,488,954,678,899,484,295 = isqrt( 7^137 ) 54,239,263,157,400,014,702,248,815,280,094,466,172,994,422,682,752,296,390,067 = isqrt( 7^139 ) 379,674,842,101,800,102,915,741,706,960,661,263,210,960,958,779,266,074,730,470 = isqrt( 7^141 ) 2,657,723,894,712,600,720,410,191,948,724,628,842,476,726,711,454,862,523,113,293 = isqrt( 7^143 ) 18,604,067,262,988,205,042,871,343,641,072,401,897,337,086,980,184,037,661,793,056 = isqrt( 7^145 ) 130,228,470,840,917,435,300,099,405,487,506,813,281,359,608,861,288,263,632,551,397 = isqrt( 7^147 ) 911,599,295,886,422,047,100,695,838,412,547,692,969,517,262,029,017,845,427,859,782 = isqrt( 7^149 ) 6,381,195,071,204,954,329,704,870,868,887,833,850,786,620,834,203,124,917,995,018,479 = isqrt( 7^151 ) 44,668,365,498,434,680,307,934,096,082,214,836,955,506,345,839,421,874,425,965,129,358 = isqrt( 7^153 ) 312,678,558,489,042,762,155,538,672,575,503,858,688,544,420,875,953,120,981,755,905,510 = isqrt( 7^155 ) 2,188,749,909,423,299,335,088,770,708,028,527,010,819,810,946,131,671,846,872,291,338,571 = isqrt( 7^157 ) 15,321,249,365,963,095,345,621,394,956,199,689,075,738,676,622,921,702,928,106,039,370,003 = isqrt( 7^159 ) 107,248,745,561,741,667,419,349,764,693,397,823,530,170,736,360,451,920,496,742,275,590,023 = isqrt( 7^161 ) 750,741,218,932,191,671,935,448,352,853,784,764,711,195,154,523,163,443,477,195,929,130,162 = isqrt( 7^163 ) 5,255,188,532,525,341,703,548,138,469,976,493,352,978,366,081,662,144,104,340,371,503,911,136 = isqrt( 7^165 ) 36,786,319,727,677,391,924,836,969,289,835,453,470,848,562,571,635,008,730,382,600,527,377,954 = isqrt( 7^167 ) 257,504,238,093,741,743,473,858,785,028,848,174,295,939,938,001,445,061,112,678,203,691,645,679 = isqrt( 7^169 ) 1,802,529,666,656,192,204,317,011,495,201,937,220,071,579,566,010,115,427,788,747,425,841,519,758 = isqrt( 7^171 ) 12,617,707,666,593,345,430,219,080,466,413,560,540,501,056,962,070,807,994,521,231,980,890,638,309 = isqrt( 7^173 ) 88,323,953,666,153,418,011,533,563,264,894,923,783,507,398,734,495,655,961,648,623,866,234,468,168 = isqrt( 7^175 ) 618,267,675,663,073,926,080,734,942,854,264,466,484,551,791,141,469,591,731,540,367,063,641,277,182 = isqrt( 7^177 ) 4,327,873,729,641,517,482,565,144,599,979,851,265,391,862,537,990,287,142,120,782,569,445,488,940,274 = isqrt( 7^179 ) 30,295,116,107,490,622,377,956,012,199,858,958,857,743,037,765,932,009,994,845,477,986,118,422,581,921 = isqrt( 7^181 ) 212,065,812,752,434,356,645,692,085,399,012,712,004,201,264,361,524,069,963,918,345,902,828,958,073,452 = isqrt( 7^183 ) 1,484,460,689,267,040,496,519,844,597,793,088,984,029,408,850,530,668,489,747,428,421,319,802,706,514,166 = isqrt( 7^185 ) 10,391,224,824,869,283,475,638,912,184,551,622,888,205,861,953,714,679,428,231,998,949,238,618,945,599,162 = isqrt( 7^187 ) 72,738,573,774,084,984,329,472,385,291,861,360,217,441,033,676,002,755,997,623,992,644,670,332,619,194,135 = isqrt( 7^189 ) 509,170,016,418,594,890,306,306,697,043,029,521,522,087,235,732,019,291,983,367,948,512,692,328,334,358,945 = isqrt( 7^191 ) 3,564,190,114,930,164,232,144,146,879,301,206,650,654,610,650,124,135,043,883,575,639,588,846,298,340,512,620 = isqrt( 7^193 ) 24,949,330,804,511,149,625,009,028,155,108,446,554,582,274,550,868,945,307,185,029,477,121,924,088,383,588,341 = isqrt( 7^195 ) 174,645,315,631,578,047,375,063,197,085,759,125,882,075,921,856,082,617,150,295,206,339,853,468,618,685,118,393 = isqrt( 7^197 ) 1,222,517,209,421,046,331,625,442,379,600,313,881,174,531,452,992,578,320,052,066,444,378,974,280,330,795,828,756 = isqrt( 7^199 ) 8,557,620,465,947,324,321,378,096,657,202,197,168,221,720,170,948,048,240,364,465,110,652,819,962,315,570,801,294 = isqrt( 7^201 ) 59,903,343,261,631,270,249,646,676,600,415,380,177,552,041,196,636,337,682,551,255,774,569,739,736,208,995,609,059 = isqrt( 7^203 ) ``` ## Quackery ``` [ dup size 3 / times [ char , swap i 1+ -3 * stuff ] dup 0 peek char , = if [ behead drop ] ] is +commas ( \$ --> \$ ) [ over size - space swap of swap join ] is justify ( \$ n --> \$ ) [ 1 [ 2dup < not while 2 << again ] 0 [ over 1 > while dip [ 2 >> 2dup - ] dup 1 >> unrot - dup 0 < iff drop else [ 2swap nip rot over + ] again ] nip swap ] is sqrt+ ( n --> n n ) ( sqrt+ returns the integer square root and remainder ) ( i.e. isqrt+ of 28 is 5 remainder 3 as (5^2)+3 = 28 ) ( To make it task compliant change the last line to ) ( "nip nip ] is sqrt+ ( n --> n )" ) 66 times [ i^ sqrt+ drop echo sp ] cr cr 73 times [ 7 i^ 1+ ** sqrt+ drop number\$ +commas 41 justify echo\$ cr 2 step ]``` Output: ```0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 2 18 129 907 6,352 44,467 311,269 2,178,889 15,252,229 106,765,608 747,359,260 5,231,514,822 36,620,603,758 256,344,226,312 1,794,409,584,184 12,560,867,089,291 87,926,069,625,040 615,482,487,375,282 4,308,377,411,626,977 30,158,641,881,388,842 211,110,493,169,721,897 1,477,773,452,188,053,281 10,344,414,165,316,372,973 72,410,899,157,214,610,812 506,876,294,100,502,275,687 3,548,134,058,703,515,929,815 24,836,938,410,924,611,508,707 173,858,568,876,472,280,560,953 1,217,009,982,135,305,963,926,677 8,519,069,874,947,141,747,486,745 59,633,489,124,629,992,232,407,216 417,434,423,872,409,945,626,850,517 2,922,040,967,106,869,619,387,953,625 20,454,286,769,748,087,335,715,675,381 143,180,007,388,236,611,350,009,727,669 1,002,260,051,717,656,279,450,068,093,686 7,015,820,362,023,593,956,150,476,655,802 ``` ## Racket ```#lang racket ;; Integer Square Root (using Quadratic Residue) (define (isqrt x) (define q-init ; power of 4 greater than x (let loop ([acc 1]) (if (<= acc x) (loop (* acc 4)) acc))) (define-values (z r q) (let loop ([z x] [r 0] [q q-init]) (if (<= q 1) (values z r q) (let* ([q (/ q 4)] [t (- z r q)] [r (/ r 2)]) (if (>= t 0) (loop t (+ r q) q) (loop z r q)))))) r) (define (format-with-commas str #:chunk-size [size 3]) (define len (string-length str)) (define len-mod (modulo len size)) (define chunks (for/list ([i (in-range len-mod len size)]) (substring str i (+ i size)))) (string-join (if (= len-mod 0) chunks (cons (substring str 0 len-mod) chunks)) ",")) (displayln "Isqrt of integers (0 -> 65):") (for ([i 66]) (printf "~a " (isqrt i))) (displayln "\n\nIsqrt of odd powers of 7 (7 -> 7^73):") (for/fold ([num 7]) ([i (in-range 1 74 2)]) (printf "Isqrt(7^~a) = ~a\n" i (format-with-commas (number->string (isqrt num)))) (* num 49)) ``` Output: ```Isqrt of integers (0 -> 65): 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Isqrt of odd powers of 7 (7 -> 7^73): Isqrt(7^1) = 2 Isqrt(7^3) = 18 Isqrt(7^5) = 129 Isqrt(7^7) = 907 Isqrt(7^9) = 6,352 Isqrt(7^11) = 44,467 Isqrt(7^13) = 311,269 Isqrt(7^15) = 2,178,889 Isqrt(7^17) = 15,252,229 Isqrt(7^19) = 106,765,608 Isqrt(7^21) = 747,359,260 Isqrt(7^23) = 5,231,514,822 Isqrt(7^25) = 36,620,603,758 Isqrt(7^27) = 256,344,226,312 Isqrt(7^29) = 1,794,409,584,184 Isqrt(7^31) = 12,560,867,089,291 Isqrt(7^33) = 87,926,069,625,040 Isqrt(7^35) = 615,482,487,375,282 Isqrt(7^37) = 4,308,377,411,626,977 Isqrt(7^39) = 30,158,641,881,388,842 Isqrt(7^41) = 211,110,493,169,721,897 Isqrt(7^43) = 1,477,773,452,188,053,281 Isqrt(7^45) = 10,344,414,165,316,372,973 Isqrt(7^47) = 72,410,899,157,214,610,812 Isqrt(7^49) = 506,876,294,100,502,275,687 Isqrt(7^51) = 3,548,134,058,703,515,929,815 Isqrt(7^53) = 24,836,938,410,924,611,508,707 Isqrt(7^55) = 173,858,568,876,472,280,560,953 Isqrt(7^57) = 1,217,009,982,135,305,963,926,677 Isqrt(7^59) = 8,519,069,874,947,141,747,486,745 Isqrt(7^61) = 59,633,489,124,629,992,232,407,216 Isqrt(7^63) = 417,434,423,872,409,945,626,850,517 Isqrt(7^65) = 2,922,040,967,106,869,619,387,953,625 Isqrt(7^67) = 20,454,286,769,748,087,335,715,675,381 Isqrt(7^69) = 143,180,007,388,236,611,350,009,727,669 Isqrt(7^71) = 1,002,260,051,717,656,279,450,068,093,686 Isqrt(7^73) = 7,015,820,362,023,593,956,150,476,655,802 ``` ## Raku There is a task Integer roots that covers a similar operation, with the caveat that it will calculate any nth root (including 2) not just square roots. See the Integer roots Raku entry. ```use Lingua::EN::Numbers; sub isqrt ( \x ) { my ( \$X, \$q, \$r, \$t ) = x, 1, 0 ; \$q +<= 2 while \$q ≤ \$X ; while \$q > 1 { \$q +>= 2; \$t = \$X - \$r - \$q; \$r +>= 1; if \$t ≥ 0 { \$X = \$t; \$r += \$q } } \$r } say (^66)».&{ isqrt \$_ }.Str ; (1, 3…73)».&{ "7**\$_: " ~ comma(isqrt 7**\$_) }».say ``` Output: ```0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 7**1: 2 7**3: 18 7**5: 129 7**7: 907 7**9: 6,352 7**11: 44,467 7**13: 311,269 7**15: 2,178,889 7**17: 15,252,229 7**19: 106,765,608 7**21: 747,359,260 7**23: 5,231,514,822 7**25: 36,620,603,758 7**27: 256,344,226,312 7**29: 1,794,409,584,184 7**31: 12,560,867,089,291 7**33: 87,926,069,625,040 7**35: 615,482,487,375,282 7**37: 4,308,377,411,626,977 7**39: 30,158,641,881,388,842 7**41: 211,110,493,169,721,897 7**43: 1,477,773,452,188,053,281 7**45: 10,344,414,165,316,372,973 7**47: 72,410,899,157,214,610,812 7**49: 506,876,294,100,502,275,687 7**51: 3,548,134,058,703,515,929,815 7**53: 24,836,938,410,924,611,508,707 7**55: 173,858,568,876,472,280,560,953 7**57: 1,217,009,982,135,305,963,926,677 7**59: 8,519,069,874,947,141,747,486,745 7**61: 59,633,489,124,629,992,232,407,216 7**63: 417,434,423,872,409,945,626,850,517 7**65: 2,922,040,967,106,869,619,387,953,625 7**67: 20,454,286,769,748,087,335,715,675,381 7**69: 143,180,007,388,236,611,350,009,727,669 7**71: 1,002,260,051,717,656,279,450,068,093,686 7**73: 7,015,820,362,023,593,956,150,476,655,802``` ## REXX A fair amount of code was included so that the output aligns correctly. ```/*REXX program computes and displays the Isqrt (integer square root) of some integers.*/ numeric digits 200 /*insure 'nuff decimal digs for results*/ parse arg range power base . /*obtain optional arguments from the CL*/ if range=='' | range=="," then range= 0..65 /*Not specified? Then use the default.*/ if power=='' | power=="," then power= 1..73 /* " " " " " " */ if base =='' | base =="," then base = 7 /* " " " " " " */ parse var range rLO '..' rHI; if rHI=='' then rHI= rLO /*handle a range? */ parse var power pLO '..' pHI; if pHI=='' then pHI= pLO /* " " " */ \$= do j=rLO to rHI while rHI>0 /*compute Isqrt for a range of integers*/ \$= \$ commas( Isqrt(j) ) /*append the Isqrt to a list for output*/ end /*j*/ \$= strip(\$) /*elide the leading blank in the list. */ say center(' Isqrt for numbers: ' rLO " ──► " rHI' ', length(\$), "─") say strip(\$) /*\$ has a leading blank for 1st number*/ say z= base ** pHI /*compute max. exponentiation product.*/ Lp= max(30, length( commas( z) ) ) /*length of " " " */ Lr= max(20, length( commas( Isqrt(z) ) ) ) /* " " " " " Isqrt of above.*/ say 'index' center(base"**index", Lp) center('Isqrt', Lr) /*show a title.*/ say '─────' copies("─", Lp) copies('─', Lr) /* " " header*/ do j=pLO to pHI by 2 while pHI>0; x= base ** j say center(j, 5) right( commas(x), Lp) right( commas( Isqrt(x) ), Lr) end /*j*/ /* [↑] show a bunch of powers & Isqrt.*/ exit 0 /*stick a fork in it, we're all done. */ /*──────────────────────────────────────────────────────────────────────────────────────*/ commas: parse arg _; do jc=length(_)-3 to 1 by -3; _=insert(',', _, jc); end; return _ /*──────────────────────────────────────────────────────────────────────────────────────*/ Isqrt: procedure; parse arg x /*obtain the only passed argument X. */ x= x % 1 /*convert possible real X to an integer*/ /* ◄■■■■■■■ optional. */ q= 1 /*initialize the Q variable to unity.*/ do until q>x /*find a Q that is greater than X. */ q= q * 4 /*multiply Q by four. */ end /*until*/ r= 0 /*R: will be the integer sqrt of X. */ do while q>1 /*keep processing while Q is > than 1*/ q= q % 4 /*divide Q by four (no remainder). */ t= x - r - q /*compute a temporary variable. */ r= r % 2 /*divide R by two (no remainder). */ if t >= 0 then do /*if T is non─negative ... */ x= t /*recompute the value of X */ r= r + q /* " " " " R */ end end /*while*/ return r /*return the integer square root of X. */ ``` output   when using the default inputs: ```───────────────────────────────────────────────── Isqrt for numbers: 0 ──► 65 ────────────────────────────────────────────────── 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 index 7**index Isqrt ───── ────────────────────────────────────────────────────────────────────────────────── ───────────────────────────────────────── 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802 ``` ## RPL Because RPL can only handle unsigned integers, a light change has been made in the proposed algorithm, Works with: Halcyon Calc version 4.2.7 RPL code Comment ``` ≪ #1 WHILE DUP2 ≥ REPEAT SL SL END #0 WHILE OVER #1 > REPEAT SWAP SR SR SWAP DUP2 + SWAP SR SWAP IF 4 PICK SWAP DUP2 ≥ THEN - 4 ROLL DROP ROT ROT OVER + ELSE DROP2 END END ROT ROT DROP2 ≫ ´ISQRT’ STO ``` ```ISQRT ( #n -- #sqrt(n) ) q ◄── 1 perform while q <= x q ◄── q * 4 z ◄── x r ◄── 0 perform while q > 1 q ◄── q ÷ 4 u ◄── r + q r ◄── r ÷ 2 if z >= u then do z ◄── z - u r ◄── r + q else remove u and copy of z from stack end perform, clean stack ``` Input: ```≪ { } 0 65 FOR n n R→B ISQRT B→R + NEXT ≫ EVAL ≪ {} #7 1 11 START DUP ISQRT ROT SWAP + SWAP 49 * NEXT DROP ≫ EVAL ``` Output: ```2: { 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 } 1: { # 2d # 18d # 129d # 907d # 6352d # 44467d # 311269d # 2178889d # 15252229d # 106765608d # 747359260d } ``` ## Ruby Ruby already has Integer.sqrt, which results in the integer square root of a positive integer. It can be re-implemented as follows: ```module Commatize refine Integer do def commatize self.to_s.gsub( /(\d)(?=\d{3}+(?:\.|\$))(\d{3}\..*)?/, "\\1,\\2") end end end using Commatize def isqrt(x) q, r = 1, 0 while (q <= x) do q <<= 2 end while (q > 1) do q >>= 2; t = x-r-q; r >>= 1 if (t >= 0) then x, r = t, r+q end end r end puts (0..65).map{|n| isqrt(n) }.join(" ") 1.step(73, 2) do |n| print "#{n}:\t" puts isqrt(7**n).commatize end ``` Output: ```0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 1: 2 3: 18 5: 129 7: 907 9: 6,352 11: 44,467 13: 311,269 15: 2,178,889 17: 15,252,229 19: 106,765,608 21: 747,359,260 23: 5,231,514,822 25: 36,620,603,758 27: 256,344,226,312 29: 1,794,409,584,184 31: 12,560,867,089,291 33: 87,926,069,625,040 35: 615,482,487,375,282 37: 4,308,377,411,626,977 39: 30,158,641,881,388,842 41: 211,110,493,169,721,897 43: 1,477,773,452,188,053,281 45: 10,344,414,165,316,372,973 47: 72,410,899,157,214,610,812 49: 506,876,294,100,502,275,687 51: 3,548,134,058,703,515,929,815 53: 24,836,938,410,924,611,508,707 55: 173,858,568,876,472,280,560,953 57: 1,217,009,982,135,305,963,926,677 59: 8,519,069,874,947,141,747,486,745 61: 59,633,489,124,629,992,232,407,216 63: 417,434,423,872,409,945,626,850,517 65: 2,922,040,967,106,869,619,387,953,625 67: 20,454,286,769,748,087,335,715,675,381 69: 143,180,007,388,236,611,350,009,727,669 71: 1,002,260,051,717,656,279,450,068,093,686 73: 7,015,820,362,023,593,956,150,476,655,802 ``` ## Rust ```use num::BigUint; use num::CheckedSub; use num_traits::{One, Zero}; fn isqrt(number: &BigUint) -> BigUint { let mut q: BigUint = One::one(); while q <= *number { q <<= &2; } let mut z = number.clone(); let mut result: BigUint = Zero::zero(); while q > One::one() { q >>= &2; let t = z.checked_sub(&result).and_then(|diff| diff.checked_sub(&q)); result >>= &1; if let Some(t) = t { z = t; result += &q; } } result } fn with_thousand_separator(s: &str) -> String { let digits: Vec<_> = s.chars().rev().collect(); let chunks: Vec<_> = digits .chunks(3) .map(|chunk| chunk.iter().collect::<String>()) .collect(); chunks.join(",").chars().rev().collect::<String>() } fn main() { println!("The integer square roots of integers from 0 to 65 are:"); (0_u32..=65).for_each(|n| print!("{} ", isqrt(&n.into()))); println!("\nThe integer square roots of odd powers of 7 from 7^1 up to 7^74 are:"); (1_u32..75).step_by(2).for_each(|exp| { println!( "7^{:>2}={:>83} ISQRT: {:>42} ", exp, with_thousand_separator(&BigUint::from(7_u8).pow(exp).to_string()), with_thousand_separator(&isqrt(&BigUint::from(7_u8).pow(exp)).to_string()) ) }); } ``` Output: ```The integer square roots of integers from 0 to 65 are: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 The integer square roots of odd powers of 7 from 7^1 up to 7^74 are: 7^ 1= 7 ISQRT: 2 7^ 3= 343 ISQRT: 18 7^ 5= 16,807 ISQRT: 129 7^ 7= 823,543 ISQRT: 907 7^ 9= 40,353,607 ISQRT: 6,352 7^11= 1,977,326,743 ISQRT: 44,467 7^13= 96,889,010,407 ISQRT: 311,269 7^15= 4,747,561,509,943 ISQRT: 2,178,889 7^17= 232,630,513,987,207 ISQRT: 15,252,229 7^19= 11,398,895,185,373,143 ISQRT: 106,765,608 7^21= 558,545,864,083,284,007 ISQRT: 747,359,260 7^23= 27,368,747,340,080,916,343 ISQRT: 5,231,514,822 7^25= 1,341,068,619,663,964,900,807 ISQRT: 36,620,603,758 7^27= 65,712,362,363,534,280,139,543 ISQRT: 256,344,226,312 7^29= 3,219,905,755,813,179,726,837,607 ISQRT: 1,794,409,584,184 7^31= 157,775,382,034,845,806,615,042,743 ISQRT: 12,560,867,089,291 7^33= 7,730,993,719,707,444,524,137,094,407 ISQRT: 87,926,069,625,040 7^35= 378,818,692,265,664,781,682,717,625,943 ISQRT: 615,482,487,375,282 7^37= 18,562,115,921,017,574,302,453,163,671,207 ISQRT: 4,308,377,411,626,977 7^39= 909,543,680,129,861,140,820,205,019,889,143 ISQRT: 30,158,641,881,388,842 7^41= 44,567,640,326,363,195,900,190,045,974,568,007 ISQRT: 211,110,493,169,721,897 7^43= 2,183,814,375,991,796,599,109,312,252,753,832,343 ISQRT: 1,477,773,452,188,053,281 7^45= 107,006,904,423,598,033,356,356,300,384,937,784,807 ISQRT: 10,344,414,165,316,372,973 7^47= 5,243,338,316,756,303,634,461,458,718,861,951,455,543 ISQRT: 72,410,899,157,214,610,812 7^49= 256,923,577,521,058,878,088,611,477,224,235,621,321,607 ISQRT: 506,876,294,100,502,275,687 7^51= 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 ISQRT: 3,548,134,058,703,515,929,815 7^53= 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 ISQRT: 24,836,938,410,924,611,508,707 7^55= 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 ISQRT: 173,858,568,876,472,280,560,953 7^57= 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 ISQRT: 1,217,009,982,135,305,963,926,677 7^59= 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 ISQRT: 8,519,069,874,947,141,747,486,745 7^61= 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 ISQRT: 59,633,489,124,629,992,232,407,216 7^63= 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 ISQRT: 417,434,423,872,409,945,626,850,517 7^65= 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 ISQRT: 2,922,040,967,106,869,619,387,953,625 7^67= 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 ISQRT: 20,454,286,769,748,087,335,715,675,381 7^69= 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 ISQRT: 143,180,007,388,236,611,350,009,727,669 7^71= 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 ISQRT: 1,002,260,051,717,656,279,450,068,093,686 7^73= 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 ISQRT: 7,015,820,362,023,593,956,150,476,655,802 ``` ## S-BASIC This follows the algorithm given in the task description. The q = q * 4 computation, however, will result in overflow (and an endless loop!) for large values of x. ```comment return integer square root of n using quadratic residue algorithm. WARNING: the function will fail for x > 16,383. end function isqrt(x = integer) = integer var q, r, t = integer q = 1 while q <= x do q = q * 4 rem overflow may occur here! r = 0 while q > 1 do begin q = q / 4 t = x - r - q r = r / 2 if t >= 0 then begin x = t r = r + q end end end = r rem - Exercise the function var n, pow7 = integer print "Integer square root of first 65 numbers" for n=1 to 65 print using "#####";isqrt(n); next n print print "Integer square root of odd powers of 7" print " n 7^n isqrt" print "------------------" for n=1 to 3 step 2 pow7 = 7^n print using "### #### ####";n; pow7; isqrt(pow7) next n end ``` An alternate version of isqrt() that can handle the full range of S-BASIC integer values (well, almost: it will fail for 32,767) looks like this. ```function isqrt(x = integer) = integer var x0, x1 = integer x1 = x repeat begin x0 = x1 x1 = (x0 + x / x0) / 2 end until x1 >= x0 end = x0 ``` Output: The output for 7^5 will be shown only if the alternate version of the function is used. ```Integer square root of first 65 numbers 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Integer square root of odd powers of 7 n 7^n isqrt ------------------ 1 7 2 3 343 18 5 16807 129 ``` ## Scheme Works with: CHICKEN version 5.3.0 Library: r7rs Library: format Adapting this to any given R7RS Scheme is probably mainly a matter of changing how output is done. ```(import (scheme base)) (import (scheme write)) (import (format)) ;; Common Lisp formatting for CHICKEN Scheme. (define (find-a-power-of-4-greater-than-x x) (let loop ((q 1)) (if (< x q) q (loop (* 4 q))))) (define (isqrt+remainder x) (let loop ((q (find-a-power-of-4-greater-than-x x)) (z x) (r 0)) (if (= q 1) (values r z) (let* ((q (truncate-quotient q 4)) (t (- z r q)) (r (truncate-quotient r 2))) (if (negative? t) (loop q z r) (loop q t (+ r q))))))) (define (isqrt x) (let-values (((q r) (isqrt+remainder x))) q)) (format #t "isqrt(i) for ~D <= i <= ~D:~2%" 0 65) (do ((i 0 (+ i 1))) ((= i 65)) (format #t "~D " (isqrt i))) (format #t "~D~3%" (isqrt 65)) (format #t "isqrt(7**i) for ~D <= i <= ~D, i odd:~2%" 1 73) (format #t "~2@A ~84@A ~43@A~%" "i" "7**i" "sqrt(7**i)") (format #t "~A~%" (make-string 131 #\-)) (do ((i 1 (+ i 2))) ((= i 75)) (let ((7**i (expt 7 i))) (format #t "~2D ~84:D ~43:D~%" i 7**i (isqrt 7**i)))) ``` Output: ```\$ csc -O3 -R r7rs isqrt.scm && ./isqrt isqrt(i) for 0 <= i <= 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 isqrt(7**i) for 1 <= i <= 73, i odd: i 7**i sqrt(7**i) ----------------------------------------------------------------------------------------------------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802``` ## SETL ```program isqrt; loop for i in [1..65] do if i mod 13=0 then print(); end if; end loop; print(); loop for p in [1, 3..73] do sqrtp := isqrt(7 ** p); print("sqrt(7^" + lpad(str p,2) + ") = " + lpad(str sqrtp, 32)); end loop; proc isqrt(x); q := 1; loop while q<=x do q *:= 4; end loop; z := x; r := 0; loop while q>1 do q div:= 4; t := z-r-q; r div:= 2; if t>=0 then z := t; r +:= q; end if; end loop; return r; end proc; end program;``` Output: ``` 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 sqrt(7^ 1) = 2 sqrt(7^ 3) = 18 sqrt(7^ 5) = 129 sqrt(7^ 7) = 907 sqrt(7^ 9) = 6352 sqrt(7^11) = 44467 sqrt(7^13) = 311269 sqrt(7^15) = 2178889 sqrt(7^17) = 15252229 sqrt(7^19) = 106765608 sqrt(7^21) = 747359260 sqrt(7^23) = 5231514822 sqrt(7^25) = 36620603758 sqrt(7^27) = 256344226312 sqrt(7^29) = 1794409584184 sqrt(7^31) = 12560867089291 sqrt(7^33) = 87926069625040 sqrt(7^35) = 615482487375282 sqrt(7^37) = 4308377411626977 sqrt(7^39) = 30158641881388842 sqrt(7^41) = 211110493169721897 sqrt(7^43) = 1477773452188053281 sqrt(7^45) = 10344414165316372973 sqrt(7^47) = 72410899157214610812 sqrt(7^49) = 506876294100502275687 sqrt(7^51) = 3548134058703515929815 sqrt(7^53) = 24836938410924611508707 sqrt(7^55) = 173858568876472280560953 sqrt(7^57) = 1217009982135305963926677 sqrt(7^59) = 8519069874947141747486745 sqrt(7^61) = 59633489124629992232407216 sqrt(7^63) = 417434423872409945626850517 sqrt(7^65) = 2922040967106869619387953625 sqrt(7^67) = 20454286769748087335715675381 sqrt(7^69) = 143180007388236611350009727669 sqrt(7^71) = 1002260051717656279450068093686 sqrt(7^73) = 7015820362023593956150476655802``` ## Seed7 Seed7 has integer sqrt() and bigInteger sqrt() functions. These functions could be used if an integer square root is needed. But this task does not allow using the language's built-in sqrt() function. Instead the quadratic residue algorithm for finding the integer square root must be used. ```\$ include "seed7_05.s7i"; include "bigint.s7i"; const func string: commatize (in bigInteger: bigNum) is func result var string: stri is ""; local var integer: index is 0; begin stri := str(bigNum); for index range length(stri) - 3 downto 1 step 3 do stri := stri[.. index] & "," & stri[succ(index) ..]; end for; end func; const func bigInteger: isqrt (in bigInteger: x) is func result var bigInteger: r is 0_; local var bigInteger: q is 1_; var bigInteger: z is 0_; var bigInteger: t is 0_; begin while q <= x do q *:= 4_; end while; z := x; while q > 1_ do q := q mdiv 4_; t := z - r - q; r := r mdiv 2_; if t >= 0_ then z := t; r +:= q; end if; end while; end func; const proc: main is func local var integer: number is 0; var bigInteger: pow7 is 7_; begin writeln("The integer square roots of integers from 0 to 65 are:"); for number range 0 to 65 do write(isqrt(bigInteger(number)) <& " "); end for; writeln("\n\nThe integer square roots of powers of 7 from 7**1 up to 7**73 are:"); writeln("power 7 ** power integer square root"); writeln("----- --------------------------------------------------------------------------------- -----------------------------------------"); for number range 1 to 73 step 2 do pow7 *:= 49_; end for; end func;``` Output: ```The integer square roots of integers from 0 to 65 are: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 The integer square roots of powers of 7 from 7**1 up to 7**73 are: power 7 ** power integer square root ----- --------------------------------------------------------------------------------- ----------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802 ``` ## Sidef Built-in: ```var n = 1234 say n.isqrt say n.iroot(2) ``` Explicit implementation for the integer k-th root of n: ```func rootint(n, k=2) { return 0 if (n == 0) var (s, v) = (n, k - 1) loop { var u = ((v*s + (n // s**v)) // k) break if (u >= s) s = u } s } ``` Implementation of integer square root of n (using the quadratic residue algorithm): ```func isqrt(x) { var (q, r) = (1, 0); while (q <= x) { q <<= 2 } while (q > 1) { q >>= 2; var t = x-r+q; r >>= 1 if (t >= 0) { (x, r) = (t, r+q) } } r } say isqrt.map(0..65).join(' '); printf("\n") for n in (1..73 `by` 2) { printf("isqrt(7^%-2d): %42s\n", n, isqrt(7**n).commify) } ``` Output: ```0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 isqrt(7^1 ): 2 isqrt(7^3 ): 18 isqrt(7^5 ): 129 isqrt(7^7 ): 907 isqrt(7^9 ): 6,352 isqrt(7^11): 44,467 isqrt(7^13): 311,269 isqrt(7^15): 2,178,889 isqrt(7^17): 15,252,229 isqrt(7^19): 106,765,608 isqrt(7^21): 747,359,260 isqrt(7^23): 5,231,514,822 isqrt(7^25): 36,620,603,758 isqrt(7^27): 256,344,226,312 isqrt(7^29): 1,794,409,584,184 isqrt(7^31): 12,560,867,089,291 isqrt(7^33): 87,926,069,625,040 isqrt(7^35): 615,482,487,375,282 isqrt(7^37): 4,308,377,411,626,977 isqrt(7^39): 30,158,641,881,388,842 isqrt(7^41): 211,110,493,169,721,897 isqrt(7^43): 1,477,773,452,188,053,281 isqrt(7^45): 10,344,414,165,316,372,973 isqrt(7^47): 72,410,899,157,214,610,812 isqrt(7^49): 506,876,294,100,502,275,687 isqrt(7^51): 3,548,134,058,703,515,929,815 isqrt(7^53): 24,836,938,410,924,611,508,707 isqrt(7^55): 173,858,568,876,472,280,560,953 isqrt(7^57): 1,217,009,982,135,305,963,926,677 isqrt(7^59): 8,519,069,874,947,141,747,486,745 isqrt(7^61): 59,633,489,124,629,992,232,407,216 isqrt(7^63): 417,434,423,872,409,945,626,850,517 isqrt(7^65): 2,922,040,967,106,869,619,387,953,625 isqrt(7^67): 20,454,286,769,748,087,335,715,675,381 isqrt(7^69): 143,180,007,388,236,611,350,009,727,669 isqrt(7^71): 1,002,260,051,717,656,279,450,068,093,686 isqrt(7^73): 7,015,820,362,023,593,956,150,476,655,802 ``` ## Standard ML Translation of: Scheme Translation of: OCaml Works with: MLton ```(* The Rosetta Code integer square root task, in Standard ML. Compile with, for example: mlton isqrt.sml *) val zero = IntInf.fromInt (0) val one = IntInf.fromInt (1) val seven = IntInf.fromInt (7) val word1 = Word.fromInt (1) val word2 = Word.fromInt (2) fun find_a_power_of_4_greater_than_x (x) = let fun loop (q) = if x < q then q else loop (IntInf.<< (q, word2)) in loop (one) end; fun isqrt (x) = let fun loop (q, z, r) = if q = one then r else let val q = IntInf.~>> (q, word2) val t = z - r - q val r = IntInf.~>> (r, word1) in if t < zero then loop (q, z, r) else loop (q, t, r + q) end in loop (find_a_power_of_4_greater_than_x (x), x, zero) end; fun insert_separators (s, sep) = (* Insert separator characters (such as #",", #".", #" ") in a numeral that is already in string form. *) let fun loop (revchars, i, newchars) = case (revchars, i) of ([], _) => newchars | (revchars, 3) => loop (revchars, 0, sep :: newchars) | (c :: tail, i) => loop (tail, i + 1, c :: newchars) in implode (loop (rev (explode s), 0, [])) end; fun commas (s) = (* Insert commas in a numeral that is already in string form. *) insert_separators (s, #","); fun main () = let val i = ref 0 in print ("isqrt(i) for 0 <= i <= 65:\n\n"); i := 0; while !i < 65 do ( print (IntInf.toString (isqrt (IntInf.fromInt (!i)))); print (" "); i := !i + 1 ); print (IntInf.toString (isqrt (IntInf.fromInt (65)))); print ("\n\n\n"); print ("isqrt(7**i) for 1 <= i <= 73, i odd:\n\n"); print ("\n"); i := 1; while !i <= 131 do ( print ("-"); i := !i + 1 ); print ("\n"); i := 1; while !i <= 73 do ( let val pow7 = IntInf.pow (seven, !i) val root = isqrt (pow7) in print (pad_with_spaces 85 (commas (IntInf.toString pow7))); print (pad_with_spaces 44 (commas (IntInf.toString root))); print ("\n"); i := !i + 2 end ) end; main (); (* local variables: *) (* mode: sml *) (* sml-indent-level: 2 *) (* sml-indent-args: 2 *) (* end: *) ``` Output: ```\$ mlton isqrt.sml && ./isqrt isqrt(i) for 0 <= i <= 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 isqrt(7**i) for 1 <= i <= 73, i odd: i 7**i sqrt(7**i) ----------------------------------------------------------------------------------------------------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802``` ## Swift Translation of: C++ Requires the attaswift BigInt package. ```import BigInt func integerSquareRoot<T: BinaryInteger>(_ num: T) -> T { var x: T = num var q: T = 1 while q <= x { q <<= 2 } var r: T = 0 while q > 1 { q >>= 2 let t: T = x - r - q r >>= 1 if t >= 0 { x = t r += q } } return r } func pad(string: String, width: Int) -> String { if string.count >= width { return string } return String(repeating: " ", count: width - string.count) + string } func commatize<T: BinaryInteger>(_ num: T) -> String { let string = String(num) var result = String() result.reserveCapacity(4 * string.count / 3) var i = 0 for ch in string { if i > 0 && i % 3 == string.count % 3 { result += "," } result.append(ch) i += 1 } return result } print("Integer square root for numbers 0 to 65:") for n in 0...65 { print(integerSquareRoot(n), terminator: " ") } let powerWidth = 83 let isqrtWidth = 42 print("\n\nInteger square roots of odd powers of 7 from 1 to 73:") print(" n |\(pad(string: "7 ^ n", width: powerWidth)) |\(pad(string: "isqrt(7 ^ n)", width: isqrtWidth))") print(String(repeating: "-", count: powerWidth + isqrtWidth + 6)) var p: BigInt = 7 for n in stride(from: 1, through: 73, by: 2) { let power = pad(string: commatize(p), width: powerWidth) let isqrt = pad(string: commatize(integerSquareRoot(p)), width: isqrtWidth) print("\(pad(string: String(n), width: 2)) |\(power) |\(isqrt)") p *= 49 } ``` Output: ```Integer square root for numbers 0 to 65: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Integer square roots of odd powers of 7 from 1 to 73: n | 7 ^ n | isqrt(7 ^ n) ----------------------------------------------------------------------------------------------------------------------------------- 1 | 7 | 2 3 | 343 | 18 5 | 16,807 | 129 7 | 823,543 | 907 9 | 40,353,607 | 6,352 11 | 1,977,326,743 | 44,467 13 | 96,889,010,407 | 311,269 15 | 4,747,561,509,943 | 2,178,889 17 | 232,630,513,987,207 | 15,252,229 19 | 11,398,895,185,373,143 | 106,765,608 21 | 558,545,864,083,284,007 | 747,359,260 23 | 27,368,747,340,080,916,343 | 5,231,514,822 25 | 1,341,068,619,663,964,900,807 | 36,620,603,758 27 | 65,712,362,363,534,280,139,543 | 256,344,226,312 29 | 3,219,905,755,813,179,726,837,607 | 1,794,409,584,184 31 | 157,775,382,034,845,806,615,042,743 | 12,560,867,089,291 33 | 7,730,993,719,707,444,524,137,094,407 | 87,926,069,625,040 35 | 378,818,692,265,664,781,682,717,625,943 | 615,482,487,375,282 37 | 18,562,115,921,017,574,302,453,163,671,207 | 4,308,377,411,626,977 39 | 909,543,680,129,861,140,820,205,019,889,143 | 30,158,641,881,388,842 41 | 44,567,640,326,363,195,900,190,045,974,568,007 | 211,110,493,169,721,897 43 | 2,183,814,375,991,796,599,109,312,252,753,832,343 | 1,477,773,452,188,053,281 45 | 107,006,904,423,598,033,356,356,300,384,937,784,807 | 10,344,414,165,316,372,973 47 | 5,243,338,316,756,303,634,461,458,718,861,951,455,543 | 72,410,899,157,214,610,812 49 | 256,923,577,521,058,878,088,611,477,224,235,621,321,607 | 506,876,294,100,502,275,687 51 | 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 | 3,548,134,058,703,515,929,815 53 | 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 | 24,836,938,410,924,611,508,707 55 | 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 | 173,858,568,876,472,280,560,953 57 | 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 | 1,217,009,982,135,305,963,926,677 59 | 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 | 8,519,069,874,947,141,747,486,745 61 | 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 | 59,633,489,124,629,992,232,407,216 63 | 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 | 417,434,423,872,409,945,626,850,517 65 | 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 | 2,922,040,967,106,869,619,387,953,625 67 | 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 | 20,454,286,769,748,087,335,715,675,381 69 | 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 | 143,180,007,388,236,611,350,009,727,669 71 | 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 | 1,002,260,051,717,656,279,450,068,093,686 73 | 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 | 7,015,820,362,023,593,956,150,476,655,802 ``` ## Tiny BASIC Works with: TinyBasic Tiny BASIC does not support string formatting or concatenation, and is limited to integer arithmetic on numbers no greater than 32,767. The isqrt of 0-65 and the first two odd powers of 7 are shown in column format. The algorithm itself (the interesting part) begins on line 100. ```10 LET X = 0 20 GOSUB 100 30 PRINT R 40 LET X = X + 1 50 IF X < 66 THEN GOTO 20 70 PRINT "---" 71 LET X = 7 72 GOSUB 100 73 PRINT R 77 LET X = 343 78 GOSUB 100 79 PRINT R 90 END 100 REM integer square root function 110 LET Q = 1 120 IF Q > X THEN GOTO 150 130 LET Q = Q * 4 140 GOTO 120 150 LET Z = X 160 LET R = 0 170 IF Q <= 1 THEN RETURN 180 LET Q = Q / 4 190 LET T = Z - R - Q 200 LET R = R / 2 210 IF T < 0 THEN GOTO 170 220 LET Z = T 230 LET R = R + Q 240 GOTO 170 ``` ## UNIX Shell Works with: Bourne Again SHell Works with: Korn Shell Works with: Zsh ```function isqrt { typeset -i x for x; do typeset -i q=1 while (( q <= x )); do (( q <<= 2 )) if (( q <= 0 )); then return 1 fi done typeset -i z=x typeset -i r=0 typeset -i t while (( q > 1 )); do (( q >>= 2 )) (( t = z - r - q )) (( r >>= 1 )) if (( t >= 0 )); then (( z = t )) (( r = r + q )) fi done printf '%d\n' "\$r" done } # demo printf 'isqrt(n) for n from 0 to 65:\n' for i in {1..4}; do for n in {0..65}; do case \$i in 1) (( tens=n/10 )) if (( tens )); then printf '%2d' "\$tens" else printf ' ' fi ;; 2) printf '%2d' \$(( n%10 ));; 3) printf -- '--';; 4) printf '%2d' "\$(isqrt "\$n")";; esac done printf '\n' done printf '\n' printf 'isqrt(7ⁿ) for odd n up to the limit of integer precision:\n' printf '%2s|%27sⁿ|%14sⁿ)\n' "n" "7" "isqrt(7" for (( i=0;i<48; ++i )); do printf '-'; done; printf '\n' for (( p=1; p<=73 && (n=7**p) > 0; p+=2)); do if r=\$(isqrt \$n); then printf "%2d|%'28d|%'16d\n" "\$p" "\$n" "\$r" else break fi done ``` Output: The powers-of-7 table is limited by the built-in precision; on my system, both bash and zsh use signed 64-bit integers with a max value of 7²² < 9223372036854775807 < 7²³. Ksh uses signed 32-bit integers with a max value of 7¹¹ < 2147483647 < 7¹²; if I remove the typeset -i integer restriction, the code will work to a much larger power of 7, but at that point it's doing floating-point arithmetic, which is against the spirit of the task. ```isqrt(n) for n from 0 to 65: 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 ------------------------------------------------------------------------------------------------------------------------------------ 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 isqrt(7ⁿ) for odd n up to the limit of integer precision: n| 7ⁿ| isqrt(7ⁿ) ------------------------------------------------ 1| 7| 2 3| 343| 18 5| 16,807| 129 7| 823,543| 907 9| 40,353,607| 6,352 # ksh stops here 11| 1,977,326,743| 44,467 13| 96,889,010,407| 311,269 15| 4,747,561,509,943| 2,178,889 17| 232,630,513,987,207| 15,252,229 19| 11,398,895,185,373,143| 106,765,608 21| 558,545,864,083,284,007| 747,359,260``` ## Visual Basic .NET Translation of: C# ```Imports System Imports System.Console Imports BI = System.Numerics.BigInteger Module Module1 Function isqrt(ByVal x As BI) As BI Dim t As BI, q As BI = 1, r As BI = 0 While q <= x : q <<= 2 : End While While q > 1 : q >>= 2 : t = x - r - q : r >>= 1 If t >= 0 Then x = t : r += q End While : Return r End Function Sub Main() Const max As Integer = 73, smax As Integer = 65 Dim power_width As Integer = ((BI.Pow(7, max).ToString().Length \ 3) << 2) + 3, isqrt_width As Integer = (power_width + 1) >> 1, n as Integer WriteLine("Integer square root for numbers 0 to {0}:", smax) For n = 0 To smax : Write("{0} ", (n \ 10).ToString().Replace("0", " ")) Next : WriteLine() For n = 0 To smax : Write("{0} ", n Mod 10) : Next : WriteLine() WriteLine(New String("-"c, (smax << 1) + 1)) For n = 0 To smax : Write("{0} ", isqrt(n)) : Next WriteLine(vbLf & vbLf & "Integer square roots of odd powers of 7 from 1 to {0}:", max) Dim s As String = String.Format("[0,2] |[1,{0}:n0] |[2,{1}:n0]", power_width, isqrt_width).Replace("[", "{").Replace("]", "}") WriteLine(s, "n", "7 ^ n", "isqrt(7 ^ n)") WriteLine(New String("-"c, power_width + isqrt_width + 6)) Dim p As BI = 7 : n = 1 : While n <= max WriteLine(s, n, p, isqrt(p)) : n += 2 : p = p * 49 End While End Sub End Module ``` Output: ```Integer square root for numbers 0 to 65: 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 ----------------------------------------------------------------------------------------------------------------------------------- 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Integer square roots of odd powers of 7 from 1 to 73: n | 7 ^ n | isqrt(7 ^ n) ----------------------------------------------------------------------------------------------------------------------------------- 1 | 7 | 2 3 | 343 | 18 5 | 16,807 | 129 7 | 823,543 | 907 9 | 40,353,607 | 6,352 11 | 1,977,326,743 | 44,467 13 | 96,889,010,407 | 311,269 15 | 4,747,561,509,943 | 2,178,889 17 | 232,630,513,987,207 | 15,252,229 19 | 11,398,895,185,373,143 | 106,765,608 21 | 558,545,864,083,284,007 | 747,359,260 23 | 27,368,747,340,080,916,343 | 5,231,514,822 25 | 1,341,068,619,663,964,900,807 | 36,620,603,758 27 | 65,712,362,363,534,280,139,543 | 256,344,226,312 29 | 3,219,905,755,813,179,726,837,607 | 1,794,409,584,184 31 | 157,775,382,034,845,806,615,042,743 | 12,560,867,089,291 33 | 7,730,993,719,707,444,524,137,094,407 | 87,926,069,625,040 35 | 378,818,692,265,664,781,682,717,625,943 | 615,482,487,375,282 37 | 18,562,115,921,017,574,302,453,163,671,207 | 4,308,377,411,626,977 39 | 909,543,680,129,861,140,820,205,019,889,143 | 30,158,641,881,388,842 41 | 44,567,640,326,363,195,900,190,045,974,568,007 | 211,110,493,169,721,897 43 | 2,183,814,375,991,796,599,109,312,252,753,832,343 | 1,477,773,452,188,053,281 45 | 107,006,904,423,598,033,356,356,300,384,937,784,807 | 10,344,414,165,316,372,973 47 | 5,243,338,316,756,303,634,461,458,718,861,951,455,543 | 72,410,899,157,214,610,812 49 | 256,923,577,521,058,878,088,611,477,224,235,621,321,607 | 506,876,294,100,502,275,687 51 | 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 | 3,548,134,058,703,515,929,815 53 | 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 | 24,836,938,410,924,611,508,707 55 | 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 | 173,858,568,876,472,280,560,953 57 | 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 | 1,217,009,982,135,305,963,926,677 59 | 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 | 8,519,069,874,947,141,747,486,745 61 | 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 | 59,633,489,124,629,992,232,407,216 63 | 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 | 417,434,423,872,409,945,626,850,517 65 | 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 | 2,922,040,967,106,869,619,387,953,625 67 | 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 | 20,454,286,769,748,087,335,715,675,381 69 | 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 | 143,180,007,388,236,611,350,009,727,669 71 | 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 | 1,002,260,051,717,656,279,450,068,093,686 73 | 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 | 7,015,820,362,023,593,956,150,476,655,802 ``` ## VTL-2 The ISQRT routine starts at line 2000. As VTL-2 only has unsigned 16-bit arithmetic, only the roots of 7^1, 7^3 and 7^5 are shown as 7^7 is too large. ```1000 X=0 1010 #=2000 1020 \$=32 1030 ?=R 1040 X=X+1 1050 #=X=33=0*1070 1060 ?="" 1070 #=X<66*1010 1080 P=1 1090 X=7 1100 #=2000 1110 ?="" 1120 ?="Root 7^"; 1130 ?=P 1140 ?="("; 1150 ?=X 1160 ?=") = "; 1170 ?=R 1180 X=X*49 1190 P=P+2 1200 #=P<6*1100 1210 #=9999 2000 A=! 2010 Q=1 2020 #=X>Q=0*2050 2030 Q=Q*4 2040 #=2020 2050 Z=X 2060 R=0 2070 #=Q<2*A 2080 Q=Q/4 2090 T=Z-R-Q 2100 I=Z<(R+Q) 2110 R=R/2 2120 #=I*2070 2130 Z=T 2140 R=R+Q 2150 #=2070``` Output: ``` 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 Root 7^1(7) = 2 Root 7^3(343) = 18 Root 7^5(16807) = 129 ``` ## Wren Library: Wren-big Library: Wren-fmt ```import "/big" for BigInt import "/fmt" for Fmt var isqrt = Fn.new { |x| if (!(x is BigInt && x >= BigInt.zero)) { Fiber.abort("Argument must be a non-negative big integer.") } var q = BigInt.one while (q <= x) q = q * 4 var z = x var r = BigInt.zero while (q > BigInt.one) { q = q >> 2 var t = z - r - q r = r >> 1 if (t >= 0) { z = t r = r + q } } return r } System.print("The integer square roots of integers from 0 to 65 are:") for (i in 0..65) System.write("%(isqrt.call(BigInt.new(i))) ") System.print() System.print("\nThe integer square roots of powers of 7 from 7^1 up to 7^73 are:\n") System.print("power 7 ^ power integer square root") System.print("----- --------------------------------------------------------------------------------- -----------------------------------------") var pow7 = BigInt.new(7) var bi49 = BigInt.new(49) var i = 1 while (i <= 73) { Fmt.print("\$2d \$,84s \$,41s", i, pow7, isqrt.call(pow7)) pow7 = pow7 * bi49 i = i + 2 }``` Output: ```The integer square roots of integers from 0 to 65 are: 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 The integer square roots of odd powers of 7 from 7^1 up to 7^73 are: power 7 ^ power integer square root ----- --------------------------------------------------------------------------------- ----------------------------------------- 1 7 2 3 343 18 5 16,807 129 7 823,543 907 9 40,353,607 6,352 11 1,977,326,743 44,467 13 96,889,010,407 311,269 15 4,747,561,509,943 2,178,889 17 232,630,513,987,207 15,252,229 19 11,398,895,185,373,143 106,765,608 21 558,545,864,083,284,007 747,359,260 23 27,368,747,340,080,916,343 5,231,514,822 25 1,341,068,619,663,964,900,807 36,620,603,758 27 65,712,362,363,534,280,139,543 256,344,226,312 29 3,219,905,755,813,179,726,837,607 1,794,409,584,184 31 157,775,382,034,845,806,615,042,743 12,560,867,089,291 33 7,730,993,719,707,444,524,137,094,407 87,926,069,625,040 35 378,818,692,265,664,781,682,717,625,943 615,482,487,375,282 37 18,562,115,921,017,574,302,453,163,671,207 4,308,377,411,626,977 39 909,543,680,129,861,140,820,205,019,889,143 30,158,641,881,388,842 41 44,567,640,326,363,195,900,190,045,974,568,007 211,110,493,169,721,897 43 2,183,814,375,991,796,599,109,312,252,753,832,343 1,477,773,452,188,053,281 45 107,006,904,423,598,033,356,356,300,384,937,784,807 10,344,414,165,316,372,973 47 5,243,338,316,756,303,634,461,458,718,861,951,455,543 72,410,899,157,214,610,812 49 256,923,577,521,058,878,088,611,477,224,235,621,321,607 506,876,294,100,502,275,687 51 12,589,255,298,531,885,026,341,962,383,987,545,444,758,743 3,548,134,058,703,515,929,815 53 616,873,509,628,062,366,290,756,156,815,389,726,793,178,407 24,836,938,410,924,611,508,707 55 30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943 173,858,568,876,472,280,560,953 57 1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207 1,217,009,982,135,305,963,926,677 59 72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143 8,519,069,874,947,141,747,486,745 61 3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007 59,633,489,124,629,992,232,407,216 63 174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343 417,434,423,872,409,945,626,850,517 65 8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807 2,922,040,967,106,869,619,387,953,625 67 418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543 20,454,286,769,748,087,335,715,675,381 69 20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607 143,180,007,388,236,611,350,009,727,669 71 1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743 1,002,260,051,717,656,279,450,068,093,686 73 49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407 7,015,820,362,023,593,956,150,476,655,802 ``` ## Yabasic ```// Rosetta Code problem: https://rosettacode.org/wiki/Isqrt_(integer_square_root)_of_X // by Jjuanhdez, 06/2022 print "Integer square root of first 65 numbers:" for n = 1 to 65 print isqrt(n) using("##"); next n print : print print "Integer square root of odd powers of 7" print " n | 7^n | isqrt " print "----|--------------------|-----------" for n = 1 to 21 step 2 pow7 = 7 ^ n print n using("###"), " | ", left\$(str\$(pow7,"%20.1f"),18), " | ", left\$(str\$(isqrt(pow7),"%11.1f"),9) next n end sub isqrt(x) q = 1 while q <= x q = q * 4 wend r = 0 while q > 1 q = q / 4 t = x - r - q r = r / 2 if t >= 0 then x = t r = r + q end if wend return int(r) end sub```
108,452
314,599
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.9375
4
CC-MAIN-2023-50
longest
en
0.864479
https://careericons.com/practice-test/ssc-chsl-tier-1-2023/powers-surds-and-indices/515-1/
1,695,541,149,000,000,000
text/html
crawl-data/CC-MAIN-2023-40/segments/1695233506623.27/warc/CC-MAIN-20230924055210-20230924085210-00570.warc.gz
182,569,492
8,185
# powers surds and indices Model Questions & Answers, Practice Test for ssc chsl tier 1 2023 #### ssc chsl tier 1 2023 SYLLABUS WISE SUBJECTS MCQs Question :1 Simplify : \$^3√2+^4√64+^4√2500+^6√8\$ \$3√2+^4√{16×4}+^4√{625×4}+^6√2^3\$ = \$√2+^4√{2^4×2^2}+^4√{5^4×2^2}+^6√2^3\$ = \$3√2+2√^4 2^2+5√^4 2^2+√^6 2^3\$ = \$3√2+2√2+5√2+√2\$ = \$(3+2+5+1)√2=11√2\$ Question :2 \$(31)^{31} × (31)^{– 27}\$ = ? ? = \$(31)^{31} × (31)^{– 27}\$ ? = \$(31)^{31 – 27}\$ ? = \$(31)^4\$ ? = \$(961)^2\$ Question :3 \$8^7 × 2^6 ÷ 8^{2.4} = 8^{?}\$ \$8^{?} = 8^7 × 2^6 ÷ 8^{2.4}\$ \$8^{?} = 8^7 × {8^2/8^{2.4}\$ or \$8^{?} = 8^{7 + 2 – 2.4}\$ \$8^{?} = 8^{6.6}\$ or ? = 6.6 Question :4 The value of \$(-1/126)^{-2/3}\$ is : \$(-1/216)^{-2/3}=(-1/6^3)^{-2/3}=(-1/6)^{-2}=(-6)^2\$=36 Question :5 \$(4 × 4)^3 ÷ (512 ÷ 8)^4 × (32 × 8)^4 = (2 × 2)^{? + 4}\$ \$(4 × 4)^3 ÷ (512 ÷ 8)^4 × (32 × 8)^4 = (2 × 2)^{? + 4}\$ ⇒\$(16)^3 ÷ (64)^4 × (256)^4 = (4)^{? + 4}\$ ⇒\$(4)^{2 × 3} ÷ (4)^{3 × 4} × (4)^{4 × 4} = (4)^{? + 4}\$ ⇒\$(4)^6\$ ÷\$(4)^{12} × (4)^{16} = (4)^{? + 4}\$ ⇒\$(4)^{6 – 2 + 16} = (4)^{? + 4}⇒(4)^{10} = (4)^{? + 4}\$⇒10 = ? + 4 ∴ ? = 6 ## Recently Added Subject & Categories For All Competitive Exams #### Top 150 Ratio and Proportion MCQ Test For IBPS SO Prelims Most Important Aptitude Topic Ratio and Proportion Concept Based Multiple Choice Questions and Answer Practice Test PDF & Quiz Problems for IBPS SO 2023 Exam 23-Aug-2023 by Careericons #### Top 150+ Number System Aptitude MCQ PDF For IBPS SO 2023 Quantitative Aptitude Problems on Fundamental Number System Based Multiple Choice Questions and Answer Practice Test PDF Useful for IBPS SO Prelims 2023 Exam 22-Aug-2023 by Careericons #### 150+ Reading Comprehension MCQ PDF For IBPS SO 2023 Exams Easy, Moderate to Hard Level English Reading Comprehension Passages Based Multiple Choice Questions and Answers Practice Test Useful for IBPS SO Prelims Exam 22-Aug-2023 by Careericons #### 150+ Directions and Distances MCQ PDF For IBPS SO Prelims New Directions and Distances Verbal Reasoning Based Multiple Choice Questions and Answers Practice Free Mock Test Series & Online Quiz For IBPS SO 2023 Exam. 21-Aug-2023 by Careericons
971
2,223
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.84375
4
CC-MAIN-2023-40
latest
en
0.494432
https://easylaser.com/en-us/about-easy-laser/blog/measure-and-align-anything-you-can-think-of
1,725,781,857,000,000,000
text/html
crawl-data/CC-MAIN-2024-38/segments/1725700650960.90/warc/CC-MAIN-20240908052321-20240908082321-00617.warc.gz
209,657,787
13,615
Measure and align anything you can think of! All Easy-Laser alignment systems come with the ”Values” program. In principle, that has always been the case and there is a simple explanation as to why. Jan Oscander, Sales Engineer at Easy-Laser, is a big fan of the Values program. This is what he has to say about it: ”The philosophy and idea behind having the Values program in the measurement systems is to be completely open and honest regarding how the measuring units work. They are actually only two dial gauges, although they are digital and laser-based. But they are extremely precise and flexible. With the Values program you can measure exactly where you want in the machine, thus getting a better understanding of the machine's functionality and condition. Our other measurement programs have step-by-step-guidance and help the user with all difficult calculations instantaneously. They are designed to be as user-friendly as possible, for any technician. That is true also for "Values" thanks to its incredibly easy-to-read displayed measurement values. However, just reading values may not be enough, you may also want to know what the measurement values mean so that you can make the right adjustment calculation. On the other hand, in principle, you can measure and align anything imaginable! Program Values with single-axis detector. We see the two measurement devices' vertical measurement values (V). Dot or line? The Values program has been part of the Easy-Laser systems from the beginning. This is just one example of our ”Straightforward by all measures” philosophy. In order to get the best out of the program, you should have measuring units with dot laser technology. For certain applications a separate laser transmitter, such as D22 for example, might be preferable. However, it can also be used with line laser units. The accuracy of the measurement differs between measuring units for technical reasons, but a resolution of 1/100 mm [0.5 mils] is usually sufficient, even if there is an option to take measurements in thousandths [0.05 mils]. A few examples of areas of use Jan goes on to explain: "I would like to highlight a few examples in order for you to understand the flexibility and power of the Values program: • Raising the end of a shaft and verifying the combined play in the bearings carrying the shaft helps us to find out how well we can align that particular machine. • Having the measurement devices at the 12 o'clock position, zeroing and then loosening the mounted flanges on a pump (before it is filled with media), and then seeing if the stresses from these joints affect the alignment. If they do, the pump and motor will "settle" after time and the centering will be altered, which will most likely shorten the service life of the machine. • Loading the installation to see if the base is sufficiently rigid. Simply climbing around on a machine can reveal ”weaknesses” that were not apparent before. Doing this prior to starting the machine can prevent many future problems. • It is also possible to record values over a period of time at any interval, for example to see if any changes occur to the base when the machinery devices are loaded. I.e. under operating conditions. A dynamic check. • A further example is if our measuring units (M and S) point the laser beams on each other, and we then reset the measurement values and rotate the shafts. The measurement value should then be low all the way around, if the shafts are centred towards each other. Within bearing play tolerance! A quick test without having to specify any machine parameters. A real-life case: Checking bearing play Most recently, I held a training course regarding the use of an E-series system (dot laser) on a bearing for a floodgate, i.e. at the pivot points of the gate. Upon inspection, damage was noted on the sliding bearing. We then wanted to find the cause of the damage and to obtain a figure to indicate the extent of the fault. Measuring unit mounted in the rotational centre. The entire blue section rotates. The laser hit point from the opposite side. We started by mounting the measuring unit according to the image above, with the transmitter in the rotational centre. We then started the Values program, rotated and coned the beam to a point on the opposite side. The distance between the bearings is approximately 14 meters, but these measuring units have a range of 20 meters so there was plenty of margin. We did this on both sides to be able to check visually that they pointed towards each other relatively well. Then we performed a normal shaft alignment and obtained a formal figure for the deviation. The next step was to check what was causing the deviation. We then mounted laser transmitter D22 vertically, and at the seal face on the side of the floodgate, and then directed the beam towards the bearing where we mounted the M unit on the upper side. A sealing side before the gate is installed. We then rotated the bearing 180°, swept the beam downwards, read off the value, halved the value and thus obtained a figure. The same measurement was performed on both sides of the floodgate. Laser transmitter D22 mounted with its integrated magnets on the sealing side. The measuring unit installed on the outer side. In this case, we were able to prove that there was play three times greater on one side than on the other and that the direction of the play matched the pointing direction we had obtained from previous measurements. There was no doubt where the corrections were to be made. I.e. where the play was three times greater. The Values program, a straight and right-angled laser beam together with a large dose of common sense helped us make the right decision and take the right corrective action. Knowing where the problem is offers breathing space, allowing us to then study the view from the top of the floodgate. Thanks to the Values program, many of our users find completely new ways of improving and aligning their machinery. Keep measuring, and become a better machine connoisseur!" Jan Oscander Sales Engineer, Problem solver etc. P.S. Are you curious about Values but don't have any Easy-Laser equipment? You can try it out for free in the XT Alignment app! (Available in the App Store or Google Play.) Subscribe to our newsletter Stay up to date with the latest news from Easy-Laser. I accept the terms in the Privacy policy 27 June 2024 Thermal growth: How does it affect shaft alignment? We know that precision shaft alignment is necessary to ensure reliable operation of rotating machinery. This will lead to better performance and longer service life for the machine and its components. Read more 10 January 2024 Understanding casing distortion in machinery One of the most critical issues affecting rotating machines is casing distortion. This article delves into what casing distortion means, how it impacts machine performance, and why it's essential to address it in order to achieve reliable operation. Read more
1,421
7,032
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.546875
3
CC-MAIN-2024-38
latest
en
0.950645
https://www.shirpeled.com/2022/
1,725,930,336,000,000,000
text/html
crawl-data/CC-MAIN-2024-38/segments/1725700651164.37/warc/CC-MAIN-20240909233606-20240910023606-00402.warc.gz
922,698,057
14,115
## Heron Famously, Heron's method of computing the square root of a some number x goes like this: 1. Guess the root, we'll denote the guess by g 2. Compute the quotient q = x/g 3. Update your next guess to be the arithmetic mean of q and g. So g := (x/g + g)/2 4. Goto 2 This can be viewed as a special case of the Newton–Raphson method, and indeed the results become very accurate very fast. ## Mckay Somewhat less famous is the anecdote about Mckay's theorem. In this paper by Laurence Sherzer, the author tells the story of an 8th grader (in 1973) named Robert Mckay, who suggests a way to find a number that lies between two fractions. Suppose the fractions are a/b and c/d, Mckay's suggestion is to use (a+c)/(b+d). This is a mathematical education paper, so it's focus is about how the class and the teacher approached the seemingly weird idea of adding numerators and denominators, and how they explained to themselves why this seems to 'magically' work. The short version of the explanation is: this amounts to taking a weighted average of the two fractions, where the weights are the denominators. When the denominators are equal, this is exactly the arithmetic mean. When they differ by a lot - the result is much closer to the fraction with the larger denominator. ## McHeron? Since taking the mean of two roots, in Heron's method, is annoying at times, why not use Mckay's very simple method instead, dubbing it the McHeron Algorithm? Mathematically, it will give an increasingly better guess in each round, even though it may not be the arithmetic mean. How would that look? Suppose we want to compute the square root of 2: 1. Our first guess is 3/2 2. The quotient is 2/(3/2) which is 4/3 ('just invert and multiply' as they say) 3. Our next guess needs to be between 3/2 and 4/3, so we use Mckay's method to get 7/5 4. Our next guess is therefore 7/5 5. The next quotient is 2/(7/5) which is just 2*5/7 = 10/7 6. Using Mckay's theorem - our next guess will be (7+10)/(5+7) = 17/12 7. The next quotient is 2/(17/12) which is just 2*12/17 = 24/17 8. Using Mckay's - (17+24)/(12+17) = 41/29 And indeed 41/29 = 1.41379... Which is approximates the square root of 2 up to 2 decimal points, which is not bad. Cool, isn't it? ## But of course, life is never quite so simple I specifically chose a nice example where the algorithm converges relatively fast. Had I chosen 715 (whose square root is 26.7394...) as the initial number, it would have taken me a 100 iterations of the algorithm just to get to 26.76... and I will be dealing with denominators with 145 digits by then. Why would the algorithm perform so bad? Well, remember how Mckay's method introduces a bias for large denominators? The algorithm above scales the quotient's denominator by the the input number, so the larger the input number, the greater the bias toward the quotient will be in the 'Mckay' step of the calculation. Heron's algorithm has quadratic convergence (which is amazing), and I don't think showing exactly how bad the convergence of the McHeron algorithm is difficult (I suspect that asymptotically, to get decent results, you'll have to run it as many iterations as the magnitude of the result, so O(2^(n/2)) for an input with n bits, which is terrible), but I should go shopping for the weekend. ## Silver Lining For small numbers (with small denominators) this works nicely for the same reasons, because Mckay's method gives a decent approximation of the arithmetic mean. That's all, would love to hear thoughts in the comments, or links if you saw this exact method somewhere else, I haven't (and for a good reason, it yields terrible results in most cases). The user @k_yaakov suggested on Twitter to bring the denominators to roughly the same scale through multiplying by the appropriate power of 10. Since determining the correct power of 10 and multiplying by it can be done by counting the number of digits and adding zeros respectively, this is very easy to do in practice. The consequence is that the bias introduced by Mckay's weighted mean is now bounded by 1/10, rendering a significantly better convergence rate. Taking the adversarial example of 715 from before: getting a 2 decimal points precision now requires only 17 iterations, compared to over 100 iterations in the previous version of McHeron. Very nice! ## Monday, January 31, 2022 ### 3 Golden Rules "Just as I cannot step in the same river twice,  the person who created this bug and I are two separate beings in the fabric of the universe. Therefore, I will also not be the one who fixes it." Heraclitus of Ephesus, a programmer I don't like code manifests. Rina Artstain once tweeted that we only think we know certain things about parenting because as luck would have it, we haven't had a child to whom all of them don't apply. That's how I feel about code manifests. However, I do have a manifest of my own, short though it may be, so I want to frame it differently. What follows are not the three rules I think everyone should follow to get a "cleaner" code or some other metric of goodness. Rather, these are three things I like when I see in other people's code and annoy me when I see blatantly disregarded. Here we go. ## 1. "לֹא עָלֶיךָ הַמְּלָאכָה לִגְמוֹר, וְלֹא אַתָּה בֶן חוֹרִין לִבָּטֵל מִמֶּנָּה." פרקי אבות, ב' טז' "It is not incumbent upon you to finish the task, but neither are you free to absolve yourself from it." Pirkei Avot 2:16 This is one of the greatest quotes I know and it sounds so much better in Hebrew. ## 2. "Entities should not be multiplied beyond necessity." William of Ockham Yes, this is the OG Ockham's razor. How amazing it is that a Franciscan friar who lived 700 years ago foresaw the harms of overusing OOP and polymorphism. ## 3. "Writing good code is superior to writing bad code. Deleting code is superior to writing good code. Superior to all is concluding that some code does not have to be written at all." Confucius Well, not Confucius, but if one wants people to listen, one should attribute their thoughts to someone famous, preferably dead. I'm pretty sure Oscar Wilde said that one.
1,632
6,149
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
4.375
4
CC-MAIN-2024-38
latest
en
0.957045
https://www.notion.so/Lesson-23-Practice-Solutions-56adfbf9a41246c6a73dcbb9ecf09e42
1,675,063,222,000,000,000
text/html
crawl-data/CC-MAIN-2023-06/segments/1674764499804.60/warc/CC-MAIN-20230130070411-20230130100411-00040.warc.gz
924,045,740
3,368
Remember, "the answer" is only half of it! Also, make sure everyone in your group can explain why. We will use this Gradescope Online Assignment as our worksheet for in-class work. These problems are coded as being worth points for our simplicity, but will not impact your grade in the course. # Question 2 ## Question 2.1 Assuming we have the unsorted data: [1, 9, 0, 5, 4, 7] Recall that during selection sort, we will seek the "smallest" element in the unsorted dataset by examining all elements and choosing the smallest one. Then, we will place that element at the first index of the "unsorted" elements. So, on the first iteration, we will find the 0 at index 2 to be the smallest element, swap it with the item at index zero, giving us the following order: [0, 9, 1, 5, 4, 7] ## Question 2.2 On the second iteration, we will find the 1 at index 2 to be the smallest element, swap it with the item at index one, giving us the following order: [0, 1, 9, 5, 4, 7] ## Question 2.3 On the third iteration, we will find the 4 at index 4 to be the smallest element, swap it with the item at index two, giving us the following order: [0, 1, 4, 5, 9, 7] ## Question 2.4 Selection Sort is not a stable sort. Consider the "swapping" mechanism that selection sort uses to move elements during the sorting process. This means that the following could take place: Suppose we had the following data, with two "1" elements (denoted with different colors). [1, 1, 0] After one iteration, we would seek out the 0 and swap it with the 1 in index 0. We would then have this order of data:
434
1,592
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.75
4
CC-MAIN-2023-06
latest
en
0.926767
http://www.sawaal.com/time-and-distance-questions-and-answers/two-persons-start-running-simultaneously-around-a-circular-track-of-length-300-m-from-the-same-point_11916
1,516,552,882,000,000,000
text/html
crawl-data/CC-MAIN-2018-05/segments/1516084890795.64/warc/CC-MAIN-20180121155718-20180121175718-00127.warc.gz
535,419,966
17,066
3 Q: Two persons start running simultaneously around a circular track of length 300 m from the same point at speeds of 15 km/hr and 25 km/hr. When will they meet for the first time any where on the track if they are moving in opposite directions  ? A) 27 sec B) 31 sec C) 23 sec D) 29 sec Answer:   A) 27 sec Explanation: Time taken to meet for the first time anywhere on the track = length of the track / relative speed = 300 / (15 + 25)5/18 = 300x 18 / 40 x 5 = 27 seconds. Q: If a girl cycles at 10 kmph, then she arrives at a certain place at 1 p.m. If she cycles at 15 kmph, she will arrive at the same place at 11 a.m. At what speed must she cycle to get there at noon? A) 14 kmph B) 13 kmph C) 12 kmph D) 11 kmph Answer & Explanation Answer: C) 12 kmph Explanation: The distance is constant in this case. Let the time taken for travel with a speed of 10 kmph be 't'. Now the speed of 15 kmph is 3/2 times the speed of 10 kmph. Therefore, time taken with the speed of 15 kmph will be 2t/3 (speed is inversely proportional to time) Extra time taken = t - 2t/3 = t/3 => 1pm - 11am = 2hrs => t/3 = 2h => t = 6 hrs. Now, Distance = speed x time = 10 x 6 = 60 kms Time he takes to reach at noon = 6 - 1 = 5 hrs Now, Speed = 60/5 = 12 kmph. 10 383 Q: In a daily morning walk three persons step off together. their steps measure 75 cm, 80 cm and 85 cm respectively. What is the minimum distance each should walk so that thay can cover the distance in complete steps  ? A) 222 m 44 cm B) 204 m C) 201 m 21 cm D) 208 m Answer & Explanation Answer: B) 204 m Explanation: To find the minimum distance, we have to get the LCM of 75, 80, 85 Now, LCM of 75, 80, 85 = 5 x 15 x 16 x 17 = 20400 Hence, the minimum distance each should walk so that thay can cover the distance in complete steps = 20400 cms = 20400/100 = 204 mts. 7 255 Q: Three friends Rudra, Siva and Anvesh start to run around a circular stadium. They complete a revolution in 24, 36 and 30 seconds respectively. After how many minutes will they meet at the starting point ? A) 60 B) 120 C) 360 D) 6 Explanation: For this we have to find the LCM of 24, 36 and 30 LCM of 24, 36 and 30 = 360 sec 360/60 min = 6 minutes. 10 462 Q: Kamal consistently runs 240 meters a day and on Saturday he runs for 400 meters. How many kilometers will he have to run in four weeks ? A) 5.75 kms B) 7.36 kms C) 8.2 kms D) 6.98 kms Answer & Explanation Answer: B) 7.36 kms Explanation: Total running distance in four weeks = (24 x 240) + (4 x 400) = 5760 + 1600 = 7360 meters = 7360/1000 => 7.36 kms 4 490 Q: K and L starts walking towards each other at 4 pm at speed of 3 km/hr and 4 km/hr respectively. They were initially 17.5 km apart. At what time do they meet ? A) 6:00 am B) 6:30 pm C) 5:45 am D) 5:52 pm Answer & Explanation Answer: B) 6:30 pm Explanation: Suppose they meet after 'h' hours Then 3h + 4h = 17.5 7h = 17.5 h = 2.5 hours So they meet at => 4 + 2.5 = 6:30 pm 9 683 Q: P, Q and R start simultaneously from A to B. P reaches B, turns back and meet Q at a distance of 11 km from B. Q reached B, turns back and meet R at a distance of 9 km from B. If the ratio of the speeds of P and R is 3:2, what is the distance between A and B ? A) 99 B) 100 C) 89 D) 1 Explanation: Let, Distance between A and B = d Distance travelled by P while it meets Q = d + 11 Distance travelled by Q while it meets P = d – 11 Distance travelled by Q while it meets R = d + 9 Distance travelled by R while it meets Q = d – 9 Here the ratio of speeds of P & Q => SP : SQ = d + 11 : d – 11 The ratio of speeds of Q & R => SQ : SR = d + 9 : d – 9 But given Ratio of speeds of P & R => P : R = 3 : 2 => $\frac{\left(d+11\right)\left(d+9\right)}{\left(d-11\right)\left(d-9\right)}$ = 3/2 =>  d = 1, 99 => d = 99 satisfies. Therefore, Distance between A and B = 99 7 454 Q: In what time a 360 m. long train moving at the speed of 44 km/hr will cross a 140 m. long bridge ? A) 36 sec B) 39 sec C) 41 sec D) 43 sec Answer & Explanation Answer: C) 41 sec Explanation: Speed = 44 kmph x 5/18 = 110/9 m/s We know that, Time = distance/speed Time = (360 + 140) / (110/9) = 500 x 9/110 = 41 sec. 6 541 Q: Karthik could cover a distance of 200 km in 22 days while resting for 2 hrs. per day. In how many days (approx) he will cover a distance of 250 km while resting for 2 hrs. per day and moving with 2/3rd of the previous speed ? A) 41.25 days B) 37.5 days C) 39.75 days D) 40 days Answer & Explanation Answer: A) 41.25 days Explanation: Given Karthik can cover the distance of 200 kms resting 2 hrs per day in 22 days. Let the initial speed be '1' Hence, Time = 22(24hrs - 2) Noe new speed = 2/3 Let the number of days he take be 'D' Therefore, $\frac{\mathbf{22}\left(\mathbf{24}\mathbf{-}\mathbf{2}\right)\mathbf{x}\mathbf{3}}{\mathbf{200}}\mathbf{=}\frac{\mathbf{D}\left(\mathbf{24}\mathbf{-}\mathbf{2}\right)\mathbf{x}\mathbf{2}}{\mathbf{250}}$ D = 11 x 3 x 5/4 = 41.25 days. = 41 1/4 days.
1,719
5,019
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 2, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
4.25
4
CC-MAIN-2018-05
longest
en
0.886905
https://prezi.com/eso61mn3hsvh/lesson-0609-polynomial-function-activity/
1,542,189,836,000,000,000
text/html
crawl-data/CC-MAIN-2018-47/segments/1542039741764.35/warc/CC-MAIN-20181114082713-20181114104713-00265.warc.gz
583,349,856
22,465
Loading presentation... Present Remotely Send the link below via email or IM Present to your audience • Invited audience members will follow you as you navigate and present • People invited to a presentation do not need a Prezi account • This link expires 10 minutes after you close the presentation • A maximum of 30 users can follow your presentation • Learn more about this feature in our knowledge base article Do you really want to delete this prezi? Neither you, nor the coeditors you shared it with will be able to recover it again. Lesson 06.09 Polynomial Function Activity No description by justin chacko on 11 August 2013 Comments (0) Please log in to add your comment. Report abuse Transcript of Lesson 06.09 Polynomial Function Activity 6.09 Option 2 Justin Chacko 5. Find the solutions to this equation algebraically using the Fundamental Theorem of Algebra, the Rational Root Theorem, Descartes' Rule of Signs, and the Factor Theorem. Hint If the numbers are large, graph the function first using GeoGebra to help you find one of the zeros. Use that zero to find the depressed equation which can be solved by factoring or the quadratic formula. 4. Simplify the equation and write it in standard form. 168 = (x + 1)(x - 4)(x) 168 = (x^2 - 4x + 1x - 3)(x) 168 = (x^2 - 3x - 4)(x) V = x^3 - 3x^2 - 4x - 168 Step 2 2.Apply the formula of a rectangular box (V = lwh) to find the volume of the object. V = 168 Now suppose you knew the volume of this object and the relation of the length to the width and height, but did not know the length. Rewriting the equation with one variable would result in a polynomial equation that you could solve to find the length. Step 5 Step 4 Procedure Step 1 1. Measure and record the length, width and height of the rectangular box you have chosen in inches. Round to the nearest whole number. Length: 7 Width: 3 Height: 8 Step 3 3. Rewrite the formula using the variable x for the length. Substitute the value of the volume found in step 2 for V and express the width and height of the object in terms of x plus or minus a constant. For example, if the height measurement is 4 inches longer than the length, then the expression for the height will be (x + 4). 168 = (x + 1)(x - 4)(x) Step 6 6.Substitute 0 for the function notation and, using graphing technology, graph the function. Step 7 7. Answer the following questions : *What does the Fundamental Theorem of Algebra indicate with respect to this equation? -According to the Fundamental Theorem of Algebra, this equation has 3 possible solutions because it is raised to the third degree. *What are the possible rational solutions of your equation? -The possible solutions were positive or negative of each of the following: 1, 2, 3, 4, 6, 7, 8, 12, 14, 21, 24, 28, 42, 56, 84, and 168. *How many possible positive, negative and complex solutions are there in your equation? -There was 1 possible positive real, 2 or 0 possible negative real, and 2 or 0 possible complex. *Graph the function. What type of function has been graphed (linear, quadratic, cubic, or quartic)? Provide your reasoning and describe the end behavior of the graph. -This was a cubic type of function. Volume is cubic, and we were finding the volume of a rectangular box, so it makes sense that this was a cubic function. The left side continues downward and the right end continues upward. *How do the solutions of the equation compare to the length of the rectangular object, and the x-intercept of the graph? Provide both the solutions and measurement. -The solution was the same as the length measurement. The solution was 7, and the measurements were 7, 3, and 8. Factors of (p/q)- Positive or Negative of each of the following: 1, 2, 3, 4, 6, 7, 8, 12, 14, 21, 24, 28, 42, 56, 84, and 168. There is 1 sign change in the original function, so there is one positive real zero. There are 2 or 0 negative real zeros and 2 or 0 complex zeros. If I use synthetic division, I can see that 7 is a zero of this function. This is the only real zero. If I tried to continue to find other zeros using the quadratic formula, I'd see that they are just imaginary numbers. (2 +/- 4.47i). The object I used was an old wooden jewelry box. The materials I used were a ruler, the cox, and a graphing calculator online. What did you think of the project? The project was pretty cool. What did you learn? I learned how to make a function and graph it using the dimensions from a box. Do you have any questions or concerns? Not really. I just hope I did this right. Full transcript
1,172
4,559
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
4.40625
4
CC-MAIN-2018-47
latest
en
0.875205
https://www.coursehero.com/file/15540/EE101Lecture20/
1,490,361,988,000,000,000
text/html
crawl-data/CC-MAIN-2017-13/segments/1490218187945.85/warc/CC-MAIN-20170322212947-00110-ip-10-233-31-227.ec2.internal.warc.gz
907,192,114
29,640
EE101Lecture20 # EE101Lecture20 - Introduction to Digital Logic Lecture 20:... This preview shows pages 1–10. Sign up to view the full content. This preview has intentionally blurred sections. Sign up to view the full version. View Full Document © Mark Redekopp, All rights reserved State Machines • Provide the “brains” or control for electronic and electro- mechanical systems • Implement a set of steps (or algorithm) to control or solve a problem • Combine Sequential and Combinational logic elements – Sequential Logic to remember what step (state) we’re in – Combinational Logic to find what step (state) to go to next • Goal is to generate output values at specific times • Use state diagrams (a.k.a. flowcharts) to specify the operation of the corresponding state machine © Mark Redekopp, All rights reserved Washing Machine State Diagram Boxes represent states or steps in the algorithm Arrows = transitions w/ conditions telling us when to take that transition Output values can be associated with a state and transition or only with a state Idle N=2 Fill WV = 1 Agitate Motor = 1 Drain DV = 1 N = N - 1 N > 0 N = 0 COINS + DOOR COINS • DOOR FULL FULL 5 MIN 5 MIN / Reset_Timer=1 EMPTY EMPTY Outputs Generated Transition Conditions /RESET This preview has intentionally blurred sections. Sign up to view the full version. View Full Document © Mark Redekopp, All rights reserved Washing Machine State Diagram We move through the states based on the conditions. Outputs get asserted when the machine is in that state and the transition is true. Idle N=2 Fill WV = 1 Agitate Motor = 1 Drain DV = 1 N = N - 1 N > 0 N = 0 COINS + DOOR COINS • DOOR FULL FULL 5 MIN 5 MIN / Reset_Timer=1 EMPTY EMPTY /RESET Stay in the initial state until there is enough money (coins) and the door is closed © Mark Redekopp, All rights reserved Washing Machine State Diagram Idle N=2 Fill WV = 1 Agitate Motor = 1 Drain DV = 1 N = N - 1 N > 0 N = 0 COINS + DOOR COINS • DOOR FULL FULL 5 MIN 5 MIN / Reset_Timer=1 EMPTY EMPTY /RESET Move to the Fill state when there is enough money (coins) and the door is closed This preview has intentionally blurred sections. Sign up to view the full version. View Full Document © Mark Redekopp, All rights reserved Washing Machine State Diagram Stay in the Fill state until it is full…also set the Water Valve Open output to be true Idle N=2 Fill WV = 1 Agitate Motor = 1 Drain DV = 1 N = N - 1 N > 0 N = 0 COINS + DOOR COINS • DOOR FULL FULL 5 MIN 5 MIN / Reset_Timer=1 EMPTY EMPTY /RESET © Mark Redekopp, All rights reserved Washing Machine State Diagram Move to the Agitate state after it is full Idle N=2 Fill WV = 1 Agitate Motor = 1 Drain DV = 1 N = N - 1 N > 0 N = 0 COINS + DOOR COINS • DOOR FULL FULL 5 MIN 5 MIN / Reset_Timer=1 EMPTY EMPTY /RESET This preview has intentionally blurred sections. Sign up to view the full version. View Full Document © Mark Redekopp, All rights reserved State Machines Use sequential and combinational logic to implement a set of steps (i.e. an algorithm) Goal is to produce outputs at specific points of time – Combinational logic alone cannot do that because the outputs will change as soon as the inputs change (no notion of time) © Mark Redekopp, All rights reserved State Diagrams • Used to show operation or function of a state machine • Like a flowchart but called a state diagram • 3 parts – States – Transitions –Ou tpu ts State Diagram for a Washing Machine Idle N=2 Fill WV = 1 Agitate Motor = 1 Drain DV = 1 N = N - 1 N > 0 N = 0 COINS + DOOR COINS • DOOR FULL FULL 5 MIN 5 MIN / Reset_Timer=1 EMPTY EMPTY /RESET This preview has intentionally blurred sections. Sign up to view the full version. View Full Document This is the end of the preview. Sign up to access the rest of the document. ## This note was uploaded on 02/27/2008 for the course EE 101 taught by Professor Redekopp during the Fall '06 term at USC. ### Page1 / 36 EE101Lecture20 - Introduction to Digital Logic Lecture 20:... This preview shows document pages 1 - 10. Sign up to view the full document. View Full Document Ask a homework question - tutors are online
1,042
4,126
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.734375
4
CC-MAIN-2017-13
longest
en
0.847221
https://www.analyticsisnormal.com/post/proc-standard-to-standardize-or-normalize-the-variables
1,726,015,335,000,000,000
text/html
crawl-data/CC-MAIN-2024-38/segments/1725700651323.1/warc/CC-MAIN-20240910224659-20240911014659-00401.warc.gz
605,976,117
206,517
top of page Search • Ekta Aggarwal # PROC STANDARD - To standardize or normalize the variables. ## What is standardization and why is it needed? Standardizing the variables becomes extremely essential in the cases when all the variables are of different scales. For eg. area of a home (in yards) and prices (in dollars) are completely different scales due to which the coefficients or the results of some data science algorithms cannot be reliable (eg. gradient descent). In order to make them comparable we need to make them on the same scale i.e. standardize them. ## How to standardize? The most common approach of standardizing the variables is subtracting the mean of the series from each observation and then dividing the result with the standard deviation (s.d.) of the series. This is called normalizing the variables. Statistically, To understand more: let us take a series X and we have calculated its mean and standard deviation (s.d.) as 50.5 and 26 respectively. Now we take first element of X i.e. 50 and calculate Z = (50 - mean)/ s.d. i.e. (50-50.5)/26 = -0.02 . Similarly we do it for all the observations. Now the mean of Z is 0 and standard deviation is 1. Now let us understand how can we standardize variables in SAS. Let us firstly define our LIBNAME as: `libname mylib '/home/u50132927/My_datasets';` ### Syntax: ```PROC STANDARD DATA = data_to_be_standardized OUT = data_to_save_output MEAN = X STD = Y VARDEF = divisor; VAR list_of_numeric_variables_to_standardize; RUN;``` DATA: Data which needs to be standardized or normalized. OUT: Location and name of output dataset. MEAN: What should be the mean of standardized values. Default value is 0. STD : What should be the standard deviation of standardized values. Default value is 1. VAR: List of column names which need to be standardized. Note: Only numeric columns can be standardized. VARDEF: divisor to calculate the standard deviation. Can take values N-1, N , WDF and WGT. We shall explain VARDEF in detail later in this tutorial. ## Learning with examples! For this tutorial we shall be leveraging SAS' inbuilt dataset SASHELP.SHOES. To view the decimals we have set comma and decimal formats for Sales and Returns variables. ```DATA MYLIB.SHOES; SET SASHELP.SHOES; FORMAT Sales comma10.2 Returns comma10.2; RUN;``` Task: Standardize Returns and Sales column in SHOES data with mean 0 and s.d. 1. ```PROC STANDARD DATA=MYLIB.SHOES MEAN=0 STD=1 OUT=MYLIB.Standardized; VAR Returns Sales ; RUN;``` Our data looks as follows: Note that original variables have been replaced by standardized values. Let us get the mean of these variables after standardizing. ```PROC MEANS DATA=MYLIB.Standardized; VAR Returns Sales; RUN;``` For both the variables mean and standard deviation are 0 and 1 respectively. ### What is you need to keep the original variables and keep standardized values in a different set of variables? SAS always replaces the original column by standardized values. To tackle this, we have to create new variables = original variables ourselves. We have created copy of columns Returns and Sales as std_returns and std_sales. ```DATA MYLIB.SHOES; SET SASHELP.SHOES; FORMAT Sales comma10.2 Returns comma10.2 std_returns comma10.2 std_sales comma10.2; std_returns = Returns; std_sales = Sales; RUN;``` Now we will pass std_returns and std_sales for standardization. ```PROC STANDARD DATA=MYLIB.SHOES MEAN=0 STD=1 OUT=MYLIB.STANDARDIZED; VAR std_returns std_sales ; RUN;``` Let us calculate the mean and standard deviation of original and standardized variables. ```PROC MEANS DATA=MYLIB.STANDARDIZED; VAR Sales Returns std_sales std_returns; RUN;``` ## Understanding VARDEF VARDEF is the denominator for calculation of variances.VARDEF can take following values: By default VARDEF = DF (i.e. n-1) , where N is the number of entries in the column. For large data, keeping the divider N or N-1 while calculating the variance won't drastically change the results. Let us recreate our data. ```DATA MYLIB.SHOES; SET SASHELP.SHOES; FORMAT Sales comma10.2 Returns comma10.2 std_returns comma10.2 std_sales comma10.2; std_returns = Returns; std_sales = Sales; RUN;``` Let us standardize it using VARDEF = N: ```PROC STANDARD DATA=MYLIB.SHOES MEAN=0 STD=1 OUT=MYLIB.STANDARDIZED REPLACE VARDEF = N; VAR std_returns std_sales ; RUN;``` ```PROC MEANS DATA=MYLIB.STANDARDIZED; VAR Sales Returns std_sales std_returns; RUN;``` ### WEIGHTED Standard deviation and mean in VARDEF. Sometimes we need to allocate weights to the observation (if some observations are more important than others then observations of higher importance are assigned a higher weight) In this way their standard deviation and means are also weighted. To understand better, let us create our data: ```DATA MYLIB.SHOES; SET SASHELP.SHOES; FORMAT Sales comma10.2 Returns comma10.2 std_returns comma10.2 std_sales comma10.2; std_returns = Returns; std_sales = Sales; RUN;``` In the following code we are weighting our data by STORES (note the WEIGHT statement) and we have defined VARDEF = WGT. Thus VARDEF will calculate weighted mean and weighted standard deviation of the variables and then standardize it. ```PROC STANDARD DATA=MYLIB.SHOES MEAN=0 STD=1 OUT=MYLIB.STANDARDIZED VARDEF = WGT; WEIGHT Stores; VAR std_returns std_sales ; RUN;``` Let us calculate the means and standard deviation: ```PROC MEANS DATA=MYLIB.STANDARDIZED; VAR Sales Returns std_sales std_returns; RUN;``` See All bottom of page
1,315
5,510
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.921875
3
CC-MAIN-2024-38
latest
en
0.869968
https://www.exactlywhatistime.com/days-from-date/december-14/27-days
1,701,698,826,000,000,000
text/html
crawl-data/CC-MAIN-2023-50/segments/1700679100529.8/warc/CC-MAIN-20231204115419-20231204145419-00307.warc.gz
863,360,091
6,182
What date is 27 days added from Thursday December 14, 2023? Wednesday January 10, 2024 Adding 27 days from Thursday December 14, 2023 is Wednesday January 10, 2024 which is day number 010 of 2023. This page is designed to help you the steps to count 27, but understand how to convert and add time correctly. • Specific Date: Thursday December 14, 2023 • Days from Thursday December 14, 2023: Wednesday January 10, 2024 • Day of the year: 010 • Day of the week: Wednesday • Month: January • Year: 2023 Calculating 27 days from Thursday December 14, 2023 by hand Attempting to add 27 days from Thursday December 14, 2023 by hand can be quite difficult and time-consuming. A more convenient method is to use a calendar, whether it's a physical one or a digital application, to count the days from the given date. However, our days from specific date calculatoris the easiest and most efficient way to solve this problem. If you want to modify the question on this page, you have two options: you can either change the URL in your browser's address bar or go to our days from specific date calculator to enter a new query. Keep in mind that doing these types of calculations in your head can be quite challenging, so our calculator was developed to assist you in this task and make it much simpler. Wednesday January 10, 2024 Stats • Day of the week: Wednesday • Month: January • Day of the year: 010 Counting 27 days forward from Thursday December 14, 2023 Counting forward from today, Wednesday January 10, 2024 is 27 from now using our current calendar. 27 days is equivalent to: 27 days is also 648 hours. Wednesday January 10, 2024 is 2% of the year completed. Within 27 days there are 648 hours, 38880 minutes, or 2332800 seconds Wednesday Wednesday January 10, 2024 is the 010 day of the year. At that time, we will be 2% through 2024. In 27 days, the Average Person Spent... • 5799.6 hours Sleeping • 771.12 hours Eating and drinking • 1263.6 hours Household activities • 375.84 hours Housework • 414.72 hours Food preparation and cleanup • 129.6 hours Lawn and garden care • 2268.0 hours Working and work-related activities • 2086.56 hours Working • 3414.96 hours Leisure and sports • 1853.28 hours Watching television Famous Sporting and Music Events on January 10 • 1898 Painter Henri Matisse (28) weds Amlie Noellie Parayre • 1982 NFC Championship, Candlestick Park, SF: San Francisco 49ers beat Dallas Cowboys, 28-27; "The Catch" - iconic moment in NFL history - Dwight Clark makes fingertip catch for a TD from Joe Montana with 58" remaining; SF goes on to win Super Bowl
687
2,598
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.734375
4
CC-MAIN-2023-50
latest
en
0.943903
https://xray.readthedocs.io/en/v0.8.0/plotting.html
1,542,295,218,000,000,000
text/html
crawl-data/CC-MAIN-2018-47/segments/1542039742779.14/warc/CC-MAIN-20181115141220-20181115162443-00018.warc.gz
1,078,592,165
14,832
# Plotting¶ ## Introduction¶ Labeled data enables expressive computations. These same labels can also be used to easily create informative plots. xarray’s plotting capabilities are centered around xarray.DataArray objects. To plot xarray.Dataset objects simply access the relevant DataArrays, ie dset['var1']. Here we focus mostly on arrays 2d or larger. If your data fits nicely into a pandas DataFrame then you’re better off using one of the more developed tools there. xarray plotting functionality is a thin wrapper around the popular matplotlib library. Matplotlib syntax and function names were copied as much as possible, which makes for an easy transition between the two. Matplotlib must be installed before xarray can plot. For more extensive plotting applications consider the following projects: • Seaborn: “provides a high-level interface for drawing attractive statistical graphics.” Integrates well with pandas. • Holoviews: “Composable, declarative data structures for building even complex visualizations easily.” Works for 2d datasets. • Cartopy: Provides cartographic tools. ### Imports¶ The following imports are necessary for all of the examples. In [1]: import numpy as np In [2]: import pandas as pd In [3]: import matplotlib.pyplot as plt In [4]: import xarray as xr For these examples we’ll use the North American air temperature dataset. In [5]: airtemps = xr.tutorial.load_dataset('air_temperature') In [6]: airtemps Out[6]: <xarray.Dataset> Dimensions: (lat: 25, lon: 53, time: 2920) Coordinates: * lat (lat) float32 75.0 72.5 70.0 67.5 65.0 62.5 60.0 57.5 55.0 52.5 ... * time (time) datetime64[ns] 2013-01-01 2013-01-01T06:00:00 ... * lon (lon) float32 200.0 202.5 205.0 207.5 210.0 212.5 215.0 217.5 ... Data variables: air (time, lat, lon) float64 241.2 242.5 243.5 244.0 244.1 243.9 ... Attributes: platform: Model Conventions: COARDS references: http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanalysis.html description: Data is from NMC initialized reanalysis (4x/day). These are the 0.9950 sigma level values. title: 4x daily NMC reanalysis (1948) # Convert to celsius In [7]: air = airtemps.air - 273.15 ## One Dimension¶ ### Simple Example¶ xarray uses the coordinate name to label the x axis. In [8]: air1d = air.isel(lat=10, lon=10) In [9]: air1d.plot() Out[9]: [<matplotlib.lines.Line2D at 0x7f7e0d224650>] Additional arguments are passed directly to the matplotlib function which does the work. For example, xarray.plot.line() calls matplotlib.pyplot.plot passing in the index and the array values as x and y, respectively. So to make a line plot with blue triangles a matplotlib format string can be used: In [10]: air1d[:200].plot.line('b-^') Out[10]: [<matplotlib.lines.Line2D at 0x7f7e163b1ed0>] Note Not all xarray plotting methods support passing positional arguments to the wrapped matplotlib functions, but they do all support keyword arguments. Keyword arguments work the same way, and are more explicit. In [11]: air1d[:200].plot.line(color='purple', marker='o') Out[11]: [<matplotlib.lines.Line2D at 0x7f7e0cc85f90>] To add the plot to an existing axis pass in the axis as a keyword argument ax. This works for all xarray plotting methods. In this example axes is an array consisting of the left and right axes created by plt.subplots. In [12]: fig, axes = plt.subplots(ncols=2) In [13]: axes Out[13]: array([<matplotlib.axes._subplots.AxesSubplot object at 0x7f7e0d3a2950>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f7e0d5116d0>], dtype=object) In [14]: air1d.plot(ax=axes[0]) Out[14]: [<matplotlib.lines.Line2D at 0x7f7e16134450>] In [15]: air1d.plot.hist(ax=axes[1]) Out[15]: (array([ 9., 38., 255., 584., 542., 489., 368., 258., 327., 50.]), array([ 0.95 , 2.719, 4.488, ..., 15.102, 16.871, 18.64 ]), <a list of 10 Patch objects>) In [16]: plt.tight_layout() In [17]: plt.show() On the right is a histogram created by xarray.plot.hist(). ## Two Dimensions¶ ### Simple Example¶ The default method xarray.DataArray.plot() sees that the data is 2 dimensional and calls xarray.plot.pcolormesh(). In [18]: air2d = air.isel(time=500) In [19]: air2d.plot() All 2d plots in xarray allow the use of the keyword arguments yincrease and xincrease. In [20]: air2d.plot(yincrease=False) Note We use xarray.plot.pcolormesh() as the default two-dimensional plot method because it is more flexible than xarray.plot.imshow(). However, for large arrays, imshow can be much faster than pcolormesh. If speed is important to you and you are plotting a regular mesh, consider using imshow. ### Missing Values¶ xarray plots data with Missing values. In [21]: bad_air2d = air2d.copy() In [22]: bad_air2d[dict(lat=slice(0, 10), lon=slice(0, 25))] = np.nan ### Nonuniform Coordinates¶ It’s not necessary for the coordinates to be evenly spaced. Both xarray.plot.pcolormesh() (default) and xarray.plot.contourf() can produce plots with nonuniform coordinates. In [24]: b = air2d.copy() # Apply a nonlinear transformation to one of the coords In [25]: b.coords['lat'] = np.log(b.coords['lat']) In [26]: b.plot() ### Calling Matplotlib¶ Since this is a thin wrapper around matplotlib, all the functionality of matplotlib is available. In [27]: air2d.plot(cmap=plt.cm.Blues) In [28]: plt.title('These colors prove North America\nhas fallen in the ocean') Out[28]: <matplotlib.text.Text at 0x7f7e0cbe1b90> In [29]: plt.ylabel('latitude') Out[29]: <matplotlib.text.Text at 0x7f7e0c381f90> In [30]: plt.xlabel('longitude') Out[30]: <matplotlib.text.Text at 0x7f7e0c386890> In [31]: plt.tight_layout() In [32]: plt.show() Note xarray methods update label information and generally play around with the axes. So any kind of updates to the plot should be done after the call to the xarray’s plot. In the example below, plt.xlabel effectively does nothing, since d_ylog.plot() updates the xlabel. In [33]: plt.xlabel('Never gonna see this.') Out[33]: <matplotlib.text.Text at 0x7f7e0c2ce850> In [34]: air2d.plot() In [35]: plt.show() ### Colormaps¶ xarray borrows logic from Seaborn to infer what kind of color map to use. For example, consider the original data in Kelvins rather than Celsius: In [36]: airtemps.air.isel(time=0).plot() The Celsius data contain 0, so a diverging color map was used. The Kelvins do not have 0, so the default color map was used. ### Robust¶ Outliers often have an extreme effect on the output of the plot. Here we add two bad data points. This affects the color scale, washing out the plot. In [37]: air_outliers = airtemps.air.isel(time=0).copy() In [38]: air_outliers[0, 0] = 100 In [39]: air_outliers[-1, -1] = 400 In [40]: air_outliers.plot() This plot shows that we have outliers. The easy way to visualize the data without the outliers is to pass the parameter robust=True. This will use the 2nd and 98th percentiles of the data to compute the color limits. In [41]: air_outliers.plot(robust=True) Observe that the ranges of the color bar have changed. The arrows on the color bar indicate that the colors include data points outside the bounds. ### Discrete Colormaps¶ It is often useful, when visualizing 2d data, to use a discrete colormap, rather than the default continuous colormaps that matplotlib uses. The levels keyword argument can be used to generate plots with discrete colormaps. For example, to make a plot with 8 discrete color intervals: In [42]: air2d.plot(levels=8) It is also possible to use a list of levels to specify the boundaries of the discrete colormap: In [43]: air2d.plot(levels=[0, 12, 18, 30]) You can also specify a list of discrete colors through the colors argument: In [44]: flatui = ["#9b59b6", "#3498db", "#95a5a6", "#e74c3c", "#34495e", "#2ecc71"] In [45]: air2d.plot(levels=[0, 12, 18, 30], colors=flatui) Finally, if you have Seaborn installed, you can also specify a seaborn color palette to the cmap argument. Note that levels must be specified with seaborn color palettes if using imshow or pcolormesh (but not with contour or contourf, since levels are chosen automatically). In [46]: air2d.plot(levels=10, cmap='husl') ## Faceting¶ Faceting here refers to splitting an array along one or two dimensions and plotting each group. xarray’s basic plotting is useful for plotting two dimensional arrays. What about three or four dimensional arrays? That’s where facets become helpful. Consider the temperature data set. There are 4 observations per day for two years which makes for 2920 values along the time dimension. One way to visualize this data is to make a seperate plot for each time period. The faceted dimension should not have too many values; faceting on the time dimension will produce 2920 plots. That’s too much to be helpful. To handle this situation try performing an operation that reduces the size of the data in some way. For example, we could compute the average air temperature for each month and reduce the size of this dimension from 2920 -> 12. A simpler way is to just take a slice on that dimension. So let’s use a slice to pick 6 times throughout the first year. In [47]: t = air.isel(time=slice(0, 365 * 4, 250)) In [48]: t.coords Out[48]: Coordinates: * lat (lat) float32 75.0 72.5 70.0 67.5 65.0 62.5 60.0 57.5 55.0 52.5 ... * time (time) datetime64[ns] 2013-01-01 2013-03-04T12:00:00 2013-05-06 ... * lon (lon) float32 200.0 202.5 205.0 207.5 210.0 212.5 215.0 217.5 ... ### Simple Example¶ The easiest way to create faceted plots is to pass in row or col arguments to the xarray plotting methods/functions. This returns a xarray.plot.FacetGrid object. In [49]: g_simple = t.plot(x='lon', y='lat', col='time', col_wrap=3) ### 4 dimensional¶ For 4 dimensional arrays we can use the rows and columns of the grids. Here we create a 4 dimensional array by taking the original data and adding a fixed amount. Now we can see how the temperature maps would compare if one were much hotter. In [50]: t2 = t.isel(time=slice(0, 2)) In [51]: t4d = xr.concat([t2, t2 + 40], pd.Index(['normal', 'hot'], name='fourth_dim')) # This is a 4d array In [52]: t4d.coords Out[52]: Coordinates: * lat (lat) float64 75.0 72.5 70.0 67.5 65.0 62.5 60.0 57.5 55.0 ... * time (time) datetime64[ns] 2013-01-01 2013-03-04T12:00:00 * lon (lon) float64 200.0 202.5 205.0 207.5 210.0 212.5 215.0 ... * fourth_dim (fourth_dim) object 'normal' 'hot' In [53]: t4d.plot(x='lon', y='lat', col='time', row='fourth_dim') Out[53]: <xarray.plot.facetgrid.FacetGrid at 0x7f7e07c16050> ### Other features¶ Faceted plotting supports other arguments common to xarray 2d plots. In [54]: hasoutliers = t.isel(time=slice(0, 5)).copy() In [55]: hasoutliers[0, 0, 0] = -100 In [56]: hasoutliers[-1, -1, -1] = 400 In [57]: g = hasoutliers.plot.pcolormesh('lon', 'lat', col='time', col_wrap=3, ....: robust=True, cmap='viridis') ....: ### FacetGrid Objects¶ xarray.plot.FacetGrid is used to control the behavior of the multiple plots. It borrows an API and code from Seaborn. The structure is contained within the axes and name_dicts attributes, both 2d Numpy object arrays. In [58]: g.axes Out[58]: array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f7e080dfb90>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f7e0780d8d0>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f7e077ed4d0>], [<matplotlib.axes._subplots.AxesSubplot object at 0x7f7e0776e610>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f7e07ac20d0>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f7e0764ca90>]], dtype=object) In [59]: g.name_dicts Out[59]: array([[{'time': numpy.datetime64('2013-01-01T00:00:00.000000000+0000')}, {'time': numpy.datetime64('2013-03-04T12:00:00.000000000+0000')}, {'time': numpy.datetime64('2013-05-06T00:00:00.000000000+0000')}], [{'time': numpy.datetime64('2013-07-07T12:00:00.000000000+0000')}, {'time': numpy.datetime64('2013-09-08T00:00:00.000000000+0000')}, None]], dtype=object) It’s possible to select the xarray.DataArray or xarray.Dataset corresponding to the FacetGrid through the name_dicts. In [60]: g.data.loc[g.name_dicts[0, 0]] Out[60]: <xarray.DataArray 'air' (lat: 25, lon: 53)> array([[-100. , -30.65, -29.65, ..., -40.35, -37.65, -34.55], [ -29.35, -28.65, -28.45, ..., -40.35, -37.85, -33.85], [ -23.15, -23.35, -24.26, ..., -39.95, -36.76, -31.45], ..., [ 23.45, 23.05, 23.25, ..., 22.25, 21.95, 21.55], [ 22.75, 23.05, 23.64, ..., 22.75, 22.75, 22.05], [ 23.14, 23.64, 23.95, ..., 23.75, 23.64, 23.45]]) Coordinates: * lat (lat) float32 75.0 72.5 70.0 67.5 65.0 62.5 60.0 57.5 55.0 52.5 ... time datetime64[ns] 2013-01-01 * lon (lon) float32 200.0 202.5 205.0 207.5 210.0 212.5 215.0 217.5 ... Here is an example of using the lower level API and then modifying the axes after they have been plotted. In [61]: g = t.plot.imshow('lon', 'lat', col='time', col_wrap=3, robust=True) In [62]: for i, ax in enumerate(g.axes.flat): ....: ax.set_title('Air Temperature %d' % i) ....: In [63]: bottomright = g.axes[-1, -1] In [64]: bottomright.annotate('bottom right', (240, 40)) Out[64]: <matplotlib.text.Annotation at 0x7f7e07960d50> In [65]: plt.show() TODO: add an example of using the map method to plot dataset variables (e.g., with plt.quiver). ## Maps¶ To follow this section you’ll need to have Cartopy installed and working. This script will plot the air temperature on a map. import xarray as xr import matplotlib.pyplot as plt import cartopy.crs as ccrs air = (xr.tutorial .air .isel(time=0)) ax = plt.axes(projection=ccrs.Orthographic(-80, 35)) ax.set_global() air.plot.contourf(ax=ax, transform=ccrs.PlateCarree()) ax.coastlines() plt.savefig('cartopy_example.png') Here is the resulting image: ## Details¶ ### Ways to Use¶ There are three ways to use the xarray plotting functionality: 1. Use plot as a convenience method for a DataArray. 2. Access a specific plotting method from the plot attribute of a DataArray. 3. Directly from the xarray plot submodule. These are provided for user convenience; they all call the same code. In [66]: import xarray.plot as xplt In [67]: da = xr.DataArray(range(5)) In [68]: fig, axes = plt.subplots(ncols=2, nrows=2) In [69]: da.plot(ax=axes[0, 0]) Out[69]: [<matplotlib.lines.Line2D at 0x7f7e06f9b550>] In [70]: da.plot.line(ax=axes[0, 1]) Out[70]: [<matplotlib.lines.Line2D at 0x7f7e06f9b210>] In [71]: xplt.plot(da, ax=axes[1, 0]) Out[71]: [<matplotlib.lines.Line2D at 0x7f7e06fa7490>] In [72]: xplt.line(da, ax=axes[1, 1]) Out[72]: [<matplotlib.lines.Line2D at 0x7f7e0716b310>] In [73]: plt.tight_layout() In [74]: plt.show() Here the output is the same. Since the data is 1 dimensional the line plot was used. The convenience method xarray.DataArray.plot() dispatches to an appropriate plotting function based on the dimensions of the DataArray and whether the coordinates are sorted and uniformly spaced. This table describes what gets plotted: Dimensions Plotting function 1 xarray.plot.line() 2 xarray.plot.pcolormesh() Anything else xarray.plot.hist() ### Coordinates¶ If you’d like to find out what’s really going on in the coordinate system, read on. In [75]: a0 = xr.DataArray(np.zeros((4, 3, 2)), dims=('y', 'x', 'z'), ....: name='temperature') ....: In [76]: a0[0, 0, 0] = 1 In [77]: a = a0.isel(z=0) In [78]: a Out[78]: <xarray.DataArray 'temperature' (y: 4, x: 3)> array([[ 1., 0., 0.], [ 0., 0., 0.], [ 0., 0., 0.], [ 0., 0., 0.]]) Coordinates: * y (y) int64 0 1 2 3 * x (x) int64 0 1 2 z int64 0 The plot will produce an image corresponding to the values of the array. Hence the top left pixel will be a different color than the others. Before reading on, you may want to look at the coordinates and think carefully about what the limits, labels, and orientation for each of the axes should be. In [79]: a.plot()
4,920
16,035
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.515625
3
CC-MAIN-2018-47
longest
en
0.726633
http://makerhome.blogspot.com/2014_07_09_archive.html
1,534,672,760,000,000,000
text/html
crawl-data/CC-MAIN-2018-34/segments/1534221215075.58/warc/CC-MAIN-20180819090604-20180819110604-00583.warc.gz
249,778,695
15,200
## Welcome to MakerHome We've completed our yearlong print-a-day project! All new material is now at Hacktastic: www.mathgrrl.com ## Wednesday, July 9, 2014 ### Day 317 - Vaas Vase Zydac's stunning Delta Vase model on Thingiverse, which was based on architect Van Shundel Huis' Delta Vass piece. It's a really cool shape, with three angled planes making a "Y" at the base and a triangle at the top: Settings: Printed on a MakerBot Replicator Mini with .3mm layer height but otherwise default settings. It took a long time, maybe over three hours? However I could print it full size and it is big enough to be a small windowsill planter. Technical notes, Rhino/Grasshopper flavor: I came across this model while looking for some demo Grasshopper files to use in Rhino, to use in the unlikely event that I have enough free time this summer to learn how to use either of those things. Zydac was kind enough to include the Rhino 3D file and Grasshopper script with their model. Thank you Zydac, I will learn from this sometime in the future, I hope! UPDATE: kitwallace has now designed a Customizable Delta Vase model with just a few lines of OpenSCAD code. Since it's in the Customizer we can "View Source" to see what he did. The side module takes a hull of four small spheres to make one of the faces of the vase, and the delta_vase module rotates and copies that face to make the vase. The The ground module just snips off the bottom so the model lies flat on the platform. /* parametric Delta vase inspired by http://www.thingiverse.com/thing:150482 from the original design by Mart van Schijndel generalised to n sides Each side is constructed by hulling spheres positioned at the corners of the plane of the face.  Three of the points are straightforward to position but the fourth needs to be placed so that the bottom edge is parallel to the top edge, */ // length of top edge top=40; // length of bottom edge bottom=20; // height of vase height=50; // wall thickness thickness=1; // number of sides nsides=3; module side(angle,top,bottom,height,thickness) { hull() { translate([top,0,height]) sphere(thickness); rotate([0,0,angle]) translate([top,0,height]) sphere(thickness); translate([0,0,0]) sphere(thickness); rotate([0,0,angle+(180-angle)/2]) translate([bottom,0,0]) sphere(thickness); } } module delta_vase(nsides,top,bottom,height,thickness) { assign(angle=360/nsides) for (i = [0:nsides-1]) rotate([0,0,i*angle]) side(angle,top,bottom,height,thickness); } module ground(size=50) { translate([0,0,-size]) cube(2*size,center=true); } \$fn=15; difference()  { delta_vase(nsides,top,bottom,height,thickness); ground(); }
687
2,647
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.625
3
CC-MAIN-2018-34
longest
en
0.913086
https://www.studypool.com/discuss/551246/need-help-with-word-problem-14?free
1,480,891,385,000,000,000
text/html
crawl-data/CC-MAIN-2016-50/segments/1480698541426.52/warc/CC-MAIN-20161202170901-00490-ip-10-31-129-80.ec2.internal.warc.gz
1,026,235,023
14,185
##### need help with word problem Algebra Tutor: None Selected Time limit: 1 Day If a square has a side of 12xy + 1, its perimeter is: 48xy + 1 None of the choices are correct. 24xy + 2 48xy + 4 May 20th, 2015 Ok so we have the length of one side, and we know that the perimeter of a square is p = 4s where s is the side length. So now simply plug in the side length. Thus p = 4(12xy + 1) = 48xy + 4. Hope this helps. Let me know if you have any questions. May 20th, 2015 ... May 20th, 2015 ... May 20th, 2015 Dec 4th, 2016 check_circle
186
542
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.578125
4
CC-MAIN-2016-50
longest
en
0.930057
http://goldenlinks.com.ua/epte9s/agf423z.php?tag=f352a3-singular-matrix-rank
1,624,556,014,000,000,000
text/html
crawl-data/CC-MAIN-2021-25/segments/1623488556482.89/warc/CC-MAIN-20210624171713-20210624201713-00142.warc.gz
19,580,668
8,730
## singular matrix rank Posted on 01-01-2021 , by: , in , 0 Comments It has two identical rows. M. Radeş, in Encyclopedia of Vibration, 2001. But the value 0.01 is so small that A is nearly a rank two matrix. Rounding errors may lead to small but non-zero singular values in a rank deficient matrix. Adding more columns to Y (like in X) should not lead to linear independence. The above matrix has a zero determinant and is therefore singular. Equivalently: Does a matrix with all its columns or rows linear independently imply all its eigenvectors linear independently? In general, if any row (column) of a square matrix is a weighted sum of the other rows (columns), then any of the latter is also a weighted sum of the other rows (columns). In case of 2 x 2 Singular matrix (for 2 x 2 MIMO) as an example, if the Rank Indictor is 2. In case the matrix has an inverse, then the matrix multiplied by its inverse will give you the identity matrix. In theoretical mathematics a singular matrix is usually defined as an n by n matrix with rank less than n. For rectangular matrices it is natural to generalize this and to define an m by n matrix to be singular if its rank is less than min(m,n) . Does full rank matrix (nonsingular) imply it is diagonalizable? Hence, I cannot understand how NumPy can calculate the inverse of X'X given Y'Y is singular. So and . The other must equal the trace, so σ 1 2 = 125. Estimation of the rank of a matrix of measured FRF data can be made using the singular value decomposition (SVD) of a composite FRF (CFRF) matrix, [A] N f ×N o N i Each column of the CFRF matrix contains elements of an individual FRF measured for given input/output location combination at all frequencies. In my opinion, the columns of Y are linear dependent. Proof. The rank of any square matrix equals the number of nonzero eigen-values (with repetitions), so the number of nonzero singular values of A equals the rank of ATA. Remark 1.4. Both diagonal elements as shown below is non-zero value and two separate communication pipe is established. Singular Value Plots. In other words, the rows are not independent. Numerically singular matrices Matrices in this collection are numerically singular in the sense that for an m by n matrix A in the collection the numerical rank of A is less than min(m,n) A has at least one small singular value and; A is very ill conditioned; where A full rank matrix implies it's determinant is non-zero or the matrix is non-singular. The three non-zero singular values tell you that the matrix has rank 3. Because this is a rank 1 matrix, one eigenvalue must be 0. Rank as used in theoretical mathematics and numerical rank. A matrix with a non-zero determinant certainly means a non-singular matrix. Hence, Y'Y is singular and its determinant is zero. numpy.linalg.LinAlgError: Singular matrix. Rank of a Matrix. A matrix is singular iff its determinant is 0. By a previous homework problem, ATAand A have the same kernel. A square matrix that does not have a matrix inverse. In other words, the rank of equals the number of non-zero singular values which is the same as the number of non-zero diagonal elements in . In fact the matrix B was created by setting that last singular value to zero. It has no inverse. ... No. Singular or near-singular matrix is often referred to as "ill-conditioned" matrix because it delivers problems in many statistical data analyses. It then follows from the \rank-nullity" theorem that ATAand Ahave the same rank. If the Rank Indicator of the matrix is 1, one of the diagonal element (Lamda 1 or Lamda 2) is zero. Now the rank one decomposition of A is and the rank one decomposition of B is .
847
3,679
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.5625
4
CC-MAIN-2021-25
latest
en
0.878025
https://bio.libretexts.org/Courses/Chemeketa_Community_College/Cell_Biology_for_Allied_Health/02%3A_Measurements_and_Problem-Solving
1,721,909,378,000,000,000
text/html
crawl-data/CC-MAIN-2024-30/segments/1720763858305.84/warc/CC-MAIN-20240725114544-20240725144544-00534.warc.gz
113,469,503
29,694
# 2: Measurements and Problem-Solving $$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$ $$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$ $$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ ( \newcommand{\kernel}{\mathrm{null}\,}\) $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}[1]{\| #1 \|}$$ $$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}[1]{\| #1 \|}$$ $$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\AA}{\unicode[.8,0]{x212B}}$$ $$\newcommand{\vectorA}[1]{\vec{#1}} % arrow$$ $$\newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow$$ $$\newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$ $$\newcommand{\vectorC}[1]{\textbf{#1}}$$ $$\newcommand{\vectorD}[1]{\overrightarrow{#1}}$$ $$\newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}}$$ $$\newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}}$$ $$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$ $$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$ $$\newcommand{\avec}{\mathbf a}$$ $$\newcommand{\bvec}{\mathbf b}$$ $$\newcommand{\cvec}{\mathbf c}$$ $$\newcommand{\dvec}{\mathbf d}$$ $$\newcommand{\dtil}{\widetilde{\mathbf d}}$$ $$\newcommand{\evec}{\mathbf e}$$ $$\newcommand{\fvec}{\mathbf f}$$ $$\newcommand{\nvec}{\mathbf n}$$ $$\newcommand{\pvec}{\mathbf p}$$ $$\newcommand{\qvec}{\mathbf q}$$ $$\newcommand{\svec}{\mathbf s}$$ $$\newcommand{\tvec}{\mathbf t}$$ $$\newcommand{\uvec}{\mathbf u}$$ $$\newcommand{\vvec}{\mathbf v}$$ $$\newcommand{\wvec}{\mathbf w}$$ $$\newcommand{\xvec}{\mathbf x}$$ $$\newcommand{\yvec}{\mathbf y}$$ $$\newcommand{\zvec}{\mathbf z}$$ $$\newcommand{\rvec}{\mathbf r}$$ $$\newcommand{\mvec}{\mathbf m}$$ $$\newcommand{\zerovec}{\mathbf 0}$$ $$\newcommand{\onevec}{\mathbf 1}$$ $$\newcommand{\real}{\mathbb R}$$ $$\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}$$ $$\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}$$ $$\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}$$ $$\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}$$ $$\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}$$ $$\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}$$ $$\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}$$ $$\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}$$ $$\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}$$ $$\newcommand{\laspan}[1]{\text{Span}\{#1\}}$$ $$\newcommand{\bcal}{\cal B}$$ $$\newcommand{\ccal}{\cal C}$$ $$\newcommand{\scal}{\cal S}$$ $$\newcommand{\wcal}{\cal W}$$ $$\newcommand{\ecal}{\cal E}$$ $$\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}$$ $$\newcommand{\gray}[1]{\color{gray}{#1}}$$ $$\newcommand{\lgray}[1]{\color{lightgray}{#1}}$$ $$\newcommand{\rank}{\operatorname{rank}}$$ $$\newcommand{\row}{\text{Row}}$$ $$\newcommand{\col}{\text{Col}}$$ $$\renewcommand{\row}{\text{Row}}$$ $$\newcommand{\nul}{\text{Nul}}$$ $$\newcommand{\var}{\text{Var}}$$ $$\newcommand{\corr}{\text{corr}}$$ $$\newcommand{\len}[1]{\left|#1\right|}$$ $$\newcommand{\bbar}{\overline{\bvec}}$$ $$\newcommand{\bhat}{\widehat{\bvec}}$$ $$\newcommand{\bperp}{\bvec^\perp}$$ $$\newcommand{\xhat}{\widehat{\xvec}}$$ $$\newcommand{\vhat}{\widehat{\vvec}}$$ $$\newcommand{\uhat}{\widehat{\uvec}}$$ $$\newcommand{\what}{\widehat{\wvec}}$$ $$\newcommand{\Sighat}{\widehat{\Sigma}}$$ $$\newcommand{\lt}{<}$$ $$\newcommand{\gt}{>}$$ $$\newcommand{\amp}{&}$$ $$\definecolor{fillinmathshade}{gray}{0.9}$$ • 2.1: Measurements Matter Measurements in chemistry are reported with a variety of units. The standard units for various measurements are discussed along with the modifying prefixes for these units. • 2.2: Significant Figures Significant figures are important in reporting values because the numbers used in chemistry are based on measurements.  The precision of a measurement should not be under- or over-reported through the use of the wrong number of significant figures. • 2.3: Scientific Dimensional Analysis Dimensional analysis (also called factor label method or unit analysis) is used to convert from one set of units to another. This method uses relationships or conversion factors between different sets of units. While the terms are frequently used interchangeably, conversion factors and relationships are different. • 2.4: Percentages Percentages are used in a variety of ways in healthcare including concentrations of solutions, medication dosages, and reporting changes to measured values for patients over time. • 2.5: Measurements and Problem-Solving (Exercises) These are homework exercises to accompany Chapter 1 of the University of Kentucky's LibreText for CHE 103 - Chemistry for Allied Health. Solutions are available below the questions. This page titled 2: Measurements and Problem-Solving is shared under a not declared license and was authored, remixed, and/or curated by Allison Soult.
2,043
5,808
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.609375
4
CC-MAIN-2024-30
latest
en
0.198373
http://wee.tools/barrel-volume-calculator/
1,713,844,623,000,000,000
text/html
crawl-data/CC-MAIN-2024-18/segments/1712296818464.67/warc/CC-MAIN-20240423033153-20240423063153-00153.warc.gz
32,708,871
45,054
Request a Tool Barrel Volume Calculator Calculate the volume of a barrel by given height and radii Volume 0 Formula • π = a constant value 3.1415 • H = Height of the Barrel • r = Middle radius of the Barrel • R = Top Bottom radius of the Barrel Defination / Uses The barrel is approximately cylindrical in shape, with the exception of a bulge in the centre. The volume of a barrel is calculated using the barrel calculator. The supplied height and radius can be used to compute the volume of a barrel. How barrel area calculator work? Its a single step procedure. • Add the required values in their corresponding fields. Thats it! You will get your answer in less than a second. Use upper given formula in case of manual calculation. To calculate the volume of a barrel, you'll need to know its height, top and bottom radiuses, and middle radius. This barrel volume calculator includes a major measurement units conversion function to get the output values in different customary units such as litres (L), gallons (gal), cubic inches (in), cubic foot (ft), cubic metres (m), and cubic centimetres (cm). For quick calculation use our weetools. No sign-up, registration OR captcha is required to use this tool.
269
1,220
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.546875
3
CC-MAIN-2024-18
latest
en
0.840121
http://mathhelpforum.com/calculus/193509-n-infinity-limit-root-n-1-root-n-zero.html
1,527,220,868,000,000,000
text/html
crawl-data/CC-MAIN-2018-22/segments/1526794866938.68/warc/CC-MAIN-20180525024404-20180525044404-00319.warc.gz
196,336,653
9,335
Thread: n --> infinity, limit root(n-1) - root(n) = zero ? 1. n --> infinity, limit root(n-1) - root(n) = zero ? the result of the above mentioned limit is infinity minus infinity = zero, or do you calculate it differently? 2. Re: n --> infinity, limit root(n-1) - root(n) = zero ? $\displaystyle \lim_{n \to \infty }\sqrt{n}-\sqrt{n-1}=\lim_{n \to \infty }(\sqrt{n}-\sqrt{n-1})\cdot \frac{\sqrt{n}+\sqrt{n-1}}{\sqrt{n}+\sqrt{n-1}}=\lim_{n \to \infty }\frac{1}{\sqrt{n}+\sqrt{n-1}}=0$ , , , , lim 1/root n 1 - root n Click on a term to search for related topics.
199
572
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.765625
4
CC-MAIN-2018-22
latest
en
0.488195
https://goprep.co/misc-3-q3-if-one-zero-of-the-polynomial-2x2-x-k-is-3-then-i-1nljpe
1,611,238,491,000,000,000
text/html
crawl-data/CC-MAIN-2021-04/segments/1610703524858.74/warc/CC-MAIN-20210121132407-20210121162407-00254.warc.gz
351,083,536
40,404
Q. 3 # If one zero of the polynomial 2x2 + x + k is 3 then the value of k will be:A. 12B. 21C. 24D. –21 Given one zero = 3 Let second zero a. When we compare the above quadratic equation with the generalized one we get, ax2 + bx + c = 0 a = 2, b = 1, c = k Sum of zeroes = -b/a 3 + a = -1/2 a = -1/2 – 3 a = -7/2 Product of zeroes = 3 × (-7/2) = -21/2 Product of zeroes = c/a k/2 = -21/2 k = -21 So the correct answer is D [-21]. Rate this question : How useful is this solution? We strive to provide quality solutions. Please rate us to serve you better. Related Videos Champ Quiz |Revealing the relation Between Zero and Coefficients38 mins Relation Between zeroes and Coefficients46 mins Interactive Quiz:Polynomials43 mins Division Algorithm-130 mins Relation b/w The Zeroes and Coefficients of Cubic Polynomials54 mins Revision of Relation Between the Zeroes and Coefficients of Quadratic Polynomial46 mins Solving Imp. Qs. of Olympiad on Polynomials47 mins Interactive Quiz - Geometrical Meaning of the Zeroes32 mins Relationship between Zeroes and Coefficients-238 mins Cubic Polynomial36 mins Try our Mini CourseMaster Important Topics in 7 DaysLearn from IITians, NITians, Doctors & Academic Experts Dedicated counsellor for each student 24X7 Doubt Resolution Daily Report Card Detailed Performance Evaluation view all courses
388
1,353
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.46875
3
CC-MAIN-2021-04
longest
en
0.803541
https://www.coursehero.com/file/6267582/lecture-31/
1,516,369,294,000,000,000
text/html
crawl-data/CC-MAIN-2018-05/segments/1516084887981.42/warc/CC-MAIN-20180119125144-20180119145144-00082.warc.gz
881,506,785
23,442
lecture_31 # lecture_31 - MA 36600 LECTURE NOTES FRIDAY APRIL 10 Systems... This preview shows pages 1–2. Sign up to view the full content. This preview has intentionally blurred sections. Sign up to view the full version. View Full Document This is the end of the preview. Sign up to access the rest of the document. Unformatted text preview: MA 36600 LECTURE NOTES: FRIDAY, APRIL 10 Systems of Linear Equations Systems of Linear Differential Equations. We return to the linear system x 1 = p 11 ( t ) x 1 + p 12 ( t ) x 2 + ··· + p 1 n ( t ) x n + g 1 ( t ) x 2 = p 21 ( t ) x 1 + p 22 ( t ) x 2 + ··· + p 2 n ( t ) x n + g 2 ( t ) . . . . . . x m = p m 1 ( t ) x 1 + p m 2 ( t ) x 2 + ··· + p mn ( t ) x n + g m ( t ) Using the notation of matrices, we may express this in the form d dt x 1 x 2 . . . x m | {z } m-dim’l vector = p 11 ( t ) p 12 ( t ) ··· p 1 n ( t ) p 21 ( t ) p 22 ( t ) ··· p 2 n ( t ) . . . . . . . . . . . . p m 1 ( t ) p m 2 ( t ) ··· p mn ( t ) | {z } m × n matrix x 1 x 2 . . . x n | {z } n-dim’l vector + g 1 ( t ) g 2 ( t ) . . . g m ( t ) | {z } m-dim’l vector When m = n , we can express this in the rather compact form d dt x = P ( t ) x + g ( t ) . We are motivated by the following observation: When m = n = 1, we have the first order equation x = p ( t ) x + g ( t ) which we can solve using integrating factors: μ ( t ) = exp- Z t p ( τ ) dτ = ⇒ x ( t ) = 1 μ ( t ) Z t μ ( τ ) g ( τ ) dτ + C .... View Full Document {[ snackBarMessage ]} ### Page1 / 3 lecture_31 - MA 36600 LECTURE NOTES FRIDAY APRIL 10 Systems... This preview shows document pages 1 - 2. Sign up to view the full document. View Full Document Ask a homework question - tutors are online
608
1,700
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.796875
4
CC-MAIN-2018-05
latest
en
0.684996
https://leanprover-community.github.io/mathlib_docs/data/list/lex.html
1,701,256,789,000,000,000
text/html
crawl-data/CC-MAIN-2023-50/segments/1700679100081.47/warc/CC-MAIN-20231129105306-20231129135306-00780.warc.gz
411,356,474
43,248
data.list.lex # Lexicographic ordering of lists. # THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4. The lexicographic order on list α is defined by L < M iff • [] < (a :: L) for any a and L, • (a :: L) < (b :: M) where a < b, or • (a :: L) < (a :: M) where L < M. ## See also # Related files are: • data.finset.colex: Colexicographic order on finite sets. • data.psigma.order: Lexicographic order on Σ' i, α i. • data.pi.lex: Lexicographic order on Πₗ i, α i. • data.sigma.order: Lexicographic order on Σ i, α i. • data.prod.lex: Lexicographic order on α × β. ### lexicographic ordering # inductive list.lex {α : Type u} (r : α α Prop) : list α list α Prop • nil : {α : Type u} {r : α α Prop} {a : α} {l : list α}, (a :: l) • cons : {α : Type u} {r : α α Prop} {a : α} {l₁ l₂ : list α}, l₁ l₂ (a :: l₁) (a :: l₂) • rel : {α : Type u} {r : α α Prop} {a₁ : α} {l₁ : list α} {a₂ : α} {l₂ : list α}, r a₁ a₂ (a₁ :: l₁) (a₂ :: l₂) Given a strict order < on α, the lexicographic strict order on list α, for which [a0, ..., an] < [b0, ..., b_k] if a0 < b0 or a0 = b0 and [a1, ..., an] < [b1, ..., bk]. The definition is given for any relation r, not only strict orders. Instances for list.lex theorem list.lex.cons_iff {α : Type u} {r : α α Prop} [ r] {a : α} {l₁ l₂ : list α} : (a :: l₁) (a :: l₂) l₁ l₂ @[simp] theorem list.lex.not_nil_right {α : Type u} (r : α α Prop) (l : list α) : @[protected, instance] def list.lex.is_order_connected {α : Type u} (r : α α Prop) [ r] [ r] : @[protected, instance] def list.lex.is_trichotomous {α : Type u} (r : α α Prop) [ r] : @[protected, instance] def list.lex.is_asymm {α : Type u} (r : α α Prop) [ r] : @[protected, instance] def list.lex.is_strict_total_order {α : Type u} (r : α α Prop)  : @[protected, instance] def list.lex.decidable_rel {α : Type u} [decidable_eq α] (r : α α Prop)  : Equations theorem list.lex.append_right {α : Type u} (r : α α Prop) {s₁ s₂ : list α} (t : list α) : s₁ s₂ s₁ (s₂ ++ t) theorem list.lex.append_left {α : Type u} (R : α α Prop) {t₁ t₂ : list α} (h : t₁ t₂) (s : list α) : (s ++ t₁) (s ++ t₂) theorem list.lex.imp {α : Type u} {r s : α α Prop} (H : (a b : α), r a b s a b) (l₁ l₂ : list α) : l₁ l₂ l₁ l₂ theorem list.lex.to_ne {α : Type u} {l₁ l₂ : list α} : l₁ l₂ l₁ l₂ theorem decidable.list.lex.ne_iff {α : Type u} [decidable_eq α] {l₁ l₂ : list α} (H : l₁.length l₂.length) : l₁ l₂ l₁ l₂ theorem list.lex.ne_iff {α : Type u} {l₁ l₂ : list α} (H : l₁.length l₂.length) : l₁ l₂ l₁ l₂ @[protected, instance] def list.has_lt' {α : Type u} [has_lt α] : Equations theorem list.nil_lt_cons {α : Type u} [has_lt α] (a : α) (l : list α) : @[protected, instance] Equations @[protected, instance] def list.has_le' {α : Type u} [linear_order α] : Equations
1,056
2,792
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.78125
3
CC-MAIN-2023-50
latest
en
0.395434
https://cdn.programiz.com/java-programming/examples/largest-number-three
1,610,902,869,000,000,000
text/html
crawl-data/CC-MAIN-2021-04/segments/1610703513062.16/warc/CC-MAIN-20210117143625-20210117173625-00488.warc.gz
274,398,451
14,383
# Java Program to Find the Largest Among Three Numbers In this program, you'll learn to find the largest among three numbers using if else and nested if..else statement in Java. To understand this example, you should have the knowledge of the following Java programming topics: ## Example 1: Find Largest Among three numbers using if..else statement ``````public class Largest { public static void main(String[] args) { double n1 = -4.5, n2 = 3.9, n3 = 2.5; if( n1 >= n2 && n1 >= n3) System.out.println(n1 + " is the largest number."); else if (n2 >= n1 && n2 >= n3) System.out.println(n2 + " is the largest number."); else System.out.println(n3 + " is the largest number."); } }`````` Output `3.9 is the largest number.` In the above program, three numbers `-4.5`, `3.9` and `2.5` are stored in variables n1, n2 and n3 respectively. Then, to find the largest, the following conditions are checked using if else statements • If n1 is greater or equals to both n2 and n3, n1 is the greatest. • If n2 is greater or equals to both n1 and n3, n2 is the greatest. • Else, n3 is the greatest. The greatest number can also be found using a nested if..else statement. ## Example 2: Find the largest number among three using nested if..else statement ``````public class Largest { public static void main(String[] args) { double n1 = -4.5, n2 = 3.9, n3 = 5.5; if(n1 >= n2) { if(n1 >= n3) System.out.println(n1 + " is the largest number."); else System.out.println(n3 + " is the largest number."); } else { if(n2 >= n3) System.out.println(n2 + " is the largest number."); else System.out.println(n3 + " is the largest number."); } } }`````` Output `5.5 is the largest number.` In the above program, instead of checking for two conditions in a single if statement, we use nested if to find the greatest. Then, to find the largest, the following conditions are checked using if else statements • If n1 is greater or equals to n2, • and if n1 is greater or equals to n3, n1 is the greatest. • else, n3 is the greatest. • Else, • if n2 is greater or equals to both n3, n2 is the greatest. • else, n3 is the greatest.
586
2,126
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.5625
3
CC-MAIN-2021-04
latest
en
0.775126
https://math.stackexchange.com/questions/985444/linear-regression-expectation-and-mean-squared-error
1,653,680,069,000,000,000
text/html
crawl-data/CC-MAIN-2022-21/segments/1652662675072.99/warc/CC-MAIN-20220527174336-20220527204336-00013.warc.gz
438,761,801
65,694
# linear regression, expectation and mean squared error Let us assume that data is generated according to a true model $$y_i = \beta_{true}x_i + \epsilon_i$$ for $i = 1, ..., n$ Assume that $x_i$ are fixed, and $\epsilon_i$~ N(0, $\sigma^2$) independently. Let $$\hat\beta =\frac{\sum^{n}_{i=1}y_ix_i}{\sum^{n}_{i=1}x^2_i + \lambda}$$ be the shrinkage estimator from the ridge regression. How to calculate expectation and variance of $\hat\beta$, and mean squared error E$[(\hat\beta - \beta_{true})^2]$ ? I'm stuck on this part for expectation. What to do next? $$E(\hat\beta)= E(\frac{\beta_{true}\sum^{n}_{i=1}x_i^2 + \sum^{n}_{i=1}x_i\epsilon_i}{\sum^{n}_{i=1}x^2_i + \lambda}) = (E(\frac{\beta_{true}\sum^{n}_{i=1}x_i^2 }{\sum^{n}_{i=1}x^2_i + \lambda})$$ • Since $x_i$ is fixed $(E(\frac{\beta_{true}\sum^{n}_{i=1}x_i^2 }{\sum^{n}_{i=1}x^2_i + \lambda})=\frac{\beta_{true}\sum^{n}_{i=1}x_i^2 }{\sum^{n}_{i=1}x^2_i + \lambda}$. Oct 22, 2014 at 7:21 • @user103828 how would you calculate the variance? Oct 22, 2014 at 7:32 • @user103828 Is the variance then $$\frac{\sigma^2\sum^{n}_{i=1}x_i^2 }{(\sum^{n}_{i=1}x^2_i + \lambda)^2}$$ Oct 22, 2014 at 7:42 • yes that is correct. see below. Oct 22, 2014 at 7:54 \begin{align*} E(\hat\beta) &= E\left(\frac{\beta_{true}\sum^{n}_{i=1}x_i^2 + \sum^{n}_{i=1}x_i\epsilon_i}{\sum^{n}_{i=1}x^2_i + \lambda}\right) = E \left(\frac{\beta_{true}\sum^{n}_{i=1}x_i^2 }{\sum^{n}_{i=1}x^2_i + \lambda} \right)=\frac{\beta_{true}\sum^{n}_{i=1}x_i^2 }{\sum^{n}_{i=1}x^2_i + \lambda} \\ var(\hat\beta) &= var\left(\frac{\beta_{true}\sum^{n}_{i=1}x_i^2 + \sum^{n}_{i=1}x_i\epsilon_i}{\sum^{n}_{i=1}x^2_i + \lambda}\right) = var \left(\frac{\sum^{n}_{i=1}x_i\varepsilon_i }{\sum^{n}_{i=1}x^2_i + \lambda} \right)=\frac{\sigma^2 \sum^{n}_{i=1}x_i^2 }{(\sum^{n}_{i=1}x^2_i + \lambda)^2} \end{align*} where the second equality follows because everything is a constant except $\varepsilon_i$ and the second equality follows because with $var(\varepsilon_i)=\sigma^2$, $\varepsilon_i$ are independent so we can take out the sum and taking out constant results in squaring them. • So my last question is... to minimize $\lambda$, do we set $\lambda = \sqrt{\frac{\sigma^2 \sum^{n}_{i=1}x^2_i}{\beta_{true}^2}}$?? I obtained this through the $$MSE = \frac{\sigma^2 \sum^{n}_{i=1}x_i^2 }{(\sum^{n}_{i=1}x^2_i + \lambda)^2} + \frac{\lambda^2 \beta_{true}^2 }{(\sum^{n}_{i=1}x^2_i + \lambda)^2}$$ Is this correct? Oct 22, 2014 at 8:04
1,002
2,463
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.8125
4
CC-MAIN-2022-21
latest
en
0.554195
https://math.answers.com/Q/What_is_16_to_the_power_of_zero
1,701,169,985,000,000,000
text/html
crawl-data/CC-MAIN-2023-50/segments/1700679099281.67/warc/CC-MAIN-20231128083443-20231128113443-00589.warc.gz
434,232,984
44,863
0 # What is 16 to the power of zero? Updated: 12/13/2022 Wiki User 13y ago Any number to the power of zero is 1. This can be proven by the laws of exponents, such that, for example, 52 / 52 = 25 / 25 = 1, because nx/nx = nx-x. Therefore, 160 = 1. Wiki User 13y ago
96
271
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.578125
4
CC-MAIN-2023-50
latest
en
0.869963
https://documents.pub/document/use-isosceles-and-equilateral-triangles-56e7c3660eeda.html
1,680,425,452,000,000,000
text/html
crawl-data/CC-MAIN-2023-14/segments/1679296950422.77/warc/CC-MAIN-20230402074255-20230402104255-00354.warc.gz
239,589,255
21,054
Home > Documents > Use isosceles and equilateral triangles # Use isosceles and equilateral triangles Date post: 15-Mar-2016 Category: Author: dale-pittman View: 68 times Description: Use isosceles and equilateral triangles. CH 4.7. In this section…. We will use the facts that we know about isosceles and equilateral triangles to solve for missing sides or angles. What do you know about an isosceles triangle?. - PowerPoint PPT Presentation Embed Size (px) Popular Tags: #### congruent segments of 19 /19 CH 4.7 USE ISOSCELES AND EQUILATERAL TRIANGLES Transcript • CH 4.7USE ISOSCELES AND EQUILATERAL TRIANGLES • In this sectionWe will use the facts that we know about isosceles and equilateral triangles to solve for missing sides or angles. • What do you know about an isosceles triangle?There are two congruent sides in an isosceles triangle and two congruent angles. • What do you remember about an equilateral triangle?All of the sides and angles should be congruent.The angles in an equilateral triangle always equal 60o. • Base Angles TheoremIf two sides of a triangle are congruent, then the base angles are also congruent.Base angles are the angles at the ends of the 2 congruent segments.So, in the diagram angles B and C are congruent.Base angle Base angle • Converse to the Base Angles TheoremIf two angles in a triangle are congruent, then the triangle is an isosceles triangle. That means that the 2 sides of the triangles are also congruent. • Find the value of x.This is an isosceles triangle, so the 2 sides are congruent5x + 5 = 355x = 30x = 6 • This is an isosceles triangle, so the 2 angles are congruent9x = 72x = 8 • x + x + 102 = 1802x + 102 = 1802x = 78x = 39 • The sum of the interior angles is 180x + 7 = 55x = 4855 + 55 + y = 180110 + y = 180y = 170 • If this is an isosceles triangle then what are the two congruent anglesx = 459y = 45y = 5 • How would you find the values of x and y? • What are all of the missing angles? • Page 267, #3 6, 14 - 22 Recommended
581
2,008
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
4.8125
5
CC-MAIN-2023-14
latest
en
0.796569
https://www.explainxkcd.com/wiki/index.php?title=2046:_Trum-&diff=162696&oldid=162695
1,542,524,418,000,000,000
text/html
crawl-data/CC-MAIN-2018-47/segments/1542039743968.63/warc/CC-MAIN-20181118052443-20181118074443-00155.warc.gz
875,257,337
11,900
# Difference between revisions of "2046: Trum-" Trum- Title text: Excited to vote for future presidents Bill Eisenhamper, Amy Forb, Ethan Obample, and Abigail Washingtoast. ## Explanation This explanation may be incomplete or incorrect: Please edit the explanation below and only mention here why it isn't complete. Do NOT delete this tag too soon.If you can address this issue, please edit the page! Thanks. Before Trump, Harry S. Truman (1884-1972) was president between 1945 and 1953. The joke is that of all the weird thinks in the present (Trump's) presidency, this is the less wierdest. # Discussion This is not that weird. If names were random then it would be a 1 in 26^4 = 456976 chance of a particular president matching another for the first 4, but this is a "Birthday Problem" with 44 presidents, so the probability of any two presidents sharing the first 4 characters is 1-(456976!/(456976^44 (456976 - 44)!)), which wolfram alpha is giving as 0.206% 141.101.99.185 (talk) (please sign your comments with ~~~~) Yes, but we already "fulfilled our obligation" after the sixth president :) Zachweix (talk) 15:59, 14 September 2018 (UTC) That would be the lower boundary, because you assume all letters are equally likely to occur. Some n-grams will have a higher probability than others. E.g. it is far less likely for the second letter to be a Q than to be a U,so a better estimate would involve Markov chains including the probability of all letters on a certain position, given the previous letters etc.141.101.76.58 05:46, 15 September 2018 (UTC) Q doesn't work because he's related to his father John Adams. The criteria that they be totally unrelated is to restore it to the realm of pure chance. -boB (talk) 17:24, 14 September 2018 (UTC) An approximation to the correct probability would be to do 44^2/(2 x 26^4) which would give about 0.2% chance of this happening. So fairly weird, but as the comic suggests, many things about this presidency are weirder than 0.2%. 162.158.155.194 (talk) (please sign your comments with ~~~~) I love that we are now having a mathematical discussion about how weird things are in the presidency. Zachweix (talk) 15:58, 14 September 2018 (UTC) Should we mention Andrew Johnson and LBJ, perhaps in a "Trivia" section? Obviously Johnson is a very common surname, but they're still unrelated presidents that share the first (and only) 7 characters of their last name. (Are there other pairs of presidents that share at least the 3 first letters of their surnames besides AJ/LBJ and HST/DJT?) 172.69.62.160 16:25, 14 September 2018 (UTC) They ARE related, distantly. https://www.geni.com/path/Lyndon-B-Johnson-36th-President-of-the-United-States+is+related+to+Andrew-Johnson-17th-President-of-the-USA?from=6000000002045454764&to=361204095530004567 SDSpivey (talk) 19:18, 14 September 2018 (UTC) I think 28 degrees of separation is distant enough to consider them unrelated. -boB (talk) 20:01, 14 September 2018 (UTC) No, they are not related. It says "Andrew Johnson, 17th President of the USA is Lyndon B. Johnson, 36th President of the United States' fifth cousin 10 times removed's 6th great nephew!" In other words, Andrew Johnson and Lyndon Johnson are both related to Lyndon Johnson's fifth cousin 10 times removed, but they are not related to each other. They do not share a common ancestor. Saying that Andrew Johnson and Lyndon Johnson are related is like saying that your parents are related to each other because both of them are related to you (your mother is your father's child's mother).173.245.48.171 05:33, 18 September 2018 (UTC) ...And, upon reflection, I just realized Harding shares the first 3 letters with the Presidents Harrison, so that's one(?) more example. 162.158.186.246 (talk) (please sign your comments with ~~~~) So we discount Presidents Adams, Bush, Cleveland, Harrison and Rosevelt as being related, or being the same person. We have the following common starts: Bu (3 names), Cl, Ha (3 names), Ta, Har, Trum and Johnson. Also A, B, C, F, G, H, J, M, P, R, T and W. 162.158.154.241 16:49, 14 September 2018 (UTC) If you count Buren as opposed to Van Buren then you have 4 starting Bu and 2 starting Bur 162.158.155.146 16:52, 14 September 2018 (UTC) Tyler and Taylor is weirdly close, in a "look elsewhere effect" kind of way. Although the fact that you elected a president whose name means "fart" in British English has got to be weirder. 162.158.155.158 (talk) (please sign your comments with ~~~~)
1,210
4,501
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.515625
4
CC-MAIN-2018-47
latest
en
0.973538
https://socratic.org/questions/the-side-of-a-square-is-4-centimeters-shorter-than-the-side-of-a-second-square-i
1,579,407,889,000,000,000
text/html
crawl-data/CC-MAIN-2020-05/segments/1579250594209.12/warc/CC-MAIN-20200119035851-20200119063851-00443.warc.gz
674,771,179
6,523
# The side of a square is 4 centimeters shorter than the side of a second square. If the sum of their areas is 40 square centimeters, how do you find the length of one side of the larger square? Let 'a' be the side of the shorter square. Then by condition, 'a+4' is the side of larger square. We know the area of a square is equal to the square of it's side. So ${a}^{2} + {\left(a + 4\right)}^{2} = 40$ (given) or $2 {a}^{2} + 8 \cdot a - 24 = 0$ or ${a}^{2} + 4 \cdot a - 12 = 0$ or $\left(a + 6\right) \cdot \left(a - 2\right) = 0$ So either $a = 2 \mathmr{and} a = - 6$ Side length canot be negative . $\therefore a = 2$. Hence the length of the side of larger square is $a + 4 = 6$ [Answer]
243
696
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 7, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
4.375
4
CC-MAIN-2020-05
longest
en
0.826767
http://math.stackexchange.com/questions/307593/a-hard-log-definite-integral-int-0-pi-4-ln3-sin-x-mathrm-dx
1,469,662,196,000,000,000
text/html
crawl-data/CC-MAIN-2016-30/segments/1469257827080.38/warc/CC-MAIN-20160723071027-00122-ip-10-185-27-174.ec2.internal.warc.gz
168,115,466
19,872
# A hard log definite integral: $\int_0^{\pi/4}\ln^3\sin x\,\mathrm dx$ Show that: $$\int_0^{\pi/4}\ln ^3\sin x\text{d}x=\frac34\text{Im}\left(\text{Polylog}\left(4,i\right)\right)-3\text{Im}\left(\text{Polylog}\left(4,\frac12+\frac{i}{2}\right)\right)-\frac{23}{128}\pi^3\ln 2+\frac32\text{Im}\left(\text{Polylog}\left(3,\frac12+\frac{i}{2}\right)\right)\ln 2-\frac38G\ln^22-\frac5{16}\pi\ln^32-\frac38\pi\zeta\left(3\right)$$ - Where did this arise? – Potato Feb 19 '13 at 0:12 A related problem. Here is a different form for the solution in terms of the hypergeometric function $$\int_0^{\frac{\pi}{4}}\ln ^3\sin x\text{d}x = -\frac{\pi\,\ln^3(2)}{32}-\frac{3}{8}\sqrt {2} \left(\ln^2( 2 ) + 4\,\ln \left( 2 \right) +8 \right)\times$$ $${_7F_6\left(\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},\frac{1}{2},\bar{\alpha}, \alpha\, ;\frac{3}{2},\frac{3}{2},\frac{3}{2},\frac{3}{2},\bar{\beta} , \beta;\,\frac{1}{2}\right )}\sim -6.037581109,$$ where $i=\sqrt{-1},$ $$\alpha = \frac{3\ln(2)+2+2i }{2\ln(2)}, \quad \beta = \frac{\ln(2)+2+2i }{2\ln(2)},$$ and $\bar{\alpha},\bar{\beta}$ are the complex conjugates of $\alpha,\beta$. - I've noticed you post challenging integrals. Sorry this is rather belated, but I just found it while nosing around the site. These log-sin integrals are tedious, especially with pi/4. There is an "identity" that can be used to evaluate them, but it is laborious. Note that $\displaystyle \ln(1-e^{i\theta})=\ln(2\sin(x/2))-\frac{i}{2}(\pi -x)$ So, it can be squared, cubed, etc. and solved for the integral in question to derive the result. We can use the formula: $\displaystyle \int_{0}^{\frac{\pi}{4}}\left(\ln(2\sin(x/2))-\frac{i}{2}(\pi -x)\right)^{3}$ $\displaystyle=-i\sum_{k=0}^{3}(-1)^{k+1}\frac{6}{(3-k)!}\cdot \ln^{3-k}(1-e^{\pi i/4})Li_{k+1}(1-e^{\pi i/4})$. Where $Li$ represents the polylog. But, it is rather nasty. The $\frac{\pi}{3}$ case is among the easiest and $\frac{\pi}{4}$ is notoriously difficult. I see part of your solution involves the imaginary part of $Li_{4}(i)$ This is equal to $\displaystyle \frac{\psi^{(3)}(1/4)-\psi^{(3)}(3/4)}{1536}$, which is the third derivative of digamma. Some of the polylogs have closed forms especially for 2 and 3. Higher order polylogs tend not to have closed forms. Take for instance $\displaystyle Li_{3}(e^{\frac{\pi i}{3}})=\frac{\zeta(3)} {3}+\frac{5{\pi}^{3}i}{162}$ Check this out: formula that can be used to integrate powers of log-sin that formula can be handy for integrating various log-sin integrals if the upper limit is pi/2. But, if you would be satisfied with $\displaystyle \int_{0}^{\frac{\pi}{4}}\ln^{3}(\sin(2t))dt$, then it can be done by using $\displaystyle \int_{0}^{1}\frac{\ln^{3}(x)}{\sqrt{1-x^{2}}}dx$ and making the sub $x=\sin(2t)$ and by differentiating $\displaystyle \int_{0}^{1}\frac{t^{a-1}}{\sqrt{1-t^{2}}}dt=\frac{1}{2}\beta\left(\frac{1}{2},\frac{a}{2}\right)$ with respect to 'a' three times and let a=1. As seen here along with other very nice methods: Integrate square of the log-sine integral: $\int_0^{\frac{\pi}{2}}\ln^{2}(\sin(x))dx$ -
1,178
3,115
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.75
4
CC-MAIN-2016-30
latest
en
0.626356
https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/igammac?hl=zh-cn
1,632,726,573,000,000,000
text/html
crawl-data/CC-MAIN-2021-39/segments/1631780058373.45/warc/CC-MAIN-20210927060117-20210927090117-00654.warc.gz
1,054,062,112
22,375
# tensorflow:: ops:: Igammac #include <math_ops.h> Compute the upper regularized incomplete Gamma function Q(a, x) . ## Summary The upper regularized incomplete Gamma function is defined as: $$Q(a, x) = Gamma(a, x) / Gamma(a) = 1 - P(a, x)$$ where $$Gamma(a, x) = {x}^{} t^{a-1} exp(-t) dt$$ is the upper incomplete Gamma function. Note, above P(a, x) ( Igamma ) is the lower regularized complete Gamma function. Args: Returns: • Output : The z tensor. ### Constructors and Destructors Igammac (const :: tensorflow::Scope & scope, :: tensorflow::Input a, :: tensorflow::Input x) ### Public attributes operation Operation z :: tensorflow::Output ### Public functions node () const ::tensorflow::Node * operator::tensorflow::Input () const operator::tensorflow::Output () const ## Public attributes ### operation Operation operation ### z ::tensorflow::Output z ## Public functions ### Igammac Igammac( const ::tensorflow::Scope & scope, ::tensorflow::Input a, ::tensorflow::Input x ) ### node ::tensorflow::Node * node() const ### operator::tensorflow::Input operator::tensorflow::Input() const ### operator::tensorflow::Output operator::tensorflow::Output() const [{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }] [{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]
514
1,866
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.53125
3
CC-MAIN-2021-39
latest
en
0.556868
https://blog.enterprisedna.co/data-segmentation-based-on-percentage-groups-advanced-dax-in-power-bi/
1,709,326,142,000,000,000
text/html
crawl-data/CC-MAIN-2024-10/segments/1707947475701.61/warc/CC-MAIN-20240301193300-20240301223300-00862.warc.gz
124,740,058
101,034
Future-Proof Your Career, Master Data Skills + AI Blog Blog # Data Segmentation Based On Percentage Groups – Advanced DAX In Power BI by | 9:00 am EDT | March 26, 2020 | Power BI I’m going to go over quite an advanced data segmentation technique in this tutorial, which is around grouping data in a dynamic way inside Power BI. You may watch the full video of this tutorial at the bottom of this blog. In this tutorial, we’re going to specifically look at just this particular visualization in this dashboard I used during a Learning Summit around customer insights. In this case, we’re grouping or segmenting customers based on percentage of sales. We utilize a secondary table or supporting table and combine it with DAX formulas to create this grouping. ## Segmenting Customers Based On Sales Percentage One group is in the top 20%, another group is between 25% to 80%, and the third group is in the bottom 25%. I’ve utilized those percentages and fed them through a DAX formula to then create these groups of Top, Mid, and Bottom. The segmentation in this case is based on sales so this is a chart showing Sales versus Margins for any particular time frame, but the segmentation has occurred via sales. We can see in this scatter chart the Top 20% of customers; they are represented by the dark blue spots. The Mid customers are sitting from a sales perspective between 25% and 80%; they are represented by the pale blue spots in the middle part of the chart. The Bottom 25% of the customers based on sales are the light blue spots at the bottom part of the chart. This is quite an advanced technique for data segmentation, where we incorporate some advanced logic inside the calculations to create these groups that just don’t exist.  In other words, there’s nothing in our raw data that exists to break out the top 20 of customers, bottom 25%, etc. So we need to create that logic using a supporting table or a secondary table, as I call them. This table doesn’t have any physical relationship with any of our tables in the data model, but it’s the key to this type of analysis. ## Utilizing A Secondary Or Supporting Table So let’s have a look at the table. You can probably create these groups in many different ways, but this is how I set it up for this demonstration. In this supporting or secondary table, we have our Groups as Top, Mid, and Bottom. We have the Low column and the High column to identify which segment each customer belongs to. This secondary table of percentages can actually be reused across many different measures. We could use sales and we could easily integrate margins or profits or costs, or any other calculation that we can do. It doesn’t even have to be sales or revenue related. We can also reuse some of the logic because percentages can be on anything. What’s important here is to create the correct logic inside the formula. So let’s dive into the formula, which I called Customer Sales TY (this year) and go through how I did the logic. ## Working Out The Variables Let’s go through the first part of the calculation first, where we work out the variables (VAR). The first variable is to identify the RankingDimension that we’re going to be working through. In this case, it’s customers. With the VALUES function, we iterate through every customer that has made a sale in any particular time frame The next variable is TotalCustomers, which is working out how many customers actually made a sale. We don’t want to count all the customers, but rather only those who made some sales. In this logic, we’re using the CALCULATE, COUNTROWS, FILTER, and the ALL functions. The third variable is CustomerRank, where we’re ranking our customers based on the sales that they’ve made. And this is the formula for Customer Rank TY. This particular formula is just doing a simple ranking, which uses the RANKX function. ## Logic For Data Segmentation Now let’s dive into the rest of the calculation. This is the logic that enables us to achieve this data segmentation analysis. The CALCULATE function iterates through each customer and evaluates through that supporting table (Customer Groups) we created with the COUNTROWS and FILTER functions. And then it evaluates whether the CustomerRank is greater than the TotalCustomers and then multiplies it by the Customer Groups Low column. So it’s asking us whether the CustomerRank is higher than the bottom. And then in the next row it highlights whether the CustomerRank is less than or equal to the TotalCustomers; it is then multiplied by the higher bin of the Customer Groups table. If it’s going to equal to true, that customer will be retained and we’ll get the total sales. ## How To Re-Use The Data Segmentation Formula This formula is a bit complex, but it’s really an interesting one. We re-use this calculation as well. For instance, if we want to look at our customers by a different metric, such as a Profit Margin, all we need to do is replace the Total Sales here with Profit Margin and change the Rank based on profit margins. Then we can utilize exactly the same supporting table to run this logic through. ## Conclusion This is a more advanced technique about data segmentation that I have demonstrated in this tutorial. We utilize the power of DAX and the data model with our supporting table. It’s amazing what we can do with the entire formula. We can change the time frame, and it will always divide up customers by those specific percentages we set up. I hope you have found great value from this tutorial and apply it to your own work. All the best! Sam ## How to Calculate Age in Excel: 5 Best Methods Explained Looking to calculate age in Excel? Well, you're in the right place. Whether you need to find the age of... ## Funny ChatGPT Prompts: 20 Hilarious ChatGPT Ideas In a world where technology continues to amaze us, we have now arrived at the point where we can have a... ## Power BI Slicer Search: User Guide With Examples Ready to get started with the Power BI slicer? This feature will allow you to filter and slice your... ## SUMPRODUCT Multiple Criteria: Explained With Examples Most Excel users think that the SUMPRODUCT function in Excel helps only to multiply the numbers in... ## Data Analytics Outsourcing: Pros and Cons Explained In today's data-driven world, businesses are constantly swimming in a sea of information, seeking the... ## How to Embed Power BI in Sharepoint: 4 Simple Steps Embedding Power BI reports in SharePoint Online is a powerful way to display interactive data... ## The Top 5 Power BI Alternatives in 2023 Power BI has established itself as a powerful business analytics platform, offering a wide range of... ## Power BI Waterfall Chart: A Detailed User Guide In the world of data visualization, charts speak louder than numbers. If you're looking for a way to... ## Power BI Import vs Direct Query: Which is Better & Why? In the world of data analysis, Power BI offers you a range of tools to connect to your data sources.... ## Power BI Certification: Everything You Need to Know In today's data-driven world, the ability to transform raw numbers into meaningful insights is more... ## Power BI Bookmarks: The Ultimate Guide When working with data, bookmarks offer a streamlined and personalized way to navigate through large... ## Power BI Default Slicer Value Explained One of the key features of Power BI is the slicer, which allows you to filter your data based on...
1,573
7,484
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.6875
3
CC-MAIN-2024-10
longest
en
0.908295
http://math.ac.vn/vi/icalrepeat.detail/2020/06/18/4026/-/-.html
1,657,157,094,000,000,000
text/html
crawl-data/CC-MAIN-2022-27/segments/1656104683020.92/warc/CC-MAIN-20220707002618-20220707032618-00119.warc.gz
33,191,029
9,313
# HOẠT ĐỘNG TRONG TUẦN Connection problems and size of graphs Báo cáo viên: Đoàn Duy Trung (ĐHBK Hà Nội)Thời gian: 9h30, Thứ 5, ngày 18/06/2020. Địa điểm: Phòng 612, nhà A6, Viện Toán học. Tóm tắt: Recently, the concepts of connection problems are introduced in graph theory. Let \$G\$ be a nontrivial connected graph on which an edge-colouring \$c:E(G)rightarrowlbrace 1,2,ldots,nrbrace, ninmathbb{N}\$, is defined, where adjacent edges may be coloured the same. A path \$P\$ in the graph \$G\$ is called emph{\$mathcal{P}\$ path} if its edges are assigned colours with \$mathcal{P}\$ property. The edge-coloured graph \$G\$ is emph{\$mathcal{P}\$ connected} if every two vertices are connected by at least one \$mathcal{P}\$ path in \$G\$. The emph{\$mathcal{P}\$ connection number} of the graph \$G\$, denoted by \$mathcal{P}(G)\$, is the smallest number of colours in order to make it \$mathcal{P}\$ connected. In our talk, we will present some results on \$mathcal{P}\$ connection number and size of graphs. ### Tin tức nổi bật 01/07/22, Hội nghị, hội thảo:Trường hè quốc tế “International Graduate Summer School 2022" 06/07/22, Hội nghị, hội thảo:Một số vấn đề trong Phương trình đạo hàm riêng và Giải tích phức 07/07/22, Hội nghị, hội thảo:WORKSHOP ON RANDOM STRUCTURES AND RELATED TOPICS 22/07/22, Bài giảng viện:Hamilton-Jacobi equations -- An introduction and some recent progress in the homogenization theory 24/07/22, Hội nghị, hội thảo:Hội thảo LÝ THUYẾT VÀNH VÀ TỔ HỢP (RING THEORY AND COMBINATORICS) 17/08/22, Hội nghị, hội thảo:International Conference on Differential Equations and Applications
480
1,616
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.734375
3
CC-MAIN-2022-27
latest
en
0.4656
https://learnetutorials.com/r-programming/programs/find-sum-mean-product-of-a-vector
1,718,289,603,000,000,000
text/html
crawl-data/CC-MAIN-2024-26/segments/1718198861451.34/warc/CC-MAIN-20240613123217-20240613153217-00866.warc.gz
324,418,787
12,111
# R Program to find Sum, Mean and Product of a Vector, ignore element like NA or NaN February 9, 2023, Learn eTutorial 1565 ## How to find the Sum, Mean, and Product of a Vector, ignore elements like NA or NaN Here we are explaining how to write an R program to find the Sum, Mean, and Product of a Vector, ignoring elements like NA or NaN. Here we are using built-in functions sum, mean, prod. The input numbers are directly passed to our functions. The function sum() returns the added value of all the values present in its arguments. The sum of the values divided by the number of values in a data series is calculated using the mean() function. Finally, the prod() is for finding the product of given arguments. ``````sum(…, na.rm = FALSE) mean(x, …) prod(…, na.rm = FALSE) ``` ``` In the above function argument structure by making na.rm = TRUE we can avoid the elements like NA, NaN. In this R program, we directly give the values to built-in functions. Consider variable A for assigning vector value and call each function by giving A as an argument. Make sure na.rm should be true like na.rm = TRUE while calling each function. Finally, print the function result. ## ALGORITHM STEP 1: Use the built-in functions STEP 2: Call `sum()` with vector and na.rm = TRUE as argument STEP 3: Call `mean()` with vector and na.rm = TRUE as argument STEP 4: Call `prod()` with vector and na.rm = TRUE as argument STEP 5: Print the result of each function ## R Source Code ``` ```A = c(30, NULL, 40, 20, NA) print("Sum is:") #ignore NA and NaN values print(sum(A, na.rm=TRUE)) print("Mean is:") print(mean(A, na.rm=TRUE)) print("Product is:") print(prod(A, na.rm=TRUE))``` ``` ## OUTPUT ```[1] "Sum is:" [1] 90 [1] "Mean is:" [1] 30 [1] "Product is:" [1] 24000``` VIEW ALL VIEW ALL
493
1,834
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.40625
3
CC-MAIN-2024-26
latest
en
0.737886
https://ischool.sg/Math?per=20
1,686,004,689,000,000,000
text/html
crawl-data/CC-MAIN-2023-23/segments/1685224652184.68/warc/CC-MAIN-20230605221713-20230606011713-00411.warc.gz
357,582,752
37,041
Level 1 Find the volume of the cuboid. 1 m Level 1 May has 3r pencils. Tom has 4 times as many pencils as May. How many pencils do they have altogether? 1 m Level 1 A copier prints 24k pieces of paper in 3 minutes. How many pieces of paper are printed by the copier in 11 minutes? 1 m Level 1 Simplify: 9 - 2n - 11 + 8n. 1 m Level 1 Simplify: 5b x 2 + 9 - 3b - 7. 1 m Level 1 PSLE John had \$4b. After buying some cloth at \$8 per metre, he had \$b left. How many metres of cloth did he buy? 1 m Level 1 Margaret bought m packets of candies. Each packet contained 40 candies. She then gave her pupils 2 candies each and had no candies left. How many pupils had candies? 1 m Level 1 Find the area of the triangle. 1 m Level 1 The side of an equilateral triangle is 24k cm long. Find its perimeter. 1 m Level 1 Find the product of 5q and 9. 1 m Level 1 PSLE Linda had \$20. After buying 3 identical markers, she has \$5z left. Express the cost of 1 marker in terms of z. 1 m Level 1 PSLE Ben sold (4 g + 3) tickets on Saturday. He sold g more tickets on Sunday than on Saturday. How many tickets did he sell altogether? Give your answer in terms of g in the simplest form. 2 m Level 2 Box X is half as heavy as Box Y. Box Z is 3 times as heavy as Boxes X and Y together. What is the mass of Box Z if Box Y is n kg? 2 m Level 1 PSLE Linda bought 4w packets of candies. Each packet contained 10 candies. After eating 2 packets of candies, how many candies had she left? Give the answer in terms of w in the simplest form. 2 m Level 1 Rynn bought 8 dresses, which cost \$t each. If she gave the cashier a \$50 note, how much change did she receive? 2 m Level 1 Lina bought 5 plates and 8 bowls. One plate is \$3b each and 1 bowl is \$2 each. How much did she pay for them? 2 m Level 1 A pencil costs \$x. A novel costs \$15 more than the pen. A file costs \$5 less than the novel. Find the total cost of the 3 items. 2 m Level 1 12 years ago, Donald was 8c years old. 1. How old was Donald 5c years ago? 2. How old will Donald be 2c years later? 2 m Level 1 Linda is k years old last year. Her brother is 3 years younger than her. What would their total age be in 7 years? time? 2 m Level 1 Ken is 11 years old. His father is x years older than him. What will be their total age in 4x years' time? 2 m
712
2,296
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.8125
4
CC-MAIN-2023-23
latest
en
0.951472
https://forum.processing.org/two/discussion/8916/discussion-main-elements-are-to-produce-something-like-this-included-code-image
1,685,300,979,000,000,000
text/html
crawl-data/CC-MAIN-2023-23/segments/1685224644506.21/warc/CC-MAIN-20230528182446-20230528212446-00691.warc.gz
307,955,375
18,408
#### Howdy, Stranger! We are about to switch to a new forum software. Until then we have removed the registration on this forum. # [discussion] main elements are to produce something like this (included code & image) edited January 2015 So this isn't my code, but I'm very interested in creating imagery like this. Note, there should be an abstraction from this exact piece to pieces of this nature, I'm sure that people on here are familiar with this type of thing as it's not uncommon. I would say that it's generally filed under 'geometrical gifs'. So the obvious things to learn would be geometry and code... I'm currently self learning code and maths, my maths isn't great. As I'm self learning I'm able to focus on certain areas and tasks more than a course though, so perhaps there are some suggestions as to how one would build towards this kind of imagery. I don't comprehend the level of math that is involved with this - it could be pretty basic or quite tricky, neither do I understand whether the weight lies in the geometry of this piece or its coding. So any suggested learning paths to this kind of thing would be interesting to hear, sorry if this seems like a daft question Here is a link to the image here is the code (and here is his twitter page ): `````` int[][] result; float t; float ease(float p) { return 3*p*p - 2*p*p*p; } float ease(float p, float g) { if (p < 0.5) return 0.5 * pow(2*p, g); else return 1 - 0.5 * pow(2*(1 - p), g); } float mn = .5*sqrt(3); void setup() { setup_(); result = new int[width*height][3]; } void draw() { if (!recording) { t = mouseX*1.0/width; draw_(); } else { for (int i=0; i<width*height; i++) for (int a=0; a<3; a++) result[i][a] = 0; for (int sa=0; sa<samplesPerFrame; sa++) { t = map(frameCount-1 + sa*shutterAngle/samplesPerFrame, 0, numFrames, 0, 1); draw_(); for (int i=0; i<pixels.length; i++) { result[i][0] += pixels[i] >> 16 & 0xff; result[i][1] += pixels[i] >> 8 & 0xff; result[i][2] += pixels[i] & 0xff; } } for (int i=0; i<pixels.length; i++) pixels[i] = 0xff << 24 | int(result[i][0]*1.0/samplesPerFrame) << 16 | int(result[i][1]*1.0/samplesPerFrame) << 8 | int(result[i][2]*1.0/samplesPerFrame); updatePixels(); saveFrame("f###.gif"); if (frameCount==numFrames) exit(); } } ////////////////////////////////////////////////////////////////////////////// int samplesPerFrame = 16; int numFrames = 120; float shutterAngle = .6; boolean recording = false; void setup_() { size(500, 500, P3D); smooth(8); rectMode(CENTER); stroke(255); strokeWeight(3); noFill(); } float x, y, z, tt; int N = 720; float r = 180; float th, ph; float ii; void draw_() { background(0); pushMatrix(); translate(width/2, height/2); rotateY(PI*.75); beginShape(); for (int i=0; i<N; i++) { ii = i-N+2*N*t; th = map(ii, 0, N, -HALF_PI, HALF_PI); z = r*sin(th); ph = 24*th + 2*TWO_PI*t; x = r*cos(th)*cos(ph); y = r*cos(th)*sin(ph); strokeWeight(map(cos(TWO_PI*i/N),1,-1,0,4)); if (0<ii & ii<N) vertex(x, y, z); } endShape(); popMatrix(); } `````` Tagged: • This type of question is a bit hard to answer, because there isn't just one single path. That's part of what makes programming so fun- you have to carve out your own style based on what makes sense to you. I suggest you start much smaller. If your end goal is to create a looping animation, can you do the simplest version of that? Get a ball bouncing back and forth. Now make it move in a circle. Now make it move in a figure eight. Work your way up by making small incremental changes. Sure, math, geometry, trigonometry, etc. are all going to come in handy for stuff like this. But even a math expert can't come in and create these types of animations- you need experience for that. And the best way to get experience is to just start with something small and work your way up. • i'd say to start with everything you need for a still image, the geometry. the animation is then either tweaking the parameters from frame to frame or, as in the above, partially drawing the object. (that said, good animation is an art. you'll notice the ease() method code in that example - that's what gives it that pleasing smoothness) (and THAT said, geometry can be pleasing on its own, even without animation. who doesn't like a good dodecahedron?) • I think koogs just proved my point, that there is no one correct way to approach the problem. I said that you should ignore the geometry and start with the animation. Koogs said you should ignore the animation and start with the geometry. Neither one of us is wrong. Neither one of us is right. But what you should do really depends on YOU, what you're familiar with, how stuff fits into your brain, etc. Nobody can tell you what will work for you. The best we can do is tell you what worked for us. • Yep to both. I know it's a hard question to answer and probably one that can't be answered in the sense of 2 + 2 = ? , which Is why I labeled it discussion. I can do some basics, shape , colour and what not. I'm working my way through the Learn Processing book at the moment, I self taught myself music production to a high standard years back so I like to think I have an appreciation for learning that would transpose to this. Can you make sense of this code? To me it's a jumble. Re what to do, I was thinking that some physics might be interesting for this type of thing as well, ho hum... Cheers though, I know there's no 'answer' here just a general post really :) • @koogs -> any simple way of explaining the ease float and why it makes things smoother? And why it would be chosen over `smooth()` thanks NOTE -> I'm not getting emails for posts in this forum, I'm not too sure why though? I've changed the settings to these (image link) • the easing is to do with the movement, not the image. things don't just start and immediately reach their final speed - they accelerate at the beginning, decelerate at the end. the easing makes it look more natural. • that code is a bit odd looking, especially the setup_ and draw_ methods, which i think are related to the saving of the animation. the draw_ method is the thing that is actually drawing the shape. you can probably take everything below the separator line, rename setup_ and draw_ and run that itself, see what it does... • yeah I tried that it wouldn't work for me though (just copying beneath the separator) • The code works perfectly, you just have to move your mouse slowly from the very left to the very right to see the entire animation. • edited January 2015 this is the entire sketch without recording, just mouse function ``````// move mouse over it float t; float x, y, z; int N = 720; float r = 180; float th, ph; float ii; // ------------------------------------------- void setup() { size(500, 500, OPENGL); // smooth(8); // rectMode(CENTER); stroke(255); strokeWeight(3); noFill(); } void draw() { background(0); t = mouseX*1.0/width; pushMatrix(); translate(width/2, height/2); rotateY(PI*.75); beginShape(); for (int i=0; i<N; i++) { ii = i-N+2*N*t; th = map(ii, 0, N, -HALF_PI, HALF_PI); z = r*sin(th); ph = 24*th + 2*TWO_PI*t; x = r*cos(th)*cos(ph); y = r*cos(th)*sin(ph); strokeWeight(map(cos(TWO_PI*i/N), 1, -1, 0, 4)); if (0<ii & ii<N) vertex(x, y, z); } // for endShape(); popMatrix(); } // draw() // ------------------------------------- `````` • this is a simple ellipse in 2D (NB, the other sketch is in 3D... it's pretty awesome actually...) but this is 2D: ``````float x, y; int N = 730; float r = 0; float a1, b1, i; // ------------------------------------------- void setup() { size(500, 500); smooth(8); // rectMode(CENTER); stroke(255); strokeWeight(1); noFill(); noLoop(); } void draw() { for (int i2=0; i2<N; i2++) { r = map (i, 0, N, 1, 1100); x = r*cos(i) + width/2; y = r*sin(i) + height/2; if (a1!=0) line (x, y, a1, b1); // point (x, y); // store these point a1=x; b1=y; i+=0.1; // } // for // } // draw() // ----------------------------------- `````` • hey Chrisir (I'm still not getting notifications :( ) yeah moving my mouse across the whole code worked, but just copying the bottom half didn't... I'm not sure how the animation was exported (he obviously didn't record a perfectly smooth take of the mouse). Though this is getting a bit outside the scope of the post, as it was more relating to knowledge foundation recommended for this manner of work. (I know that's a bit vague though!) cheers :) • edited January 2015 • edited January 2015 just copying the bottom half didn't (work) No, 2nd half alone won't, because bottom half is • setup_ and not setup and • draw() and not draw But: where I wrote this is the entire sketch without recording, just mouse function It is essentially a stripped down version of the 2nd half of the sketch. recording the recording is decided by the var recording. When you write false in the code, it reacts on mouse, write true in it and it records. It's line 63 and then line 24. draw() has 2 main parts depending on the boolean var recording: first when you don't record it's mouse input: ``````if (!recording) { t = mouseX*1.0/width; draw_(); } else { `````` here mouse is read, then draw_() in the 2nd half takes over. When recording is true, the 2nd half of draw() [without the underscore _ ] kicks in. ``````} else { for (int i=0; i<width*height; i++) `````` It also calls draw_() with underscore _ but instead of reading mouse, the t-value (which stand in maths and physics for time and is just the time that has run from the beginning of an experiment or interval like here) is derived from for-loop with the var sa. he obviously didn't record a perfectly smooth take of the mouse As I said, he is not recording the mouse in the 1st place; he is replacing the mouse-X value by getting t from for-loop sa (see line 32 and 33). To make it more smooth you probably you have to increase how many frames he is using for the movie, making it very big.... So he decided to make the movie smaller (and less smooth) with these consts: ``````int samplesPerFrame = 16; int numFrames = 120; float shutterAngle = .6; `````` So draw_() with underscore _ is the core of the program and of the graphic. ;-) • edited January 2015 Answer ✓ just change values like for N or for r to find out what they do. Or enter a fixed value (line 39) instead of using the mouse ``````// enter value OR move mouse over it float t; // this is time or just how many steps since start. // in our case it is calculated from the mouse-X position. // we can also calculated it from a fixed number like 300. // see line 38 / 39. float x, y, z; // coords in space: x and y and z. Represents our result we show with vertex. Line 57. int N = 720; // 720 makes the circle soft, 42 circle is with hard edges float r = 180; // maximal radius; 180 is good, 80 is pretty small. float th, ph; // two angles: theta and phi. They are often used for angles in a circle. http: //en.wikipedia.org/wiki/Theta#Lower_case // all angles are in radians. There are 360 degrees in a circle and 2*PI radians in a circle. float ii; // we use this ii as a 2nd i // ------------------------------------------- void setup() { size(500, 500, OPENGL); // 3D space // smooth(8); rectMode(CENTER); stroke(255); strokeWeight(3); // quite thick stroke noFill(); } void draw() { background(0); // clear canvas // t is derived from how far we are from left border (it goes from 0 (for 0) to 1 (for width)) // t = mouseX*1.0/width; t = 300 * 1.0/width; println (t); // pushMatrix(); translate(width/2, height/2); // move all to the middle, so we can work around 0 later // rotateY(PI*.75); // rotate it, we want to see it from the side rotateY(frameCount*.01); // rotate it, we want to see it from all the sides beginShape(); for (int i=0; i<N; i++) { // loop: how many steps per image - for N see above ii = i-N+2*N*t; // we derive a ii from N,i and t th = map(ii, 0, N, -HALF_PI, HALF_PI); // we get theta, for map see reference z = r*sin(th); // we get a Z value ph = 24*th + 2*TWO_PI*t; // and phi x = r*cos(th)*cos(ph); // now x y = r*cos(th)*sin(ph); // and y strokeWeight(map(cos(TWO_PI*i/N), 1, -1, 0, 4)); if (0<ii & ii<N) vertex(x, y, z); } // for endShape(); // popMatrix(); } // draw() // ---------------------------------- `````` • oh right, I changed the settings and it said about email notifications and what not. Is there a 'message the moderator' section or is that just how it is..? Nice one for the above - It's a bit much for me at the moment I think... I need to do some trigonometry ! • yes, I don't understand the math either.
3,467
12,625
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.234375
3
CC-MAIN-2023-23
latest
en
0.883483
https://www.coursehero.com/file/6729390/image-manipulation-1/
1,513,592,006,000,000,000
text/html
crawl-data/CC-MAIN-2017-51/segments/1512948612570.86/warc/CC-MAIN-20171218083356-20171218105356-00476.warc.gz
715,540,878
304,591
image_manipulation-1 # image_manipulation-1 - Image Manipulation Institute for... This preview shows pages 1–9. Sign up to view the full content. CS 1 with Robots Image Manipulation Institute for Personal Robots in Education (IPRE) This preview has intentionally blurred sections. Sign up to view the full version. View Full Document Aug 29 2007 2 Taking / Saving / Loading a Picture p = takePicture() show(p) savePicture(p, “class.gif”) p2 = loadPicture(“class.gif”) print getWidth(p) print getHeight(p) 256 192 Aug 29 2007 3 Robot Pictures Robot pictures are: 256 pixels wide by 192 pixels high Each pixel is made up of 3 colors: Red, Green, and Blue Colors range in value from 0 – 255 Plus an “Alpha” value we won't use (for now). When you print a picture or a pixel, Python gives you some textual information about the item, but does not give a visual representation. The show(picture) method will display the picture on the screen. This preview has intentionally blurred sections. Sign up to view the full version. View Full Document Aug 29 2007 4 Colors (R,G,B) Different colors can be made by mixing different values of the primary (Red,Green,Blue) color lights. In computer output, colors are made by adding lights of different colors, and color combinations are additive. For example: (0, 0, 0) – Black (255, 255, 255) – White White (255, 0, 0) – Red (255, 255,0) – Yellow (255, 0, 255) – Magenta / fuchsia (bright purple) (0, 255, 255) – Cyan (bright teal) Aug 29 2007 5 Accessing a specific pixel: getPixel(picture, x,y) print p pix = getPixel(p, 50,50) print pix setRed(pix,0) setGreen(pix,0) setBlue(pix,0) print pix show(p) <Pixel instance (r=153, g=255, b=255, a=255) at (50, 50)> <Pixel instance (r=0, g=0, b=0, a=255) at (50, 50)> <Picture instance (256 x 192)> This preview has intentionally blurred sections. Sign up to view the full version. View Full Document Aug 29 2007 6 Zoomed In View: One Black Pixel Aug 29 2007 7 Looping through all pixels: getPixels( picture ) print p for pix in getPixels(p): setRed(pix,0) setBlue(pix,255) setGreen(pix,255) show(p) This preview has intentionally blurred sections. Sign up to view the full version. View Full Document Aug 29 2007 8 Looping through all pixels: getPixels( picture ) p = loadPicture(“class.gif”) for pix in getPixels(p): setRed(pix,255) But what if you only change the red part of the pixels? This is the end of the preview. Sign up to access the rest of the document. {[ snackBarMessage ]} ### Page1 / 29 image_manipulation-1 - Image Manipulation Institute for... This preview shows document pages 1 - 9. Sign up to view the full document. View Full Document Ask a homework question - tutors are online
755
2,697
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.75
3
CC-MAIN-2017-51
latest
en
0.735475
http://apmonitor.com/me575/index.php/Main/EquationResiduals?action=diff
1,553,544,493,000,000,000
text/html
crawl-data/CC-MAIN-2019-13/segments/1552912204300.90/warc/CC-MAIN-20190325194225-20190325220225-00114.warc.gz
13,495,505
6,278
Main ## Main.EquationResiduals History January 14, 2013, at 07:01 PM by 128.187.97.21 - Changed line 36 from: !!!! Exercise 3 Results to: !!!! Exercise Results for the Two Bar Truss January 14, 2013, at 06:54 PM by 128.187.97.21 - !!!! Exercise 3 Results January 14, 2013, at 06:54 PM by 128.187.97.21 - Deleted lines 10-14: * [[https://apmonitor.com/online/view_pass.php?f=twobar_v1.apm | Solve Initial Version]] * [[https://apmonitor.com/online/view_pass.php?f=twobar_v2.apm | Solve with SQRT removed]] * [[https://apmonitor.com/online/view_pass.php?f=twobar_v3.apm | Solve with added constraints and no SQRT]] * [[https://apmonitor.com/online/view_pass.php?f=twobar_v4.apm | Solve with added constraints and explicit definition of some variables]] !!!! Tips for Improved Convergence ---- The following models are taken from the homework assignment on the [[Main/TwoBarTruss | Two Bar Truss problem]]. The initial version is most similar to how the problem would be posed in a textbook. Removing the SQRT and adding constraints to the variables shows improvements in model convergence. Explicit definition of some of the variables adds additional improvements. * [[https://apmonitor.com/online/view_pass.php?f=twobar_v1.apm | Solve Initial Version]] * [[https://apmonitor.com/online/view_pass.php?f=twobar_v2.apm | Solve with SQRT removed]] * [[https://apmonitor.com/online/view_pass.php?f=twobar_v3.apm | Solve with added constraints and no SQRT]] * [[https://apmonitor.com/online/view_pass.php?f=twobar_v4.apm | Solve with added constraints and explicit definition of some variables]] January 14, 2013, at 06:51 PM by 128.187.97.21 - ---- January 14, 2013, at 06:50 PM by 128.187.97.21 - (:title Best Practices for Open-Equation Modeling:) (:keywords mathematical modeling, nonlinear, optimization, engineering optimization, interior point, active set, differential, algebraic, modeling language, university course:) (:description Mathematical modeling is necessary to apply optimization techniques in engineering. Improved structure of the models leads to faster and more robust convergence.:) !!!! Modeling Exercise Modeling often constitutes most of the effort on an optimization project. There is some art in the way a programmer poses the model in a way that allows solvers to efficiently find a solution. Below are some tips and an exercise on ways to rearrange the model equations for improved convergence. [[Attach:twobar_rearrangement.pdf | Worksheet with Modeling Exercises]] * [[https://apmonitor.com/online/view_pass.php?f=twobar_v1.apm | Solve Initial Version]] * [[https://apmonitor.com/online/view_pass.php?f=twobar_v2.apm | Solve with SQRT removed]] * [[https://apmonitor.com/online/view_pass.php?f=twobar_v3.apm | Solve with added constraints and no SQRT]] * [[https://apmonitor.com/online/view_pass.php?f=twobar_v4.apm | Solve with added constraints and explicit definition of some variables]] # Rearrange to equation in residual form to: ## Avoid divide by zero ## Minimize use of functions like sqrt, log, exp, etc. ## Have continuous first and second derivatives ## Fit the equation into a linear or quadratic form # Bounds ## Include variable bounds to exclude infeasible solutions ## Variable bounds to avoid regions of strong nonlinearity ## Caution: watch for infeasible solutions # Scaling: ## Scale absolute value of variables to 1e-3 to 1e3 ## Scale absolute value of equation residuals to 1e-3 to 1e3 ## Better that 1st derivative values are closer to 1.0 # Good initial conditions: ## Starting near a solution can improve convergence ## Try multiple initial conditions to verify global solution (non-convex problems) ## Explicitly calculate intermediate values # Check iteration summary for improved convergence ---- (:html:) <script type="text/javascript"> /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ var disqus_shortname = 'apmonitor'; // required: replace example with your forum shortname /* * * DON'T EDIT BELOW THIS LINE * * */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
1,029
4,188
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.328125
3
CC-MAIN-2019-13
latest
en
0.881845
https://www.designnews.com/motion-control/converting-a-fortran-program-to-mathcad
1,716,118,243,000,000,000
text/html
crawl-data/CC-MAIN-2024-22/segments/1715971057786.92/warc/CC-MAIN-20240519101339-20240519131339-00619.warc.gz
654,768,742
88,744
# Converting a Fortran Program to Mathcad DN Staff June 6, 2005 Fortran has been so successful at helping engineers to approximate equations that for many it has become a key part of the engineering process. But with many of the engineers who coded in Fortran now retiring, it leaves a lot of legacy bits unsupported out there. All the more a problem since Fortran and Microsoft products don't naturally go together. "Many of these legacy programs are rapidly turning into black boxes and that's a worry for many engineering departments," says John Sheehan, VP of services at Mathsoft, makers of Mathcad, a software tool for math calculations. It was actually at the request of several customers who were worried about the growing black-box nature of their Fortran programs that Sheehan looked into how Mathcad-an interpretive math engine with natural math notation-could help. Mathcad is also a strong collaborative work tool-which makes it easy for engineers to publish and share information. Although engineers can enter an exact system of equations into Mathcad, Sheehan discovered that some engineers want to replicate exactly the results they were getting in Fortran-possibly they need the margin of error for backward compatibility. He then demonstrated a better approach-taking the original partial differential equations (which the Fortran code was trying to approximate) and typing them directly in Mathcad. Fortran to Mathcad: A Conversion Plan This is the system of equations that John set up to solve... ut(x,t) - uxx(x,t) = 0 u(x,0) = f(x) u(0,t) = p(t) u(1,t) = q(t) u:= Pdesolve [ u,x (0 1), t, (0 0.5)] solve for u (x,t) over the range x = 0 to 1 and t = 0 to 0.5 x:=0,0.01 .. 1 t:= 0.5 ...then he compared the results he generated using Mathcad (by using the column operator) to results from the FORTRAN program... ...and then showed that you can obtain the exact solution using Mathcad's built-in Pdesolve function. For John's complete instructions for converting a Fortran program with several do laps into an equivalent Mathcad program using Mathcad's while loop, go to: http://rbi.ims.ca/4392-553. Got a cool software trick? Send us details, including any documentation and supporting code, to [email protected]. If we publish your trick, we'll send you a super cool, limited-edition Design News t-shirt.
549
2,343
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.015625
3
CC-MAIN-2024-22
latest
en
0.963576
https://www.wyzant.com/resources/answers/15317/find_the_domain_and_range
1,526,985,072,000,000,000
text/html
crawl-data/CC-MAIN-2018-22/segments/1526794864657.58/warc/CC-MAIN-20180522092655-20180522112655-00618.warc.gz
880,160,607
16,534
0 # find the domain and range suppose that f(x) = √(x2 -72)  and g(x)= √(7-x) for each function (h) below, find a formula for h (x) and the domain of h ( use internal notation) a) h(x) = f composed with g of (x) b) h(x) = g composed with f of (x) c) h(x)= f composed with f of (x) d) h(x)= g composed with g of (x) ### 1 Answer by Expert Tutors Michael F. | Mathematics TutorMathematics Tutor 4.7 4.7 (7 lesson ratings) (7) 0 For f(x)=√(x²-7²) and g(x)= √(7-x) a)  h(x)=f(g(x))=√(g²(x)-7²)=√(7-x-7²)=√(7-x-49)=√(-x-42) The domain are those x-values where -x-42≥0 or where x+42≥0 or where x≥-42 For these values h(x)=√(-x-42) takes values in the range [0,∞), or all positive values. b)  h(x)=g(f(x))=√(7-f(x))=√(7-√(x²-7²))=√(7-√(x²-49)) In order to determine the domain we must be able to take square roots so 1.  x²-49 must be ≥0 or x²≥49 or either x≤-7 or x≥7 an in addition √(x²-49) must be ≤7 since we need √(7-√(x²-49)). √(x²-49)≤7 means that  x²-49≤49 or that x²≤98 or that x≤√98=√(2×49)=7√2 or x≥-7√2 Combining the requirements the domain is the two intervals   -7√2≤x≤-7  or 7≤x≤7√2 The range of h(x) is h(7) to h(7√2) or from 0 to √7.  The function has the same range when the negative boundaries of the domain are used. c) f(f(x))=√(f²(x)-49)=√(x²-49-49)=√(x²-98).  The domain are those values where x²-98≥0 or where x²≥98 or where x≥√98 or where x≤-√98, That is the two infinite intervals x≤-7√2 and x≥7√2 The range of the function is all the positive numbers. d) g(g(x))=√(7-g(x))=√(7-√(7-x)).  In order to evaluate the square roots we need to have x≤7 for √(7-x) and 7≥√(7-x) for the final square root.  This last means that 49≥7-x or that x≥-42.  The domain is -42≤x≤7.  The range is from 0 to √7
700
1,718
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
4.21875
4
CC-MAIN-2018-22
latest
en
0.712275
http://stackoverflow.com/questions/3099275/how-do-i-convert-a-int-to-an-array-of-bytes-and-then-back
1,406,246,285,000,000,000
text/html
crawl-data/CC-MAIN-2014-23/segments/1405997892641.2/warc/CC-MAIN-20140722025812-00031-ip-10-33-131-23.ec2.internal.warc.gz
237,062,398
19,125
How do I convert a int to an array of byte's and then back? I need to send an integer through a NetworkStream. The problem is that I only can send bytes. Thats why I need to split the integer in four byte's and send those and at the other end convert it back to a int. For now I need this only in C#. But for the final project I will need to convert the four bytes to an int in Lua. - How about asking a separate (but related) question for the Lua side so that those answers are clearly independent of the C# answers... –  RBerteig Jun 24 '10 at 0:23 Try BitConverter.GetBytes() http://msdn.microsoft.com/en-us/library/system.bitconverter.aspx Just keep in mind that the order of the bytes in returned array depends on the endianness of your system. EDIT: As for the Lua part, I don't know how to convert back. You could always multiply by 16 to get the same functionality of a bitwise shift by 4. It's not pretty and I would imagine there is some library or something that implements it. Again, the order to add the bytes in depends on the endianness, so you might want to read up on that Maybe you can convert back in C#? - BitConverter is the easiest way, but if you want to control the order of the bytes you can do bit shifting yourself. ``````int foo = int.MaxValue; byte lolo = (byte)(foo & 0xff); byte hilo = (byte)((foo >> 8) & 0xff); byte lohi = (byte)((foo >> 16) & 0xff); byte hihi = (byte)(foo >> 24); `````` Also.. the implementation of BitConverter uses unsafe and pointers, but it's short and simple. ``````public static unsafe byte[] GetBytes(int value) { byte[] buffer = new byte[4]; fixed (byte* numRef = buffer) { *((int*) numRef) = value; } return buffer; } `````` - For Lua, check out Roberto's struct library. (Roberto is one of the authors of Lua.) It is more general than needed for the specific case in question, but it isn't unlikely that the need to interchange an `int` is shortly followed by the need to interchange other simple types or larger structures. Assuming native byte order is acceptable at both ends (which is likely a bad assumption, incidentally) then you can convert a number to a 4-byte integer with: ``````buffer = struct.pack("l", value) `````` and back again with: value = struct.unpack("l", buffer) In both cases, `buffer` is a Lua string containing the bytes. If you need to access the individual byte values from Lua, `string.byte` is your friend. To specify the byte order of the packed data, change the format from `"l"` to `"<l"` for little-endian or `">l"` for big-endian. The `struct` module is implemented in C, and must be compiled to a DLL or equivalent for your platform before it can be used by Lua. That said, it is included in the Lua for Windows batteries-included installation package that is a popular way to install Lua on Windows systems. - - Convert an int to a byte array and display : BitConverter ... www.java2s.com/Tutorial/CSharp/0280__Development/Convertaninttoabytearrayanddisplay.htm Integer to Byte - Visual Basic .NET answers How to: Convert a byte Array to an int (C# Programming Guide) http://msdn.microsoft.com/en-us/library/bb384066.aspx - As Nubsis says, `BitConverter` is appropriate but has no guaranteed endianness. I have an `EndianBitConverter` class in MiscUtil which allows you to specify the endianness. Of course, if you only want to do this for a single data type (`int`) you could just write the code by hand. `BinaryWriter` is another option, and this does guarantee little endianness. (Again, MiscUtil has an `EndianBinaryWriter` if you want other options.) - To convert to a byte[]: BitConverter.GetBytes(int) http://msdn.microsoft.com/en-us/library/system.bitconverter.aspx To convert back to an int: BitConverter.ToInt32(byteArray, offset) http://msdn.microsoft.com/en-us/library/system.bitconverter.toint32.aspx I'm not sure about Lua though. If you are concerned about endianness use John Skeet's EndianBitConverter. I've used it and it works seamlessly. C# supports their own implementation of htons and ntohs as: But they only work on signed int16, int32, int64 which means you'll probably end up doing a lot of unnecessary casting to make them work, and if you're using the highest order bit for anything other than signing the integer, you're screwed. Been there, done that. ::tsk:: ::tsk:: Microsoft for not providing better endianness conversion support in .NET. - Here are some functions in Lua for converting a 32-bit two's complement number into bytes and converting four bytes into a 32-bit two's complement number. A lot more checking could/should be done to verify that the incoming parameters are valid. ``````-- convert a 32-bit two's complement integer into a four bytes (network order) function int_to_bytes(n) if n > 2147483647 then error(n.." is too large",2) end if n < -2147483648 then error(n.." is too small",2) end n = (n < 0) and (4294967296 + n) or n return (math.modf(n/16777216))%256, (math.modf(n/65536))%256, (math.modf(n/256))%256, n%256 end -- convert bytes (network order) to a 32-bit two's complement integer function bytes_to_int(b1, b2, b3, b4) if not b4 then error("need four bytes to convert to int",2) end local n = b1*16777216 + b2*65536 + b3*256 + b4 n = (n > 2147483647) and (n - 4294967296) or n return n end print(int_to_bytes(256)) --> 0 0 1 0 print(int_to_bytes(-10)) --> 255 255 255 246 print(bytes_to_int(255,255,255,246)) --> -10 `````` - this one is good one, though personally I never followed lua-style (... and ...) or assignments. Using just if in this very case is fine for me. –  shabunc Jan 7 '12 at 16:20
1,448
5,612
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.71875
3
CC-MAIN-2014-23
latest
en
0.87463
https://es.mathworks.com/matlabcentral/cody/problems/44950-calculate-inner-product/solutions/2179131
1,590,598,149,000,000,000
text/html
crawl-data/CC-MAIN-2020-24/segments/1590347394756.31/warc/CC-MAIN-20200527141855-20200527171855-00420.warc.gz
338,616,883
15,784
Cody # Problem 44950. Calculate Inner Product Solution 2179131 Submitted on 28 Mar 2020 This solution is locked. To view this solution, you need to provide a solution of the same size or smaller. ### Test Suite Test Status Code Input and Output 1   Fail x = [1 2]; y = [2;3]; z_correct = 8; assert(isequal(in_prod(x,y),z_correct)) z = "the inner dimesions are x and y. matrix multiplication is not possible" Assertion failed. 2   Fail x = -5; y = 100; z_correct = -500; assert(isequal(in_prod(x,y),z_correct)) Error using * Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'. Error in in_prod (line 5) z=x*y; Error in Test2 (line 4) assert(isequal(in_prod(x,y),z_correct)) 3   Pass x = [1 2 3]; y = [2;3]; assert(isStringScalar(in_prod(x,y))) z = "the inner dimesions are x and y. matrix multiplication is not possible"
274
977
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.6875
3
CC-MAIN-2020-24
latest
en
0.70081
https://www.polytechforum.com/air/brushless-glow-equivalency-42065-.htm
1,590,690,648,000,000,000
text/html
crawl-data/CC-MAIN-2020-24/segments/1590347399830.24/warc/CC-MAIN-20200528170840-20200528200840-00513.warc.gz
893,617,994
26,396
# Brushless-glow equivalency How can you determine if an electric for direct drive should be roughly equal to a .40 two stroke. Then how do you match-up an ESC and lipos. Apparently money is the answer but how do you spend it well. <% if( /^image/.test(type) ){ %> <% } %> <%-name%> agpete wrote: One way that works well is to get Moto-Calc, assuming they've stayed current. It'll tell you motor, prop & battery. You should plan on about 50 watts per pound for zippy performance, more (75?) for 3D and less (35 or so) for a lightly loaded trainer. Smaller airplanes can go less, and really light slow flyers can go even less than that. Few manufacturers will tell you watts out but you can get close by looking at current draw times supply voltage. Once you know the supply voltage and expected current draw select an ESC that will handle both of those. It's probably a good idea to get one that will handle plenty of extra current for when you land in that tree and forget to cut power. Size your battery for two things: current draw and capacity. It used to be that LiPos would always give you long flights because you just couldn't draw to much current. Now they've got ones advertised for 15C, which would be about 4 minutes of flying at full throttle -- I'd go for a battery sized for 5C (i.e. amp-hours current * 5) to get reasonably long flights. Or call your favorite web store and ask them -- hobby-lobby is recommending e-flight sets for glow conversions. -- Tim Wescott Wescott Design Services <% if( /^image/.test(type) ){ %> <% } %> <%-name%> Go to some of the retail motor sites and look at the performance specs of the motors. Most will tell you what props they will turn at what voltage. The AXI range is pretty extensive. I bought an AZI 2820/10 for my first real foray into electrics. It is probably equivalent to a .25-.32 glow. This motor needs a 30A controller and 2200mAh Lipos at 15C for minimum performance. I will be using 1500s in a 3S2P configuration at first. -- Paul McIntosh RC-Bearings.com <% if( /^image/.test(type) ){ %> <% } %> <%-name%> That should have read that the battery was the minimum for full performance of the AXI motor. -- Paul McIntosh RC-Bearings.com <% if( /^image/.test(type) ){ %> <% } %> <%-name%> Goedendag ;-) Lots of motor numbers/test: http://www.flyingmodels.org/motortest/index_e.htm E-flight calculator: Usage and : http://www.badcock.net/motorcalc / Example: http://goldeneye.ethz.ch/motoren/electric/e_highlight/index_EN Lots of E info: www.eflight101.com/ Vriendelijke groeten ;-) Ron van Sommeren http://home.hetnet.nl/~ronvans/ int E fly-in near Nijmegen, the Netherlands <% if( /^image/.test(type) ){ %> <% } %> <%-name%> You can compare them on the basis of power output. A low-end .40 (e.g. OS 40LA) puts out about 0.7 bhp with a practical prop, a decent ball-bearing sport 40 about 0.9 - 1.0 bhp at practical rpm - not 16K or so where the ad writers like to rate them. The conversion is 1 bhpt6watts. A motor in the 500-600 watt range should give comparable performance, likely better as it gives you more flexibility to choose the most efficient prop/rpm for the job. A 12 cell (nom. 12V under peak load) pack at 50A should do nicely. I like batteries that are multiples of 6 cells, as you can use relatively cheap R/C car packs and put them in series. A 3000 mah pack is only good for about 3 1/2 minutes at that current, so throttle management is key to reasonable duration. Of course a 3 (or more) cell LiPo could be used instead, but for a 40-50 A load, it'll cost you a bundle and have you spending a lot more time on battery care and feeding, too. Abel <% if( /^image/.test(type) ){ %> <% } %> <%-name%> First, you completely forget the notion that glow engine = electric motor. That, and, "I'm not a newbie," are the two biggest hangups glow fliers have when converting to electric for the first time. Just throw away everything you think you know about electrics, and come at it as if you're a complete newbie. Tuck the information you have about glow engines away, because it's useless on an electric conversion. You need to approach it from the plane, not the engine. A .40-size airplane weighs around 6 pounds typically. For glow-like performance with electric, the plane needs 100 Watts of power for every pound of final, ready-to-fly weight. Figuring a 6lb airplane, you need 600 Watts. Watts come from the battery, not the motor, so next you size the battery. I can hear you saying, "But...??" But nothing. Just forget about the motor for now. Forget it. "But..." Forget about the motor, okay? We'll get to it. Trust me. Okay, you've got 600 Watts, so how to turn that into a battery... Well, a battery provides Volts and Amps, and Watts is Volts times Amps, so we simply break the 600 Watts into a reasonable combination of Volts and Amps. This is a bit of a leap of faith for most people, but from experience, 40 Amps is a good target current for a .40-size airplane. So, 600 Watts divided by 40 Amps is 15 Volts. That just happens to be the working voltage of a 4S LiPoly pack, or 14 NiMH cells. Can you tell me what size ESC you need now? Yep, one that does at least 40 Amps, and is rated to handle at least 14 NiMH cells or a 4S LiPoly. Ba-da-bing, ba-da-boom. You've got enough information to pick a motor now too. Motors are rated by # of cells, and maximum Amps. As long as you pick a motor that can handle 14 NiMH cells (or a 4S LiPoly), at 40 Amps, you're golden. The motor can be geared as necessary to turn the right size prop, but if you're looking strictly at direct drive, look at AXi motors. They have extensive application tables that tell you what size prop, how many cells, how many Amps. <% if( /^image/.test(type) ){ %> <% } %> <%-name%> Essentially true, but you really don't need 100W per pound with an efficient brushless. Those figures were more true for brushed motors. I converted my 4 Star .40 from an OS .52 4 stroke to AXI brushless. I'm only pulling 300W and it is almost as fast as it was with the OS. Probably 75W per pound is more realistic. Of course if you want unlimited vertical or 3D, more id better ;) PCPhill <% if( /^image/.test(type) ){ %> <% } %> <%-name%> I must disagree. I built a Great Planes Tracer kit as an electric. I had two Tracers with OS 46FX's powering them. I ran a 6s3p arrangement on the old 1500 mAH packs, rated at 7.5C and an AXI 4120 (I think) that pulled about 30A. It weighed almost exactly 6 lb, and ran at very close to 610 W into the motor. I got close to 100 flights on it. Although it was as fast as the .40 size versions, it lacked just a little of making unlimited vertical, which the glow powered planes had. It was a dandy plane. Unfortunately, the pilot made a dumb mistake. I really think you need 100W/lb to get glow performance. 120 would be better. -- Mike Norton <% if( /^image/.test(type) ){ %> <% } %> <%-name%> Mike Norton wrote: That is true, if that is what you want...in fact a racing 36 in a 'mad' airframe you need getting on for 300W/lb..almost impossible even with latest electric technology.. Remember that airframes designed for glo have been optimised to glo sort of power delivery: you can build a fra lighter airframe that will exceed teh glo performance on less power with electric...but its a bigger deal than 'conversion' <% if( /^image/.test(type) ){ %> <% } %> <%-name%> | I really think you need 100W/lb to get glow performance. Ultimately, `glow performance' is a mighty broad brush. `Glow performance' varies widely, and so will the watts/lb needed to approximate it. A pylon racer or 3D plane will need a lot more watts/lb than a slow flying glider, even though both may have previously had `glow performance'. As for brushless motors, at this stage in the game, if your plane uses more than say 200 watts or so, you really should have a brushless motor, especially if you're using LiPos. Sure, a brushed motor may be cheaper, but the added efficiency of a good brushless motor means you can save money on your batteries, more money than the additional cost of the better motor. -- Doug McLaren, snipped-for-privacy@frenzy.com In a real emergency, we would have all fled in terror, and you would <% if( /^image/.test(type) ){ %> <% } %> <%-name%> Doug McLaren wrote: Sure, a brushed motor may be That statement is, doing the maths, false, for most smaller sizes of motor. To get - say - 100W out of a 60% efficient can, takes 160W To get the same out of a 85% efficient brushless, takes 117W. The difference in cost between the (say) speed 480, at \$10 with a \$20 speed controller is and a \$50 Mega 16/15 brushless and \$50 speed controller is about \$70. The TOTAL cost of a 3s2200 LIPO pack to power teh brushed motor is not \$70...the difference between a 1600 and 2200 pack to 'make up for the brushed inefficiency' is almost negligible. The only downside on the brushed setup is increased motor weight. That is an issue ONLY with ultra high performance models. Otherwise given the battery weights with LIPOS, its almost a non issue. <% if( /^image/.test(type) ){ %> <% } %> <%-name%> | Doug McLaren wrote: | Sure, a brushed motor may be | > cheaper, but the added efficiency of a good brushless motor means you | > can save money on your batteries, more money than the additional cost | > of the better motor. | > | That statement is, doing the maths, false, for most smaller sizes of motor. You didn't read the post you're responding to very carefully. I qualified my statement before the part that you quoted -- As for brushless motors, at this stage in the game, if your plane uses more than say 200 watts or so, you really should have a brushless motor, especially if you're using LiPos. If you're going to correct me, at least try and read my post carefully enough to make sure I'm wrong first. | To get - say - 100W out of a 60% efficient can, takes 160W | To get the same out of a 85% efficient brushless, takes 117W. Which part of 160 watts is higher than 200 watts? In any event, perhaps 300 watts would be a more definitive cutoff, but I still stand by my statement -- the larger your setup, the more you want brushless, even if it's just for economic reasons. I was really aiming at setups where a speed 400 or speed 480 motor wasn't adequate anymore. Your basic speed 480 can motor might be able to handle 200 watts, but it won't last long at that power level. And once you start getting into the larger brushed motors (larger than a 480) the price differences between them and the equivilent brushless become smaller and smaller. | The difference in cost between the (say) speed 480, at \$10 with a \$20 | speed controller is and a \$50 Mega 16/15 brushless and \$50 speed | controller is about \$70. My main point was economics, so don't forget that if you are pumping 170 watts into it, that speed 480 motor won't last long, so let's count a few of them (because the brushless motor will last much longer.) Now, you could get a higher quality speed 480 motor, with rare earth magnets and such, and you may even be able to replace the brushes seperately, and the efficiency will improve, but it'll cost almost as much as a brushless motor ... | The TOTAL cost of a 3s2200 LIPO pack to power teh brushed motor is | not \$70 ... ... except that you're forgetting at least two factors : 1) if you put in a bigger pack, it'll weigh more. So you'll need even more power, which will require an even bigger pack for the same peformance. I'm talking about performance in a plane, not on the test bench. 2) most people have more than one pack for a plane. Three sounds more reasonable. So triple the difference ... (Though to be fair, the brushless cost benefits will go down if you have several planes that all use the same battery packs.) | the difference between a 1600 and 2200 pack to 'make up for the | brushed inefficiency' is almost negligible. 3 cell 1500 mAh LiPo pack at CBP = \$52. 3 cell 2100 mAh LiPo pack at CBP = \$79 Triple that difference and you get \$81, which is *more* than the added money that you spent on the brushless setup. And this is a case where we're looking at power levels *lower* than the break-even point I'd proposed, and I'm ignoring any additional capacity needed due to the additional weight (perhaps I should be looking at the three cell 2500 mAh pack for \$100 instead?). | The only downside on the brushed setup is increased motor | weight. That is an issue ONLY with ultra high performance | models. Well, it's a small issue, but it's not a non-issue. All that weight adds up. Also, comparing that Mega 16/15 brushless to a speed 480 is hardly fair -- the Mega can put out a lot more power. Comparing it to a speed 500 or maybe 600 motor would be more reasonable -- and that bigger motor will weigh a whole lot more. -- Doug McLaren, snipped-for-privacy@frenzy.com That which does not kill me can still really hurt. <% if( /^image/.test(type) ){ %> <% } %> <%-name%> Actually, from what I have seen, the price difference grows quite a bit. A speed geared 600 can motor is about \$35.00. Equivalent brushless is \$80 or more. Go any larger and the difference grows (except you won't find many can motors larger than 700 size). -- Paul McIntosh RC-Bearings.com <% if( /^image/.test(type) ){ %> <% } %> <%-name%> Paul McIntosh wrote: De Walts...sort of 'speed 800'. \$50 for a '40 sized' can motor. Or use two in a belt drive and get a '90 sized' electric motor for \$200 :-) http://www.modelairtech.com/belt.html If I ever go 'quarter scale' electric, that's what I'd use... Mind you a 6s 5000 mA/h pack to drive it is going to be nigh on \$400.. Other than that motor combo, its astro Cobalts that cost as much as, if not more than, a brushless..but they are as good as, or better than..a brushless! I have no doubt that a suitable motorcycle starter motor capable of delivering a couple of brake horsepower would also be not THAT expensive....in the same way that weed whacker motos are turned into cheap IC power plants for larger models. <% if( /^image/.test(type) ){ %> <% } %> <%-name%> Doug McLaren wrote: That is only true when cheap brushed motors cease to become available. You can get 200W out od a \$15 soeed 600, 300W out of a buggy motor, and there are varous dewalt type motors that will do 600W or more. Beyond that point you run into the problem that any motor you buy is custome built for the RC market and brushed or brushless makes almost no difference to cost or performance. The speed controllers for brushed arer cheaper though, and efficiencies on a decent neodymium brushed or brushless of say 600W capability are very similar, as is the price. Abovce 400 W yes..but so do the advantages of the brushless get smaller and smaller.. Oh , it will last OK if you are careful with it...the secret is to get te voltage right..:-) Indeed. Slightly more, but the ESC is cheaper.. 10% more on a LIPO pack weight is almost irrelevant. Unless you are going for utter contest power, the pack weight will be around 25% or less of the model weight..10% of 25% is hardly earth shattering in rterms of performance decrease. Only when they are running Nickel technology that flies for 3 minutes and takes an houir to charge. I have ione pack for three planes. It lastys most of te afternoon, and then I charge it while flying another pack in another three planes :-) I fly at about 2:1 charge to fly time ratios. Charging 20 minutes for ten minutes of flight is not onerous..although it is really an hours charge the evening before for 3 x 10 minute flights before I even get OUT the charger.. Indeed, but so what? That is my point...a permax 600 - a decent 200W plus motor, weighs 6.7oz...a mega 16/15 weighs 2.70z..also capable of 200W or better (but a buggy motor will also fior similar weight to the can 600 do what a mega 16/15 will) anyway both are about '.19' power. They are both goiung to draw similar currents - the mega a little less. I have a pack that weighs 4.8oz (2200mAh) that will drive either well. So the advantages of 'going brushless' are 4 oz weight saving in a power train that weighs 11.5 oz and is likley to be powering 2-4lb of plane. so its an 8% weight increase to use the can motor, and save about \$80. If you take the brushless and nickel cells, to get similar run times you woopuld beneed 10x3300 cells - weight 20oz, so AUW is 22.7oz for NiMh cells against 11.5oz...a whoppping 11 oz heavierr for an exopesnive brushless motor that WILL need tio be that heavy, or else you WILL need 3 opacks of lighter weight simply because one pack WILL go flat on you in under ten minutes.. In short, what motor you use is nowhere NEAR as crucial as what battery you use..and in ANY size a LIPO cell is half the price to 9 SUB C's - that 9 because you WILL need three packs and each LIPO cell is about three times the voltage of a Nickel cell.. My contention is therefore, that its cheaper to get one decent LIPO pack than a trunkful of crap Nickel cells, and that alone will make your model hugely better performing. Whether you choose to run a hacker B50 at \$300 up the front, or a Modelair belt drive with a 600W De Walt can costing \$100, is hardly an issue after that..except the controller on the de walt will also cost you half the price... Sure, it will weigh in a bit heavier..but so will your wallet... Its enough to match a 40 power plant...For \$105 with belt drive...http://www.modelairtech.com/belt.html.and it will top 70% efficiency too. You won't get an AXI 4130 for that money..and they are not much lighter either..and the ESC will set you back more... <% if( /^image/.test(type) ){ %> <% } %> <%-name%> That was a VERY good primer on how to do it! Thanks for making the process so clear. -- Paul McIntosh RC-Bearings.com <% if( /^image/.test(type) ){ %> <% } %> <%-name%> On 28 Oct 2005 14:01:13 -0700, snipped-for-privacy@rochester.rr.com wrote: Very Well said. I also tell people interested in Electric flying to start with the battery. After a litte explanation they usually agree that it's much simpler than they thought. Ken Day <% if( /^image/.test(type) ){ %> <% } %> <%-name%> agpete wrote: A 40 will produce about a horsepower, or 750 watts, at around 10-12KRPM. On a 10x6 sort of prop. If you want to directly replace that, you need a 750 watt motor that will turn a 10x6 at similar RPM. However, most glo aircraft are overweight and overpowered, and a 10" prop is usually too small and 10K RPM too high for efficent use of the power. So many more sedate '40' models can fly on half a horsepower with a larger prop revving slower. Achieved by a 300-400 watt motor with either a gearbox, or multipole (outrunner) design. Aim for about 70-100W/lb for a typical sport model, use LIPO batteries, and buy a halfway decent motor and you will not go wrong... ..and ask here http://www.ezonemag.com/ because no one uses Usenet anymore...much.. <% if( /^image/.test(type) ){ %> <% } %> <%-name%> ## Site Timeline • Share To Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.
4,987
19,140
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.703125
3
CC-MAIN-2020-24
latest
en
0.932392
https://gbschemphys.com/physics/question-what-is-a-short-circuit-physics.html
1,643,220,435,000,000,000
text/html
crawl-data/CC-MAIN-2022-05/segments/1642320304959.80/warc/CC-MAIN-20220126162115-20220126192115-00375.warc.gz
334,507,827
14,340
# Question: What Is A Short Circuit Physics? A short circuit is an abnormal connection between two nodes of an electric circuit intended to be at different voltages. In real circuits, the result is a connection with almost no resistance. In such a case, the current is limited only by the resistance of the rest of the circuit. ## What is a short circuit a level physics? At ‘A’ level you need to understand why the components get so little current. A short circuit is a low resistance path for the current to follow. It allows the majority of the current to flow through this easy route and very little then flows through the component it is ‘shorting out’. ## Why is it called a short circuit? A short circuit is when there is a low resistance connection between two conductors that are supplying electrical power to a circuit. This would generate an excess of voltage streaming and cause excessive flow of current in the power source. The electricity will flow through a ‘short’ route and cause a short circuit. You might be interested:  Readers ask: How To Understand Physics? ## What is the best definition of a short circuit? The definition of a short circuit is a connection on an electric circuit that allows a current to follow an unplanned or accidental path. An example of a short circuit is a storm damaging a power line and cutting off electricity. ## What does short circuit power mean? Short circuiting is when an electric current flows down the wrong or unintended path with little to no electrical resistance. It can cause serious damage, fire, and even small-scale explosions. If you’ve ever seen sparks in your electrical panel, it most likely was a short circuit causing them. ## What causes a short circuit physics? In electrical devices, unintentional short circuits are usually caused when a wire’s insulation breaks down, or when another conducting material is introduced, allowing charge to flow along a different path than the one intended. A short circuit may lead to formation of an electric arc. ## How do you locate a short circuit? The first step in finding a short circuit is to look for physical signs. This may include visible burns or melted metal on wires, burning smells, or flickering lights. Once you’ve identified a potential short, use your multimeter to confirm the voltage by placing it on its resistance or continuity setting. ## How can you prevent a short circuit? There are many steps one can take to prevent short circuits, here are some of them. 1. Unplug Electronics When Not in Use: This is one of the easiest methods to prevent short circuits in your home. 2. Install Fuses: 3. Install Magneto-Thermal Switches: 4. Have Grounded Outlets: ## Can water cause short circuit? Water can cause electrical outlets to short-circuit and even ignite, presenting considerable risk. You might be interested:  Readers ask: What Is The Definition Of Energy In Physics? ## How do you fix a short circuit in a room? 10 Tips for Identifying and Fixing an Electrical Short 1. Shorts Occur in a Circuit. Electricity flows in a circuit. 2. Isolate the Circuit. 3. Check the Appliances on the Affected Circuit. 4. You Need the Proper Tools. 5. Remove the Wires. 6. Check the Wires. 7. Remove the Breaker Wires. 8. Check the Breaker. ## What is a short circuit answer in one sentence? A short circuit is generally an unintended electrical connection between current carrying parts. A short circuit is a situation in which a faulty connection or damaged wire causes electricity to travel along the wrong route and damage an electrical device. ## What are the dangers of short circuit? The result of a short circuit can be appliance damage, electrical shock, or even a fire. And if you’re not taking any preventative measures against short circuits, you’re only increasing the risk of these situations happening. ## How does a short circuit occurs what is its effect? When a naked live wire and a neutral wires touches each other, a short circuit occurs. In situations like these, the resistance of the circuit becomes low. This results in the heating of the wires and it sparks due to Joule’s heating effect of current. ## How do you fix a short circuit? Locate the exact location of the short circuit within the wiring system. Make a new wire to replace the old and damaged one. Remove some insulation from the ends of the new wires and solder them to the current wires. Ensure the wires are safely installed and turn on the circuit breaker to test if successful. You might be interested:  Readers ask: What Is A Net Force In Physics? ## What causes an electrical short? A short circuit is any electrical flow that strays outside its intended circuit with little or no resistance to that flow. The usual cause is bare wires touching one another or wire connections that have come loose. Frayed or otherwise damaged electrical extension cords or appliance cords can also cause short circuits. ## What happens to voltage and current in a short circuit? A short circuit implies that the two terminals are externally connected with resistance R=0, the same as an ideal wire. This means there is zero voltage difference for any current value. This means that zero current can flow between the two terminals, regardless of any voltage difference.
1,066
5,306
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.515625
4
CC-MAIN-2022-05
latest
en
0.932683
https://www.emmamichaels.com/4196/ax-b-c-axb-axc.html
1,679,562,638,000,000,000
text/html
crawl-data/CC-MAIN-2023-14/segments/1679296945030.59/warc/CC-MAIN-20230323065609-20230323095609-00082.warc.gz
839,315,428
15,673
Breaking News # Ax B C Axb Axc Ax B C Axb Axc. Then x ∈ a and y ∈ b∪c. Asked apr 23, 2018 in mathematics by nisa ( 60.1k points) vector algebra This is equal to explain us a times x minus b, times x minus c. Davneet singh has done his b.tech from indian institute of technology, kanpur. Let's ask & get answers log in sign up. A x (b∩c) = (axb) ∩ (axc) let p be an arbitrary element of a x (b∩c). It is usually called a vector triple product. ## Let (X, Y) ∈ Ax (B∪C). Anuradha sharma, meritnation expert added an answer, on 13/6/14. Mathematics glossary » table 3 associative. Ax (b+c) = (axb)+ (axc) is called janu9579 is waiting for your help. ### 'Vector' Because The Result Of (Ax (Bxc)) Is A Vector, 'Triple' Because It Involves 3 Vectors: 12] for a = 3 ax +a, +/a: ### Kesimpulan dari Ax B C Axb Axc. Question if a,b, c are any three vectors, show that ax (b+c) = āxb+axc. A × ( b ∩ c) = ( a × b) ∩ ( a × c). Preparing for jee/neet exam, start your free demo account start your free. Ax (b∩c) = (axb) ∩ (axc) solution:
362
1,034
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.25
3
CC-MAIN-2023-14
latest
en
0.816551
https://studylib.net/doc/7357319/percent-nh4cl-in-mixture
1,611,129,391,000,000,000
text/html
crawl-data/CC-MAIN-2021-04/segments/1610703519923.26/warc/CC-MAIN-20210120054203-20210120084203-00407.warc.gz
577,338,797
12,568
# Percent NH4Cl in Mixture ```1 Determining the Percent Composition of Ammonium Chloride in a Mixture PRE-LAB ASSIGNMENTS: To be assigned by your lab instructor. CONCEPTS TO BE LEARNED IN THIS LAB:    By the end of this lab, the student should understand what it means to know the percent composition of a mixture. The students should understand the concept of determining the mass of a substance by taking the difference of two other masses. Learn how to use physical properties to separate the components of a mixture. EXPERIMENTAL GOALS: The purpose of this procedure is to determine the percent composition of an unknown mixture that contains ammonium chloride, NH4Cl, and sand, (SiO2)n. INTRODUCTION: This lab is the first of three procedures which are designed to introduce the concept of reaction stoichiometry. In this procedure, the percent composition of a mixture of ammonium chloride and sand will be determined from the physical properties of the components of the mixture. Most solid substances, when heated, undergo a phase transition from the solid phase to the liquid phase, a process known as melting. However, some substances go from the solid phase directly to the gas phase, a process known as sublimation. (A familiar example is frozen carbon dioxide, or dry ice. If you put a chunk of dry ice on a tabletop, the dry ice does not melt, but the chunk gets smaller and smaller as the particles in the solid warm up and go directly into the gas phase.) Ammonium chloride sublimes when heated, which gives us a convenient way to separate ammonium chloride from sand. By knowing the weight of the sample before and after heating, the mass of the ammonium chloride in the sample can be determined. Once the weights of each component are known, the percent composition of the mixture is determined by dividing the weight of each component by the total weight of the sample. 2 Figure 1. Apparatus for the sublimation of ammonium chloride. PROCEDURE: 1. Obtain a sample of an unknown mixture of ammonium chloride and sand from the stockroom and record the sample number on the lab report (1). 2. Clean an evaporating dish, warm it over a Bunsen burner to dry, allow it to cool, and weigh it to the accuracy of the balance (3). Handle the clean dish with tongs, not your hands. Add between four and five grams of your unknown mixture to the dish, and weigh it again (2). 3. Place the evaporating dish containing the mixture on a wire gauze held by an iron ring in the fume hood (see Figure 1.) Heat carefully at first to avoid any spattering, and increase the heat after a couple of minutes. After heating strongly for 10 minutes, remove the flame and stir the contents with a glass stirring rod. Heat the sample again for another 10 minutes, or until no more white fumes are observed. Using your crucible tongs, carefully move the hot evaporating dish to a wire gauze or a clay triangle bent into the shape of a tripod, and allow the dish and its contents to cool in the hood. Do NOT put the hot dish down directly on the floor of the hood or the lab bench, because when the dish cools off, it may stick. 4. When the dish has cooled to room temperature, weigh the dish and remaining material (5). CALCULATIONS: 1. Determine the weight of the unknown mixture (4), the ammonium chloride (6), and the sand (7). 2. Calculate the percentage of each component in the mixture (8) using the formula weight % C  grams C  100 total grams sample 3 LAB REPORT Determining the Percent Composition of Ammonium Chloride in a Mixture Name ________________________________ Date _________ Partner ________________________________ Section _________ 1. Unknown number ________________ 2. Mass of unknown mixture and container __________ 3. Mass of empty container __________ 4. Mass of unknown mixture __________ 5. Mass of sand and container after sublimation __________ 6. Mass of ammonium chloride __________ 7. Mass of sand __________ 8. Percent composition of sample: % ammonium chloride __________ CALCULATIONS: Mass of ammonium chloride: Mass of sand: % ammonium chloride % sand % sand __________ ```
962
4,106
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.96875
3
CC-MAIN-2021-04
latest
en
0.920682
https://meta.wikimedia.org/wiki/User:OrenBochman/WGT/Ham_Spam_Game
1,556,160,076,000,000,000
text/html
crawl-data/CC-MAIN-2019-18/segments/1555578678807.71/warc/CC-MAIN-20190425014322-20190425040322-00209.warc.gz
477,115,502
13,965
User:OrenBochman/WGT/Ham Spam Game Simple Ham Spam - Creator facing a New Page Patroller A new articles has n memes etimated as 5. They are either contributed as ham or spam and they are either accepted as ham or rejected as spam. By introducing Reputation and Face into the payoff the game can be seen to be an assymetrical Prisoner's dillema (iterated or not). Partroller (accept) Partroller (reject SD) Partroller (reject Afd) ham ${\displaystyle n-work}$ ${\displaystyle n}$ ${\displaystyle -work}$ ${\displaystyle -work({\frac {1}{10}}+{\frac {1}{\lVert Community\rVert }})}$ ${\displaystyle -2work,}$ ${\displaystyle -work(2+{\frac {1}{\lVert Community\rVert }})}$ spam ${\displaystyle Ln-{\frac {work}{3}}}$ ${\displaystyle -Ln}$ ${\displaystyle -{\frac {work}{3}}}$ ${\displaystyle -{\frac {work}{10}}}$ ${\displaystyle -{\frac {work}{3}}}$ ${\displaystyle -2work}$ • The information is perfect so the patroller can identify spam from ham. • Deleting SD requires a minimal expenditure in communication, coordination or time. • Afd requires voting, communication and reaching consensus within a week. • L is the lemon[1] factor and is greater than one. The ham spam games can be followed by: • a single round of CSD/AfD game. High (40%) and on optional round of Xfd (resoration request) (5%)low. • a single round of a Ban Game below. If spam count > 3. • a single round of chicken - an edit war with another editor. (would be better modeled using a ham/opinion/spam). However these have complex probabilities of taking place. Empirical questions 1. What is the distribution of memes in a new article. Avarage and Standard diviation. 2. Is Accept/Reject dependent on number of memes. 3. The probabilities of CSD AFD have been studied 4. The probability of Bans are more difficult but can also be estimated by reviewing edit histories and counting events. 5. The death event is of interest as well. Actual deletion can be more complicated for both sides - as can be seen from the chart (developed Alexandre Passant & Jodi Schneider) below: this chart suggests that the normal form game occurs with multiple agents and multiple rounds at Afd and CSD. Practical Conerns Modeling a the playesrs as both a bad faith and a good faith actor simply reflects that each user may have his a conflict of interest with that of wikipedia. This includes pai editing under an alias AKA the invisible pink unicorn. Such an editor can quickly establish a IPU identity with low cost and a minimal reputation to do the spam edits. Since this is a Prisoners dillema some questions arise. Both players can may wish to increase their payoffs resulting in a non parto efficent mutual deffection equilibria (spam spam). A social engineer would inquire how a (ham,ham) could be encouraged. This is generaly solved by punishing users who defect. the IPU is a form of abuse more pravelent amonst advanced users. These experienced users are able to game the system and place articles into wikipedia with minimal work. This has significant value for forign elements who offer significant temptations to have the creator intoroduce spam. Such editors will not longer be impatial when taking the other side as patroller. The risk of spamming is far greater for a patroller since he could loose his privlages. In practice great abuse is tollerated (a moral hazzard) One case which is not tolerated is and therefore not without risk — once IPUs are exposed users can inccur signficant penalties. and lose their real identity and privileges. So when they wish to behave badly they will use disposable accounts sometimes refered to as Invisible Pink Unicorns or (IPU). These accounts are also detectable and depending on how badly the IPU is abused - the curtain may be lifted. Recomendation • Use of stylometric and editing metadata to identify IPUs. • A better COI resolution - let there be good spam. Users should be allowed to do much broader work within the scope of their main account, and not have to resort to hiding their identities. This means having a more liberal policy and being clearer about COI. However this will not solve all COI problems. • So users should also have a stylometric print or another method of authentication which they cannot forge. This is a commited stylometric identiy. • But revealing identity is punished in the long-term — epsecialy when dealing with controversial matters. So these two concerns must also be resolved. Spam Ham Game under perfect information Combine the above in an extensive form. Simple Ham Spam - Non-Creator facing a Revent Changes Patroller - Sub Game • This is a close relative of the ham/spam game. However in this case the edit is a smaller departure from the status quoe and thus percieved as less controversial. An quickest rejection of an edit is the a reversion. It is possible for a deletion prorocol to be initated as well. • On the other hand users are cessured against making many small edits which increase work load at recent changes. • generaly under knowledge symmetry (the longer the edit the more likely it is to be reverted). this is due to problems like CPVIO risk (though it can also be) due to other reasons. • Revisions add new memes or replace memes. edits can be ham or spam. • ${\displaystyle P_{revert}={\frac {\lVert Memes\rVert }{Meme_{max}}}*reputation}$ Partroller (accept) Partroller (revert) ham, defend ${\displaystyle n-work}$ ${\displaystyle n}$ ${\displaystyle -2work-2face}$ ${\displaystyle -work({\frac {11}{10}}+{\frac {1}{\lVert Community\rVert }})}$ ham, abandon ${\displaystyle n-work}$ ${\displaystyle n}$ ${\displaystyle -work-face}$ ${\displaystyle -work/10}$ spam, defend ${\displaystyle nL-work/3}$ ${\displaystyle -nL}$ ${\displaystyle -2work}$ ${\displaystyle -work({\frac {11}{10}})}$ spam, abandon ${\displaystyle nL-work/3}$ ${\displaystyle -nL}$ ${\displaystyle -work/3}$ ${\displaystyle -work/10}$ • remember the information is still symmetric so the patroller can identify ham from spam. • reversion after defending is a double effrontery resulting in a loss of the editor • this is a sub game which would be followed by another round where the Patroller bans the Editor with probability ${\displaystyle p_{ban}=\sum edits_{ham}-L\sum edits_{spam}}$ • can this become a war of attrition? Refrences 1. Hoffer, George E.; Pratt, Michael D. (1987). "Used vehicles, lemons markets, and Used Car Rules: Some empirical evidence". Journal of Consumer Policy 10 (4): 409–414. doi:10.1007/BF00411482.
1,604
6,505
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 30, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.015625
3
CC-MAIN-2019-18
longest
en
0.901306
https://almazrestaurant.com/how-to-calculate-amortization-schedule/
1,669,538,613,000,000,000
text/html
crawl-data/CC-MAIN-2022-49/segments/1669446710218.49/warc/CC-MAIN-20221127073607-20221127103607-00706.warc.gz
135,565,556
12,827
How To Calculate Amortization Schedule What is the formula for calculating amortization? Amortization is Calculated Using Below formula: ƥ = rP / n * [1-(1+r/n)-nt] ƥ = 0.1 * 100,000 / 12 * [1-(1+0.1/12)-12*20] What is the formula for calculating monthly payments? • a: \$100,000, the amount of the loan. • r: 0.005 (6% annual rate—expressed as 0.06—divided by 12 monthly payments per year) • n: 360 (12 monthly payments per year times 30 years) • How do you calculate an amortization schedule in Excel? Related Question how to calculate amortization schedule What is amortization with example? Amortization is the process of incrementally charging the cost of an asset to expense over its expected period of use, which shifts the asset from the balance sheet to the income statement. Examples of intangible assets are patents, copyrights, taxi licenses, and trademarks. What does a loan amortization schedule show? An amortization schedule, often called an amortization table, spells out exactly what you'll be paying each month for your mortgage. The table will show your monthly payment and how much of it will go toward paying down your loan's principal balance and how much will be used on interest. How much income do I need for a 200k mortgage? A \$200k mortgage with a 4.5% interest rate over 30 years and a \$10k down-payment will require an annual income of \$54,729 to qualify for the loan. You can calculate for even more variations in these parameters with our Mortgage Required Income Calculator. How do I make an extra amortization schedule in Excel? • Define input cells. As usual, begin with setting up the input cells. • Calculate a scheduled payment. • Set up the amortization table. • Build formulas for amortization schedule with extra payments. • Hide extra periods. • Make a loan summary. • How do I use Ipmt in Excel? The formula to be used will be =IPMT( 5%/12, 1, 60, 50000). In the example above: As the payments are made monthly, it was necessary to convert the annual interest rate of 5% into a monthly rate (=5%/12), and the number of periods from years to months (=5*12). What does a 15 year amortization mean? Fixed-Rate Mortgages A fixed-rate mortgage fully amortizes at the end of the term. In the case of a 15-year fixed-rate mortgage, the loan is paid in full at the end of 15 years. Loans with shorter terms have less interest because they amortize over a shorter period of time. What do you mean by monthly amortization? Related Definitions Monthly Amortization Payment means a payment of principal of the Term Loans in an amount equal to (x) the then-outstanding principal amount (including any PIK Interest) divided by (y) the number of months left until the Maturity Date. How do you calculate principal and interest? You can calculate Interest on your loans and investments by using the following formula for calculating simple interest: Simple Interest= P x R x T ÷ 100, where P = Principal, R = Rate of Interest and T = Time Period of the Loan/Deposit in years. How do I calculate the interest rate on a loan? • EMI = equated monthly instalments. • P = the principal amount borrowed. • R = loan interest rate (monthly basis) = annual interest rate/12. • N = loan tenure (in months) • How do you calculate interest amortization? To calculate interest expense for the next semiannual payment, we subtract the amount of amortization from the bond's carrying value and multiply the new carrying value by half the yield to maturity. Here's what that looks like over the full five-year period. How do you calculate annual amortization? Divide the total cost of the asset by the years of each asset's useful life. This is the annual amortization expense. Record the amortization expense in the accounting records. Create a journal entry at the end of the year to recognize the expense. How do you calculate assets amortization? Subtract the residual value of the asset from its original value. Divide that number by the asset's lifespan. The result is the amount you can amortize each year. If the asset has no residual value, simply divide the initial value by the lifespan. What is the monthly payment on a \$30000 loan? For example, the total interest on a \$30,000, 60-month loan at 4% would be \$3,150. So, your monthly payment would be \$552.50 (\$30,000 + \$3,150 ÷ 60 = \$552.50). What credit score do I need to get a \$25000 loan? So in general it's recommended that borrowers have a minimum credit score of 610 if applying for a personal loan. However, as we creep into higher loan amounts such as \$25,000, the minimum credit score requirements may change. The more money a lender loans, the more risk they take. How much house can I afford 120k salary? If you make \$50,000 a year, your total yearly housing costs should ideally be no more than \$14,000, or \$1,167 a month. If you make \$120,000 a year, you can go up to \$33,600 a year, or \$2,800 a month—as long as your other debts don't push you beyond the 36 percent mark. What salary do I need for a 500k mortgage? How Much Income Do I Need for a 500k Mortgage? You need to make \$153,812 a year to afford a 500k mortgage. We base the income you need on a 500k mortgage on a payment that is 24% of your monthly income. In your case, your monthly income should be about \$12,818. How much house can I afford 80k salary? So, if you make \$80,000 a year, you should be looking at homes priced between \$240,000 to \$320,000. You can further limit this range by figuring out a comfortable monthly mortgage payment. To do this, take your monthly after-tax income, subtract all current debt payments and then multiply that number by 25%. How much house can I afford with a 50000 salary? A person who makes \$50,000 a year might be able to afford a house worth anywhere from \$180,000 to nearly \$300,000. That's because salary isn't the only variable that determines your home buying budget. You also have to consider your credit score, current debts, mortgage rates, and many other factors. How much income do you need to buy a \$450 000 house? You need to make \$138,431 a year to afford a 450k mortgage. We base the income you need on a 450k mortgage on a payment that is 24% of your monthly income. In your case, your monthly income should be about \$11,536. The monthly payment on a 450k mortgage is \$2,769. How much income do you need to buy a \$300000 house? This means that to afford a \$300,000 house, you'd need \$60,000. Closing costs: Typically, you'll pay around 3% to 5% of a home's value in closing costs. How does amortization schedule change with extra payments? Even a single extra payment made each year can reduce the amount of interest and shorten the amortization, as long as the payment goes toward the principal and not the interest (make sure your lender processes the payment this way). How do I calculate APR in Excel? To calculate the APR in Excel, use the "RATE" function. Choose a blank cell, and type "=RATE(" into it. The format for this is "=RATE(number of repayments, payment amount, value of loan minus any fees required to get the loan, final value)." Again, the final value is always zero. What is PPMT and Ipmt? PMT calculates the fixed monthly repayment of a loan taken out over a certain timescale at a fixed interest rate. IPMT calculates the interest amount and PPMT calculates the capital amount so you can always determine the proportions for each payment. What does Ipmt mean? IPMT Acronym Definition IPMT Integrated Project Management Team IPMT Intraductal Papillary and Mucinous Tumor (pancreatic tumor) IPMT Interventional Pain Management Techniques Why is it better to take out a 15-year mortgage instead of a 30-year mortgage? Less in Total Interest. A 15-year mortgage costs less in the long run since the total interest payments are less than a 30-year mortgage. The more cash you put toward the home, the better the interest rate you could get. A low down payment increases the lifetime cost of your mortgage. How do you calculate depreciation and amortization on a balance sheet? Amortization can be calculated through a straight-line method similar to depreciation. Corporate Finance Institute writes that an asset should be amortized until it reaches its residual value or 0. The straight-line method formula is as follows: (book value - residual value) / useful life. How does amortization work in accounting? • Amortization is an accounting technique used to periodically lower the book value of a loan or an intangible asset over a set period of time. • Amortization can refer to the process of paying off debt over time in regular installments of interest and principal sufficient to repay the loan in full by its maturity date. • Is amortization an asset or expense? Unlike depreciation, amortization is typically expensed on a straight line basis, meaning the same amount is expensed in each period over the asset's useful life. Additionally, assets that are expensed using the amortization method typically don't have any resale or salvage value, unlike with depreciation. Posted in FAQ
2,096
9,112
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.9375
4
CC-MAIN-2022-49
latest
en
0.91254
http://www.ques10.com/p/30864/intelligent-systems-question-paper-may-18-inform-1/
1,556,131,837,000,000,000
text/html
crawl-data/CC-MAIN-2019-18/segments/1555578655155.88/warc/CC-MAIN-20190424174425-20190424200425-00469.warc.gz
288,117,678
6,297
Question Paper: Intelligent Systems Question Paper - May 18 - Information Technology (Semester 7) - Mumbai University (MU) 0 ## Intelligent Systems - May 18 ### Information Technology (Semester 7) Total marks: 80 Total time: 3 Hours INSTRUCTIONS (1) Question No. 1 is compulsory. (2) Attempt any three from remaining five questions. 1(a) Formulate 8 queens problem. (4 marks) 1580 1(b) Explain Learning Agent with diagram. (4 marks) 00 1(c) Discuss Heuristic function for 8 puzzle problem. (4 marks) 00 1(d) Explain components and structure of expert system. (4 marks) 1590 1(e) Solve following Crypt-arithmetic problem. L O G I C + L O G I C ======== P R O L O G (4 marks) 00 2(a) Compare different uninformed search strategies. (10 marks) 00 2(b) Apply DFS algorithm on given tree. Write the sequence of nodes in which it is explored. (10 marks) 00 3(a) Define partial order planner. Explain STRIPS representation of planning problem. (10 marks) 1566 3(b) What is prolog? Write Prolog program for family information system. (10 marks) 1559 4(a) Explain WUMPUS world environment giving its PEAS description. Explain how percept sequence is generated? (10 marks) 1554 4(b) Apply Alpha-Beta Pruning and min-max search on given game tree and find which is the next move. $\triangle$-max node, $\triangledown$- min node (10 marks) 00 5(a) Assume the following facts: • i) Steve only like easy courses. • ii) Science courses is hard. • iii) All the courses in the basket-weaving department are easy. • iv) BIB 301 is a basket-weaving course. Use resolution to answer the question "What course would Steve like?" (10 marks) 00 5(b) What is uncertainty? Explain Bayesian Network with example. (10 marks) 00 Q6) Write short notes on any four • a) Type of Intelligent Agents. • b) Hill Climbing. 1543 • c) A* algorithm 1546 • d) Decision Tree. • e) Cousal Normal form. (20 marks) 00
520
1,901
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.546875
3
CC-MAIN-2019-18
latest
en
0.812704
https://www.geogebra.org/material/show/id/27767
1,544,465,033,000,000,000
text/html
crawl-data/CC-MAIN-2018-51/segments/1544376823382.1/warc/CC-MAIN-20181210170024-20181210191524-00345.warc.gz
877,473,947
8,727
# Triangle Exterior angles What is the sum of the exterior angles of a n-gon? Use the following sketches to investigate. See if you can come up with a formula (like we did for the sum of the interior angles of an n-gon) that if you put the number of sides in for n, it gives you the sum of the exterior angles for that polygon. Be sure to drag the polygon around so that you confirm that the formula works for any polygon with that number of sides, not just the one that you see when you first click on the tab. Like we did for the sum of the interior angles, try to explain why the formula that you discovered for the question above works. Resource Type Activity Tags angle  anlge  exterior  of  polygons  sum Target Group (Age) 19+ Language English (United States) GeoGebra version 4.2 Views 2792 • GeoGebra • Help • Partners
202
831
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.59375
3
CC-MAIN-2018-51
latest
en
0.864434
https://www.tensorflow.org/versions/r2.2/api_docs/python/tf/expand_dims?hl=ko
1,624,073,593,000,000,000
text/html
crawl-data/CC-MAIN-2021-25/segments/1623487643380.40/warc/CC-MAIN-20210619020602-20210619050602-00119.warc.gz
917,781,095
59,142
질문이있다? TensorFlow 포럼 에서 커뮤니티와 연결 # tf.expand_dims Returns a tensor with an additional dimension inserted at index `axis`. Given a tensor `input`, this operation inserts a dimension of size 1 at the dimension index `axis` of `input`'s shape. The dimension index `axis` starts at zero; if you specify a negative number for `axis` it is counted backward from the end. This operation is useful if you want to add a batch dimension to a single element. For example, if you have a single image of shape ```[height, width, channels]```, you can make it a batch of one image with `expand_dims(image, 0)`, which will make the shape `[1, height, width, channels]`. #### Examples: ````t = [[1, 2, 3],[4, 5, 6]] # shape [2, 3]` ``` ````tf.expand_dims(t, 0)` `<tf.Tensor: shape=(1, 2, 3), dtype=int32, numpy=` `array([[[1, 2, 3],` ` [4, 5, 6]]], dtype=int32)>` ``` ````tf.expand_dims(t, 1)` `<tf.Tensor: shape=(2, 1, 3), dtype=int32, numpy=` `array([[[1, 2, 3]],` ` [[4, 5, 6]]], dtype=int32)>` ``` ````tf.expand_dims(t, 2)` `<tf.Tensor: shape=(2, 3, 1), dtype=int32, numpy=` `array([[[1],` ` [2],` ` [3]],` ` [[4],` ` [5],` ` [6]]], dtype=int32)>` ``` ````tf.expand_dims(t, -1) # Last dimension index. In this case, same as 2.` `<tf.Tensor: shape=(2, 3, 1), dtype=int32, numpy=` `array([[[1],` ` [2],` ` [3]],` ` [[4],` ` [5],` ` [6]]], dtype=int32)>` ``` This operation is related to: `input` A `Tensor`. `axis` Integer specifying the dimension index at which to expand the shape of `input`. Given an input of D dimensions, `axis` must be in range `[-(D+1), D]` (inclusive). `name` Optional string. The name of the output `Tensor`. A tensor with the same data as `input`, with an additional dimension inserted at the index specified by `axis`. `ValueError` If `axis` is not specified. `InvalidArgumentError` If `axis` is out of range `[-(D+1), D]`. [{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"필요한 정보가 없음" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"너무 복잡함/단계 수가 너무 많음" },{ "type": "thumb-down", "id": "outOfDate", "label":"오래됨" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"기타" }] [{ "type": "thumb-up", "id": "easyToUnderstand", "label":"이해하기 쉬움" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"문제가 해결됨" },{ "type": "thumb-up", "id": "otherUp", "label":"기타" }]
830
2,496
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.625
3
CC-MAIN-2021-25
latest
en
0.600685
https://www.teachstarter.com/au/teaching-resource/rounding-numbers-maths-mazes/
1,725,988,862,000,000,000
text/html
crawl-data/CC-MAIN-2024-38/segments/1725700651303.70/warc/CC-MAIN-20240910161250-20240910191250-00352.warc.gz
955,871,553
74,904
teaching resource # Rounding Numbers – Maths Mazes • Updated:  07 Sep 2023 Round numbers to various places while finding your way through this set of 5 maths mazes. • Non-Editable:  PDF • Pages:  10 Pages • Years:  4 - 7 ### Curriculum • #### ACMNA072 Recognise, represent and order numbers to at least tens of thousands • #### ACMNA099 Use estimation and rounding to check the reasonableness of answers to calculations teaching resource # Rounding Numbers – Maths Mazes • Updated:  07 Sep 2023 Round numbers to various places while finding your way through this set of 5 maths mazes. • Non-Editable:  PDF • Pages:  10 Pages • Years:  4 - 7 Round numbers to various places while finding your way through this set of 5 maths mazes. ## Practise Rounding Numbers With this maths worksheet bundle, students will work their way through 5 different mazes. To solve each maze, students will round each number to the given place, designated in the page’s upper right-hand corner. Students can practise the following rounding skills: • rounding to the nearest 10 • rounding to the nearest 100 • rounding to the nearest 1,000 • rounding to the nearest whole number • rounding to the nearest tenth. Students will round each number within a rectangle and follow the path with the correct answer. Students can shade the path with coloured pencils, crayons, etc. But watch out! Some dead ends are waiting for your students in some of the mazes. If you are looking to incorporate a little competitive fun into your classroom, consider assigning this resource to a pair of students. When someone says, “Go!” students can race each other through the maze and check their answers at the end with the provided answer pages. ## Tips for Differentiation + Scaffolding In addition to independent student work time, use this worksheet as an activity for: • Guided maths groups • Lesson warm-up • Lesson wrap-up • Fast finishers • Homework assignment • Whole-class review (via smartboard) Extend this resource by having students create their own rounding maze with at least 12 numbers to round. Students can swap mazes with a classmate as well. If there are students who need a bit of support, encourage them to reference previous assignments, posters, or anchor charts as a means of reference. Additionally, this worksheet can be completed in a 1-on-1 setting or with a small group of students. Use the dropdown icon on the Download button to choose between the PDF or editable PowerPoint or Google Slides version of this resource. Turn this teaching resource into a sustainable activity by printing on card and slipping it into a write-and-wipe sleeve. Students can colour the maze with a whiteboard marker, then erase and reuse them. Get more worksheets to have handy! This resource was created by Lorin Davies, a Teach Starter Collaborator.
634
2,853
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.484375
3
CC-MAIN-2024-38
latest
en
0.886753
https://gmatclub.com/forum/the-two-lines-are-tangent-to-the-circle-271398.html
1,596,711,560,000,000,000
text/html
crawl-data/CC-MAIN-2020-34/segments/1596439736902.24/warc/CC-MAIN-20200806091418-20200806121418-00453.warc.gz
328,122,070
161,064
GMAT Question of the Day: Daily via email | Daily via Instagram New to GMAT Club? Watch this Video It is currently 06 Aug 2020, 02:59 ### GMAT Club Daily Prep #### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email. Customized for You we will pick new questions that match your level based on your Timer History Track every week, we’ll send you an estimated GMAT score based on your performance Practice Pays we will pick new questions that match your level based on your Timer History # The two lines are tangent to the circle. Author Message TAGS: ### Hide Tags GMAT Club Legend Joined: 11 Sep 2015 Posts: 4999 GMAT 1: 770 Q49 V46 The two lines are tangent to the circle.  [#permalink] ### Show Tags 24 Jul 2018, 04:45 1 Top Contributor 14 00:00 Difficulty: 95% (hard) Question Stats: 44% (02:58) correct 56% (02:33) wrong based on 118 sessions ### HideShow timer Statistics The two lines are tangent to the circle. If AC = 10 and AB = 10√3, what is the area of the circle? A) 100π B) 150π C) 200π D) 250π E) 300π *kudos for all correct solutions _________________ If you enjoy my solutions, you'll love my GMAT prep course. GMAT Club Legend Joined: 11 Sep 2015 Posts: 4999 GMAT 1: 770 Q49 V46 Re: The two lines are tangent to the circle.  [#permalink] ### Show Tags 26 Jul 2018, 06:01 2 1 Top Contributor 4 GMATPrepNow wrote: The two lines are tangent to the circle. If AC = 10 and AB = 10√3, what is the area of the circle? A) 100π B) 150π C) 200π D) 250π E) 300π *kudos for all correct solutions If AC = 10, then BC = 10 Since ABC is an isosceles triangle, the following gray line will create two right triangles... Now focus on the following blue triangle. Its measurements have a lot in common with the BASE 30-60-90 special triangle In fact, if we take the BASE 30-60-90 special triangle and multiply all sides by 5 we see that the sides are the same as the sides of the blue triangle. So, we can now add in the 30-degree and 60-degree angles Now add a point for the circle's center and draw a line to the point of tangency. The two lines will create a right triangle (circle property) We can see that the missing angle is 60 degrees Now create the following right triangle We already know that one side has length 5√3 Since we have a 30-60-90 special triangle, we know that the hypotenuse is twice as long as the side opposite the 30-degree angle. So, the hypotenuse must have length 10√3 In other words, the radius has length 10√3 What is the area of the circle? Area = πr² = π(10√3)² = π(10√3)(10√3) = 300π Cheers, Brent _________________ If you enjoy my solutions, you'll love my GMAT prep course. ##### General Discussion Senior Manager Joined: 01 Feb 2017 Posts: 273 The two lines are tangent to the circle.  [#permalink] ### Show Tags 24 Jul 2018, 06:00 2 2 *Let O be the centre of circle. *AC=BC=10 (Power point theorem) *Let E be perpendicular bisector of line AB. *AE=BE=5√3 *Triangle AEC: as per side ratio of a:a√3:2a, angle ACE is 60. *Triangle AOC: angle OAC is 90, angle ACO is 60 and angle AOC is 30. Side AC opposite angle 30 is 10. Therefore, Side AO (Radius) opposite angle 60 is 10√3. Hence, area of circle= (10√3)^2*π= 300π Ans E Posted from my mobile device Math Expert Joined: 02 Aug 2009 Posts: 8795 Re: The two lines are tangent to the circle.  [#permalink] ### Show Tags 24 Jul 2018, 06:02 4 1 GMATPrepNow wrote: The two lines are tangent to the circle. If AC = 10 and AB = 10√3, what is the area of the circle? A) 100π B) 150π C) 200π D) 250π E) 300π *kudos for all correct solutions Look at triangle ACD.. It is 30:60:90 triangle as sides are _:5√3:10 Now join OA, where O is the centre.. angle OAD = OAC-DAC=90-30=60... OAC is 90 as it is tangent.. Area =π*(10√3)^2=300π E Attachments PicsArt_07-24-07.26.21.png [ 17.66 KiB | Viewed 2657 times ] _________________ Senior Manager Joined: 22 Feb 2018 Posts: 404 Re: The two lines are tangent to the circle.  [#permalink] ### Show Tags 24 Jul 2018, 06:24 2 1 OA:E Attachment: gmatprepnow.PNG [ 69.75 KiB | Viewed 2634 times ] In above sketch, $$OA=OB=$$ radius $$\angle OAC = \angle OBC =\angle ADC =\angle BDC = 90^{\circ}$$ $$AD= DB = \frac{{10\sqrt[]{3}}}{{2}}=5\sqrt[]{3}$$ $$AD =5\sqrt[]{3}$$ and$$\angle ADC = 90^{\circ}$$ , along with $$AC= 10$$, We can say that $$\triangle ADC$$ is $$30^{\circ}-60^{\circ}-90^{\circ}$$ Triangle with $$\angle ACD = 60^{\circ}$$ Now in $$\triangle$$ $$OAC$$ ,$$\angle AOC =30^{\circ}$$ $$\angle AOB = 2 * \angle AOC = 60^{\circ}$$ This imply that $$\triangle AOB$$ is equilateral $$\triangle$$ , with all sides equal to $$10\sqrt{3}$$. $$OA=OB=$$ radius $$=10\sqrt{3}$$ Area of circle$$= \pi * 10\sqrt{3}*10\sqrt{3} =300\pi$$ Director Joined: 20 Feb 2015 Posts: 721 Concentration: Strategy, General Management Re: The two lines are tangent to the circle.  [#permalink] ### Show Tags 24 Jul 2018, 09:37 Princ wrote: OA:E Attachment: gmatprepnow.PNG In above sketch, $$OA=OB=$$ radius $$\angle OAC = \angle OBC =\angle ADC =\angle BDC = 90^{\circ}$$ $$AD= DB = \frac{{10\sqrt[]{3}}}{{2}}=5\sqrt[]{3}$$ $$AD =5\sqrt[]{3}$$ and$$\angle ADC = 90^{\circ}$$ , along with $$AC= 10$$, We can say that $$\triangle ADC$$ is $$30^{\circ}-60^{\circ}-90^{\circ}$$ Triangle with $$\angle ACD = 60^{\circ}$$ Now in $$\triangle$$ $$OAC$$ ,$$\angle AOC =30^{\circ}$$ $$\angle AOB = 2 * \angle AOC = 60^{\circ}$$ This imply that $$\triangle AOB$$ is equilateral $$\triangle$$ , with all sides equal to $$10\sqrt{3}$$. $$OA=OB=$$ radius $$=10\sqrt{3}$$ Area of circle$$= \pi * 10\sqrt{3}*10\sqrt{3} =300\pi$$ I understand that 2 of the sides are 10 and 5\sqrt{3} How can we conclude that the triangle here is a 30 :60:90 triangle ? GMAT Club Legend Joined: 11 Sep 2015 Posts: 4999 GMAT 1: 770 Q49 V46 Re: The two lines are tangent to the circle.  [#permalink] ### Show Tags 24 Jul 2018, 09:43 1 Top Contributor CounterSniper wrote: Princ wrote: OA:E Attachment: gmatprepnow.PNG In above sketch, $$OA=OB=$$ radius $$\angle OAC = \angle OBC =\angle ADC =\angle BDC = 90^{\circ}$$ $$AD= DB = \frac{{10\sqrt[]{3}}}{{2}}=5\sqrt[]{3}$$ $$AD =5\sqrt[]{3}$$ and$$\angle ADC = 90^{\circ}$$ , along with $$AC= 10$$, We can say that $$\triangle ADC$$ is $$30^{\circ}-60^{\circ}-90^{\circ}$$ Triangle with $$\angle ACD = 60^{\circ}$$ Now in $$\triangle$$ $$OAC$$ ,$$\angle AOC =30^{\circ}$$ $$\angle AOB = 2 * \angle AOC = 60^{\circ}$$ This imply that $$\triangle AOB$$ is equilateral $$\triangle$$ , with all sides equal to $$10\sqrt{3}$$. $$OA=OB=$$ radius $$=10\sqrt{3}$$ Area of circle$$= \pi * 10\sqrt{3}*10\sqrt{3} =300\pi$$ I understand that 2 of the sides are 10 and 5\sqrt{3} How can we conclude that the triangle here is a 30 :60:90 triangle ? HINT: You'll find the answer to your question in the following video on Circle Properties: Cheers, Brent _________________ If you enjoy my solutions, you'll love my GMAT prep course. Director Joined: 20 Feb 2015 Posts: 721 Concentration: Strategy, General Management Re: The two lines are tangent to the circle.  [#permalink] ### Show Tags 24 Jul 2018, 10:08 GMATPrepNow wrote: CounterSniper wrote: Princ wrote: OA:E Attachment: gmatprepnow.PNG In above sketch, $$OA=OB=$$ radius $$\angle OAC = \angle OBC =\angle ADC =\angle BDC = 90^{\circ}$$ $$AD= DB = \frac{{10\sqrt[]{3}}}{{2}}=5\sqrt[]{3}$$ $$AD =5\sqrt[]{3}$$ and$$\angle ADC = 90^{\circ}$$ , along with $$AC= 10$$, We can say that $$\triangle ADC$$ is $$30^{\circ}-60^{\circ}-90^{\circ}$$ Triangle with $$\angle ACD = 60^{\circ}$$ Now in $$\triangle$$ $$OAC$$ ,$$\angle AOC =30^{\circ}$$ $$\angle AOB = 2 * \angle AOC = 60^{\circ}$$ This imply that $$\triangle AOB$$ is equilateral $$\triangle$$ , with all sides equal to $$10\sqrt{3}$$. $$OA=OB=$$ radius $$=10\sqrt{3}$$ Area of circle$$= \pi * 10\sqrt{3}*10\sqrt{3} =300\pi$$ I understand that 2 of the sides are 10 and 5\sqrt{3} How can we conclude that the triangle here is a 30 :60:90 triangle ? HINT: You'll find the answer to your question in the following video on Circle Properties: Cheers, Brent figured it out from the ratio 1:root3:2 Thanks !! Intern Joined: 01 May 2020 Posts: 3 The two lines are tangent to the circle.  [#permalink] ### Show Tags 25 Jul 2020, 18:01 BrentGMATPrepNow wrote: GMATPrepNow wrote: The two lines are tangent to the circle. If AC = 10 and AB = 10√3, what is the area of the circle? A) 100π B) 150π C) 200π D) 250π E) 300π *kudos for all correct solutions If AC = 10, then BC = 10 Since ABC is an isosceles triangle, the following gray line will create two right triangles... Now focus on the following blue triangle. Its measurements have a lot in common with the BASE 30-60-90 special triangle In fact, if we take the BASE 30-60-90 special triangle and multiply all sides by 5 we see that the sides are the same as the sides of the blue triangle. So, we can now add in the 30-degree and 60-degree angles Now add a point for the circle's center and draw a line to the point of tangency. The two lines will create a right triangle (circle property) We can see that the missing angle is 60 degrees Now create the following right triangle We already know that one side has length 5√3 Since we have a 30-60-90 special triangle, we know that the hypotenuse is twice as long as the side opposite the 30-degree angle. So, the hypotenuse must have length 10√3 In other words, the radius has length 10√3 What is the area of the circle? Area = πr² = π(10√3)² = π(10√3)(10√3) = 300π Cheers, Brent Hi BrentGMATPrepNow, Is there any property that states that a perpendicular bisector from C to AB will also pass through the center O? Else we will not be able to confirm the length 5*(root 3) is the same in the two triangles. I guess I am missing a trick here..Thanks! GMAT Club Legend Joined: 11 Sep 2015 Posts: 4999 GMAT 1: 770 Q49 V46 Re: The two lines are tangent to the circle.  [#permalink] ### Show Tags 26 Jul 2020, 06:06 Top Contributor harshbirsingh wrote: Hi BrentGMATPrepNow, Is there any property that states that a perpendicular bisector from C to AB will also pass through the center O? Else we will not be able to confirm the length 5*(root 3) is the same in the two triangles. I guess I am missing a trick here..Thanks! Yes, the perpendicular bisector from C to AB will pass through the center. _________________ If you enjoy my solutions, you'll love my GMAT prep course. Re: The two lines are tangent to the circle.   [#permalink] 26 Jul 2020, 06:06
3,468
10,601
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
4.28125
4
CC-MAIN-2020-34
latest
en
0.846682
https://documen.tv/question/ocean-waves-of-wavelength-22-m-are-moving-directly-toward-a-concrete-barrier-wall-at-4-6-m-s-the-24103662-13/
1,660,428,084,000,000,000
text/html
crawl-data/CC-MAIN-2022-33/segments/1659882571987.60/warc/CC-MAIN-20220813202507-20220813232507-00604.warc.gz
232,167,897
16,327
## Ocean waves of wavelength 22 m are moving directly toward a concrete barrier wall at 4.6 m/s . The waves reflect from the wall, and the inco Question Ocean waves of wavelength 22 m are moving directly toward a concrete barrier wall at 4.6 m/s . The waves reflect from the wall, and the incoming and reflected waves overlap to make a lovely standing wave with an antinode at the wall. (Such waves are a common occurrence in certain places.) A kayaker is bobbing up and down with the water at the first antinode out from the wall. Required: a. How far from the wall is she? b. What is the period of her up-and-down motion? in progress 0 7 months 2021-07-19T05:07:59+00:00 1 Answers 5 views 0 a) b) Explanation: From the question we are told that: Wavelength Velocity a) Generally the equation for distance between her and the wall d is mathematically given by Since The First Anti node distance is Therefore b) Generally the equation for her up-and-down motion is mathematically given by
248
1,005
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.265625
3
CC-MAIN-2022-33
latest
en
0.925629
https://edustrings.com/mathematics/1619001.html
1,624,544,128,000,000,000
text/html
crawl-data/CC-MAIN-2021-25/segments/1623488556133.92/warc/CC-MAIN-20210624141035-20210624171035-00526.warc.gz
216,515,256
6,811
3 June, 18:42 # Simple geometry can compute the height of an object from the object's shadow length and shadow angle using the formula: tan (angleElevation) = treeHeight / shadowLength. Given the shadow length and angle of elevation, compute the tree height. +2 1. 3 June, 19:58 0 Step-by-step explanation: if Tan (angle of Elevation) = Tree Height/Shadow Length Lets assume Tree height = x
101
394
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.78125
3
CC-MAIN-2021-25
latest
en
0.731637
https://www.smartkeeda.com/Quantitative_Aptitude/Arithmetic/Average_Level_1/newest/all/passage/Average_Quiz_13/
1,686,083,808,000,000,000
text/html
crawl-data/CC-MAIN-2023-23/segments/1685224653071.58/warc/CC-MAIN-20230606182640-20230606212640-00404.warc.gz
1,062,068,187
35,072
New Pattern Average Questions for LIC Assistant LIC AAO, CET | Download Average questions Free PDF at Smartkeeda. Directions : Read the following questions carefully and choose the right answer. Important for : 1 The average height of the first six students is 170 cm, the average height of the last eight students is 175 cm. The average height of the total 16 students is 180 cm. Find the average height of the rest two students. » Explain it D Sum of the heights of the first six students = 170 × 6 = 1020 cm Sum of the heights of the last eight students = 175 × 8 = 1400 cm Sum of the heights of the total 16 students = 180 × 16 = 2880 Sum of the height of the left 2 students = 2880 – 1020 – 1400 = 460 Average height of the left 2 students = 460 = 230 cm 2 Hence, option D is correct. 2 The average salary of each trainee in an startup is Rs. 90. The average salary of 16 trainees is Rs.708.75 and the average salary of the rest is Rs. 75. How many trainees does the startup have? » Explain it B Total salary of trainees = 16 × 708.75 = Rs. 11,340 Let there be x trainees. ∴ Total salary = Rs. (90x) and salary of remaining trainees = Rs. [75(x − 16)] ∴ 90x = 11340 + 75x − 1200 ∴ 15x = 10140 i.e. x = 676 Hence, option B is correct. 3 In a hostel, food is available for 200 students for 50 days. After 10 days, 50 more students join the hostel. For how many more days will the food last? » Explain it B Man days for which food is available = 200 × 50 = 10000 Available food is enough for 1 student for 10000 days Food used by 200 students in 10 days = 200 × 10 man days of food = 2000 Man days of food left = 10000 – 2000 = 8000 man days of food Total number of students now = 200 + 50 = 250 Remaining food can be used for 250 students for = 8000 days = 32 days 250 Hence, option B is correct. 4 The average weight of five friends P, Q, R, S, and T is (x + 6) kg while the average weight of R and T is (x – 6) kg. If the weight of another person U is also added, then average weight of all of them is reduced by 5 kg. Find the value of ‘x’ if average weight of P, Q, S and U is 94.5 kg. » Explain it D Total weight of friends P, Q, R, S and T = (x + 6) x 5 = 5 (x + 6) kg So, total weight of P, Q and S = 5 (x + 6) – 2 (x – 6) = (3x + 42) = 3 (x + 14) Weight of U = (x + 6 – 5) × 6 – 5 (x + 6) = 6 (x + 1) – 5 (x + 6) = (x – 24) kg According to the question, [3 (x + 14) + (x – 24)] = 94.5 × 4 4x + 18 = 378 4x = 360; x = 90 Hence, option D is correct. 5 A, B, C, D and E are five persons. The weight of A, B and C is 90%, 112% and 94% respectively of the average weight of all five. The ratio of weight of D and E is 6 : 11. The difference between the weight of D and E is 75kg. What is the average weight of al the five persons? » Explain it E Let the average weight of all five = 100k So, weight of A = 90k, B = 112k and C = 94k Let the weight of D = d and that of E = e 90k + 112k + 94k + d + e = 100k 5 d + e = 204k d : e = 6 : 11 → d = 6 × 204 = 72k → e = 132k 17 Difference = 132k – 72k = 60k 60k = 75 So, k = 75 = 1.25 60 Average weight of all the five persons = 100 × 1.25 = 125kg Hence ,option E is correct. You may also like to study Looking for any of the following? • High level Quant Questions for NIACL AO 2020 • High Level Quant Questions for IBPS PO 2020 • New Pattern Quant Questions for SBI PO 2020 • New Pattern Quant Questions for RBI Assistant 2020 • High Level Quant Questions for Bank PO Exams 2020 • Bank PO High level Quant Questions with Solutions • SBI PO 2020 High level Quant Questions • High level Quant Questions for IBPS RRB PO Mains • High level Quant Questions for SBI Clerk Mains • 100 High level Quant sets PDF for SBI PO 2020 • Bank PO High level Quant quizzes • High level Quant Quiz for SBI PO 2020 and SBI Clerk 2020 • High level Quant Quizzes with detailed explanation • High level Quant Free PDF download for Bank Clerk Exams 2020 • Unlimited High level Quant Quizzes for RRB PO 2020 • High level Quant Questions for IBPS PO Mains • High level Quant Questions for RRB Assistant Mains 2020 • Exam Level Quant Average Questions for SBI Clerk Mains 2020 • Exam level Quant Average Questions with detailed explanation for RBI Assistant 2020 • New Pattern Quant Average Free Download PDF for SBI PO Mains 2020 • New Pattern Quant Average Free Download PDF for IBPS PO Mains 2020 • IBPS Clerk 2020 High level Quant Average PDF • Quant Average PDF for IBPS Clerk 2020 • Quant High Level Quizzes for IBPS Clerk with Free PDF • IBPS Clerk Quant New Pattern Questions with Answers • Quant Average Mains Level Questions for SBI Clerk Mains 2020 with proper explanation • RRB PO High Level Quant Average Questions with Answers Free PDF • IBPS Clerk 2020 Quant Average Quizzes for Practice • IBPS Clerk 2020 Quant Average Sets for Practice • IBPS Clerk 2020 New pattern Quant Average Questions with detailed explanation • IBPS Clerk 2020 New pattern Data Interpretation Quizzes • Bank PO Quant Average Questions with Solutions • Bank Clerk Quant Average Questions with Solutions • High level Quant Average Sets for IBPS RRB PO Mains • High level Quant Average Sets for IBPS RRB Assistant • 100 Quant Average sets for IBPS PO • 100 Quant Average sets for RRB PO • 100 Quant Average sets for SBI PO • 100 Quant Average Sets for IBPS Clerk • 100 Quant Average sets for RRB Assistant • Quant Average Quiz for SBI PO prelims 2020 and RRB PO prelims 2020 • Quant Average Quiz for SBI Clerk mains • Quant Average Questions with detailed explanation for RBI Assistant Mains • How to solve Quant Average questions easily • SBI Clerk pre 2020 Quant Average sets for practice • RRB Assistant pre 2020 Quant Average sets for practice with detailed answers • High level Quant Average questions with explanation for RBI Assistant Mains • High level Quant Average Questions with explanation for IBPS SO Mains • RRB PO 2020 Quant Average Quizzes with Free PDF • SBI PO 2020 Quant Average Quizzes with Free PDF • Quant Average Questions with Answers PDF for BANK PO 2020 Exams • Quant Average Questions with Answers PDF for BANK Clerk Exams 2020 • Quant Average Quiz for RRB Assistant Mains • Quant Average Quiz for IBPS Clerk Mains • Quant High level Average PDF for IBPS SO Prelims If yes then you have landed at the right page. SBI PO 2020, RBI Assistant Mains and SBI Clerk Mains are round the corner and you must be leaving no stone unturned to crack your desired job. Average questions play a very important role in Quant section in prelims as well as mains. In prelims 2-3 questions can come from this section and in mains 5-10 questions in the form of DI or directly too. The key to master it is to practice latest pattern questions through quizzes and mocks. Smartkeeda provides the latest pattern questions in both quizzes and mocks. On this page we have shared all the most important questions with answers in the form of Quizzes and PDFs. You can take the Quizzes online and check your preparation. Practice Free Study Materials for SBI PO 2020 SBI Clerk 2020 RRB PO and RBI Assistant 2020, Get Quantative Aptitude Questions, Free PDF with explanation, learn how to solve mains level Data Interpretation problems fast, Get all types of Quant Questions and answers for all Bank PO exams at Smartkeeda. Take a free mock test of SBI Clerk Mains, SBI PO Prelims, RRB PO Prelims & RBI Assistant Mains and access your preparation level before the Exam Day. Regards Team Smartkeeda
2,124
7,453
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
4.1875
4
CC-MAIN-2023-23
latest
en
0.906431
http://www.markedbyteachers.com/gcse/science/the-the-molecular-formula-of-succinic-acid.html
1,585,452,022,000,000,000
text/html
crawl-data/CC-MAIN-2020-16/segments/1585370493684.2/warc/CC-MAIN-20200329015008-20200329045008-00190.warc.gz
271,185,228
19,734
• Join over 1.2 million students every month • Accelerate your learning by 29% • Unlimited access from just £6.99 per month Page 1. 1 1 2. 2 2 3. 3 3 4. 4 4 # The The Molecular Formula of Succinic acid Extracts from this document... Introduction The Molecular Formula of Succinic acid Problem 'Describe in detail how you would determine the relative formula mass of Succinic acid' The relative formula mass is the mass of 1 molecule of succinic acid compared with 1/12th of the mass of an atom of carbon-12. This is obtained by adding together the relative atomic masses of the atoms within the molecule according to its written formula. However we do not know the exact formula: HOOC(CH )nCOOH Where n is a whole number between 1 and 4 So to calculate the relative formula mass I must use the formula m = n �Mr and rearrange it to make Mr the subject Mr = m n However I do not know the number of moles for a given mass. I can calculate this by preparing a standard solution of the acid and performing a titration experiment. Firstly I would like to calculate a likely value of the relative formula mass given the information above. Suppose n = 3 then HOOC(CH ) COOH and Mr = 1+(2 x 16)+12+(3x12)+(3x2)+12+(2x16)+1 = 132 To perform the titration I have chosen to use equal concentrations of acid and alkali at 0.1mols/dm�. ...read more. Middle Once this has been completed I can proceed with the titration. In this experiment I will use a solution of Sodium Hydroxide to standardise my solution of Succinic acid. Equipment requirements include: * Distilled water wash bottle * Sodium Hydroxide (0.1mols/dm�) * Succinic acid (0.1mols/dm� approx.) * Phenolphalein indicator * Burette (50cm�) and stand * Conical flask (250cm�) * Pipette (25cm�) and filler * Small beaker and funnel It is a good idea to perform a rough titration to get an idea of where the end point will be. Firstly all the equipment must be thoroughly rinsed with distilled water to minimise the risk of impurities affecting the reaction. Then fill the burette with acid up to the 0 mark. This should be done below your head for example on a stool to prevent an accident. Pipette 25cm� of the sodium hydroxide solution into the conical flask and add two drops of indicator. Begin to slowly add the acid, continually swirling the mixture. As you near the end point add the acid drop wise so you know exactly when the reaction is complete and consequently gain more accurate results. When the whole solution has just turned completely pink then the reaction is complete and no more acid should be added. ...read more. Conclusion if your method of recording is not that reliable. Errors can occur with measurements using certain apparatus, the following are the maximum errors you may incur: 1dm� standard flask � 0.80 cm� 250cm� standard flask � 0.30cm� 25cm� pipette � 0.06 cm� 50cm� burette � 0.10cm� The value is the difference between two points for example using a 250cm� flask you might measure to 250.1cm� or 249.8cm�, a difference of 0.30cm�. Potential hazards and safety precautions Experiments involving acids and alkalis are always dangerous as both are corrosive but we can minimize the risks by following safety precautions. * Always wear safety goggles when near chemicals * Wear gloves when handling vessels containing acids or alkalis as both are corrosive, the severity of which depends on the concentration of the acid/alkali * When filling the burette bring it to below eye level to eliminate the risk of tipping acid on your head * Never 'suck up' a solution when filling a pipette * Don't low the last drop out of the pipette, the alkali it contains in this experiment is very harmful * Don't eat or drink around areas where acids or alkalis have been used. Don't eat after handling a vessel containing an acid or alkali without first washing your hands. ?? ?? ?? ?? ...read more. The above preview is unformatted text This student written piece of work is one of many that can be found in our GCSE Aqueous Chemistry section. ## Found what you're looking for? • Start learning 29% faster today • 150,000+ documents available • Just £6.99 a month Not the one? Search for your essay title... • Join over 1.2 million students every month • Accelerate your learning by 29% • Unlimited access from just £6.99 per month # Related GCSE Aqueous Chemistry essays 1. ## The Formula of Succinic Acid water to it; I will then carefully transfer the bulk of solute into the beaker stirring until all the solute has dissolved. This shouldn't take long as the sample of succinic acid is anhydrous and very soluble in water. To make sure I have all the acid I will wash 2. ## 'The Molecular Formula of Succinic Acid'. I must make sure I clean the balance with a fine brush assuming that it may not have been cleaned after the last time it was used and set the balance back to 0.00. I must also make sure I careful when using the spatula to add the white crystalline solid anhydrous succinic acid. 1. ## In order for me to obtain the value of 'n' in the formula: ... I have a fair amount of this solution so that it is enough for about 3 titrations with some remainder liquid left for the cleaning of the equipment In the other 250cm3 beaker I will pour the alkali solution in this case sodium hydroxide (NaOH) 2. ## Determine the relative formula mass and the molecular formula of succinic acid * Use a neat and dry pipette to add the last few cm3 of water-allowing a good control of water. * Seal the volumetric flask and shake it to ensure a homogeneous solution. * Label the beaker with correct concentration in moles.dm -3 (B) • Over 160,000 pieces of student written work • Annotated by experienced teachers • Ideas and feedback to
1,385
5,729
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.109375
3
CC-MAIN-2020-16
latest
en
0.89784
https://www.wyzant.com/resources/answers/282527/express_cos_4_2x_in_terms_of_cosine_with_an_exponent_of_1
1,601,260,660,000,000,000
text/html
crawl-data/CC-MAIN-2020-40/segments/1600401583556.73/warc/CC-MAIN-20200928010415-20200928040415-00352.warc.gz
1,083,474,969
13,757
John F. # Express cos^(4)2x in terms of cosine with an exponent of 1? Hi, this is my first time using this site. So I have been staring at this trigonometric equation for a long while and looking for what it asks for. For what I know, I think I have to use sum of difference identities, but I am not so sure where to begin from there. I know I am working for an answer of cosine, but then I am lost as to what identity I should use, or if I am using the right identity. I really appreciate any help for this problem and I thank you. Kenneth S. You have not given us an EQUATION.  You have an expression here. You should know that cos 2x = 2cos2x - 1. Therefore ½(1+cos 2x) = cos2x Using this idea, repeatedly, can give you an expression for the 4th power of cosine, in terms of cosine, degree one (the latter's argument being a multiple of the basic argument, x). Get it?  Good luck. Report 02/09/17 By: Tutor New to Wyzant Experienced General Mathematics Tutor ## Still looking for help? Get the right answer, fast. Get a free answer to a quick problem. Most questions answered within 4 hours. #### OR Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
315
1,213
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.109375
3
CC-MAIN-2020-40
latest
en
0.925133
https://www.gamedev.net/topic/455478-in-3d-finding-the-perpendicular-distance-of-a-point-to-a-line/
1,493,557,477,000,000,000
text/html
crawl-data/CC-MAIN-2017-17/segments/1492917125532.90/warc/CC-MAIN-20170423031205-00597-ip-10-145-167-34.ec2.internal.warc.gz
882,263,091
37,922
• FEATURED View more View more View more ### Image of the Day Submit IOTD | Top Screenshots ### The latest, straight to your Inbox. Subscribe to GameDev.net Direct to receive the latest updates and exclusive content. # In 3D, finding the perpendicular distance of a point to a line? Old topic! Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic. 7 replies to this topic ### #1johnnyBravo  Members Posted 12 July 2007 - 09:33 PM In 3D, I'm finding the perpendicular distance of a point to a line (consisting of a point and a direction vector). I've found two different ways, one using the dot product, distance between point on the line and using sin to find the length of the side aka the distance. the second was with the distance forumulae combined with the vector multiplied by an unknown, and i derive the the equation to find the min of the unknown which subbed into the dist forumale to get the distance. My problem is I feel there should be much a simpler solution to this. Is there another simpler way of doing this? thx ### #2Ezbez  Members Posted 12 July 2007 - 09:55 PM 1). Find slope of line perpendicular to the line, call it pm 2). Create a line that goes through the point and has a slope of pm 3). Intersect this new line and the original line 4). Find distance between the intersection point and the original point Of course, it's a bit more than four steps when you do it out in code, but it shouldn't be bad. Edit: Oh gods, I forgot step 4! How could I do that? ### #3johnnyBravo  Members Posted 12 July 2007 - 11:31 PM Isn't that just for 2D? ### #4scgames  Members Posted 13 July 2007 - 02:02 AM Quote: Original post by johnnyBravoIsn't that just for 2D? Yeah (also, even in 2D I wouldn't recommend approaching this sort of problem in terms of slopes). The equation to find the closest point on a line to a point (in any dimension) is: closest = O + ((P-O).D)/(D.D) * DWhere:P is the query pointO is the line originD is the line direction There are several ways to derive this, one of which is as a minimization problem (which I assume is what you were referring to earlier). However you derive it though, I don't think there's any simpler solution than the above. ### #5johnnyBravo  Members Posted 13 July 2007 - 02:19 AM Ah ok. Quote: Original post by jyk [code=auto:0]((P-O).D)/(D.D) The 2 was from in the distance formulae part eg (2*b)*t + (c^2)*t^2 Or am I wrong? thx ### #6scgames  Members Posted 13 July 2007 - 02:28 AM Quote: Original post by johnnyBravo Ah ok. Quote: Original post by jyk [code=auto:0]((P-O).D)/(D.D) The 2 was from in the distance formulae part eg (2*b)*t + (c^2)*t^2 Or am I wrong? thx Yeah, it looks like you've got an extra '2' in there. I'll sketch out the derivation here (very informally) so you can compare it to yours: f(P) = (P-(O+tD))^2 f(P) = (P-O-tD)^2 d = P-O f(P) = (d-tD)^2 f(P) = D^2t^2-2dDt+d^2 f'(P) = 2D^2t - 2dD 2D^2t - 2dD = 0 2D^2t = 2dD D^2t = dD t = dD/D^2 ### #7relsoft  Members Posted 13 July 2007 - 02:33 AM The above equation Jyk made is the simplest one I could imagine. What the equation does is this: 1. Get vector from O to P 2. Project the OP vector to line(vector) D , which would drop a perpendicular from point P to line D. 3. Now the projection would give you the component(a distance) of the OP vector from O to P parallel to D. I hope you could understand me. 4. The return depends on where P lies. Left or right of the line. ### #8johnnyBravo  Members Posted 13 July 2007 - 02:53 AM Quote: Original post by jykf(P) = D^2t^2-2dDt+d^2f'(P) = 2D^2t - 2dD Ah I forgot to multiply it by 2 when I derived the t^2 Thanks! Old topic! Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
1,182
3,951
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.65625
4
CC-MAIN-2017-17
latest
en
0.921182
https://pt.scribd.com/document/75838148/Ultrasonic-Sensor-Test
1,585,914,857,000,000,000
text/html
crawl-data/CC-MAIN-2020-16/segments/1585370510846.12/warc/CC-MAIN-20200403092656-20200403122656-00150.warc.gz
649,193,233
71,403
Você está na página 1de 5 # ULTRASONIC SENSOR TEST 1) The effect of changing the angle of an object towards ultrasonic sensor reading Objective: To identify the effect of changing the angles of an object towards the data recorded from ultrasonic sensor. Procedures: 1- Set the actual distance between object and ultrasonic sensor to be 9 inch. 2- Position the object in front of the sensor with the angle of an object to the sensor is set to 50. 3- Record distance of an object by using ultrasonic sensor. 4- Repeat the procedures by changing the angle to 70, 90, 110 and 130 respectively. ## Position B (angle 110) Position C (angle 90) Position D (angle 70) Ultrasonic sensor ## Table 1: The distance of an object at different angles Discussion: The results show that ultrasonic sensor only read the actual distance at the angle of 90. As the angle decrease or increase by 20, the angle also increases by one inch. The sensor will not collect data once the object is position at angle less than 50 or more than 130. Conclusion: The change in angle between object and ultrasonic sensor would affect the reading of the sensor. 2) Ultrasonic Sensor Sensitivity Test a) Two objects at different position but have same distance from ultrasonic sensor. 8 inch Object A ## 8 inch Ultrasonic sensor Object Object B Figure 2: Object positioning from ultrasonic sensor Objective: To determine the distance recorded by ultrasonic sensor when two object is position at same distance but different angle from the sensor. Procedures: 1- Position 2 objects in front of ultrasonic sensor with both have same distance (8 inch) but different angle from the sensor. Record distance of an object by using ultrasonic sensor. 2- Results: The distance recorded by ultrasonic sensor show that the distance between both object is equal to 8 inch which is the actual distance between the objects and sensor. Discussion: When two objects is position at the same distance but different angle, ultrasonic sensor would read the actual distance between objects and sensor. Conclusion: Ultrasonic sensor record the actual distance when two objects is position at the same distance but different angle from the sensor. 8 inch Object A ## 10 inch Ultrasonic sensor Object Object B Figure 3: Object positioning from ultrasonic sensor Objective: To determine the distance recorded by ultrasonic sensor when two object is position at different distance and angle from the sensor. Procedures: 1Position 2 objects in front of ultrasonic sensor with one close to the sensor while another 2- ## Record distance of an object by using ultrasonic sensor. Results: Ultrasonic sensor only read the distance of an object which close to it and ignore the object which is far from it. Ultrasonic sensor record the distance as 8 inch instead of 10 inch. Discussion: When two objects was position with one close to the sensor while another object is far from sensor, ultrasonic sensor would only read the distance of an object nearer to it. Conclusion: Ultrasonic sensor only considers the distance of an object that is nearer to it.
656
3,113
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.234375
3
CC-MAIN-2020-16
latest
en
0.857072
https://learnsoc.org/math-worksheet/fraction-math-worksheets-5/
1,547,792,092,000,000,000
text/html
crawl-data/CC-MAIN-2019-04/segments/1547583659890.6/warc/CC-MAIN-20190118045835-20190118071835-00104.warc.gz
569,735,380
13,442
Browse All Plans Just Plans # Fraction Math Worksheets 2ndde Practice Finding Half Number Line Worksheet Generator Long Division For 1stders Pdf Kids By Creissant Beaudoin at December 20 2018 11:12:36 Point is, whatever it takes to get students actively involved with the reviewing process where they are not bored and effectively reviewing grade level material in order to prepare them for state or quarterly assessments. In other words, they never memorized their multiplication tables! Many times I have seen a student do poorly due to a weakness in basic math facts they should have learned in third grade. How much of an apple pie has been eaten? The answer to this question can be expressed in percentages, 50%; or in decimals, 0.5; or in fraction, ½. In other words, half of mom's delicious apple pie is gone. When you're teaching your student to write, there are a whole host of worksheets online that you can use. Many of these include clipart that will help the students learn the sounds of letters and letter combinations. There are other sheets that help the student learn to write his or her numbers. It's helpful having printable worksheets for something like this, because parents often go through quite a few of these before the child masters writing the numbers or letters correctly. Once you have a scope and sequence book, make a list of each area in math that he needs to work on for the school year. For example for grades three and four, by the end of the year in subtraction, your child should be able to:
323
1,535
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.859375
3
CC-MAIN-2019-04
longest
en
0.960181
http://stackoverflow.com/questions/7444242/special-integer-conversion/7444548
1,440,939,747,000,000,000
text/html
crawl-data/CC-MAIN-2015-35/segments/1440644065306.42/warc/CC-MAIN-20150827025425-00084-ip-10-171-96-226.ec2.internal.warc.gz
224,402,202
19,312
# Special integer conversion Is it possible to convert an integer in 4 position varchar.. Example I have the integer 1 and I get varchar '0001', for integer 550 I get varchar '0550' . Thanks - What should happen to integer `99999`? or integer `-9999`? Or are we guaranteed between `0-9999`? –  Martin Smith Sep 16 '11 at 11:52 Have a look at this question, not an exact duplicate but could help. –  Jacob Sep 16 '11 at 11:53 This question also could help you. –  denolk Sep 16 '11 at 11:54 @Martin this field is between 1 and 9999 –  bAN Sep 16 '11 at 11:59 or this ? ``````right('000'+ convert(varchar,MyNum),4) `````` I just did some rough timings on the various methods and this solution seemed to be a little quicker than the others. That surprised me ... ``````DECLARE @loop INT; DECLARE @MyNum INT; DECLARE @Upper INT; DECLARE @Lower INT; DECLARE @result VARCHAR; DECLARE @start DATETIME; SET @Lower = 1; SET @Upper = 9999; SET @loop = 10000; SET @start = GETDATE(); WHILE @loop > 0 BEGIN SELECT @MyNum = ROUND(((@Upper - @Lower -1) * RAND() + @Lower), 0); SET @loop = @loop -1; SET @result = right('000'+ convert(varchar,@MyNum),4); -- SET @result = right(10000 + @MyNum, 4); -- SET @result = right(convert(float, @MyNum) / 10000, 4); -- SET @result = stuff('0000', 1 + 4 - len(@MyNum), len(@MyNum), @MyNum); -- SET @result = replace(str(@MyNum, 4), ' ', '0'); END; SELECT GETDATE() - @start; `````` - I wonder if this might be quicker ...select right(convert(float, MyNum) / 10000, 4) –  Hugh Jones Sep 16 '11 at 12:58 IF it is better then Mikael's answer below is probably better still. –  Hugh Jones Sep 16 '11 at 13:09 Try this : ``````SELECT REPLACE(STR(550, 4), ' ', '0') `````` ! - ``````declare @Num int set @Num = 1 select right(10000+@Num, 4) `````` - Onw way (NULL if len input > 4); ``````;with t(f) as ( select 1 union select 11 union select 111 union select 1111 ) select f, stuff('0000', 1 + 4 - len(f), len(f), f) from t >> f (No column name) 1 0001 11 0011 11 0111 1111 1111 `````` -
677
2,047
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.03125
3
CC-MAIN-2015-35
latest
en
0.690902
https://www.slideserve.com/yonah/a-salt-baso-4-s-is-placed-in-water
1,702,218,458,000,000,000
text/html
crawl-data/CC-MAIN-2023-50/segments/1700679102469.83/warc/CC-MAIN-20231210123756-20231210153756-00109.warc.gz
1,084,935,810
22,357
1 / 19 # A salt, BaSO 4 (s), is placed in water A salt, BaSO 4 (s), is placed in water At first, the only process occurring is the dissolving of the salt - the dissociation of the salt into its ions. However, soon the ions floating in the water begin to collide with the salt crystal and are “pulled back in” to the salt. ( precipitation ) ## A salt, BaSO 4 (s), is placed in water E N D ### Presentation Transcript 1. A salt, BaSO4(s), is placed in water • At first, the only process occurring is the dissolving of the salt - the dissociation of the salt into its ions. • However, soon the ions floating in the water begin to collide with the salt crystal and are “pulled back in” to the salt. (precipitation) • Eventually the rate of dissociation is equal to the rate of precipitation. • The solution is now “saturated”. It has reached equilibrium. 2. Na+ and Cl -ions surrounded by water molecules NaCl Crystal Solubility Equilibrium: Dissociation = Precipitation In a saturated solution, there is no change in amount of solid precipitate at the bottom of the beaker. Concentration of the solution is constant. The rate at which the salt is dissolving into solution equals the rate of precipitation. Dissolving NaCl in water 3. Dissolving silver sulfate, Ag2SO4, in water • When silver sulfate dissolves it dissociates into ions. When the solution is saturated, the following equilibrium exists: Ag2SO4(s) 2 Ag+(aq) + SO42-(aq) • Since this is an equilibrium, we can write an equilibrium expression for the reaction: Ksp = [Ag+]2[SO42-] Notice that the Ag2SO4 is left out of the expression! Why? 4. Writing solubility product expressions... • For each salt below, write a balanced equation showing its dissociation in water. • Then write the Ksp expression for the salt. Iron (III) hydroxide, Fe(OH)3 Nickel sulfide, NiS Silver chromate, Ag2CrO4 Zinc carbonate, ZnCO3 Calcium fluoride, CaF2 5. Calculating Ksp of Silver Chromate • A saturated solution of silver chromate, Ag2CrO4, has [Ag+] = 1.3 x 10-4 M. What is the Ksp for Ag2CrO4? Ag2CrO4(s) 2 Ag+(aq) + CrO42- (aq) ---- ---- 1.3 x 10-4 M Ksp = [Ag+]2[CrO42-] Ksp= (1.3 x 10-4 )2 (6.5 x 10-5) = 1.1 x 10-12 6. Calculating the Ksp of silver sulfate • The solubility of silver sulfate is 0.014 mol/L. This means that 0.0144 mol of Ag2SO4 will dissolve to make 1.0 L of saturated solution. Calculate the value of the equilibrium constant, Ksp for this salt. Ag2SO4(s) 2 Ag+(aq) + SO42-(aq) --- --- + 2s + s 2s s Ksp = [Ag+]2[SO42-] = (2s)2(s) = (4s2)(s) = 4s3 We know: s = 0.0144 mol/L Ksp = 4(0.0144)3 = 1.2 x 10-5 7. Molar Solubility • The solubility of a substance can be expressed as a molar solubility. • Molar solubility = the amount (in moles) of solute in 1 L of a saturated solution. • It is sometimes expressed as the mass (in grams) of solute dissolved in 100 g of water. • Since density of water is 1 g/ml at 25 oC, this value is also the mass (in grams) of solute in 100 ml of water. 8. Calculating solubility, given Ksp • The Ksp of NiCO3 is 1.4 x 10-7 at 25°C. Calculate its molar solubility. NiCO3(s) Ni2+(aq) + CO32-(aq) --- --- + s + s s s Ksp = [Ni2+][CO32-] 1.4 x 10-7 = s2 s = = 3.7 x 10-4 M 9. Other ways to express solubility... • We just saw that the solubility of nickel (II) carbonate is 3.7 x 10-4 mol/L. What mass of NiCO3 is needed to prepare 500 mL of saturated solution? 0.022 g of NiCO3 will dissolve to make 500 mL solution. 10. Calculate the solubility of MgF2 in water. What mass will dissolve in 2.0 L of water? MgF2 (s)  Mg2+ (aq) + 2 F- (aq) ---- ---- + s + 2s s 2s Ksp = [Mg2+][F-]2 = (s)(2s)2 = 4s3 Ksp = 7.4 x 10-11 = 4s3 s = 2.6 x 10-4 mol/L 11. Solubility and pH • Calculate the pH of a saturated solution of silver hydroxide, AgOH. Refer to the table in your booklet for the Ksp of AgOH. AgOH (s) Ag+(aq) + OH-(aq) ---- ---- + s + s s s Ksp = 2.0 x 10-8 = [Ag+][OH-] = s2 s = 1.4 x 10-4 M = [OH-] pOH = - log (1.4 x 10-4) = 3.85 pH = 14.00 - pOH = 10.15 12. The Common Ion Effect on Solubility The solubility of MgF2 in pure water is 2.6 x 10-4 mol/L. What happens to the solubility if we dissolve the MgF2 in a solution of NaF, instead of pure water? 13. Calculate the solubility of MgF2 in a solution of 0.080 M NaF. MgF2 (s)  Mg2+ (aq) + 2 F- (aq) ---- 0.080 M + s + 2s s 0.080 + 2s Ksp = 7.4 x 10-11 = [Mg2+][F-]2 = (s)(0.080 + 2s)2 Since Ksp is so small…assume that 2s << 0.080 7.4 x 10-11 = (s)(0.080)2 s = 1.2 x 10-8 mol/L 14. Explaining the Common Ion Effect The presence of a common ion in a solution will lower the solubility of a salt. • Le Chatelier’s Principle: The addition of the common ion will shift the solubility equilibrium backwards. This means that there is more solid salt in the solution and therefore the solubility is lower! 15. Ksp and Solubility • Generally, it is fair to say that salts with very small solubility product constants (Ksp) are only sparingly soluble in water. • When comparing the solubilities of two salts, however, you can sometimes simply compare the relative sizes of their Ksp values. • For example… CuI has Ksp = 5.0 x 10-12 and CaSO4 has Ksp = 6.1 x 10-5. Since the Ksp for calcium sulfate is larger than that for the copper (I) iodide, we can say that calcium sulfate is more soluble. 16. Mixing Solutions - Will a Precipitate Form? If 15 mL of 0.024-M lead nitrate is mixed with 30 mL of 0.030-M potassium chromate - will a precipitate form? Pb(NO3)2 (aq) + K2CrO4 (aq)  PbCrO4 (s) + 2 KNO3 (aq) 17. Pb(NO3)2(aq) + K2CrO4(aq) PbCrO4(s) + 2 KNO3(aq) Step 1: Is a sparingly soluble salt formed? We can see that a double replacement reaction can occur and produce PbCrO4. Since this salt has a very small Ksp, it may precipitate from the mixture. The solubility equilibrium is: PbCrO4(s) Pb2+(aq) + CrO42-(aq) Ksp = 2 x 10-16 = [Pb2+][CrO42-] If a precipitate forms, it means the solubility equilibrium has shifted BACKWARDS. This will happen only if Qsp > Ksp in our mixture. 18. Step 2: Find the concentrations of the ions that form the sparingly soluble salt. Since we are mixing two solutions in this example, the concentrations of the Pb2+ and CrO42- will be diluted. We have to do a dilution calculation! Dilution: C1V1 = C2V2 [Pb2+] = [CrO42-] = 19. Step 3: Calculate Qsp for the mixture. Qsp = [Pb2+][CrO42-] = (0.0080 M)(0.020 M) Qsp = 1.6 x 10-4 Step 4: Compare Qsp to Ksp. Since Qsp >> Ksp, a precipitate will form when the two solutions are mixed! Note: If Qsp = Ksp, the mixture is saturated If Qsp < Ksp, the solution is unsaturated Either way, no ppte will form! More Related
2,197
6,574
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.140625
3
CC-MAIN-2023-50
latest
en
0.898096
http://www.javaprogrammingforums.com/%20java-theory-questions/6592-solve-them-please-printingthethread.html
1,526,948,035,000,000,000
text/html
crawl-data/CC-MAIN-2018-22/segments/1526794864572.13/warc/CC-MAIN-20180521235548-20180522015548-00001.warc.gz
399,384,593
3,554
# Solve Them Please • December 25th, 2010, 03:19 PM omath Hi everybody My english is not good. I have 4 problems must be solved. These are my assignments and I don't have enough time to solve them all. I ask you to solve them. These are the problems: 2. (Date Class) Create class Date with the following capabilities: a) Output the date in multiple formats, such as MM/DD/YYYY June 14, 1992 DDD YYYY b) Use overloaded constructors to create Date objects initialized with dates of the formats in part (a). In the first case the constructor should receive three integer values. In the second case it should receive a String and two integer values. In the third case it should receive two integer values, the first of which represents the day number in the year. [Hint: To convert the string representation of the month to a numeric value, compare strings using the equals method. For example, if s1 and s2 are strings, the method call s1.equals( s2 ) returns true if the strings are identical and otherwise returns false.] 3. (Rational Numbers) Create a class called Rational for performing arithmetic with fractions. Write a program to test your class. Use integer variables to represent the private instance variables of the class—the numerator and the denominator. Provide a constructor that enables an object of this class to be initialized when it is declared. The constructor should store the fraction in reduced form. The fraction 2/4 is equivalent to 1/2 and would be stored in the object as 1 in the numerator and 2 in the denominator. Provide a no-argument constructor with default values in case no initializers are provided. Provide public methods that perform each of the following operations: a) Add two Rational numbers: The result of the addition should be stored in reduced form. b) Subtract two Rational numbers: The result of the subtraction should be stored in reduced form. c) Multiply two Rational numbers: The result of the multiplication should be stored in reduced form. d) Divide two Rational numbers: The result of the division should be stored in reduced form. e) Print Rational numbers in the form a/b, where a is the numerator and b is the denominator. f) Print Rational numbers in floating-point format. (Consider providing formatting capabilities that enable the user of the class to specify the number of digits of precision to the right of the decimal point.) 4. (Huge Integer Class) Create a class HugeInteger which uses a 40-element array of digits to store integers as large as 40 digits each. Provide methods input, output, add and subtract. For comparing HugeInteger objects, provide the following methods: isEqualTo, isNotEqualTo, isGreaterThan, isLessThan, isGreaterThanOrEqualTo and isLessThanOrEqualTo. Each of these is a predicate method that returns true if the relationship holds between the two HugeInteger objects and returns false if the relationship does not hold. Provide a predicate method isZero. If you feel ambitious, also provide methods multiply, divide and remainder. [Note: Primitive boolean values can be output as the word “true” or the word “false” with format specifier %b.] 5. Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as the superclass of the hierarchy. Make the hierarchy as deep (i.e., as many levels) as possible. Specify the instance variables and methods for each class. The private instance variables of Quadrilateral should be the x-y coordinate pairs for the four endpoints of the Quadrilateral. Write a program that instantiates objects of your classes and outputs each object’s area (except Quadrilateral). And this is its pdf file: http://cw.sharif.edu/file.php/661/hw4.pdf hw4 pdf
827
3,744
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.71875
3
CC-MAIN-2018-22
latest
en
0.892109
https://studysoup.com/tsg/567674/holt-physics-student-edition-2009-1-edition-chapter-1-3-problem-3
1,580,208,435,000,000,000
text/html
crawl-data/CC-MAIN-2020-05/segments/1579251778168.77/warc/CC-MAIN-20200128091916-20200128121916-00116.warc.gz
664,062,841
11,933
× # Which of the following is the best order-of-magnitude ISBN: 9780030368165 258 ## Solution for problem 3 Chapter 1.3 Holt Physics: Student Edition 2009 | 1st Edition • Textbook Solutions • 2901 Step-by-step solutions solved by professors and subject experts • Get 24/7 help from StudySoup virtual teaching assistants Holt Physics: Student Edition 2009 | 1st Edition 4 5 0 291 Reviews 21 0 Problem 3 Which of the following is the best order-of-magnitude estimate in meters of the height of a mountain? a. 1 m b. 10 m c. 100 m d. 1000 m Step-by-Step Solution: Step 1 of 3 r nnntl(S in lprne v\t lSu',rf fIurn & wHCve rnovt v uftlYrrre whdf f wt lrrupre nat{"s pllfion offlt* ) tl ttx obitcl i:il YI h- 6goc,'t*kdv*lY!... Step 2 of 3 Step 3 of 3 ##### ISBN: 9780030368165 Since the solution to 3 from 1.3 chapter was answered, more than 219 students have viewed the full step-by-step answer. Holt Physics: Student Edition 2009 was written by and is associated to the ISBN: 9780030368165. The answer to “Which of the following is the best order-of-magnitude estimate in meters of the height of a mountain? a. 1 m b. 10 m c. 100 m d. 1000 m” is broken down into a number of easy to follow steps, and 29 words. The full step-by-step solution to problem: 3 from chapter: 1.3 was answered by , our top Physics solution expert on 01/19/18, 04:35PM. This textbook survival guide was created for the textbook: Holt Physics: Student Edition 2009, edition: 1. This full solution covers the following key subjects: . This expansive textbook survival guide covers 12 chapters, and 143 solutions. #### Related chapters Unlock Textbook Solution Which of the following is the best order-of-magnitude ×
503
1,704
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.328125
3
CC-MAIN-2020-05
latest
en
0.854185
https://www.jiskha.com/display.cgi?id=1334073002
1,516,342,463,000,000,000
text/html
crawl-data/CC-MAIN-2018-05/segments/1516084887746.35/warc/CC-MAIN-20180119045937-20180119065937-00480.warc.gz
907,112,144
3,923
# calculus posted by . assume that is the rate of change of the unit price of a commodity is proportional to the diference between the demand and the supply, so that dp/dt=k (D-S) where k is a constant of proportionalily. suppose that D=40-2p, S=5+3p, and P(0)=4. find a formula for p(t) ## Similar Questions 1. ### Economics help What is the short-run effect on the exchange rate of an increase in domestic real GNP, given expectations about future exchange rates? 2. ### Survey of Calculus (Algebra too) For the supply equations, where X is the quantity supplied in units of a thousand and P is the unit price in dollars, (A.)- sketch the supply curve and (B.)- determine the price at which the supplier will make 2000 units of the commodity … 3. ### Math The pric of a certain commodity is a function of supply and demand. The table below shows the price of commodity per barrel between 1995 and 2000. Find the average anual rate of change between 1998 and 2000. Year Price/barrel 1995 … 4. ### math The price of a certain commodity is a function of supply and demand. The table below shows the price of commodity per barrel between 1995 and 2000. Find the average anual rate of change between 1998 and 2000. Year Price/barrel 1995 … 5. ### math supply and demand: for a certain commodity the supply equation is given by S=2p+5 at a price o \$1, there is a demand for 19 units of the commodity. If the demand equation is linear and the market price is \$3, find the demand equation A price (in dollars) and demand for a product are related by 2x^2-5xp+50p^2=21200 If the price is increasing at a rate of 2 dollars per month when the price is 20 dollars, find the rate of change of the demand. Rate of change of demand … 7. ### Math Could someone work this question out so I understand it. Thanks The marginal price dp/dx at x units of demand per week is proportional to the price p. There is no weekly demand at a price of \$100 per unit [p(0)=100], and there is a … 8. ### Calculus The demand function for the Luminar desk lamp is given by the following function where x is the quantity demanded in thousands and p is the unit price in dollars. p = f(x) = -0.1x2 - 0.3x + 39 (a) Find f '(x). f '(x) = (b) What is … 9. ### Math For a certain commodity the supply equation is given by S=2p+5 At a price of \$1,there is a demand for 19units of the commodity.If the demand equation is linear and the market price is \$3,find the demand equation? 10. ### Calculus II Assume that the rate of change of the unit price of a commodity is propirtional to the difference between the demand and the supply, so that dp/dt = k(D-S) where k is a constant of proportionality. Suppose that D = 72-5p, S = 9 + 2P, … More Similar Questions
719
2,739
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.046875
3
CC-MAIN-2018-05
latest
en
0.892857
https://www.cnccookbook.com/gdt-symmetry-symbol-tolerance-measurement/
1,726,167,135,000,000,000
text/html
crawl-data/CC-MAIN-2024-38/segments/1725700651491.39/warc/CC-MAIN-20240912174615-20240912204615-00279.warc.gz
667,629,758
63,361
Easy Guide to GD&T – Symmetry [ Symbol, Tolerance, Measurement ] GD&T Symmetry Symbol Definition of Symmetry In GD&T, Symmetry is a 3D tolerance that is used to ensure that two features on a part are symmetrical across a daum plane. Put another way, Symmetry establishes a tolerance zone for the median points of non-cylindrical part features. Those median points are the points halfway between the two features and must lie within a certain distance of the datum plane. While designers often create symmetrical parts, GD&T’s Symmetry may not be the best approach. Like concentricity, other tolerances such as position, parallelism, or straightness are preferred over symmetry because it’s difficult and time-consuming to establish median points with measuring equipment. Wherever possible, it is therefore preferable to use another form of GD&T tolerance. Symmetry Callout on Drawings Symmetry callout… The Symmetry callout above is for a notch in a rectangular part. It species that the notch must be symmetrical about the Datum Plan “A”, which is a plane at the midpoint of the top and bottom of the part.. Symmetry Tolerance Zone Continuing with the example above, Symmetry controls how much the distance between any median point and the ideal datum plane may vary, hence it establishes a tolerance zone that looks like two planes symmetrical about the datum plane and whose distance apart is the Symmetry tolerance. Every median point on the feature must fall within that tolerance zone. Gaging and Measurement of Symmetry Measuring Symmetry is difficult because it relies on the measurement of a derived feature rather than on the measurement of an actual surface on the part. In practice, measuring Symmetry requires taking many measurements (as many as is realistic) to establish the theoretical central plane of symmetry. The surface must be mapped as well as possible and the median points calculated. That process is so time consuming that typically Symmetry is only measured using a coordinate measuring machine (CMM) or other automated approach, such as a probe. Recently updated on March 9th, 2023 at 04:07 pm
438
2,136
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.234375
3
CC-MAIN-2024-38
latest
en
0.920211
https://mail.scipy.org/pipermail/numpy-discussion/2005-November/017829.html
1,495,953,545,000,000,000
text/html
crawl-data/CC-MAIN-2017-22/segments/1495463609605.31/warc/CC-MAIN-20170528062748-20170528082748-00486.warc.gz
957,328,222
1,978
# [Numpy-discussion] Re: help in improving data analysis code gf gyromagnetic at gmail.com Fri Nov 25 14:19:00 CST 2005 ```From: Francesc Altet <faltet at ca...> Re: help in improving data analysis code 2005-11-25 07:32 >>A Divendres 25 Novembre 2005 16:27, Francesc Altet va escriure: > > print nn[argsort(abs(nn_c-nn_c.mean()),0)][:-int(sz*0.10),0] >> >> Ups. I have had a confusion. This should work better ;-) >> >> print nn[argsort(abs(nn-nn.mean()),0)][:-int(sz*0.10),0] Hi Francesc, Thank you for the suggestions. Your code is performing a different task than mine was. In particular, I believe it does not 're-mean' the data after removing each point. However, based on the great ideas from your code, I now have the function below that looks to be more efficient (although I haven't measured it). -g ==== from numarray import argsort, floor, absolute def eliminate_outliers(data,frac): num_to_eliminate = int(floor(data.size())*frac) for i in range(num_to_eliminate): data = data[argsort(absolute(data-data.mean()),0)][:-1,0] return data if __name__ == "__main__": from numarray.mlab import rand sz = 100 nn = rand(sz,1) nn[:10] = 20*rand(10,1) nn[sz-10:] = -20*rand(10,1) print eliminate_outliers(nn,0.10) ```
376
1,239
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.703125
3
CC-MAIN-2017-22
longest
en
0.691567
http://mathonmonday.com/ABE%20Resources.htm
1,555,829,118,000,000,000
text/html
crawl-data/CC-MAIN-2019-18/segments/1555578530253.25/warc/CC-MAIN-20190421060341-20190421082341-00533.warc.gz
118,582,263
4,614
TUTOR Math Web Resources Syllabus Super Money Tutorial Provided By Courtney Phillips and her class of growing mathematicians. Activities 01match numbers 02 match numbers II 03number speedspell 04co numbers jigsaw 05numbers match 06number speedspell 07counting coins Super Money Tutorial 09arithmattack 10the counting story 11count your Chickens 12numerals matching 13time matching I 14time matching II 15timed +-x/ flashcards 16Skills Practice IXL 17Mental Math 18 Super Excel Stuff 19mathdrills 20Primary Resources 21Multiplication Practice 22Number Bonds 10 23Visual Fractions 24NumeracyWorld 25Virtual Manipulatives 26Fraction Frenzy 27Ruler Game 28Measure It 29Tape measure 30Geoboard 31Stopwatch 32Math Worksheets 33Algebra PPT 34Algebra Lessons 35Pay Stub 36Practice Tables 37Teaching Kids Money 38Fourth Grade Class GED Practice Sites 01GED test 1 02 GED Test 2 03 GED For Free 04 Flashcards(Aplusmath) Timed Flashcards(Vkids) vocabulary builder X Flashcards(Automatic) Math Lab(Nussbaum) Divisibility Rules(Vkids) ArithmAttack Fraction Drill 1 Factor Tree Division Bingo Math.com Place Value/Rounding Equivalent Fractions HotMath.com Multiplication Grid SOS Math Mental Addition/Sutraction Graph Paper/Number lines Order of Operations Practice Math Worksheets Function Machine 1 Function Machine 2 +/- Integer Operations Math Glossary Estimation Skills Shodor Interactive Cut-The Knot Math Playground Decimal Lessons Visual Fractions Decimal Jeopardy Ratio Proportions Lessons POST ABE RESOURCES Download Virtual Calc Math Placement Test Algebra Tutor J YouTubeFastMath OHM Zone Math Placement Test 2 Thinking Blocks Quick Math Tools Calculator Lessons xFunctions Using A Protractor Algebra Tools Pre-Calculus Supplement J OHM Zone Thinking Blocks Quick Math Tools Calculator Lessons xFunctions Using A Protractor
426
1,831
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.609375
3
CC-MAIN-2019-18
longest
en
0.522101
https://www.mapleprimes.com/users/ComputerUser/replies?page=44
1,725,914,320,000,000,000
text/html
crawl-data/CC-MAIN-2024-38/segments/1725700651157.15/warc/CC-MAIN-20240909201932-20240909231932-00895.warc.gz
824,327,668
42,084
535 Reputation 11 years, 278 days Social Networks and Content at Maplesoft.com Seldom to ask question after retired math hobby Just waiting for beauty who born in 1994 And waited for her email to mavio@protonmail.com What is the difference in ownership among different universe? https://skydrive.live.com/redir?resid=E0... https://skydrive.live.com/redir?resid=E0ED7271C68BE47C!293 https://skydrive.live.com/redir?resid=E0ED7271C68BE47C!292 here it is, once you got it, tell me, i will delete it after you got it. i think this because chapter 3 page 86 ... i think this because chapter 3 page 86 3.2.1 said  z-transform of this network can be written as rational function (3.1) i think this because chapter 3 page 86 ... i think this because chapter 3 page 86 3.2.1 said  z-transform of this network can be written as rational function (3.1) the general case result (2) still has zt... the general case result (2) still has ztrans, it should be a simple rational function the general case result (2) still has zt... the general case result (2) still has ztrans, it should be a simple rational function if it is impossible, how arthur derive t... if it is impossible, how Author derive this? need transformation? i see that they are quite similar, like just need a few more steps, then success can it be manually done by observation using below script restart; n := 1: rodrigues := exp(x)*(x^alpha)/n!*diff(exp(-x)*(x^(n+alpha)), x\$n): rodrigues := subs(x=2*p, rodrigues): rodrigues := subs(alpha=1/2, rodrigues): rodrigues1 := factor(simplify(rodrigues)); n := 2: rodrigues := exp(x)*(x^alpha)/n!*diff(exp(-x)*(x^(n+alpha)), x\$n): rodrigues := subs(x=2*p, rodrigues): rodrigues := subs(alpha=1/2, rodrigues): rodrigues2 := factor(simplify(rodrigues)); n := 3: rodrigues := exp(x)*(x^alpha)/n!*diff(exp(-x)*(x^(n+alpha)), x\$n): rodrigues := subs(x=2*p, rodrigues): rodrigues := subs(alpha=1/2, rodrigues): rodrigues3 := factor(simplify(rodrigues)); -(4 p - 3) p 1   /    2            \ - p \16 p  - 40 p + 15/ 4 1    /    3        2              \ - -- p \64 p  - 336 p  + 420 p - 105/ 24 if it is impossible, how arthur derive t... if it is impossible, how Author derive this? need transformation? i see that they are quite similar, like just need a few more steps, then success can it be manually done by observation using below script restart; n := 1: rodrigues := exp(x)*(x^alpha)/n!*diff(exp(-x)*(x^(n+alpha)), x\$n): rodrigues := subs(x=2*p, rodrigues): rodrigues := subs(alpha=1/2, rodrigues): rodrigues1 := factor(simplify(rodrigues)); n := 2: rodrigues := exp(x)*(x^alpha)/n!*diff(exp(-x)*(x^(n+alpha)), x\$n): rodrigues := subs(x=2*p, rodrigues): rodrigues := subs(alpha=1/2, rodrigues): rodrigues2 := factor(simplify(rodrigues)); n := 3: rodrigues := exp(x)*(x^alpha)/n!*diff(exp(-x)*(x^(n+alpha)), x\$n): rodrigues := subs(x=2*p, rodrigues): rodrigues := subs(alpha=1/2, rodrigues): rodrigues3 := factor(simplify(rodrigues)); -(4 p - 3) p 1   /    2            \ - p \16 p  - 40 p + 15/ 4 1    /    3        2              \ - -- p \64 p  - 336 p  + 420 p - 105/ 24 After adding assuming X > 1, it can n... After adding assuming X > 1, it can not evaluate too , how to define a range for it to transform successfully? Bernoulli charc := 1/(I*X/(-1+exp(I*X)))^n; Density := int(exp(-I*X*u)/(I*X/(-1+exp(I*X)))^n, X = -infinity .. infinity) assuming X > 1; Density := int(exp(-I*X*u)/(I*X/(-1+exp(I*X)))^n, X = 1.1 .. infinity) can not evaluate WoW!!!!  it success to evaluate wh... WoW!!!!  it success to evaluate why not set pdf at the same time? WoW!!!!  it success to evaluate wh... WoW!!!!  it success to evaluate why not set pdf at the same time? after using Unapply RealDist := Distrib... after using Unapply RealDist := Distribution(Dist(t-1)); Error, (in Statistics:-Distribution) invalid input: IsKnownDistribution expects its 1st argument, dn, to be of type name, but received Unapply(Pi*erf(t), t) after using unapply unexpected argument after using Unapply RealDist := Distrib... after using Unapply RealDist := Distribution(Dist(t-1)); Error, (in Statistics:-Distribution) invalid input: IsKnownDistribution expects its 1st argument, dn, to be of type name, but received Unapply(Pi*erf(t), t) after using unapply unexpected argument sorry for misunderstanding, just conside... sorry for misunderstanding, just consider all i in small letter or all in big letter sorry for misunderstanding, just conside... sorry for misunderstanding, just consider all i in small letter or all in big letter yes, by madan's result, in other words t... yes, by madan's result, in other words to see how integration of two things result in new distribution First 42 43 44 45 Page 44 of 45 
1,476
4,757
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.109375
3
CC-MAIN-2024-38
latest
en
0.815817
https://moonbooks.org/Articles/How-to-perform-a-1D-convolution-in-python-/
1,632,008,675,000,000,000
text/html
crawl-data/CC-MAIN-2021-39/segments/1631780056578.5/warc/CC-MAIN-20210918214805-20210919004805-00418.warc.gz
452,032,611
12,935
September 13, 2021    /    Viewed: 115    /    Comments: 0    /    Edit Examples of how to perform a 1D convolution in python: ### 1d convolution in python Let's consider the following data: F = [1, 2, 3] G = [0, 1, 0.5] To compute the 1d convolution between F and G: F*G, a solution is to use numpy.convolve: C = np.convolve(F,G) will gives here array([0. , 1. , 2.5, 4. , 1.5]) Short explanation on how to get the result above. First the kernel G is reversed [0, 1, 0.5] -> [0.5, 1, 0.] (Step 1) Calculate C[0] => 0. f g product - 0.5 - - 1 - 1 0 0 2 0 0 3 0 0 $$\sum product = 0$$ (Step 2) Calculate C[1] => 1.0 f g product - 0.5 - 1 1 1 2 0 0 3 0 0 $$\sum product = 1$$ (Step 3) Calculate C[2] => 2.5 f g product 1 0.5 0.5 2 1 2 3 0 0 $$\sum product = 0.5 + 2 = 2.5$$ (Step 4) Calculate C[3] = 4. f g product 1 0 0 2 0.5 1 3 1.0 3 - 0.0 - $$\sum product = 1 + 3 = 4$$ (Step 5) Calculate C[4] = 1.5 f g product 1 - 0 2 0 0 3 0.5 1.5 - 1.0 - $$\sum product = 1.5$$ ### 1d convolution in python using opt "same" If you want the output the same size as the input F: np.convolve(F,G,'same') returns array([1. , 2.5, 4. ]) ### 1d convolution in python using opt "valid" np.convolve(F,G,'valid') returns array([2.5]) Compute only: f g product 1 0.5 0.5 2 1 2 3 0 0 $$\sum product = 0.5 + 2 = 2.5$$ ### Another example Another example, let's create a rectangular function in python (see also wikipedia's article Convolution) import numpy as np def f(x): if np.absolute(x) > 0.5: y = 0 else: y = 1 return y X = np.linspace(-2.0, 2.0, num=100) F = [f(x) for x in X] And let's compute for example the autocorrelation G = [f(x) for x in X] C = np.convolve(F, G) To visualize the results, we can first plot the rectangular function using matplotlib: import matplotlib.pyplot as plt plt.plot(X,F) plt.title("How to perform a 1D convolution in python ?") plt.savefig("1d_convolution_01.png", bbox_inches='tight', dpi=100) plt.show() gives and then plot the autocorrelation: plt.plot(C) plt.title("How to perform a 1D convolution in python ?") plt.savefig("1d_convolution_02.png", bbox_inches='tight', dpi=100) plt.show() gives here ### References ##### Daidalos Hi, I am Ben. I have developed this web site from scratch with Django to share with everyone my notes. If you have any ideas or suggestions to improve the site, let me know ! (you can contact me using the form in the welcome page). Thanks!
901
2,519
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.96875
4
CC-MAIN-2021-39
latest
en
0.612148
https://math.stackexchange.com/questions/33745/drawing-a-card-from-a-deck
1,652,997,983,000,000,000
text/html
crawl-data/CC-MAIN-2022-21/segments/1652662530066.45/warc/CC-MAIN-20220519204127-20220519234127-00630.warc.gz
426,402,746
66,971
# Drawing a card from a deck A single card is drawn from a standard 52-deck of cards with four suits: hearts, clubs, diamonds, and spades; there are 13 cards per suit. If each suit has three face cards, how many ways could the drawn card be either a club of any kind or anything else besides a face card? • Hint: How many non-face cards are there? How many clubs are there? How any cards are both non-face cards and clubs? Apr 19, 2011 at 1:36 • I am assuming that n=52 and r=30, order doesn't matter so it's a combination???? – user9762 Apr 19, 2011 at 2:32 I have a feeling your teacher/professor intended for you to learn the following (we first introduce some notation): For two sets $A, B$ in a common universe $U$, define their union as $$A \cup B = \{x \in U : x \in A \text { or } x \in B\}.$$ Define their intersection as: $$A \cap B = \{x \in U : x \in A \text{ and } x \in B\}.$$ It is important not to get too wrapped in the English here. Being in $A \cup B$ simply means being in one of the two sets (or possibly both). Being in $A \cap B$ simply means being in set $A$ and being in set $B$ at the same time. Finally, a finite set $A$ with $k$ elements ($k$ things in the set) has cardinality $k$, and this is written as $|A| = k$, or $\#A = k$ or even sometimes, $n(A) = k$. Therefore: $$\{1,3,5\} \cup \{1,2,3\} = \{1,2,3,5\},$$ while $$\{1 ,3 , 5 \} \cap \{ 1 , 2, 3 \} = \{ 1, 3\}.$$ Also, $$| \{ 1,3,5\}| = 3,$$ while $$| \{ 1, 3\} | = 2.$$ Now, what your teacher probably wanted you to learn was the following "rule": $$|A \cup B| = |A| + |B| - |A \cap B|.$$ This is easy to see it is true, since to count the number of elements that are in either $A$ or $B$ (or possibly both $A$ and $B$), you count the number of elements in $A$, add to it the number of elements in $B$, and then subtract the stuff you double counted, which is precisely the elements in $A \cap B$. Therefore, if you want to find the number of sides of a die that are (say) even or prime, you count the number of sides which are even (there are $3$ such sides - namely $2$ , $4$, $6$) add to it the number of sides which are prime (again, there are $3$ such sides - namely $2$, $3$, $5$), and then subtract the sides which we double counted (we counted the side with the number $2$ twice). Therefore, there are $3 + 3 - 1 = 5$ sides of a die which are even or prime. Now, you can take this strategy and count the number of cards in a deck which are either non face cards or clubs. The total number of possible outcomes is $52$, because that's the number of cards: you have one outcome per possible cards. How many outcomes are "good" (that is, are "either a club of any kind or anything else besides a face card")? Well, there's one "good outcome" per club; that's 13 clubs. Of the remaining 39 cards, how many are also "good outcomes"? Out of the 13 hearts there are, ten hearts (all hearts except the three face cards) count as "good outcomes." So in addition to the 13 clubs, 10 hearts are also "good." How many spades are "good"? How many diamonds? Now just add them all up. • I don't think she is worried about probability here, just the "number of good outcomes". Apr 19, 2011 at 3:04 • I feel like a total idiot. I made this problem much more difficult than what is there. Thanks DJC. I appreciate it. – user9762 Apr 19, 2011 at 3:05 • @DJC: Oops. Quite right. Apr 19, 2011 at 3:12 • @Paula: No need to feel down. Talking about math with other people is useful! Apr 19, 2011 at 3:15 You have to square the number of suits...$4*4=16$...$\frac{52}{16}=3.25$ raise it to the next power...
1,102
3,611
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
4.375
4
CC-MAIN-2022-21
longest
en
0.947241
https://www.lmpforum.com/forum/topic/540-motor-starting-fuse-problem/
1,718,873,835,000,000,000
text/html
crawl-data/CC-MAIN-2024-26/segments/1718198861916.26/warc/CC-MAIN-20240620074431-20240620104431-00268.warc.gz
774,281,123
18,266
# Motor Starting Fuse Problem ## Recommended Posts Hi, I have a 415V 50Hz motor with 5.2kW no load, 22.6kW Full Load power. The motor is always requested to start at No load. This application is an air compressor, so motor starts and loading valve is closed for about 10seconds, before it opens for compressor to go on full load. Power factor for motor is around 0.91. So 5200 / (415*1.73*.91) = 8A 22600 / (415*1.73*.91) = 34.5A So my question is that I have a DOL starter with a fuse rating of 50A. We operate at ambient temperatures close to 52degC. Is 50A Fuse enough, or should we go for 63A? Is there any rule of thumb to calculate these things accurately from the No Load / Full load currents?? thanx for help ##### Share on other sites Hello Anonymous The problem with fuse ratings is related to the starting current of the motor, and the cable ratings of the cable supplying the motor. Strictly speaking, the fuse should be rated to protect the cable, but it must also withstand the start current of the machine. The starting current of the motor is a function of the motor design and the starting method used. If you Direct On Line start the motor, it will draw locked rotor current. This is independant of the connected load. The Locked Rotor Current (LRC or LRI) is typically 6 - 8 times the full load current rating of the motor. In this case, the start current under full voltage conditions is probably going to be 200 - 250 Amps. Fuses have an overload characteristic and an overload time and you need to study this curve to ensure that it will with stand the start current/time required. Motor rated fuses are available with a longer overload time and these will enable motor starting with smaller fuses. If you use a reduced voltage starter, then the start current will be reduced. The actual start current reduction will be dependent on the type of starter and how it is set up. - If you give us more information, we may be able to help further. Best regards, ## Create an account Register a new account • ### Who's Online (See full list) • There are no registered users currently online • ### Tell a friend Love LMPForum? Tell a friend! ×
518
2,180
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.90625
3
CC-MAIN-2024-26
latest
en
0.906297
https://eng.libretexts.org/Courses/Oxnard_College/Matlab_and_Octave_Programming_for_STEM_Applications_(Smith)/16%3A__Interpolation_and_Curve_Fitting/16.03%3A_Regression_Analysis
1,716,423,192,000,000,000
text/html
crawl-data/CC-MAIN-2024-22/segments/1715971058575.96/warc/CC-MAIN-20240522224707-20240523014707-00580.warc.gz
187,359,347
32,234
# 16.3: Regression Analysis $$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$ $$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$ $$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ ( \newcommand{\kernel}{\mathrm{null}\,}\) $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}[1]{\| #1 \|}$$ $$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}[1]{\| #1 \|}$$ $$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\AA}{\unicode[.8,0]{x212B}}$$ $$\newcommand{\vectorA}[1]{\vec{#1}} % arrow$$ $$\newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow$$ $$\newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$ $$\newcommand{\vectorC}[1]{\textbf{#1}}$$ $$\newcommand{\vectorD}[1]{\overrightarrow{#1}}$$ $$\newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}}$$ $$\newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}}$$ $$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$ $$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$ ## What is Regression Analysis? Suppose we calculate some variable of interest, y, as a function of some other variable x. We call y the dependent variable and x the independent variable. For example, consider the data set below, taken from a simple experiment involving a vehicle, its velocity versus time is tabulated. In this case, velocity is a function of time, thus velocity is the dependent variable and the time is the independent variable. Time [s] Velocity [m/s] 0 20 10 39 20 67 30 89 40 111 50 134 60 164 70 180 80 200 Vehicle velocity versus time. In its simplest form regression analysis involves fitting the best straight line relationship to explain how the variation in a dependent variable, y, depends on the variation in an independent variable, x. In our example above, once the relationship (in this case a linear relationship) has been estimated we can produce a linear equation in the following form: $$y=m x+n$$ And once an analytic equation such as the one above has been determined, dependent variables at intermediate independent values can be computed. ## Performing Linear Regression Regression analysis with MATLAB is easy. The MATLAB Basic Fitting GUI allows us to interactively to do "curve fitting" which is a method to arrive at the best "straight line" fit for linear equations or the best curve fit for a polynomial up to the tenth degree. The procedure to perform a curve fitting with MATLAB is as follows: 1. Input the variables, 2. Plot the data, 3. Initialize the Basic Fitting GUI, 4. Select the desired regression analysis parameters. Using the data set above, determine the relationship between velocity and time. First, let us input the variables (Workspace > New variable) as shown in the following figures. Figure $$\PageIndex{1}$$. A new variable is created in the Workspace. Figure $$\PageIndex{2}$$. New variables are entered in the Variable Editor. Second, we will plot the data by typing in plot(time,velocity) at the MATLAB prompt. The following plot is generated, select Tools > Basic Fitting: Figure $$\PageIndex{3}$$. A plot is generated in Figure 1. The Basic Fitting tool can be initialized from Tools > Basic Fitting. In the "Basic Fitting" window, select "linear" and "Show equations". The best fitting linear line along with the corresponding equation are displayed on the plot: Figure $$\PageIndex{4}$$. Basic Fitting window is used to select the desired regression analysis parameters. Now let us do another curve fitting and obtain an equation for the function. Using that equation, we can evaluate the function at a desired value with polyval. The following is a collection of data for an iron-constantan thermocouple (data available for download). 1 Temperature [C] Voltage [mV] 50 2.6 100 6.7 150 8.8 200 11.2 300 17.0 400 22.5 500 26 600 32.5 700 37.7 800 41 900 48 1000 55.2 Temperature [C] vs Voltage [mV] 1. Plot a graph with Temperature as the independent variable. 2. Determine the equation of the relationship using the Basic Fitting tools. 3. Estimate the Voltage that corresponds to a Temperature of 650 C and 1150 C. We will input the variables first Voltage=[2.6;6.7;8.8;11.2;17;22.5;26;32.5;37.7;41;48;55.2] Voltage=[2.6;6.7;8.8;11.2;17;22.5;26;32.5;37.7;41;48;55.2] To plot the graph, type in: plot(Temp,Voltage) We can now use the Plot Tools and Basic Fitting settings and determine the equation: Figure $$\PageIndex{5}$$. Basic Fitting window is used to select the desired regression analysis parameters. By clicking the right arrow twice at the bottom right corner on the Basic Fitting window, we can evaluate the function at a desired value. See the figure below which illustrates this process for the temperature value 1150 C. Figure $$\PageIndex{6}$$. Estimating the Voltage that corresponds to a Temperature of 1150 C. Now let us check our answer with a technique we learned earlier. As displayed on the plot, we have obtained the following equation:$$y=0.052831 x+0.67202$$ This equation can be entered as polynomial and evaluated at 650 and 1150 as follows: >> p=[0.052831,0.67202] p = 0.0528 0.6720 >> polyval(p,1150) ans = 61.4277 ## Summary of Key Points 1. Linear regression involves fitting the best straight line relationship to explain how the variation in a dependent variable, y, depends on the variation in an independent variable, x, 2. Basic Fitting GUI allows us to interactively perform curve fitting, 3. Some of the plot fits available are linear, quadratic and cubic functions, 4. Basic Fitting GUI can evaluate functions at given points. ## Footnotes • 1 Engineering Fundamentals and Problem Solving by Arvid R. Eide, Roland Jenison, Larry L. Northup, Steven K. Mikelson , McGraw-Hill Higher Education. © 2007 p.114 This page titled 16.3: Regression Analysis is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Serhat Beyenir via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.
1,897
6,734
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.84375
4
CC-MAIN-2024-22
latest
en
0.33267
https://nl.mathworks.com/matlabcentral/cody/problems/1641-abbreviation/solutions/258856
1,606,761,767,000,000,000
text/html
crawl-data/CC-MAIN-2020-50/segments/1606141216897.58/warc/CC-MAIN-20201130161537-20201130191537-00293.warc.gz
430,881,250
17,068
Cody # Problem 1641. ABBREVIATION Solution 258856 Submitted on 10 Jun 2013 by andrea84 This solution is locked. To view this solution, you need to provide a solution of the same size or smaller. ### Test Suite Test Status Code Input and Output 1   Pass %% x ='Abbreviation of The Given String'; y_correct = 'A T G S '; assert(strcmp(your_fcn_name(x),y_correct)==1) x = 'Abbreviation' 'of' 'The' 'Given' 'String' s = A s = A T s = A T G s = A T G S 2   Pass %% x ='The Propose is to Make ABBREBIATION'; y_correct = 'T P M A '; assert(strcmp(your_fcn_name(x),y_correct)==1) % x ='The MATLAB Coder'; y_correct = 'T M C '; assert(strcmp(your_fcn_name(x),y_correct)==1) x = 'The' 'Propose' 'is' 'to' 'Make' 'ABBREBIATION' s = T s = T P s = T P M s = T P M A x = 'The' 'MATLAB' 'Coder' s = T s = T M s = T M C ### Community Treasure Hunt Find the treasures in MATLAB Central and discover how the community can help you! Start Hunting!
306
939
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.703125
3
CC-MAIN-2020-50
latest
en
0.700981
http://mathhelpforum.com/differential-geometry/25961-problem-related-complex-numbers.html
1,524,297,886,000,000,000
text/html
crawl-data/CC-MAIN-2018-17/segments/1524125945082.84/warc/CC-MAIN-20180421071203-20180421091203-00632.warc.gz
197,380,984
9,924
# Thread: A problem related to complex numbers 1. ## A problem related to complex numbers Hey guys, I have a problem concerning complex numbers and I could very much use your help. Please help me with it. I need to find the cube roots of -64i in the form of a+bi with a and b being real. Thank you for your help in advance. 2. Can you arrive at this: $\displaystyle (-64)^{\frac{1}{3}}=2\sqrt{3}-2i$ 3. First $\displaystyle (-64)^{1/3} = -4$. If you let $\displaystyle \zeta = \cos \frac{2\pi}{3}+i\sin \frac{2\pi}{3}$ then the roots are: $\displaystyle -4,-4\zeta,-4\zeta^2$. 4. Written in polar form: $\displaystyle - 64i = 64\left( {\cos \left( {\frac{{ - \pi }}{2}} \right) + i\sin \left( {\frac{{ - \pi }}{2}} \right)} \right) = 64cis\left( {\frac{{ - \pi }}{2}} \right)$ So the three cube roots are: $\displaystyle 4cis\left( {\frac{{ - \pi }}{6}} \right)\,,\,4cis\left( {\frac{{ - 5\pi }}{6}} \right)\,\& \,4cis\left( {\frac{\pi }{2}} \right)\,\,$
342
961
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.828125
4
CC-MAIN-2018-17
latest
en
0.674766
https://chat.stackexchange.com/transcript/71/2024/2/23
1,713,791,178,000,000,000
text/html
crawl-data/CC-MAIN-2024-18/segments/1712296818293.64/warc/CC-MAIN-20240422113340-20240422143340-00042.warc.gz
146,115,861
26,770
3:17 AM oh my god ._. i thought that $k_\mu x^\mu = k_0x^0 - k_1x^1 - ...$ ._. index notation moment 3:39 AM @SillyGoose omg no I think part of the problem is that you osmosised a lot of weird misconceptions of index notation rather than having a comprehensive first introduction that tells you how to work with them in general... @naturallyInconsistent i know right H O N K yes tonight i am just going to watch a lecture or read an intro section of a GR book or something and then write it in my own notes for future me H O N K I usually give students the exact same advice: Start with RHB and Cartesian tensors. It gives you a very simplest best case scenario so that you can use tensors to prove vector identities. Then move on to Schutz GR and try to learn what it means to have contravariance and covariance. The point of the index notation is to keep track of these, not keep track of the metric signature. If you are having metric signature issues, you are beyond confused. And because it is GR, you should be doing -+++ as we all should miehehehe And then you should link the covariant basis to condensed matter reciprocal lattice vectors 1 hour later… 4:50 AM is there anything stopping me from making the replacement $\eta^{\nu\sigma} \mapsto \eta^{\sigma\nu}$ in the second to last line? I feel like there must be the only thing that i started to think of is maybe contracted indices need to change together if you change them @SillyGoose The flat Minkowski metric is famously symmetric and doesn't matter if it is both upper indices or both lower indices so this replacement is definitely allowed. It is rare that such replacements work, but this is one of the special cases that it does. @naturallyInconsistent but then wouldn't i be able to conclude from the second to last line that $[\eta][\Lambda][\eta] = [\Lambda^{-1}]$ where the bracket notation means matrix representation of the bracketed object In your particular case, you only needed the thing to be symmetric, not symmetric between upper and lower indices, so there is a much wider class of tensors in which this replacement works @SillyGoose $[\Lambda^T][\eta][\Lambda]=[\eta]$ already immediately implies $[\eta^{-1}][\Lambda^T][\eta]=[\Lambda^{-1}]$ and since $[\eta]=[\eta^{-1}]$ so I am not sure what it is you think you are confused about. 2 hours later… 6:53 AM what is a good reference for going through the classification of the finite dimensional irreducible representations of the universal cover of the restricted lorentz group? i am up to identifying the isomorphism between the complexified lorentz algebra and a direct sum of two copies of $sl(2, \mathbb{C}$, but I haven't found a resource which runs through thoroughly the remaining steps 7:14 AM @SillyGoose Are you just looking for Weyl and Wigner's treatment of spins? @naturallyInconsistent i would like a general classification 7:45 AM @SillyGoose Weinberg QFT Chapter 2 not of the infinite dimension unitary representations @bolbteppa of the finite dimensional non-unitary representations @Sanjana what an insane set of notes @SillyGoose chapter 5 on fields oh i see okay so for each pair $(n, m) \in \frac{1}{2}\mathbb{N}_0 \times \frac{1}{2}\mathbb{N}_0$ we obtain a representation of $sl(2, C) \oplus sl(2, C)$ by sending $A_i \mapsto$ usual spin-n operators and $B_i \mapsto$ usual spin-m operators. but actually we want representations of $\mathfrak{so}(1,3)$, not its complexification, so we solve for $J_i$ and $K_i$, resulting in an irrep for $\mathfrak{so}(1,3)$. And then by usual machinery, this is equivalent to projective lie group irreps of $SO^+(1,3)$? 8:12 AM what is the intuition for irreps being tensor products of two individual irreps of $sl(2,C)$? ACuriousMind mentioned this. lemme find in general, the result is that $T(g_1)\otimes T(g_2)$ is an irreducible rep of $G_1\times G_2$ @SillyGoose ultimately this is due to the Peter-Weyl theorem: Equivalently we're looking at representations of $\mathrm{SU}(2)\times \mathrm{SU}(2)$, and more generally at reps of $G\times H$ for compact Lie groups $G,H$. $L^2(G)$ contains all the irreducible representations of $G$, and $L^2(G\times H) = L^2(G)\otimes L^2(H)$ so the irreps of $G\times H$ have a basis in terms of tensor products of irreps of $G$ and $H$ this is also the reason the infinite-dimensional reps of $\mathrm{SO}(1,3)$ are not of this form, because the equivalence to reps of $\mathrm{SU}(2)\times \mathrm{SU}(2)$ only works in the finite-dimensional case 8:30 AM @ACuriousMind is the representation $\phi(x^{\mu})\rightarrow \phi(\Lambda x^{\mu})$ for scalar $\phi$ irreducible? $\psi(x)\rightarrow \psi(R_{\theta} x)$ is reducible for rotations. does this not hold for the analogous thing for lorentz group? 8:52 AM @SillyGoose Note that I did not understand Weinberg's version of this, but I did understand Anthony Duncan's. 9:03 AM @ACuriousMind do you think i could understand Peter-Weyl theorem in a reasonable amount of time :P @naturallyInconsistent hm i'll check it out 9:15 AM @PM2Ring this is the message I would never have expected to read as soon as I woke up It thrills me is this the appropriate explicit construction of irreps for $\mathfrak{so}(1,3)$? (i have set $\hbar = 1$) 9:47 AM I think this helps There was an excellent answer by Qmechanic, which I don't have time to search rn i think i might have read through it at least i read a few of qmech answers related :P maybe one of them was it hm this stipulation seems potentially problematic: "The passage from real to complex is harmless, as the complex linear representations of the complexified Lie algebra are in 1 to 1 correspondence with the real linear representations of the real form. (Given, that we are working with representations on a C vector space.)" might we have a real field? then we could not do our complexification business by the quote? @SillyGoose you can just determine all the complex representations and then figure out which ones restrict to real ones; it's easier than to restrict to the reals from the start 10:03 AM oh no wait i think something must be wrong in my definition bc $K_i$ is not hermitian that's normal :P the boost generators are not unitary in the finite-dimensional representations remember that you're not looking at unitary representations of SO(1,3) here oh right 10:27 AM $\psi (x)\rightarrow \psi(R_{\theta} x)$ is reducible for rotations, but $\phi(x)\rightarrow \phi(\Lambda x)$ is not reducible for Lorentz transforms of Klein gordon solutions, right? sorry take the 1-particle space of Klein Gordon $\psi (p^{\mu})\rightarrow \psi(\Lambda p^{\mu})$ with on-shell p ^(mu) if this was reducible into a direct sum of (j,m) reps, then it wud mean boosts are non-unitary here. but boosts are unitary here, so it should be irreducible or maybe it's reducible but not reducible into a direct sum of (j,m) reps 3 hours later… 1:09 PM latex question how do i add some comment inside the square brackets in a citation like [5, pag. 30] @ekardnam_ why don't you just ref instead of quoting the page, which may change? Oh the page is of the source @SirCrackpot its the page of the book Sry anyhow i find out its \cite[pag. 30]{nameofyourbibtexentry} 1 hour later… 2:46 PM This Arnold Neumaier guy seems to know everything 3:01 PM How can i physically interpret that near $p^2=m^2$, the dressed propagator looks like the free propagator? @DIRAC1930 He is rather extremely wrong about Lattice QCD. He thinks that LQCD would not need to consider loops. @ekardnam_ You can also define the bibtex entry in the references file with the page numbers already there, so then you don't have to write which page it is, if you reuse that particular citation-to-page often. @ACuriousMind Is there no physical interpretation to my question? 3:23 PM Won't this mean that the field operators near $p^2=m^2$ look like free field operators? Why don't you read a standard textbook covering this topic? $p^2 = m^2$ is gonna be precisely the case closest to a free particle Since that's just the case where the field contains exactly the energy of one particle It is not lower (due to being affected by some potential energy) or higher from being a system of bound particles @Slereah Why do you not use the sensible convention? Oh wait, you mean that system of bound particles is higher in energy because more particles means more rest energy? So if I operate on the vacuum with $\hat{\Phi}(p^2=m^2)$, I will create what looks like a free particle? @Slereah that mass hyperboloid being isolated is protected, but its location is moved around by renormalisation. 3:32 PM yeah there's plenty of nuance to what I said But that's the rough idea So how do I interpret this physically? If I take the non rel limit, all I essentially have is the free field operator since $p^2 \approx m^2$ Like this is the typical figure of a spectral function @DIRAC1930 the non rel limit is the one in which $E\gg |\vec{p}|$, so you want the energy to be basically just mass energy If you take $p^2=m^2$ you just have a relativistic free particle Ah yes sorry I meant $E \approx m$ @Slereah Actually, it seems to not be about typicality. For the QFT that we can even do Feynman diagrammatics on, Källén–Lehmann is a necessity, isn't it? That's why it is in all textbooks on the subject 3:39 PM I guess? More than a necessity I would call it a theorem I mean, it's a fact about how a field is expanded, it's not directly related to perturbation theory as far as I remember I'm trying to understand this in terms of non-rel QFT i.e. the poles of the GF become the excitation energies of the system You may be interested in some many body theory book Condensed matter people deal with this all the time, they're called quasiparticles @SirCrackpot Remember, in realistic models we have, say, bound states of protons and electrons to make hydrogen atoms at least, and that is some bound state that has the field operators giving a state at energies strictly smaller than the $m^2$ of each of the "free dressed particle" precisely because it is a bound state. Page 72 in the pdf 3:43 PM anything more than one particle and you will never really get a "free" state, except asymptotically I'm trying to understand the 3rd paragraph Starting at 'The Green's function of a liquid, near it's pole...' @DIRAC1930 What else would you expect it to look like? A single on-shell particle usually cannot decay due to kinematic constraints. all it can do is...propagate If I have a particle in front of me, what do I have? How does this fit into that picture? All I currently know is that I have a dressed particle. Are bound states the only hindrance to perturbation theory? @DIRAC1930 What is "a particle" in this context 3:46 PM @DIRAC1930 what "picture" do you mean? A particle can mean quite a lot of things in QFT is this going to be another round of you trying to bypass the rule that we don't really know the interacting/dressed space :P Lets just say if I had an electron in front of me In which state :p how do you know it's there you can't see electrons 3:48 PM Like what people call a particle in QFT is a momentum eigenvector It's not really what we think of as an electron in experimental physics It's not a mostly localized packet How do I go from QFT to the real world @Slereah and Pauli-Lubanski (?) @DIRAC1930 with precaution Haag's book has a chapter on what this all means on an experimental level, it's not super clear Isn't the answer to Dirac's questions just rep theory of the Poincaré group? 3:50 PM Feb 5 at 15:26, by ACuriousMind @DIRAC1930 Then perhaps you should start learning a lot more technically focused QFT (like how to compute jets in colliders, or how to do lattice QCD) instead of worrying about all these abstract issues in QFT in general :P Does anything I was talking about before have anything to do with the fact that we can treat particles as being free when doing non rel QM using the Schrodinger equation? @ACuriousMind Do we really not? I thought with infra-particles we treat IR divergences properly, at the cost of the propagator no longer looking like what we always assume it to be? Whereas we can use CPT to deal with UV divergences (I do not know if the combination works, but I surely do hope so) why do you keep asking the same questions You're one to talk, giving the same answer :P I swear I've only asked this once It's not like that time when I kept asking about asymptotic states lol 3:52 PM I'm not even sure what a typical dumb electron shot from a cathode ray tube is supposed to look like as a wavefunction @DIRAC1930 but that's the same issue! @SirCrackpot Poor Sisyphus lol Probably some coherent state but idk because the "particles" we usually talk about are asymptotic states 3:52 PM @naturallyInconsistent I'm in a mood for banter @SirCrackpot arrives with batter oops But if I have two particles near each other, I can still use the Schrodinger equation @DIRAC1930 are you sure you can? Does anyone have anything to say about the hideous passive-active question I asked yesterday? :P The real truth is that I don't think we really have a good QFT theory that is usable at all levels of physics 3:54 PM @naturallyInconsistent Yes I mean, all I need is "it's just a name" We have a patchwork of various elements that sort of overlap @Slereah Isn't that the point of EFT @SirCrackpot the only thing that I have to say is that I don't want to talk about active and passive transformations :P @SirCrackpot Might I suggest "It is a name that ACM is particularly allergic to"? 3:54 PM We have the formal theory, we have the more approximative theories, we have the way this relates to experiment And all those things have some links between them @ACuriousMind don't be so passive, come on :P But it is not entirely clear how everything coheres Doing an entire theory like that is extremely hard, even for classical mechanics really, we don't even have that for QM without QFT, at least not one everyone agrees on, cf. the measurement problem Typically you have to do some handwaving to avoid complications if you want to actually model what the measurement apparatus does it all gets a bit hazy, too 3:57 PM You can kind of do it but yeah, in experiment nobody actually does :p You're not gonna do the wavefunction of your bubble chamber in a sense I consider treating the measurement apparatus as a black box as about as bad as just assuming all the stuff with asymptotic states and particles works - it's a crucial assumption you need to apply the theory to anything but if you dig into it too deep there's no foundational bottom in that rabbit hole You also have to solve problems like "how does state preparation even work" QFT sucks GR is sexy physics I keep telling people I mean GR has its host of issues as well certainly Look what you've done to me you monster 3:59 PM @Slereah easy, I just use my machine that spits out identically prepared states :) @ACuriousMind But then which one is it! don't ask me how that works, that's the experimentalists' job If I take the non rel limit and ignore transitions involving antiparticles I can always write, $\hat{\Phi}^\dagger=\sum_p \psi_p \hat{a}^\dagger$. So is the issue of interpreting rel-QFT in that a) I cant write a wavefunction, and b) I need to include transitions involving antiparticles because now there is sufficient energy, hence motivating the field operator expansion in terms of 2 types of creation operators which muddy's physical interpretation @Slereah at least not like "the metric tensor is just a formal object and doesn't really exist" A lot of experimental QM sort of relies on analogy with classical mechanics I think? 4:00 PM @DIRAC1930 those are both issues but I wouldn't commit myself to claiming they're the only ones Like we assume that in a bubble chamber, the measurement is sort of gonna be like position since you can see its trace @Slereah this is a really confusing terminology. more standard is to say that any state of the 1-particle space is a particle @Slereah there's actually a pretty good explanation originally by Mott on how the bubble chamber trajectories emerge I'm not sure if anyone has ever formally proven that a bubble chamber's measurement is close to a position measurement Dang they just told me I looked like a law students 4:01 PM @ACuriousMind Yeah I saw it once, but can you check it but some treatments popularise the idea that a particle is a discrete chunk of energy @Slereah it's not that the chamber is a "position measurement" How does one unlock the physics person look? Like it relies on previous assumptions about how atoms work everything relies on everything else 4:02 PM Alas physics is a house of cards and at the very bottom is a bunch of "obviously"s In the philosophy of science, observations are said to be "theory-laden" when they are affected by the theoretical presuppositions held by the investigator. The thesis of theory-ladenness is most strongly associated with the late 1950s and early 1960s work of Norwood Russell Hanson, Thomas Kuhn, and Paul Feyerabend, and was probably first put forth (at least implicitly) by Pierre Duhem about 50 years earlier.Semantic theory-ladenness refers to the impact of theoretical assumptions on the meaning of observational terms while perceptual theory-ladenness refers to their impact on the perceptua... They were right 😔 @SirCrackpot if they think you're a law student then your hair is too neat :P In the non rel real world, if I have two electrons together, what will they do? Shake hands? 4:03 PM how did you get them there? they're like charges, they'll repel each other this isn't even a QM question :P So something weird must be going on between the rel and non-rel limit Plenty of weird things happen certainly yes, it's not even clear to me that limit exists in a proper sense usually people just match a few interesting quantities, but I think that - much like the "classical limit" - there's not actually a well-defined procedure that turns a consistent relativistic theory into a consistent non-relativistic theory 4:06 PM @DIRAC1930 they've got a lot to teach and not that much time :p @DIRAC1930 Because of time constraints, the correct avenue to cover such topics is in thick books, where they have the space to properly introduce the topic. Plus really what are most physics students gonna say if they try to teach you all the nuances @ACuriousMind does Haag Ruelle not completely solve the asymptotic state problem? @DIRAC1930 the converse question would be - why do you care? These limits etc. are theoretically interesting but practically useless: Just use the appropriate theory for the appropriate regime Ideal QFT course would be 1) Calculate Lamb shift (optional) 2) Calculate lifetime of positronium (optional) 3) Show how all of QM comes out of QFT 4:08 PM the purpose of QFT is not to give you back QM, it's to build QED and QCD, to explain the particle zoo and other collider observations @ACuriousMind Actually, I think such a scheme already exists. The rel -> non-rel should exist as a linearisation starting from rapidity variables. I think it is the quantum -> classical limit that isn't well-established. @ACuriousMind I guess it depends on the person I am reading about defining the Kelvin Scale using carnot maschines, i reached this part where we have $1- \eta = \frac{T_2}{T_1}$ where $T_1 > T_2$ the text just mentions from this the conclusion, how exactly is this now deduced from this statement? i understand that $\eta$ is universal, so the left side is equal to a constant value. then you have T_1 = Constant T_2 .. ? @DIRAC1930 How can starting with two optional things be a tolerable start? If anything, my stillborn textbook is about simply skipping QM and introducing students directly into QFT land, so that the usual QM stuff are done in QFT language. @Mad It is a standard observation that efficiency $\eta=1-\frac{T_C}{T_H}$ and so rearranging this expression, you can work backwards and define temperatures using efficiencies. @naturallyInconsistent I know that that's what people do - to the "few interesting quantities" I mentioned I'm not convinced this really works universally to produce a consistent non-relativistic theory 4:13 PM @naturallyInconsistent this is what i wrote, if i substitute this, i will get naturally zero. @naturallyInconsistent i dont understand why you rewrote the equation that i wrote. but again, that's not really what we need - just the predictions of the non-relativistic and relativistic theories need to match in the regime where they overlap, there is nothing physical/experimental telling us that such a limit on the level of the theories needs to even exist Things get a little weird when you try to apply kinematic limits to systems rather than to theories I think yes... all we know is that the relativistic theory applies to a larger domain, the non rel theory is defined to be some approximation of it that u can afford to do in some situations @ACuriousMind 4:15 PM For instance go from special relativity to classical mechanics but a limit on the level of the theories would need to exist to produce the kind of universal reductionist explanation of QM from QFT that @DIRAC1930 wants @Mad That is not what I did. I wrote down what is the quintessential and original discovery of Carnot and Clausius and then explained to you how, by carefully arguing things so that temperatures were not defined prior to that point, then the efficiencies can be used to define the temperatures. so the non rel theory does not have a concrete definition Take a point, look at the light cone it describes, then contract it to the Galilean group @naturallyInconsistent I just derived the expression you wrote, its the same one that i wrote above! you literally just moved it on the other side of the equation sign. 4:16 PM Points on the past and future light cone fuse together, since the light cone is flat classically Their time interval is zero @ACuriousMind I feel like there must be a simple answer to this @Mad Correct, but I did not start from yours. I am trying to tell you that people originally started from what I wrote down, and then discovered that the logical flow could be reversed. but if those two points are timelike separated, then from another perspective, their interval shouldn't be zero after the contraction @DIRAC1930 if so, it has eluded us for about a century now :P I think pretty much all "limits" in physics are super tricky and probably not formally that possible to do for the systems themselves 4:20 PM i am satisfied with a vague idea of that limit works personally Too brutal of a limit in most cases :p All I want to do is take QED and then take some limit and reproduce the Schrodinger equation You're gonna have to take a few different limits I fear :p there are known ways @DIRAC1930 what do you mean "the Schrödinger equation" the Schrödinger equation of what system 4:23 PM she means either the Pauli or the Dirac eqn but the Dirac eqn interpreted as a wave eqn Lets say something like $\sum_n \hat{H}^{(1)}_n+ \hat{H}^{int}$ where $\hat{H}^{(1)}_n$ is a single particle Hamiltonian and $\hat{H}^{int}$ is the interacting part @naturallyInconsistent I think i undesrstand the statment, do they pick the cold bath to have the temperature of the triple point or the hot bath?Because its a quotient so you need comparrision @DIRAC1930 well, the free/single particle part you get from one-particle states obeying the same equation of motion as the field, see the answers to this question of mine and the interaction potential you get from the tree-level 2 -> 2 diagram(s), see this answer of mine you could probably also produce "multipotentials" by looking at 3->3 and higher diagrams, but I can't quite remember if I've ever seen that used for anything @Mad There will be a cold bath and a hot bath. To define temperatures above the 3ple point, the cold bath is the 3ple point, and to define temperatures below the 3ple point, the hot bath is the 3ple point. @naturallyInconsistent Ok so its relative i see. thanks! 4:27 PM the threeple point @ACuriousMind always fun! I mean, if minds are out of the gutter, it can always be spidey~ reminds me (although it is not really related) that I just recently had to deal with some old code that called a secondary connection the "2th connection" and it immediately bothered me subconsciously but it took me a while to figure out why @ACuriousMind :D the tooth? I swear to tell the tooth, the full tooth, and nothing but the tooth 4:35 PM what r some interesting things in philosophy of cloning? @ACuriousMind my hair is a MESS I mean, a combed mess @ACuriousMind reminds me of plusve and minusve @SirCrackpot you mean, like a barrister's wig? Lol @Loong hey, that's some of my most beloved shortforms! 4:37 PM @Loong I actually haven't seen that in a while - "thanks" for reminding me! I mean I have some tufts that even spray, wax or gel can't tame @SirCrackpot all that is left is fire @SirCrackpot it's that fact that you seem to use spray, wax or gel that makes you not a stereotypical physics student :P And those are in the back of my head, so whatever I do I always have this neat "fountain" of hair at the top of my head Also, are you an orc? Because nobody should have hair that wild 4:38 PM @ACuriousMind I don't! I just tried to tame my hair :P @SirCrackpot have you consulted "How to Train a Dragon"? Well, I also had a long coat and a suitcase so maybe that's my fault but really that would be ok in the 50s... lol guy over here carrying around a suitcase wondering why people tell him he looks like a lawyer In the 50s I could have been everything! I'm sorry to tell you it's 100% the suitcase 2 4:42 PM It's comfier to carry around though :P lawyers have to memorise all the laws I guess my mental image of a physicist is just plainly wrong or maybe they can google in courtroom @SirCrackpot does your pants look like this @naturallyInconsistent oh yeah i have seen this before, but i only need it once in this case 4:54 PM @ekardnam_ sure @SirCrackpot omg, please don't look like the ppl in Young Sheldon @ACuriousMind does the probability of having long/disheveled hair coincide with how far along you are in your physics degree? I don't help the statistics in any way :P
6,550
26,494
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.21875
3
CC-MAIN-2024-18
latest
en
0.931905
https://accessdatas.com/qa/is-the-slope-of-the-position-time-graph.html
1,624,567,926,000,000,000
text/html
crawl-data/CC-MAIN-2021-25/segments/1623488559139.95/warc/CC-MAIN-20210624202437-20210624232437-00464.warc.gz
86,714,994
11,208
# Is The Slope Of The Position Time Graph? ## What is a position-time graph? The principle is that the slope of the line on a position-time graph reveals useful information about the velocity of the object. If the velocity is constant, then the slope is constant (i.e., a straight line). If the velocity is changing, then the slope is changing (i.e., a curved line).. ## What is the slope of a graph in physics? The principle is that the slope of the line on a position-time graph is equal to the velocity of the object. If the object is moving with a velocity of +4 m/s, then the slope of the line will be +4 m/s. If the object is moving with a velocity of -8 m/s, then the slope of the line will be -8 m/s. ## What is the slope of D t2 graph? the slope of d-t squared graph is a slant. it represent the speed of the rolling can. ## What is the slope of a velocity time graph? The slope of a velocity graph represents the acceleration of the object. So, the value of the slope at a particular time represents the acceleration of the object at that instant. ## What do you mean by slope of a graph? The steepness of a hill is called a slope. The slope is defined as the ratio of the vertical change between two points, the rise, to the horizontal change between the same two points, the run. … ## Can position-time graph have negative slope? Solution : Yes, when the velocity of the obect is begative. ## What is the slope in physics? Slope is the ‘steepness’ of the line, also commonly known as rise over run. We can calculate slope by dividing the change in the y-value between two points over the change in the x-value. ## What does it mean if the slope of a position time graph is negative? Negative Position-Time Graph with respect to Velocity In position and time graphs, the slope of line indicates the velocity. Therefore negative slope of a position-time graph actually indicates negative velocity. Negative velocity is defined as the velocity of the object moving in an opposite direction. ## What are the 3 slope formulas? There are three major forms of linear equations: point-slope form, standard form, and slope-intercept form. We review all three in this article. ## What does no motion look like on a graph? If an object is not moving, a horizontal line is shown on a distance-time graph. Time is always plotted on the X-axis (bottom of the graph). The further to the right on the axis, the longer the time from the start. ## What is the slope of a position graph? The slope of a position graph represents the velocity of the object. So the value of the slope at a particular time represents the velocity of the object at that instant. ## What does the slope of a position vs time 2 graph represent? The slope of the graph gives the speed of the particle. Distance vs Time graph shows the variation of distance as the square of the time changes, but square of the time does not make sense physically. But the slope of the graph gives you the acceleration. ## Can a line on a position time graph have a negative slope that is can it slope downward from left to right? Yes, a position-time graph can have a negative slope. This would represent the motion of an object that is getting closer to the starting position. … The object’s velocity is 10 m/s. ## What does a slope on a distance-time graph mean? A sloping line on a distance-time graph shows that the object is moving. In a distance-time graph, the slope or gradient of the line is equal to the speed of the object. The steeper the line (and the greater the gradient) the faster the object is moving. ## What are 4 types of slopes? Slopes come in 4 different types: negative, positive, zero, and undefined. as x increases. ## What is the slope of the points? Slope, sometimes referred to as gradient in mathematics, is a number that measures the steepness and direction of a line, or a section of a line connecting two points, and is usually denoted by m. Generally, a line’s steepness is measured by the absolute value of its slope, m. ## What does the slope represent? The slope and y-intercept values indicate characteristics of the relationship between the two variables x and y. The slope indicates the rate of change in y per unit change in x.
932
4,257
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
4.3125
4
CC-MAIN-2021-25
latest
en
0.94053
http://www.education.com/study-help/article/pre-calculus-help-practice-problems-domain/
1,409,417,087,000,000,000
text/html
crawl-data/CC-MAIN-2014-35/segments/1408500835505.87/warc/CC-MAIN-20140820021355-00360-ip-10-180-136-8.ec2.internal.warc.gz
349,202,355
23,390
Education.com Try Brainzy Try Plus Domain and Range Practice Problems based on 8 ratings By — McGraw-Hill Professional Updated on Oct 4, 2011 Review the following concept if needed: Domain and Range Help Domain and Range Practice Problems Directions: For Problems 2–11, give the domain in interval notation. 1. A function consists of the ordered pairs {( h , 5), ( z , 3), ( i , 12)}. List the elements in the domain. Solutions 1. The domain consists of the first coordinate of the ordered pairs— h, z , and i . 2. We cannot let x − 8 = 0, so we cannot let x = 8. The domain is x ≠ 8, or (−∞, 8) ∪ (8, ∞). 3. We cannot let x 2 − 2 x = x ( x − 2) = 0, so we cannot let x = 0 or x = 2. The domain is all real numbers except 0 and 2, or (−∞, 0)∪(0, 2)∪(2, ∞). 4. Because x 2 + 10 = 0 has no real number solution, the domain is all real numbers, or (−∞, ∞). 5. We can take the cube root of any number, so the domain is all real numbers, or (−∞, ∞). 6. We must have x + 3 ≥ 0, or x ≥ −3. The domain is [−3, ∞). 7. We need to solve 4 − x 2 = (2 − x)(2 + x) ≥ 0. Fig. 2.6. The domain is [−2, 2]. 8. Because 3 x 2 + 5 ≥ 0 is true for all real numbers, the domain is (−∞, ∞). 9. We need x − 9 > 0. The domain is x > 9, or (9, ∞). 10. The domain is all real numbers, or (−∞, ∞). 11. From x + 5 ≥ 0, we have x ≥ −5. Fig. 2.7 Now we need to solve x 2 + 2 x − 8 = ( x + 4)(x − 2) = 0. x + 4 = 0      x − 2 = 0 x = −4           x = 2 Now we need to remove −4 and 2 from x ≥ −5. The domain is [−5, −4)∪(−4, 2) ∪ (2, ∞). Fig. 2.8 Add your own comment Ask a Question Have questions about this article or topic? Ask 150 Characters allowed Related Questions Q: See More Questions Top Worksheet Slideshows
641
1,711
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
4.78125
5
CC-MAIN-2014-35
longest
en
0.785535
https://www.mersenneforum.org/showpost.php?s=38ed6d9203e983777b0e50e2cdaaedcd&p=585275&postcount=1322
1,639,033,157,000,000,000
text/html
crawl-data/CC-MAIN-2021-49/segments/1637964363689.56/warc/CC-MAIN-20211209061259-20211209091259-00597.warc.gz
944,875,147
4,775
View Single Post 2021-08-09, 18:28   #1322 garambois "Garambois Jean-Luc" Oct 2011 France 24×43 Posts Quote: Originally Posted by warachwe The problem is that when the factor 13 are with even power, it does not preserve the 7 for the second iteration. This only happen when k is multiple of 13, for example 2^(12*13)-1 =3^2*5*7*13^2*53*79*... This is why conjecture 34 ( 3^(18*37) ), 35 ( 3^(36*37) ), and 106 ( 11^(6*37) ) are false. But this doesn't mean all similar conjecture are false, as there maybe others prime(s) that preserve p. When we try to 'get rid of' those primes, there maybe yet another that will preserve p instead. Since the size of first iteration grow very quickly, it is hard to find other contradiction this way. If some of those are true, I imagine the proof might be similar to the proof of conjecture (2). Thank you so much for your explanations ! I think I'm going to have to add some red to the conjecture page very quickly ! I will do that in the next few days...
286
998
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.90625
3
CC-MAIN-2021-49
latest
en
0.93331
https://gmatclub.com/forum/gmat-club-tests-are-extremely-challenging-131757.html?fl=similar
1,508,603,057,000,000,000
text/html
crawl-data/CC-MAIN-2017-43/segments/1508187824820.28/warc/CC-MAIN-20171021152723-20171021172723-00092.warc.gz
701,503,574
45,615
It is currently 21 Oct 2017, 09:24 ### GMAT Club Daily Prep #### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email. Customized for You we will pick new questions that match your level based on your Timer History Track every week, we’ll send you an estimated GMAT score based on your performance Practice Pays we will pick new questions that match your level based on your Timer History # Events & Promotions ###### Events & Promotions in June Open Detailed Calendar # GMAT Club Tests are extremely challenging. Author Message TAGS: ### Hide Tags Manager Joined: 06 Jul 2011 Posts: 213 Kudos [?]: 71 [0], given: 39 Location: Accra, Ghana GMAT Club Tests are extremely challenging. [#permalink] ### Show Tags 02 May 2012, 01:46 Good day my fellow forumers, After reading so much about the difficulty and challenge of the GMATClub Math Tests, I decided to try my hands at them and my goodness I received a disastrous score (8/37). I could not believe it, I am feeling a little let down. I am wondering if the Quantitative Section on the GMAT is as hard or even HARDER than these tests. I am feeling a little let down as my test date is slowly coming up. Wow, I guess I must just have faith and do better next time. Kudos [?]: 71 [0], given: 39 Manager Status: I will be back! Joined: 13 Feb 2012 Posts: 67 Kudos [?]: 67 [0], given: 38 Location: India Re: GMAT Club Tests are extremely challenging. [#permalink] ### Show Tags 02 May 2012, 02:02 dzodzo85 wrote: Good day my fellow forumers, After reading so much about the difficulty and challenge of the GMATClub Math Tests, I decided to try my hands at them and my goodness I received a disastrous score (8/37). I could not believe it, I am feeling a little let down. I am wondering if the Quantitative Section on the GMAT is as hard or even HARDER than these tests. I am feeling a little let down as my test date is slowly coming up. Wow, I guess I must just have faith and do better next time. Yes they are quite a bit harder. But these tests are really good. Just go through the basics of maths from books such as mgmat. And building the concepts are very important. _________________ Gmat FlashCard For Anki Kudos [?]: 67 [0], given: 38 GMAT Forum Moderator Status: Accepting donations for the mohater MBA debt repayment fund Joined: 05 Feb 2008 Posts: 1882 Kudos [?]: 916 [0], given: 234 Location: United States Concentration: Operations, Finance Schools: Ross '14 (M) GMAT 2: 710 Q48 V38 GPA: 3.54 WE: Accounting (Manufacturing) Re: GMAT Club Tests are extremely challenging. [#permalink] ### Show Tags 02 May 2012, 04:45 Yes, the GMATClub math test is aimed at people who want to score a 48+ in math. If you're not there yet, it's advisable to start on more basic material and questions. If you're having trouble understanding material, I suggest find a good source for explanations. The Khan Academy is one such source (http://www.khanacademy.org/) _________________ Strategy Discussion Thread | Strategy Master | GMAT Debrief| Please discuss strategies in discussion thread. Master thread will be updated accordingly. | GC Member Write Ups GMAT Club Premium Membership - big benefits and savings Kudos [?]: 916 [0], given: 234 GMAT Forum Moderator Joined: 13 Sep 2011 Posts: 284 Kudos [?]: 98 [0], given: 0 Re: GMAT Club Tests are extremely challenging. [#permalink] ### Show Tags 02 May 2012, 04:48 Khan academy ?! I've never heard of it before , are they a test prep company ? Posted from GMAT ToolKit Kudos [?]: 98 [0], given: 0 GMAT Forum Moderator Status: Accepting donations for the mohater MBA debt repayment fund Joined: 05 Feb 2008 Posts: 1882 Kudos [?]: 916 [0], given: 234 Location: United States Concentration: Operations, Finance Schools: Ross '14 (M) GMAT 2: 710 Q48 V38 GPA: 3.54 WE: Accounting (Manufacturing) Re: GMAT Club Tests are extremely challenging. [#permalink] ### Show Tags 02 May 2012, 04:55 georgepaul0071987 wrote: Khan academy ?! I've never heard of it before , are they a test prep company ? Posted from GMAT ToolKit No, it's a service that posts educational videos on youtube covering a wide array of topics (math, sciences, economics, history, etc.). The guy who does the videos went through an entire OG explaining each question. He also covers math concepts (if you need help with a concept (algebra, word problems, geometry, etc.), he has a wide array of videos on that as well. It's not for the GMAT, but many people have benefited greatly from using it as a resource. _________________ Strategy Discussion Thread | Strategy Master | GMAT Debrief| Please discuss strategies in discussion thread. Master thread will be updated accordingly. | GC Member Write Ups GMAT Club Premium Membership - big benefits and savings Kudos [?]: 916 [0], given: 234 Re: GMAT Club Tests are extremely challenging.   [#permalink] 02 May 2012, 04:55 Display posts from previous: Sort by # GMAT Club Tests are extremely challenging. Moderator: HiLine Powered by phpBB © phpBB Group | Emoji artwork provided by EmojiOne Kindly note that the GMAT® test is a registered trademark of the Graduate Management Admission Council®, and this site has neither been reviewed nor endorsed by GMAC®.
1,382
5,343
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.96875
3
CC-MAIN-2017-43
latest
en
0.939107
https://davidwalsh.name/canvas-effect
1,638,187,133,000,000,000
text/html
crawl-data/CC-MAIN-2021-49/segments/1637964358705.61/warc/CC-MAIN-20211129104236-20211129134236-00605.warc.gz
285,063,899
20,181
# Replicating the DOOM Screen Melt with JavaScript and Canvas By  on I love retro games almost as much as I love development and from time to time I find myself addicted to games I haven't played in 20 or more years. This weekend while loading up DOOM on my speedy 486/SX (a full 66mhz of speed!) I was reminded of the awesome screen melt effect when transitioning between menus and levels. From looking at it I really had no idea how it was accomplished, so seeing as DOOM is open source I went right to the source and I was surprised with how simple it is to achieve. So how exactly does the effect work? First you need to logically divide the screen into columns allowing them to be moved independently. Next Each column then needs to be assigned a height value that is less than 0. We start out by assigning the first column a random value between 0 and -100, and each neighboring column is assigned a random value within 50 of its neighbor. We also have a limit in place for the values, never allowing a value greater than 0, and never allowing a value less than our maximum deviation of -100. These values aren't set in stone and can be played with, but the higher the deviation between columns the more random the effect will become. The reason behind keeping the columns values within a certain range of their neighbors is to create a rolling hill effect, this same method can also be used when creating simple 2d terrain. The next and final step is to lower the columns in order to reveal the image behind it. The "magic" of the melt effect is illustrated below. This should also make it clear why we need to assign negative values to begin with. ## Implementation When I implemented the effect I tried two different approaches direct pixel manipulation using getImageData and putImageData, and using standard drawImage with offsets. The drawImage approach was much faster and the method I'll be explaining. We will use two images for the effect, the first image is the background and will be drawn first every tick, we will then draw the 2nd image in columns offsetting the y position of each column by its value incrementing the value every time the `doMelt()` function is called until all columns values are greater than the height of the image. ## The HTML The html needed is very minimal all we need is the canvas element `<canvas id="canvas"></canvas>` ## The JavaScript For the melt effect we will create a canvas element in memory this is where we will draw the offset columns to, image1 and image2 hold references to image objects created within the js, bgImage and meltImage are used to swap between what image is the background and what image is melting. ```var meltCan = document.createElement("canvas"), meltCtx = meltCan.getContext("2d"), images = [image1, image2], bgImage = 1, meltImage = 0,``` The following settings are what will control how the resulting effect looks. colSize controls the width of the columns, maxDev controls the highest a column can go, maxDiff controls the maximum difference in value between neighboring columns, and fallSpeed controls how fast the columns fall. ```settings = { colSize: 2, maxDev: 100, maxDiff: 50, fallSpeed: 6, }``` The init() function is where we setup our columns initial values and draw the image we are going to melt to our temporary canvas. We set the first element to a random number that falls between 0 and maxDev, then for each neighboring column pick a random value thats within the maxDiff range we set. ```function init() { meltCtx.drawImage(images[meltImage],0,0); for (var x = 0; x < columns; x++) { if (x === 0) { y[x] = -Math.floor(Math.random() * settings.maxDev); } else { y[x] = y[x - 1] + (Math.floor(Math.random() * settings.maxDiff) - settings.maxDiff / 2); } if (y[x] > 0) { y[x] = 0; } else if (y[x] < -settings.maxDev) { y[x] = -settings.maxDev; } } } ``` The `doMelt()` function is where the magic happens. First we draw our image thats behind the melting image to the canvas, another approach is to place the canvas element in front of an image and use clearRect to clear the canvas. However for this example we will just draw both images to the same canvas. Next we iterate through the columns incrementing their value by fallspeed. If the value is not greater than 0, it means the user cannot see the effect yet, so the columns y position (yPos) stays at 0. If the column value is greater than 0, the columns y position is set to the columns value. We then use drawImage to draw the column from the temporary canvas to the primary canvas using the offsetting its y by yPos. The done flag stays true if the column values are greater than the height, and we swap images to do it again. ```function doMelt() { ctx.drawImage(images[bgImage],0,0); done = true; for (col = 0; col < columns; col++) { y[col] += settings.fallSpeed; if (y[col] < 0 ) { done = false; yPos = 0; }else if(y[col] < height){ done = false; yPos = y[col]; } ctx.drawImage(meltCan, col * settings.colSize, 0, settings.colSize, height, col * settings.colSize, yPos, settings.colSize, height); } if(done){ var swap = meltImage; meltImage = bgImage; bgImage = swap; init(); } requestAnimationFrame(domelt); } ``` The completed code and effect can be seen on CodePen: http://codepen.io/loktar00/details/vuiHw. If you're curious as to how the masterminds of DOOM implemented the effect you can check it out at https://github.com/id-Software/DOOM/blob/master/linuxdoom-1.10/f_wipe.c Government web developer in Nebraska who’s looking to get back to Michigan! Lover of JavaScript, canvas, game development, and retro gaming systems. When not programming I’m hanging out with the family or gaming with friends ## Recent Features • By I get asked loads of questions every day but I'm always surprised that they're rarely questions about code or even tech -- many of the questions I get are more about non-dev stuff like what my office is like, what software I use, and oftentimes... • By ### Chris Coyier’s Favorite CodePen Demos David asked me if I'd be up for a guest post picking out some of my favorite Pens from CodePen. A daunting task! There are so many! I managed to pick a few though that have blown me away over the past few months. If you... ## Incredible Demos • By ### MooTools 1.3 Browser Object MooTools 1.3 was just released and one of the big additions is the Browser object.  The Browser object is very helpful in that not only do you get information about browser type and browser versions, you can gain information about the user's OS, browser plugins, and... • By ### Use Custom Missing Image Graphics Using MooTools Missing images on your website can make you or your business look completely amateur. Unfortunately sometimes an image gets deleted or corrupted without your knowledge. You'd agree with me that IE's default "red x" icon looks awful, so why not use your own missing image graphic? The MooTools JavaScript Note that... ## Discussion 1. MaxArt I can’t recall of a 486 SX at 66 MHz. Maybe it was a DX/2? 2. MaxArt, you might be right Ill have to check it out today, maybe it is a DX/2, the one I was playing on most recently is a Unisys Cwd4002, which I *just* grabbed from Ebay a few weeks ago since I was having issues with the ISA bus on my 486 from my childhood :(. 3. Max is right – the SX was the DX with the FPU disabled, it was only available in the original chip release, max speed 33M… Oh, you’ve all fallen asleep. I’ll just slip out quietly. Oh, yes, and when you wake up, get off my lawn. 4. You guys are correct, in my defense it boots up as a 80486DX2-S hence me saying SX :P. 5. Brilliant, sure I saw an emulated version of DooM somewhere using HTML5 Canvas… Also awesome. Wrap your code in `<pre class="{language}"></pre>` tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!
1,878
7,853
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.703125
3
CC-MAIN-2021-49
longest
en
0.961152
https://cboard.cprogramming.com/c-programming/118220-recriating-bst-tree-preorder.html
1,495,530,643,000,000,000
text/html
crawl-data/CC-MAIN-2017-22/segments/1495463607593.1/warc/CC-MAIN-20170523083809-20170523103809-00140.warc.gz
742,418,723
11,755
# Thread: recriating a bst tree from preorder 1. ## recriating a bst tree from preorder i have an array of the pre order traversal and i know that the root it arr[0] and its left son is arr[1] whats the formula for spotting the value of its right son value ?? 2. Given, node with index i and it's left child is 2i. Working out what the right child is shouldn't be too hard for you. Hint: Draw the tree and its array. 3. its not 2i but i+1 i got to that conclution too but the right son is hard because if a tree is not simetric and somewhere we dont have a left of right node then we cant break it into two 4. i think the answer is searching the first node whoch is larger then arr[i] is it ok? 5. Just use a value that wasn't in the tree before you flattened it as nil.
208
782
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.8125
3
CC-MAIN-2017-22
longest
en
0.941464
https://web2.0calc.com/questions/another-problem_1
1,582,104,735,000,000,000
text/html
crawl-data/CC-MAIN-2020-10/segments/1581875144111.17/warc/CC-MAIN-20200219092153-20200219122153-00190.warc.gz
617,068,423
6,388
+0 # another problem 0 1672 2 +4330 Side  $$CD$$of rectangle $$ABCD$$ measures 12 meters, as shown. Each of the three triangles with a side along segment $$CD$$ is an equilateral triangle. What is the total area of the shaded regions? Express your answer in simplest radical form https://latex.artofproblemsolving.com/3/f/3/3f369421bbd6032e57b184bc4f0d665a4cb7cba8.png Dec 28, 2017 #1 +8866 +2 The three triangles along CD are all equilateral and they all have the same height, so they are all congruent to each other. The length of each side of these three triangles  =  12/3 m  =  4  m And we know that an angle along line CD between two  60°  angles  =  180° - 60° - 60°  =  60° So the two shaded triangles are also equilateral triangles with a side length of  4 m. the area of the shaded region  =  2 * (area of one shaded triangle) =  2 * ( 1/2 * base * height ) =  2 * ( 1/2 * 4 * 2√3 ) =  8√3     sq meters Dec 29, 2017 #2 +878 +2 1/2 sol: An altitude of an equilateral triangle is therefore $$\sqrt{3}$$ times the length of half the side length of the triangle. Therefore, an equilateral triangle with side length 4 has altitude length $$\sqrt{3}(4/2) = 2\sqrt{3}$$, and area $$(2\sqrt{3})(4)/2 = 4\sqrt{3}$$ square units. The shaded regions consist of two of these equilateral triangles, so their total area is $$2(4\sqrt{3}) = \boxed{8\sqrt{3}}$$ . Dec 29, 2017
474
1,387
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
4.46875
4
CC-MAIN-2020-10
latest
en
0.778532
http://metamath.tirix.org/mpests/xrub
1,718,970,389,000,000,000
text/html
crawl-data/CC-MAIN-2024-26/segments/1718198862070.5/warc/CC-MAIN-20240621093735-20240621123735-00593.warc.gz
17,697,756
6,135
# Metamath Proof Explorer ## Theorem xrub Description: By quantifying only over reals, we can specify any extended real upper bound for any set of extended reals. (Contributed by NM, 9-Apr-2006) Ref Expression Assertion xrub ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}\in {ℝ}^{*}\right)\to \left(\forall {x}\in ℝ\phantom{\rule{.4em}{0ex}}\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)↔\forall {x}\in {ℝ}^{*}\phantom{\rule{.4em}{0ex}}\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)$ ### Proof Step Hyp Ref Expression 1 breq1 ${⊢}{x}={z}\to \left({x}<{B}↔{z}<{B}\right)$ 2 breq1 ${⊢}{x}={z}\to \left({x}<{y}↔{z}<{y}\right)$ 3 2 rexbidv ${⊢}{x}={z}\to \left(\exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}↔\exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)$ 4 1 3 imbi12d ${⊢}{x}={z}\to \left(\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)↔\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\right)$ 5 4 cbvralvw ${⊢}\forall {x}\in ℝ\phantom{\rule{.4em}{0ex}}\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)↔\forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)$ 6 elxr ${⊢}{x}\in {ℝ}^{*}↔\left({x}\in ℝ\vee {x}=\mathrm{+\infty }\vee {x}=\mathrm{-\infty }\right)$ 7 pm2.27 ${⊢}{x}\in ℝ\to \left(\left({x}\in ℝ\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)$ 8 7 a1i ${⊢}\left(\left({A}\subseteq {ℝ}^{*}\wedge {B}\in {ℝ}^{*}\right)\wedge \forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\right)\to \left({x}\in ℝ\to \left(\left({x}\in ℝ\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)\right)$ 9 pnfnlt ${⊢}{B}\in {ℝ}^{*}\to ¬\mathrm{+\infty }<{B}$ 10 breq1 ${⊢}{x}=\mathrm{+\infty }\to \left({x}<{B}↔\mathrm{+\infty }<{B}\right)$ 11 10 notbid ${⊢}{x}=\mathrm{+\infty }\to \left(¬{x}<{B}↔¬\mathrm{+\infty }<{B}\right)$ 12 9 11 syl5ibr ${⊢}{x}=\mathrm{+\infty }\to \left({B}\in {ℝ}^{*}\to ¬{x}<{B}\right)$ 13 pm2.21 ${⊢}¬{x}<{B}\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)$ 14 12 13 syl6com ${⊢}{B}\in {ℝ}^{*}\to \left({x}=\mathrm{+\infty }\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)$ 15 14 ad2antlr ${⊢}\left(\left({A}\subseteq {ℝ}^{*}\wedge {B}\in {ℝ}^{*}\right)\wedge \forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\right)\to \left({x}=\mathrm{+\infty }\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)$ 16 15 a1dd ${⊢}\left(\left({A}\subseteq {ℝ}^{*}\wedge {B}\in {ℝ}^{*}\right)\wedge \forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\right)\to \left({x}=\mathrm{+\infty }\to \left(\left({x}\in ℝ\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)\right)$ 17 elxr ${⊢}{B}\in {ℝ}^{*}↔\left({B}\in ℝ\vee {B}=\mathrm{+\infty }\vee {B}=\mathrm{-\infty }\right)$ 18 peano2rem ${⊢}{B}\in ℝ\to {B}-1\in ℝ$ 19 breq1 ${⊢}{z}={B}-1\to \left({z}<{B}↔{B}-1<{B}\right)$ 20 breq1 ${⊢}{z}={B}-1\to \left({z}<{y}↔{B}-1<{y}\right)$ 21 20 rexbidv ${⊢}{z}={B}-1\to \left(\exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}↔\exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{B}-1<{y}\right)$ 22 19 21 imbi12d ${⊢}{z}={B}-1\to \left(\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)↔\left({B}-1<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{B}-1<{y}\right)\right)$ 23 22 rspcv ${⊢}{B}-1\in ℝ\to \left(\forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\to \left({B}-1<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{B}-1<{y}\right)\right)$ 24 18 23 syl ${⊢}{B}\in ℝ\to \left(\forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\to \left({B}-1<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{B}-1<{y}\right)\right)$ 25 24 adantl ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}\in ℝ\right)\to \left(\forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\to \left({B}-1<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{B}-1<{y}\right)\right)$ 26 ltm1 ${⊢}{B}\in ℝ\to {B}-1<{B}$ 27 id ${⊢}\left({B}-1<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{B}-1<{y}\right)\to \left({B}-1<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{B}-1<{y}\right)$ 28 26 27 syl5com ${⊢}{B}\in ℝ\to \left(\left({B}-1<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{B}-1<{y}\right)\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{B}-1<{y}\right)$ 29 28 adantl ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}\in ℝ\right)\to \left(\left({B}-1<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{B}-1<{y}\right)\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{B}-1<{y}\right)$ 30 18 ad2antlr ${⊢}\left(\left({A}\subseteq {ℝ}^{*}\wedge {B}\in ℝ\right)\wedge {y}\in {A}\right)\to {B}-1\in ℝ$ 31 mnflt ${⊢}{B}-1\in ℝ\to \mathrm{-\infty }<{B}-1$ 32 30 31 syl ${⊢}\left(\left({A}\subseteq {ℝ}^{*}\wedge {B}\in ℝ\right)\wedge {y}\in {A}\right)\to \mathrm{-\infty }<{B}-1$ 33 mnfxr ${⊢}\mathrm{-\infty }\in {ℝ}^{*}$ 34 30 rexrd ${⊢}\left(\left({A}\subseteq {ℝ}^{*}\wedge {B}\in ℝ\right)\wedge {y}\in {A}\right)\to {B}-1\in {ℝ}^{*}$ 35 ssel2 ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {y}\in {A}\right)\to {y}\in {ℝ}^{*}$ 36 35 adantlr ${⊢}\left(\left({A}\subseteq {ℝ}^{*}\wedge {B}\in ℝ\right)\wedge {y}\in {A}\right)\to {y}\in {ℝ}^{*}$ 37 xrlttr ${⊢}\left(\mathrm{-\infty }\in {ℝ}^{*}\wedge {B}-1\in {ℝ}^{*}\wedge {y}\in {ℝ}^{*}\right)\to \left(\left(\mathrm{-\infty }<{B}-1\wedge {B}-1<{y}\right)\to \mathrm{-\infty }<{y}\right)$ 38 33 34 36 37 mp3an2i ${⊢}\left(\left({A}\subseteq {ℝ}^{*}\wedge {B}\in ℝ\right)\wedge {y}\in {A}\right)\to \left(\left(\mathrm{-\infty }<{B}-1\wedge {B}-1<{y}\right)\to \mathrm{-\infty }<{y}\right)$ 39 32 38 mpand ${⊢}\left(\left({A}\subseteq {ℝ}^{*}\wedge {B}\in ℝ\right)\wedge {y}\in {A}\right)\to \left({B}-1<{y}\to \mathrm{-\infty }<{y}\right)$ 40 39 reximdva ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}\in ℝ\right)\to \left(\exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{B}-1<{y}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}\mathrm{-\infty }<{y}\right)$ 41 25 29 40 3syld ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}\in ℝ\right)\to \left(\forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}\mathrm{-\infty }<{y}\right)$ 42 41 a1dd ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}\in ℝ\right)\to \left(\forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\to \left(\mathrm{-\infty }<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}\mathrm{-\infty }<{y}\right)\right)$ 43 1re ${⊢}1\in ℝ$ 44 breq1 ${⊢}{z}=1\to \left({z}<{B}↔1<{B}\right)$ 45 breq1 ${⊢}{z}=1\to \left({z}<{y}↔1<{y}\right)$ 46 45 rexbidv ${⊢}{z}=1\to \left(\exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}↔\exists {y}\in {A}\phantom{\rule{.4em}{0ex}}1<{y}\right)$ 47 44 46 imbi12d ${⊢}{z}=1\to \left(\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)↔\left(1<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}1<{y}\right)\right)$ 48 47 rspcv ${⊢}1\in ℝ\to \left(\forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\to \left(1<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}1<{y}\right)\right)$ 49 43 48 ax-mp ${⊢}\forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\to \left(1<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}1<{y}\right)$ 50 ltpnf ${⊢}1\in ℝ\to 1<\mathrm{+\infty }$ 51 43 50 ax-mp ${⊢}1<\mathrm{+\infty }$ 52 breq2 ${⊢}{B}=\mathrm{+\infty }\to \left(1<{B}↔1<\mathrm{+\infty }\right)$ 53 51 52 mpbiri ${⊢}{B}=\mathrm{+\infty }\to 1<{B}$ 54 id ${⊢}\left(1<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}1<{y}\right)\to \left(1<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}1<{y}\right)$ 55 53 54 syl5com ${⊢}{B}=\mathrm{+\infty }\to \left(\left(1<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}1<{y}\right)\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}1<{y}\right)$ 56 mnflt ${⊢}1\in ℝ\to \mathrm{-\infty }<1$ 57 43 56 ax-mp ${⊢}\mathrm{-\infty }<1$ 58 rexr ${⊢}1\in ℝ\to 1\in {ℝ}^{*}$ 59 43 58 ax-mp ${⊢}1\in {ℝ}^{*}$ 60 xrlttr ${⊢}\left(\mathrm{-\infty }\in {ℝ}^{*}\wedge 1\in {ℝ}^{*}\wedge {y}\in {ℝ}^{*}\right)\to \left(\left(\mathrm{-\infty }<1\wedge 1<{y}\right)\to \mathrm{-\infty }<{y}\right)$ 61 33 59 60 mp3an12 ${⊢}{y}\in {ℝ}^{*}\to \left(\left(\mathrm{-\infty }<1\wedge 1<{y}\right)\to \mathrm{-\infty }<{y}\right)$ 62 57 61 mpani ${⊢}{y}\in {ℝ}^{*}\to \left(1<{y}\to \mathrm{-\infty }<{y}\right)$ 63 35 62 syl ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {y}\in {A}\right)\to \left(1<{y}\to \mathrm{-\infty }<{y}\right)$ 64 63 reximdva ${⊢}{A}\subseteq {ℝ}^{*}\to \left(\exists {y}\in {A}\phantom{\rule{.4em}{0ex}}1<{y}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}\mathrm{-\infty }<{y}\right)$ 65 55 64 sylan9r ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}=\mathrm{+\infty }\right)\to \left(\left(1<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}1<{y}\right)\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}\mathrm{-\infty }<{y}\right)$ 66 49 65 syl5 ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}=\mathrm{+\infty }\right)\to \left(\forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}\mathrm{-\infty }<{y}\right)$ 67 66 a1dd ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}=\mathrm{+\infty }\right)\to \left(\forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\to \left(\mathrm{-\infty }<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}\mathrm{-\infty }<{y}\right)\right)$ 68 xrltnr ${⊢}\mathrm{-\infty }\in {ℝ}^{*}\to ¬\mathrm{-\infty }<\mathrm{-\infty }$ 69 33 68 ax-mp ${⊢}¬\mathrm{-\infty }<\mathrm{-\infty }$ 70 breq2 ${⊢}{B}=\mathrm{-\infty }\to \left(\mathrm{-\infty }<{B}↔\mathrm{-\infty }<\mathrm{-\infty }\right)$ 71 69 70 mtbiri ${⊢}{B}=\mathrm{-\infty }\to ¬\mathrm{-\infty }<{B}$ 72 71 adantl ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}=\mathrm{-\infty }\right)\to ¬\mathrm{-\infty }<{B}$ 73 72 pm2.21d ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}=\mathrm{-\infty }\right)\to \left(\mathrm{-\infty }<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}\mathrm{-\infty }<{y}\right)$ 74 73 a1d ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}=\mathrm{-\infty }\right)\to \left(\forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\to \left(\mathrm{-\infty }<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}\mathrm{-\infty }<{y}\right)\right)$ 75 42 67 74 3jaodan ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge \left({B}\in ℝ\vee {B}=\mathrm{+\infty }\vee {B}=\mathrm{-\infty }\right)\right)\to \left(\forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\to \left(\mathrm{-\infty }<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}\mathrm{-\infty }<{y}\right)\right)$ 76 17 75 sylan2b ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}\in {ℝ}^{*}\right)\to \left(\forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\to \left(\mathrm{-\infty }<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}\mathrm{-\infty }<{y}\right)\right)$ 77 76 imp ${⊢}\left(\left({A}\subseteq {ℝ}^{*}\wedge {B}\in {ℝ}^{*}\right)\wedge \forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\right)\to \left(\mathrm{-\infty }<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}\mathrm{-\infty }<{y}\right)$ 78 breq1 ${⊢}{x}=\mathrm{-\infty }\to \left({x}<{B}↔\mathrm{-\infty }<{B}\right)$ 79 breq1 ${⊢}{x}=\mathrm{-\infty }\to \left({x}<{y}↔\mathrm{-\infty }<{y}\right)$ 80 79 rexbidv ${⊢}{x}=\mathrm{-\infty }\to \left(\exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}↔\exists {y}\in {A}\phantom{\rule{.4em}{0ex}}\mathrm{-\infty }<{y}\right)$ 81 78 80 imbi12d ${⊢}{x}=\mathrm{-\infty }\to \left(\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)↔\left(\mathrm{-\infty }<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}\mathrm{-\infty }<{y}\right)\right)$ 82 77 81 syl5ibrcom ${⊢}\left(\left({A}\subseteq {ℝ}^{*}\wedge {B}\in {ℝ}^{*}\right)\wedge \forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\right)\to \left({x}=\mathrm{-\infty }\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)$ 83 82 a1dd ${⊢}\left(\left({A}\subseteq {ℝ}^{*}\wedge {B}\in {ℝ}^{*}\right)\wedge \forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\right)\to \left({x}=\mathrm{-\infty }\to \left(\left({x}\in ℝ\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)\right)$ 84 8 16 83 3jaod ${⊢}\left(\left({A}\subseteq {ℝ}^{*}\wedge {B}\in {ℝ}^{*}\right)\wedge \forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\right)\to \left(\left({x}\in ℝ\vee {x}=\mathrm{+\infty }\vee {x}=\mathrm{-\infty }\right)\to \left(\left({x}\in ℝ\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)\right)$ 85 6 84 syl5bi ${⊢}\left(\left({A}\subseteq {ℝ}^{*}\wedge {B}\in {ℝ}^{*}\right)\wedge \forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\right)\to \left({x}\in {ℝ}^{*}\to \left(\left({x}\in ℝ\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)\right)$ 86 85 com23 ${⊢}\left(\left({A}\subseteq {ℝ}^{*}\wedge {B}\in {ℝ}^{*}\right)\wedge \forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\right)\to \left(\left({x}\in ℝ\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)\to \left({x}\in {ℝ}^{*}\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)\right)$ 87 86 ralimdv2 ${⊢}\left(\left({A}\subseteq {ℝ}^{*}\wedge {B}\in {ℝ}^{*}\right)\wedge \forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\right)\to \left(\forall {x}\in ℝ\phantom{\rule{.4em}{0ex}}\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\to \forall {x}\in {ℝ}^{*}\phantom{\rule{.4em}{0ex}}\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)$ 88 87 ex ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}\in {ℝ}^{*}\right)\to \left(\forall {z}\in ℝ\phantom{\rule{.4em}{0ex}}\left({z}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{z}<{y}\right)\to \left(\forall {x}\in ℝ\phantom{\rule{.4em}{0ex}}\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\to \forall {x}\in {ℝ}^{*}\phantom{\rule{.4em}{0ex}}\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)\right)$ 89 5 88 syl5bi ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}\in {ℝ}^{*}\right)\to \left(\forall {x}\in ℝ\phantom{\rule{.4em}{0ex}}\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\to \left(\forall {x}\in ℝ\phantom{\rule{.4em}{0ex}}\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\to \forall {x}\in {ℝ}^{*}\phantom{\rule{.4em}{0ex}}\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)\right)$ 90 89 pm2.43d ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}\in {ℝ}^{*}\right)\to \left(\forall {x}\in ℝ\phantom{\rule{.4em}{0ex}}\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\to \forall {x}\in {ℝ}^{*}\phantom{\rule{.4em}{0ex}}\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)$ 91 rexr ${⊢}{x}\in ℝ\to {x}\in {ℝ}^{*}$ 92 91 imim1i ${⊢}\left({x}\in {ℝ}^{*}\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)\to \left({x}\in ℝ\to \left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)$ 93 92 ralimi2 ${⊢}\forall {x}\in {ℝ}^{*}\phantom{\rule{.4em}{0ex}}\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\to \forall {x}\in ℝ\phantom{\rule{.4em}{0ex}}\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)$ 94 90 93 impbid1 ${⊢}\left({A}\subseteq {ℝ}^{*}\wedge {B}\in {ℝ}^{*}\right)\to \left(\forall {x}\in ℝ\phantom{\rule{.4em}{0ex}}\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)↔\forall {x}\in {ℝ}^{*}\phantom{\rule{.4em}{0ex}}\left({x}<{B}\to \exists {y}\in {A}\phantom{\rule{.4em}{0ex}}{x}<{y}\right)\right)$
8,705
17,769
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 95, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.734375
4
CC-MAIN-2024-26
latest
en
0.362263
https://mathhelpboards.com/threads/problem-of-the-week-32-january-7th-2013.2927/
1,606,902,592,000,000,000
text/html
crawl-data/CC-MAIN-2020-50/segments/1606141706569.64/warc/CC-MAIN-20201202083021-20201202113021-00391.warc.gz
402,134,533
14,675
# Problem of the Week #32 - January 7th, 2013 Status Not open for further replies. #### Chris L T521 ##### Well-known member Staff member Here's this week's problem (and the first Graduate POTW of 2013!). ----- Problem: Prove that if $A$ is a $3\times 3$ matrix over $\mathbb{Q}$ such that $A^8=1$, then in fact $A^4=1$. ----- #### Chris L T521 ##### Well-known member Staff member This week's problem was correctly answered by Deveno and Opalg. You can find Opalg's solution below: First, notice that if $A$ is considered as an element of $M_3(\mathbb{C})$ it is diagonalisable because it has finite order. (If its Jordan form had any off-diagonal elements, it could not have finite order.) Its eigenvalues are 8th roots of unity, and we have to show that in fact they are 4th roots of unity. The irreducible factorisation of $A^8-I=0$ over $\mathbb{Q}$ is $(A-I)(A+I)(A^2+I)(A^4+I) = 0$. The polynomial $(x-1)(x+1)(x^2+1)(x^4+1)$ must therefore be a multiple of the minimal polynomial of $A$ The characteristic polynomial $p(x)$ of $A$ must be a product formed using those same irreducible factors, namely $x\pm1$, $x^2+1$ and $x^4+1.$ It has degree 3, so it cannot involve the factor $x^4+1.$ So it must be formed from copies of the other factors, whose roots are all 4th roots of unity. Status Not open for further replies.
403
1,338
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.265625
3
CC-MAIN-2020-50
longest
en
0.940638
https://es.mathworks.com/matlabcentral/answers/418009-duration-in-double-between-two-datenum?s_tid=prof_contriblnk
1,726,358,590,000,000,000
text/html
crawl-data/CC-MAIN-2024-38/segments/1725700651601.85/warc/CC-MAIN-20240914225323-20240915015323-00198.warc.gz
211,464,520
29,293
# Duration in double between two datenum 10 visualizaciones (últimos 30 días) Luis Ruiz el 7 de Sept. de 2018 Comentada: Peter Perkins el 12 de Sept. de 2018 I have two dates given in text format, I want to have the real duration in seconds between the two values. The answer is -24, and I can do it parsing the strings. But does MATLAB have a function to do it nice and quick? If I do the following the answer is not a -24 that I can use as a double: datenum('2018-09-07 18:36:05.079')-datenum('2018-09-07 18:36:29.079') I need this time for a Simulink simulation. For example, I might need the duration in seconds between two days. ##### 2 comentariosMostrar NingunoOcultar Ninguno Stephen23 el 7 de Sept. de 2018 Luis Ruiz el 10 de Sept. de 2018 I edited my question to match the answers. Iniciar sesión para comentar. Stephen23 el 7 de Sept. de 2018 Editada: Stephen23 el 7 de Sept. de 2018 To get seconds simply multiply the days by 60*60*24: >> F = 'yyyy-mm-dd HH:MM:SS.FFF'; >> D = datenum('2018-09-07 18:36:05.079',F)-datenum('2018-09-07 18:36:29.079',F); >> D*60*60*24 ans = -24.000 ##### 2 comentariosMostrar NingunoOcultar Ninguno Luis Ruiz el 10 de Sept. de 2018 Editada: Luis Ruiz el 10 de Sept. de 2018 This one seems to be the right answer, but then, does it mean that operations between two datenum values are always in days? Stephen23 el 10 de Sept. de 2018 @Luis Ruiz: yes, datenum always returns days. But the conversion to seconds is trivial, as my answer shows. Iniciar sesión para comentar. ### Más respuestas (2) Peter Perkins el 7 de Sept. de 2018 If possible, don't use datenum. Use datetimes: >> fmt = 'yyyy-MM-dd HH:mm:ss.SSS'; >> dur = datetime('2018-09-07 18:36:05.079','Format',fmt) - datetime('2018-09-07 18:36:29.079','Format',fmt) dur = duration -00:00:24 >> dur.Format = 's' dur = duration -24 sec ##### 3 comentariosMostrar 1 comentario más antiguoOcultar 1 comentario más antiguo James Tursa el 7 de Sept. de 2018 To turn it into a double, e.g. seconds(dur) Peter Perkins el 12 de Sept. de 2018 As James says, you can convert, but the point of duration is that you may not need a number. duration supports all kinds of time arithmetic. Hard to know if that's possible in your case. Iniciar sesión para comentar. Image Analyst el 7 de Sept. de 2018 Editada: Image Analyst el 10 de Sept. de 2018 Try the etime() function. t1 = datevec('2018-09-08 18:36:05.079','yyyy-mm-dd HH:MM:SS.FFF') t2 = datevec('2018-09-07 18:36:29.079','yyyy-mm-dd HH:MM:SS.FFF') elapsedTime = etime(t1, t2) % Results in seconds. ##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos Iniciar sesión para comentar. ### Categorías Más información sobre Dates and Time en Help Center y File Exchange. R2018a ### Community Treasure Hunt Find the treasures in MATLAB Central and discover how the community can help you! Start Hunting! Translated by
906
2,903
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.921875
3
CC-MAIN-2024-38
latest
en
0.481853
https://entrepreneurshipprofessional.com/by-definition-empirical-probability-is-equal-to/
1,696,353,463,000,000,000
text/html
crawl-data/CC-MAIN-2023-40/segments/1695233511170.92/warc/CC-MAIN-20231003160453-20231003190453-00199.warc.gz
261,679,365
18,207
# 10 Great by definition empirical probability is equal to Public Speakers the chance of something happening. Therefore, the probability of x happening is equal to the chance of x happening if the conditions are the same. This simple rule is the basis of the field of probability theory. The rule is a way of calculating the chance that something does or does not happen, based on the same circumstances as the one we’ve already used. However, it’s also the basis of statistics, and as such, it’s a very useful tool in making inferences about the world around us. This rule is often used in the scientific study of data. We call it the probability of something happening because we can use the chance of something happening to predict the probability of something else. For example, if I have a deck of cards, I can use the chance of one of the cards being red to predict the probability of me being in a card-shuffle situation (e.g. winning a poker tournament). The way I know something is going on is through the measurement of the probability of something happening. So for a card to be considered an event the probability of it happening is equal to the probability of the event being an event. In the case of a deck of cards, the probability that I win a poker tournament will be equal to the probability of the deck being a poker tournament as well. In terms of probability, what really makes it a problem is if you find that the probability of you winning a poker tournament is higher than the probability of the deck of cards being a poker tournament. This is a problem because you just feel like you have won something, and this only gives you greater chance to win something else. What is the good of this? What we’re really asking ourselves is if we have an idea of what “better” means and what “worse” means. A good deck is one that looks like a poker tournament, but also looks like the poker experience that you have in your head. One of the things that makes poker entertaining is the ability to play the deck of cards when you play the poker experience. This is obviously good, but it also means that every time you choose something to bet on, you are choosing the best of the best in a vacuum. In the end, that is not good enough, and you need to consider all potential outcomes. You’re not just going to get something better, but you’re also going to lose something else that was important to you. I think the word you’re looking for is “weighted”. That is, you can bet on more of a certain outcome than you can on something else. For example, if you’re betting on a red card, you are betting on the best cards, so you are betting on a better probability of drawing a red card. At some point, you need to add up all the probabilities before you draw a conclusion about what to bet on.
587
2,810
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.96875
4
CC-MAIN-2023-40
latest
en
0.970146
https://thebluebrainteacher.com/make-inferences/
1,716,773,106,000,000,000
text/html
crawl-data/CC-MAIN-2024-22/segments/1715971058984.87/warc/CC-MAIN-20240526231446-20240527021446-00215.warc.gz
479,300,053
22,717
# A Quick and Easy Guide to Teach Inferencing to Students ## What is the skill of inferencing? Inferencing is one of those tough skills to teach but a necessary skill for students to practice and develop so that they can get the most out of a text. Being able to make inferences is all about using your background knowledge and experience to make new connections. For example, you asked your student to read the sentences “Martha is still hungry.” and “Her mother is baking cookies in the oven.” Our job is to help students infer something from these two sentences. After telling students these two sentences, you can make an discuss what Martha might do next.  Most students will probably say that Martha will ask for cookies. You can ask your students how they came to that conclusion. We draw conclusions after we consider the evidence. ## What is the skill of drawing conclusions? Drawing conclusions requires students to use the inferences that they have figured out to understand the big idea. For example, in the previous example, “Martha will ask for cookies” was our inference. If we were to draw conclusions from these two sentences, we might say that Martha did not have enough to eat for breakfast, or maybe she was at school and forgot her lunch. Drawing conclusions is about thinking what the big picture might be, of course we would need more clues aside from those two sentences! Making Inferences and Drawing Conclusions are Important for Reading Comprehension These two skills are important for students as it will help them understand what they are reading. Inferencing is a skill that transfers over to critical thinking that is especially important for science, social studies, and other disciplines etc. It is also a tool that students will apply throughout their lifetime in problem solving and different contexts. Fun Activities to Teach Students Inferencing and Drawing Conclusions It is a good idea to model inferencing and drawing conclusions in your read alouds. Here are some activities that you can do to practice making inferences with your students. Mystery Bag All you need is a cloth bag and fill it with items of your choice that is specific to an activity. Then, you give it to your students and ask them to identify the items. After that, ask them where the person with this bag would go next. For example, you can add a bottle of sunscreen, a pair of shades, and a towel let your students guess that the person wants to go to the beach. Think about different things that we do during the week and put real items or pictures of items in a bag and play this game! You can read my blog post where I use Diary of a Worm with this method. Picture Puzzles Show students two sequential photographs. For example, show a picture of a kid running on the street, followed by another picture of running towards a small rock on the road. Let your students think about what would happen next to the person in the picture. You can ask them to say it out loud as an answer or let them draw it. Picture Books without Words For an even greater challenge, show your students a sequence of pictures based on a story you want to introduce to them or a story that you have read to them in the past month. Then, ask your students to retell it in their own words while making it shorter. The wonderful thing about wordless books is that it really requires the reader to observe what is going on and make a guess based on their observations! Switch Stories For this activity, group your students into pairs. Each person writes down an event that happened to them last week. Then hands the paper to the other student who adds on their inference of what happened next. Inferencing and drawing conclusions are skills that students need to develop. I hope that in this blog post you were able to take away some ideas on how to apply teaching inferencing in your classroom. If you want more resources to help make your classes fun while helping your students learn, don’t forget to sign up to The Blue Brain Teacher’s Free Resource Library! You can also check out an activity I made to help you to teach inferences here. Have any more tips on teaching inferencing and drawing conclusions to students? Comment them down below!
854
4,252
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.640625
3
CC-MAIN-2024-22
latest
en
0.970247
https://brainmass.com/math/graphs-and-functions/483670
1,477,437,193,000,000,000
text/html
crawl-data/CC-MAIN-2016-44/segments/1476988720468.71/warc/CC-MAIN-20161020183840-00431-ip-10-171-6-4.ec2.internal.warc.gz
816,607,235
17,791
Share Explore BrainMass A rental company charges \$40.00 a day...Solve equations. A rental company charges \$40.00 a day plus \$0.34 per mile to rent a moving truck. The total cost, y, for a day's rental if x miles are driven is described by y = 0.34x + 40. A second company charges \$32.00 a day plus \$0.44 per mile, so the daily cost, y, if x miles are driven is described by y = 0.44x + 32. The graphs of the two equations are shown in the same rectangular coordinate system. a. Determine from the graph the x-coordinate of the intersection point of the two graphs. Describe what this x-coordinate means in practical terms. Choose the correct answer below. A. Both companies charge the same for 80 miles driven. B. Both companies charge the \$80 for the same number of miles driven. C. The maximum amount of miles that can be driven is 80. D. The maximum amount that both companies charge is \$80. b. Substitute the x-coordinate of the intersection point from part a into one of the two equations. Find the corresponding value for y. y = ? Describe what this value represents in practical terms. Choose the correct answer below. A. Both companies charge \$67.20 for 80 miles driven. B. Both companies always charge more than \$67.20. C. Both companies alyways charge less than \$67.20. D. Both companies charge \$67.20 for 67 miles driven. Solution Preview (A)We have two equations y=0.34x+40 and y=0.44x+32 where x is the miles driven and y is the total cost for a day's ... Solution Summary This solution shows step by step how to calculate the given set of equations. \$2.19
396
1,597
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.875
4
CC-MAIN-2016-44
latest
en
0.879586
https://www.bartleby.com/questions-and-answers/a-pair-of-points-on-the-graph-of-an-exponential-function-is-given.-give-a-formula-for-the-function-w/8ff5598b-648b-430e-be92-8d5d491815a7
1,579,595,465,000,000,000
text/html
crawl-data/CC-MAIN-2020-05/segments/1579250601628.36/warc/CC-MAIN-20200121074002-20200121103002-00180.warc.gz
781,643,567
22,510
# A pair of points on the graph of an exponential function is given. Give a formula for the function, writing it in standard form f(t)=a⁢bt.   f(t): (0,10),(9,45)Round your answer for b to four decimal places. f(t)=? Question 15 views A pair of points on the graph of an exponential function is given. Give a formula for the function, writing it in standard form f(t)=a⁢bt. f(t): (0,10),(9,45) f(t)=? check_circle Step 1 Given: The two points (0,10) and (9,45) and an exponential function Step 2 Since the points (0,10) and (9,45) are on t... ### Want to see the full answer? See Solution #### Want to see this answer and more? Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.* See Solution *Response times may vary by subject and question. Tagged in
233
829
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.25
3
CC-MAIN-2020-05
latest
en
0.848561
https://www.physicsforums.com/threads/momentum-of-a-ball.549629/
1,656,533,967,000,000,000
text/html
crawl-data/CC-MAIN-2022-27/segments/1656103642979.38/warc/CC-MAIN-20220629180939-20220629210939-00698.warc.gz
989,232,588
14,654
# Momentum of a Ball ## Homework Statement An 80 kg man standing at rest on a smooth, level ice surface throws a 200g ball horizontally with a speed of 25 m/s, relative to the Earth. a) With what speed and in what direction does the man move? b) If the man throws six such balls every 5.0s, what is the average force acting on him? Ft=mv ## The Attempt at a Solution I got part a using the conservation of momentum equation, but I don't get how to do b. Can anyone help? Delphi51 Homework Helper Use F = ma = M*Δv/Δt Every throw gives him a bit of Δv. Multiply it by 6 for 6 throws. Okay, I got it. Thanks! Delphi51 Homework Helper Most welcome! Force = rate of change of momentum Force = change in momentum per second Force = change in momentum of each interaction x number of interactions per second This is another way to say what Delphi51 said. Okay thanks!
229
871
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.40625
3
CC-MAIN-2022-27
latest
en
0.916219
https://classroom.thenational.academy/lessons/decimals-and-measures-to-generate-and-describe-linear-number-6xh3je
1,618,629,473,000,000,000
text/html
crawl-data/CC-MAIN-2021-17/segments/1618038098638.52/warc/CC-MAIN-20210417011815-20210417041815-00166.warc.gz
270,853,603
41,163
# Decimals and measures: To generate and describe linear number In today’s lesson, we will represent decimals using dienes blocks, find the term to term rule in a sequence and then represent sequences on a number line. # Video Click on the play button to start the video. If your teacher asks you to pause the video and look at the worksheet you should: • Click "Close Video" • Click "Next" to view the activity Your video will re-appear on the next page, and will stay paused in the right place. # Worksheet These slides will take you through some tasks for the lesson. If you need to re-play the video, click the ‘Resume Video’ icon. If you are asked to add answers to the slides, first download or print out the worksheet. Once you have finished all the tasks, click ‘Next’ below. Quiz: # Generate and describe linear number sequences Generate and describe linear number sequences 1/3 2/3 3/3 Quiz: # Generate and describe linear number sequences Generate and describe linear number sequences 1/3 2/3 3/3 # Lesson summary: Decimals and measures: To generate and describe linear number ### Time to move! Did you know that exercise helps your concentration and ability to learn? For 5 mins... Move around: Climb stairs On the spot: Dance ### Take part in The Big Ask. The Children's Commissioner for England wants to know what matters to young people.
312
1,379
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.734375
3
CC-MAIN-2021-17
longest
en
0.864191
https://www.teachoo.com/3690/702/Ex-5.6--6---Find-dy-dx--x-=-a-(theta---sin)--y-=-a-(1---cos)/category/Ex-5.6/
1,527,059,855,000,000,000
text/html
crawl-data/CC-MAIN-2018-22/segments/1526794865456.57/warc/CC-MAIN-20180523063435-20180523083435-00316.warc.gz
828,594,087
12,870
1. Chapter 5 Class 12 Continuity and Differentiability 2. Serial order wise Transcript Ex 5.6, 6 If x and y are connected parametrically by the equations without eliminating the parameter, Find ๐‘‘๐‘ฆ๏ทฎ๐‘‘๐‘ฅ๏ทฏ, ๐‘ฅ = ๐‘Ž (๐œƒ โ€“ sinโก๐œƒ), ๐‘ฆ = ๐‘Ž (1 + cosโก๐œƒ) ๐‘ฅ = ๐‘Ž ๐œƒ โ€“ sin๏ทฎ๐œƒ๏ทฏ๏ทฏ , ๐‘ฆ = ๐‘Ž (1+cosโก๐œƒ) ๐‘‘๐‘ฆ๏ทฎ๐‘‘๐‘ฅ๏ทฏ = ๐‘‘๐‘ฆ๏ทฎ๐‘‘๐‘ฅ๏ทฏ ร— ๐‘‘๐œƒ๏ทฎ๐‘‘๐œƒ๏ทฏ ๐‘‘๐‘ฆ๏ทฎ๐‘‘๐‘ฅ๏ทฏ = ๐‘‘๐‘ฆ๏ทฎ๐‘‘๐œƒ๏ทฏ ร— ๐‘‘๐œƒ๏ทฎ๐‘‘๐‘ฅ๏ทฏ ๐‘‘๐‘ฆ๏ทฎ๐‘‘๐‘ฅ๏ทฏ = ๐‘‘๐‘ฆ๏ทฎ๐‘‘๐œƒ๏ทฏ๏ทฎ ๐‘‘๐‘ฅ๏ทฎ๐‘‘๐œƒ๏ทฏ๏ทฏ
436
575
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.796875
3
CC-MAIN-2018-22
longest
en
0.388481
https://www.coursehero.com/file/5796887/hw09-p04Trap/
1,527,465,740,000,000,000
text/html
crawl-data/CC-MAIN-2018-22/segments/1526794870497.66/warc/CC-MAIN-20180527225404-20180528005404-00569.warc.gz
727,682,251
36,672
{[ promptMessage ]} Bookmark it {[ promptMessage ]} hw09_p04Trap # hw09_p04Trap - Y2new = Y2 h/2 fxy2(t h Y1bar Y2bar fxy2(t... This preview shows page 1. Sign up to view the full content. function [ Y1new, Y2new ] = hw09_p04Trap(h,t,Y1,Y2) Y1bar = Y1 + h*fxy1(t, Y1, Y2); Y2bar = Y2 + h*fxy2(t, Y1, Y2); Y Y1new = Y1 + h/2*( fxy1(t+h, Y1bar, Y2bar) + fxy1(t, Y1, Y2) ); This is the end of the preview. Sign up to access the rest of the document. Unformatted text preview: Y2new = Y2 + h/2*( fxy2(t+h, Y1bar, Y2bar) + fxy2(t, Y1, Y2) ); Y function f_xy1 = fxy1(t, y1, y2) f_xy1 = y2; f function f_xy2 = fxy2(t, y1, y2) f_xy2 = exp(y1) - t;... View Full Document {[ snackBarMessage ]} ### What students are saying • As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students. Kiran Temple University Fox School of Business ‘17, Course Hero Intern • I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero. Dana University of Pennsylvania ‘17, Course Hero Intern • The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time. Jill Tulane University ‘16, Course Hero Intern
490
1,629
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.625
3
CC-MAIN-2018-22
latest
en
0.869994
https://quant.stackexchange.com/questions/70652/does-it-matter-that-bachelier-iv-differs-from-bs-iv-for-a-given-option-price
1,653,076,393,000,000,000
text/html
crawl-data/CC-MAIN-2022-21/segments/1652662534669.47/warc/CC-MAIN-20220520191810-20220520221810-00409.warc.gz
549,141,735
66,442
# Does it matter that Bachelier IV differs from BS IV for a given option price? In one sense, it’s just an accounting convention, so it doesn't matter. In another sense, the implied volatility can be interpreted as the minimum realised volatility which implies that your option price was ≤ fair value (realized via dynamic hedging/gamma scalping, see Gamma Pnl vs Vega Pnl from BS.) So does it matter, or does it not? Which is the correct hurdle realized volatilty? • With the appropriate input vols, both models can match the market price as you say. However they will give radically differently deltas for you to hedge with. As a trader, you need to choose the model which best reflects the market dynamics you expect to see, to minimise hedging error. So it isn't just an accounting convention but one of risk management in my view. Apr 28 at 4:51 • Replace 'deltas' with 'Greeks' to be most general. Wish there was an edit button! Apr 28 at 5:54 • linkedin.com/feed/update/urn:li:activity:6926568087676743681 May 5 at 14:07 ## 1 Answer Neither of them is correct or incorrect, these are just two different numerical inputs that one should plug-in into two different formulas to get the market price of an option given all other information. The Black-76 formula (i.e. Black-Scholes in terms of forward price rather than a spot price) for pricing a call option is $$C_{BS}(K) = F_0 N(d_1) - K N(d_2)$$ where $$d_{1,2} = \frac{\log(F_0/K)}{\sigma_{BS}\sqrt{T}}\pm\frac{\sigma_{BS}\sqrt{T}}{2}$$. The Bachelier formula for a call is $$C_N(K) = (F_0-K) N(d_N) + \sigma_N\sqrt{T}n(d_N)$$ where $$d_N = \frac{F_0-K}{\sigma_N\sqrt{T}}$$. It's clear that giving the same $$K$$, $$F_0$$, $$T$$ you have to use two different implied volatilites $$\sigma_{BS}$$ and $$\sigma_N$$ in order to match the market price of an option with two different formulas. The more qualitative explanation is that volatility has different meanings in each model. The Black-Scholes model assumes a lognormal distribution of the underlying. The Bachelier model assumes a normal distribution. The Black-Scholes volatility $$\sigma_{BS}$$ measures the relative change in $$F_t$$, while the Bachelier volatility $$\sigma_N$$ measures the absolute change in $$F_t$$. In other words, the probability of the forward rate going from $$1\%$$ to $$2\%$$ is the same as the probability of it going from $$2\%$$ to $$4\%$$ in Black-Scholes and from $$2\%$$ to $$3\%$$ in Bachelier. Thus these are just two different pricing conventions and one can more or less freely go back-and-forth between them. More details on conversion between Black-Scholes and Bachelier volatilities can be found in such articles as A Black-Scholes user's guide to the Bachelier model or Volatility conversion calculators if needed. Hope it helps. • Hi Hasek, thank you for the prompt and detailed reply - I'm afraid this doesn't really answer what I was asking so I've edited the question to make it clearer. Thanks again Apr 27 at 16:15 • Just like there are two ways to compute implied vol $\sigma$ (Bachelier and BS) there are two ways to compute realized vol (Bachelier and BS). Then you can compare like with like and there is no confusion possible. Apr 28 at 12:11
842
3,222
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 19, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
2.8125
3
CC-MAIN-2022-21
longest
en
0.895061
https://edurev.in/course/quiz/attempt/26744_Test-Packing-Efficiency--NCERT-/23fbce34-3972-49fd-b543-9eab28df4f86
1,669,760,501,000,000,000
text/html
crawl-data/CC-MAIN-2022-49/segments/1669446710711.7/warc/CC-MAIN-20221129200438-20221129230438-00718.warc.gz
257,936,606
39,993
NEET  >  Test: Packing Efficiency (NCERT) # Test: Packing Efficiency (NCERT) Test Description ## 10 Questions MCQ Test Topic-wise MCQ Tests for NEET | Test: Packing Efficiency (NCERT) Test: Packing Efficiency (NCERT) for NEET 2022 is part of Topic-wise MCQ Tests for NEET preparation. The Test: Packing Efficiency (NCERT) questions and answers have been prepared according to the NEET exam syllabus.The Test: Packing Efficiency (NCERT) MCQs are made for NEET 2022 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Test: Packing Efficiency (NCERT) below. Solutions of Test: Packing Efficiency (NCERT) questions in English are available as part of our Topic-wise MCQ Tests for NEET for NEET & Test: Packing Efficiency (NCERT) solutions in Hindi for Topic-wise MCQ Tests for NEET course. Download more important topics, notes, lectures and mock test series for NEET Exam by signing up for free. Attempt Test: Packing Efficiency (NCERT) | 10 questions in 10 minutes | Mock test for NEET preparation | Free important questions MCQ to study Topic-wise MCQ Tests for NEET for NEET Exam | Download free PDF with solutions 1 Crore+ students have signed up on EduRev. Have you? Test: Packing Efficiency (NCERT) - Question 1 ### The edge length of a fcc  is 508 pm. If the radius of cation is 110 pm, the radius of anion is Detailed Solution for Test: Packing Efficiency (NCERT) - Question 1 For fcc, 2(r+ + r-) = a 2(110 + r-) = 508 r- = 508/2 - 110 = 144 pm Test: Packing Efficiency (NCERT) - Question 2 ### A metal X crystallises in a face-centred cubic arrangement with the edge length 862 pm. What is the shortest separation of any two nuclei of the atom ? Detailed Solution for Test: Packing Efficiency (NCERT) - Question 2 For fcc arrangement , distance of nearest neighbour (d) is = 609.6 pm Test: Packing Efficiency (NCERT) - Question 3 ### The edge length of sodium chloride unit cell is 564 pm. If the size of Cl- ion is 181 pm. The size of Na+ ion will be Detailed Solution for Test: Packing Efficiency (NCERT) - Question 3 2(r+ + r-) = a 2(2Na+ + rCl-) = 564 2Na = 564/2 - 181 = 101 pm Test: Packing Efficiency (NCERT) - Question 4 If the distance between Na+ and Cl- ions in NaCl crystals is 265 pm, then edge length of the unit cell will be? Detailed Solution for Test: Packing Efficiency (NCERT) - Question 4 In NaCl crystal , Edge length = 2 x distance between Na+ and Cl =2 x 265 = 530 pm Test: Packing Efficiency (NCERT) - Question 5 The radius of Na+ is 95pm and that of Cl- is 181 pm. The edge length of unit cell in NaCl would be (pm). Detailed Solution for Test: Packing Efficiency (NCERT) - Question 5 a = (r+ + r-) = 2(95 + 181) = 552 pm Test: Packing Efficiency (NCERT) - Question 6 Copper crystallises in fcc with a unit cell length of 361 pm. What is the radius of copper atom?157 pm Detailed Solution for Test: Packing Efficiency (NCERT) - Question 6 For fcc, r = √2 / 4 x a = √2 / 4 x 361 = 127 pm Test: Packing Efficiency (NCERT) - Question 7 Total volume of atoms present in a fcc unit cell of a metal with radius r is Detailed Solution for Test: Packing Efficiency (NCERT) - Question 7 a = 2√2 r Volume of the cell = a3 = (2√2 r)3 =  16√2r3 No. of shperes in fcc = 8 x 1/8 + 6 x 1/2 = 4 Volume of the four spheres = 4 x 4/3πr3 = 16πr3 Test: Packing Efficiency (NCERT) - Question 8 The relation between atomic radius and edge length 'a' of a body centred cubic unit cell: Detailed Solution for Test: Packing Efficiency (NCERT) - Question 8 Distance between nearest neighbours, d = AD/2 In right angled △ABC,AC= AB2 + BC2 AC2 = a2 + a2  or AC = √2a ∴ d = √3a / 2 Radius , r = d/2 = √3/4 a Test: Packing Efficiency (NCERT) - Question 9 Edge length of unit cell of Chromium metal is 287 pm with the arrangement. The atomic radius is the order of: Detailed Solution for Test: Packing Efficiency (NCERT) - Question 9 In bcc lattice, r = √3/4 r = = 124.27 pm Test: Packing Efficiency (NCERT) - Question 10 The fraction of total volume occupied by the atoms present in a simple cube is Detailed Solution for Test: Packing Efficiency (NCERT) - Question 10 For simple cube, Radius(r) = a / 2 [a = edge length] Volume of the atom = Packing fraction = Volume of the sphere (atoms) in an unit cell. For simple cubic, Z = 1 atom Packing fraction = ## Topic-wise MCQ Tests for NEET 12 docs|1493 tests Use Code STAYHOME200 and get INR 200 additional OFF Use Coupon Code Information about Test: Packing Efficiency (NCERT) Page In this test you can find the Exam questions for Test: Packing Efficiency (NCERT) solved & explained in the simplest way possible. Besides giving Questions and answers for Test: Packing Efficiency (NCERT), EduRev gives you an ample number of Online tests for practice ## Topic-wise MCQ Tests for NEET 12 docs|1493 tests ### How to Prepare for NEET Read our guide to prepare for NEET which is created by Toppers & the best Teachers
1,410
4,974
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}
3.46875
3
CC-MAIN-2022-49
latest
en
0.847986