text:
mersenneforum.org A prime number "game of life": can floor(y*p#) always be prime?
 Register FAQ Search Today's Posts Mark Forums Read

2021-06-28, 19:20   #12
mart_r

Dec 2008
you know...around...

2·373 Posts

Quote:
 Originally Posted by henryzz It's a shame that extending the search made so little difference lower down. From 599 to 797 the difference is only 1. I was hoping that more could be eliminated. Maybe some more could be if the easiest targets are attacked rather than everything.
Yeah, but I don't hold a grudge against those primes, it's still interesting enough that there's a unique solution up to level 191. I may compare this to the luck that Euler's number 41 has (i.e. the polynomial 41+n(n+1) that produces primes until 41²), and claim that my sequence is even a bit luckier because 191 is the 43rd prime

I know for a fact that, at level 797, two more primes bite the dust after 2089#, so at this point only 226 will be left. I'd have to check how far-reaching exactly the consequences are, but at level 541 the 47 surviving primes remain unchanged. I've checked the weakest branches of level 797 already in 2015, and the weakest of those that I haven't checked further has 42 primes at level 1597. Puzzling together the probabilities, I would expect one more prime to be cancelled out at level 797, leaving 225 "stable" primes at this point.

2021-08-05, 17:50   #13
mart_r

Dec 2008
you know...around...

10111010102 Posts
That playground is gigantonormous!

Updated and polished, just a little. Added "higher-order descendants" (page 19).
This is a "MS print to PDF" version, while the one in the OP was a "FreePDF print" version; each version comes with its own minor glitches. If I'm ever able to convert it to proper LaTeX, maybe next year/decade, this issue will be taken care of.

After 1987#, the number of surviving primes n* in table 7 appears to be fixed for p<=601. The following level p=607 contains a split with a branch still present at level 1987, but dissipating at level 2089, so there are only 71 surviving primes at stage 111. You can see the "trajectories" for these weakest branches in the attachment. That split branch at level 607 started out like a flash in the pan! It's like a prime number stock market out there...

Quote:
 Originally Posted by mart_r I would expect one more prime to be cancelled out at level 797, leaving 225 "stable" primes at this point.
Down to 223 now. There's still a >1% chance it reaches 222, but <1% that the number drops even below that.

Supplemental tool for the backtracking process (only semi-general-purpose):
Code:
print("backtrack(b[,c]): track level b back to level c [or every level with < 512 surviving primes]");
backtrack(b,c)=
{
p=b;
t=p;
o=vector(primepi(p)-40);
n=#d;
o[1]=n;
k=1;
while(n>1&&p>c,
z=vector(512);
y=1;x=1;
for(i=2,#d,
if(d[i]<t,
if(d[i]>t/p,n--);y++;if(i==#d,z[x]=y;x++),
z[x]=y;y=1;if(x<512,x++)
)
);
k++;
o[k]=n;
p=precprime(p-2);
t*=p;
print("backtrack... p="p);
if(n<512&&(p==c||c==0),
write("backtrack_"b"-"p".txt",vecextract(z,Str("1.."x-1)))
)
);
o=vecextract(o,Str("1.."k));
forstep(i=#o,1,-1,
write("backtrack_"b".txt",o[i])
);
print("data stored in backtrack_{p-c}.txt");
}
Example: backtrack(1987,197) = "[96637, 113792, 156942]" - meaning: 3 surviving branches at level 197 with respectively 96637, 113792, 156942 primes at level 1987. (I'll upload the level 1987 data depending on the resonance, since it has 3.74 MB zipped.)

Additional Table 7 info not really fit for the paper:
The number of surviving primes n* appears to have settled for...
Code:
s = 30 to 36  after s = 48
s = 37 to 65  after s = 95
s = 66 to 70  after s = 162
s = 71 to 92  after s = 189
s = 93        after s = 191
s = 94 to 108 after s = 215
s =109 to 110 after s = 277
s =111 to ??? after s = 316
(s=139        after s>= 365)
So, when I give you these 65 primes of level 599 (s=109), you'll (hopefully) end up with all primes of the sequence after level 1787 (s=277):
Code:
a=39624069013936965087096009433866594830980870998888700289477858045283065746616452803046877051058323608232360514007056743887671907849763652319988387476334527612284794568776090626036384425467238802263863077912348447009215427300887220486657625693147;
d=[0, 466455760294422823953804039675640047201077790734154654780965233768051077060385506551407568084738361988997027851963959610818647415718916847152, 44895563831368704616159353930540997828272453622716098834658210530168205692523959883757599112304579276962544182213994859302153464025610, 26706100635873975723434507798935828965926546552594370, 5349424105738534, 901898922830014190586001959240919331648326160928257099022394892456073146632010, 8995009362764739858959068329200056018893114699905074080917303621788351313861729098338404578, 335544104419153579655358597659804721070678961457899223253722433765243412023981115104923784391687635420326417875238, 4523471714186028497063758655500264647233710442107467015046892971714017309602121083966315477490178979402201052, 13558128246316966557562438271899907310750726822, 4934323886885543883827676375700166702424555062100227255395720919371207047219908212443254804028675171530193258025833342400752532251499752430581830, 388743572956706723444269225383396603443044134640778117599062700920205080348, 7131662087452, 33194405695790798430238872743598395294, 269730, 135320865050066733911728570, 11221001162, 6090567717995320705159336935158027964523675153732520176913426535613320656808731739785868047152936659580764487743815834176652322675806820457799664407012544927967378642, 966178811730010342231796148, 950218907960867236355409812416967381787168349447008, 186, 120950, 73131703534393817971440867435305555941325599875579554494296006281538000190675946442663191144668123588, 9500734976302631650958, 239805326438620473888522605578, 121757244991625966205374175349841785534615242815048191144254, 66687483923550353133932113715210392764921421988484986752527792068, 55963473253722215455307053540553065129204623773008139755208417335670283622191194014140, 374220210121664223149161671575248005142427307251864790690209608349390524597485609165745496013651149975393673161307792844136375404294244730453984728505635072279055652, 1209221770576241494563186529310, 28686868, 513195473075718020212004909660243183839001052209643336479222370958923901013785264992668591798528873698138934, 28832971082846920, 48533460370249984502739595104518, 41532609059904971662727814316530245330921320936385322890063242134040854418808228566236415441515393074907863930376015390, 493668696637110236477409740705170, 1808806165895014602770, 2261804119760347690745179746, 9311195034, 99434466581329648062553784651274547675969070085859370489887908418, 11225742884389569244962733297207525945870303941562175609336782988922, 112530771834007266493561947078591371253972340193864418633152934638854286685371266094730252277266033265826678554646900216277609060540241061184441929856119915131915176, 103350, 44740191674963654791540507699261670144839100857418098222434989798279884602883087809574557987137117510760, 9254712663124863672244531853950613218514667190892855782913340344365740049591921814953513360801840244416196898101508293163612904791809371838669710474565685029165706842604, 10033871640846413419993982882804977302146190667092951612473356704835668, 773645088515448882592365176248227130967319190028631391234006175499055409359482, 6309191045489857456582839123180771159412906264449006658980416499498, 805748915562249520203749088487780366455469723998114574728718044699745578442712351844994056568611864541729304569354505304688218, 1871911391108669620366209771942252280517428081404, 281083455286058273331808398475392, 4187509955264496840236, 10812133799323198, 9428157516571371362264424890339613308558429717606124684073379249324365172732443776189794620110086458638386, 203548, 40180857345840, 2060098878522283566900456084770695449091282256414174589864543021569432, 670291401847140231046228944641480671586531001527350972352877129757263171304541394348129386594411256, 2452831165494447922493076252, 71305177701894194705286338516277103466839112851099161326083402585320861927804314198838482177449447105067911900878227962, 158419166957241279541816714465231159780430892544161477518866140, 1284912443358386721676929857796019465275702641192465355368497364626176221916, 17223504, 318, 154391504732234881359906941526553166298281939591864102142977844101440097198716489216556904069919213710];
I'm having way too much fun with this crazy sequence...
(Then again, some say I'm also having way too much fun watching cartoon shows...)
Attached Thumbnails

Attached Files
 Project p#Y.pdf (1.02 MB, 120 views)

 2021-08-06, 08:18 #14 sweety439     "99(4^34019)99 palind" Nov 2016 (P^81993)SZ base 36 22·5·132 Posts Can floor (y*n!) always be prime?
2021-08-06, 14:07   #15
mart_r

Dec 2008
you know...around...

2×373 Posts

Quote:
 Originally Posted by sweety439 Can floor (y*n!) always be prime?
I'm afraid not. n! grows slower per step, leaving not enough room for primes of size y*n!.
With this regard, p# has just the "right" growth rate. Any slower rate would not result in an infinite sequence of this kind.

 2021-12-31, 10:45 #16 mart_r     Dec 2008 you know...around... 2×373 Posts tl;dr: some more results, potentially interesting further computations & a question First, the question: Calling y*p# the "slowest exponentially growing prime number sequence", would that be formally correct? Further results: Computation complete to 2111# on Sep 27, 2021. There was a delay of three days due to insufficient allocatemem, so net calculation time was 157 days (one Intel i7-10510U @ 2.3 GHz). The most difficult part after that was figuring out the potential crossover n* > p. Code:  s p n n* s* 1 2 1 1 1 2 3 1 1 2 3 5 1 1 3 4 7 1 1 4 5 11 2 1 8 6 13 2 1 8 7 17 3 1 8 8 19 3 1 11 9 23 4 1 11 10 29 6 1 21 11 31 4 1 21 12 37 5 1 21 13 41 5 1 21 14 43 9 1 23 15 47 11 1 23 16 53 10 1 23 17 59 12 1 23 18 61 8 1 23 19 67 6 1 23 20 71 11 1 25 21 73 5 1 25 22 79 4 1 25 23 83 6 1 25 24 89 3 1 25 25 97 2 1 26 26 101 1 1 26 27 103 3 1 28 28 107 1 1 28 29 109 1 1 29 30 113 3 1 48 31 127 2 1 48 32 131 5 1 48 33 137 6 1 48 34 139 12 1 48 35 149 21 1 48 36 151 19 1 48 37 157 15 1 95 38 163 16 1 95 39 167 24 1 95 40 173 18 1 95 41 179 18 1 95 42 181 17 1 95 43 191 14 1 95 44 193 24 2 95 45 197 24 3 95 46 199 28 5 95 47 211 30 5 95 48 223 36 5 95 49 227 49 5 95 50 229 44 5 95 51 233 52 5 95 52 239 53 5 95 53 241 55 5 95 54 251 67 6 95 55 257 69 6 95 56 263 72 7 95 57 269 81 7 95 58 271 79 7 95 59 277 85 8 95 60 281 83 8 95 61 283 93 8 95 62 293 81 9 95 63 307 81 9 95 64 311 67 9 95 65 313 66 11 95 66 317 74 11 162 67 331 91 12 162 68 337 88 12 162 69 347 90 14 162 70 349 95 15 162 71 353 102 16 189 72 359 126 18 189 73 367 152 19 189 74 373 154 19 189 75 379 166 19 189 76 383 187 20 189 77 389 214 20 189 78 397 206 21 189 79 401 201 21 189 80 409 220 21 189 81 419 241 23 189 82 421 249 25 189 83 431 269 25 189 84 433 320 27 189 85 439 354 29 189 86 443 354 31 189 87 449 365 32 189 88 457 369 33 189 89 461 358 33 189 90 463 387 34 189 91 467 413 35 189 92 479 426 36 189 93 487 446 37 191 94 491 454 37 215 95 499 491 37 215 96 503 456 38 215 97 509 490 38 215 98 521 559 41 215 99 523 573 43 215 100 541 594 47 215 101 547 652 47 215 102 557 718 50 215 103 563 757 50 215 104 569 786 53 215 105 571 835 55 215 106 577 839 57 215 107 587 854 59 215 108 593 906 63 215 109 599 916 65 277 110 601 998 69 277 111 607 988 71 316 112 613 1016 74 316 113 617 1078 78 316 114 619 1165 81 316 115 631 1237 84 316 116 641 1295 86 316 117 643 1371 90 316 118 647 1399 93 316 119 653 1523 97 316 120 659 1618 101 316 121 661 1701 105 316 122 673 1773 108 316 123 677 1801 116 316 124 683 1889 121 316 125 691 1885 127 316 <-- n* > s 126 701 1944 132 316 127 709 2008 138 316 128 719 2141 144 316 129 727 2136 150 316 130 733 2241 158 316 131 739 2354 165- 365 132 743 2442 177- 133 751 2548 179- 134 757 2649 184- 135 761 2791 193- 136 769 2998 200- 137 773 3017 207- 138 787 3148 214- 139 797 3132 224- 140 809 3385 231- 141 811 3537 245- 142 821 3698 250- 143 823 3914 261- 144 827 4175 266- 145 829 4345 273- 146 839 4360 284- 147 853 4537 292- 148 857 4722 304- 149 859 4862 308- 150 863 4951 320- 151 877 5099 332- 152 881 5228 345- 153 883 5334 357- 154 887 5460 364- 155 907 5715 379- 156 911 5971 389- 157 919 6366 404- 158 929 6582 414- 159 937 6799 433- 160 941 7006 455- 161 947 7151 463- 162 953 7599 474- 163 967 7920 494- 164 971 8276 511- 165 977 8708 524- 166 983 9086 535- 167 991 9577 553- 168 997 9736 570- 169 1009 10329 586- 170 1013 10722 594- 171 1019 11048 611- 172 1021 11387 639- 173 1031 11769 669- 174 1033 12251 685- 175 1039 12490 711- 176 1049 12905 733- 177 1051 13209 750- 178 1061 13556 775- 179 1063 13918 797- 180 1069 14393 822- 181 1087 15006 852- 182 1091 15472 874- 183 1093 15695 908- 184 1097 16075 937- 185 1103 16548 971- 186 1109 16852 1008- 187 1117 17548 1033- 188 1123 17926 1064- 189 1129 18415 1090- 190 1151 19145 1124- 191 1153 19690 1147- 192 1163 20364 1179- 193 1171 21154 1216- <-- n* > p ?? 194 1181 21954 1262- 195 1187 22688 1287- 196 1193 23528 1333- 197 1201 24295 1363- 198 1213 25085 1401- 199 1217 25717 1442- 200 1223 26680 1492- 201 1229 27569 1527- 202 1231 28242 1572- 203 1237 28917 1614- 204 1249 29871 1659- 205 1259 30707 1708- 206 1277 31555 1754- 207 1279 32633 1808- 208 1283 33494 1871- 209 1289 34556 1921- 210 1291 35744 1981- 211 1297 36546 2034- 212 1301 37363 2087- 213 1303 38018 2150- 214 1307 38936 2218- 215 1319 39633 2303- 216 1321 40152 2375- 217 1327 40822 2456- 218 1361 42524 2541- 219 1367 44138 2626- 220 1373 45674 2704- 221 1381 47308 2791- 222 1399 49203 2876- 223 1409 50999 2966- 224 1423 53578 3047- 225 1427 56009 3139- 226 1429 58245 3213- 227 1433 60614 3340- 228 1439 63012 3442- 229 1447 65622 3520- 230 1451 67609 3633- 231 1453 69411 3747- 232 1459 71677 3844- 233 1471 73978 3960- 234 1481 76816 4078- 235 1483 78753 4173- 236 1487 81051 4292- 237 1489 82647 4411- 238 1493 84106 4551- 239 1499 85756 4684- 240 1511 87469 4811- 241 1523 90333 4958- 242 1531 93284 5084- 243 1543 96279 5233- 244 1549 99150 5376- 245 1553 101723 5539- 246 1559 104560 5675- 247 1567 107041 5832- 248 1571 109795 5999- 249 1579 111912 6155- 250 1583 114508 6341- 251 1597 117842 6528- 252 1601 121087 6716- 253 1607 124407 6901- 254 1609 126382 7113- 255 1613 128949 7305- 256 1619 130732 7493- 257 1621 132088 7720- 258 1627 133678 7965- 259 1637 135308 8188- 260 1657 137970 8439- 261 1663 141747 8687- 262 1667 144129 8937- 263 1669 146278 9203- 264 1693 150011 9484- 265 1697 153719 9799- 266 1699 157438 10097- 267 1709 160935 10460- 268 1721 164713 10819- 269 1723 168209 11187- 270 1733 171914 11552- 271 1741 175208 11966- 272 1747 178924 12392- 273 1753 182442 12861- 274 1759 186286 13363- 275 1777 190466 13889- 276 1783 196294 14432- 277 1787 200525 14980- 278 1789 204944 15548- 279 1801 209420 16163- 280 1811 214672 16789- 281 1823 218990 17483- 282 1831 224272 18194- 283 1847 230486 18982- 284 1861 238339 19837- 285 1867 246127 20704- 286 1871 253236 21653- 287 1873 259946 22631- 288 1877 266707 23698- 289 1879 272114 24815- 290 1889 278512 26035- 291 1901 285821 27356- 292 1907 292121 28714- 293 1913 298404 30241- 294 1931 305779 31927- 295 1933 314060 33679- 296 1949 323493 35595- 297 1951 332369 37696- 298 1973 344077 40005- 299 1979 355840 42551- 300 1987 367371 45250- 301 1993 379303 48293- 302 1997 391133 51726- 303 1999 402306 55407- 304 2003 413306 59585- 305 2011 424348 64450- 306 2017 435084 69845- 307 2027 446383 76167- 308 2029 457067 83297- 309 2039 468311 91883- 310 2053 482068 102217- 311 2063 494789 114639- 312 2069 509095 130467- 313 2081 524247 150449- 314 2083 538695 177304- 315 2087 551951 214976- 316 2089 564045 271897- 317 2099 577252 370885- 318 2111 592642 592642- n* = surviving primes backtracked from stage 318; "-" indicates that this number will decrease further in the process (e.g. n* = 164 for p = 739) s* = stage after which n* appears to have settled The point where n* > p is in a state of "touch and go": checking the weakest branches for s > 318, at p = 1171 n* will settle between 1168 and 1173 with probability > 0.99; I'm still running calculations to determine whether or not three more branches with around 50 or more primes are becoming extinct. Some manual work is involved, and I have other projects, so in the worst case, it may take a couple more weeks to determine a solution to this question. In any case, n* will be > 1181 for p = 1181. Up for grabs: - The currently largest known p for which a prime in the sequence is known is 11131. This Pari program tries to find successively larger primes, thus digging ever deeper into the sequence: Code: {[encoded data, 4714 characters]; i=0; o=p; while(o>1, i++; o\=prime(i) ); q=prime(i); gettime(); g=1; h=1; forprime(i=3,1327,g*=i); forprime(i=1361,355111,h*=i); a=vector(4096); n=p; o=q; while(o>2, a[primepi(o)]=n%o; n\=o; o=precprime(o-1) ); l=primepi(q); m=1348; while(l<#a, l++; while(a[l]+2m, m=l; write("p#first.txt",prime(l)" "q) ); p=q; l++ ) ) ) ); p\=prime(l-1); a[l]=0; l-=2 ) } The output file "_p#first.txt" includes only the first prime of consecutively larger levels, and "_p#progress.txt" keeps track of all the primes found, each of those pose as an improvement on the value y_min (1.2541961...). Screen output will look like this (first column = level p / second column = p#Y mod (p-1)#, this may also serve as a cross-check value / third column = time since last prime in seconds): Code: 10979 ... +1374 [52 s] 10987 ... +5772 [225 s] 10979 ... +5634 [776 s] 10987 ... +3372 [137 s] 10993 ... +8434 [319 s] 10973 ... +8780 [1073 s] 10979 ... +4998 [171 s] etc. So within a matter of hours, larger primes may be found. The thrilling element here is the volatility: see the attached graph "sequential". We're practically following one single thread in the calculation. Occasionally, the first prime of a certain level becomes a stable branch - those are the points in the graph that exceed a previously unattained level without ever dropping below it again, with p = {2, 3, 5, 7, 11, 13, 17, 83, 89, 101, 103, 107, 109, 127, 131, 173, 241, 277, 281, 283, 1511, 1523, 1559, 1579, 1583, 1597, 1613, 4327, 4337, 4339, 4349, 4357, 4373, 4421, 4643, 4649, 4651, 4657, 4703, 4721, 6047, 6053, 6067, 6073, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6373, 6389, 6397, 6427, 6449, 6451, 6481, 6491, 6521, 9227, 9239, 9319, 9371, 9397, 9403, 9413, 9419, 9421, 9431, 9433} being the currently known points. Much like e.g. local extrema of Li(x)-pi(x), they tend to come in flocks. - The first surviving prime of level 9973 is probably 74612...13259 - take the number a in the program below *9973#/11131# to get the full decimal expansion. That's the 35th prime of level 9973 (out of an expected number of about 1.2*1012, by the way). I thought it would be interesting to see how such a branch deep down in the sequence would evolve, as it is much more volatile there, plus it would also improve the confidence that the eleven numbers between 9227 and 9433 in the list above "first prime of a certain level becomes a stable branch" are valid. So I let my rather slow laptop run for a couple of days on that branch, with the following development: Level {10007, 10009, 10037 ...} - #primes = {1, 2, 3, 3, 4, 2, 5, 8, 11, 14, 15, 16, 12, 12, 13, 19, 18, 22, 23, 27, 33, 35, 25, 26, 22, 18, 19, 25, 25, 26, 27, 31, 37, 31, 26, 27, 25, 28, 32, 27, 27, 30, 37, 36, 32, 31, 36, 30, 32, 32, 35, 29, 35, 36, 29, 30, 30, 36, 28, 33, 38, 44, 37, 44, 46, 57, 51, 50, 53, 44, 44, 41, 42, 45, 43, 54, 46, 40, 25, 26, 39, 39, 45, 38, 32, 39, 45, 44, 44, 47, 53, 52, 51, 61, 70, 64, 71, 81, 83, 63, 65, 55, 60, 48, 52, 56, 56, 76, 68, 74, 81, 90, 76, 75, 80, 81, 84, 71, 69, 63 ...} By the heuristics, it's safe enough to assume that the branch survives once the number of primes exceeds 500-ish, so here's the program for continuing here: Code: {[encoded data, 4783 characters]; d=[0, 2778003193391157627089323520755728579061443990119777710451723526790349339554005245488, 63887669758118978106, 1017920472699345500061756403080892302858203744771338715984167130830462592030300664597346250683103732164134000509861036123909901908619653265570128688091862, 1219677150505529264465486013704043532243042001014, 398, 2146, 6067874708925443592, 3248, 255956618666133897542791663437458747828377110317078268415383760053402150092863021246787241866047152028317514213131809996755517774500899337900397516453831138087965904414362267358879597985493454919462, 2050, 3834, 126, 46852074603681593539240838283300, 3887738522335914, 92827286, 57951728362, 403690535312, 949503011758563778866834, 1155896951927506114088679552457132600, 568430922959533130642288139672030296572633912649966496789630073728956675221221762814053399072, 1457976159686761813703226647435487891188, 510429129482610506475400, 780, 4704, 52740880470424034664231997774080667213005258305149885360506482547998059832208816288738521417345004655013202371952677270934863215425234750653583649070136549654563582899475887328352205316648196484818927416041469293796172123437744846, 22177604531727053380, 107800812888170728652896590663686, 16604026, 78, 690, 8934, 4135519530, 5920655143599653575357224613979876727030207367795308, 5010711041691654472851287568, 407344034506394, 416636449138, 3939326235211838642, 42969706, 72935321292762714102, 139798175202280184401082980410254, 3778, 84146490, 9348, 7534866756524099872482709477334651583879236253167550, 28688136814322883572997745026930951659205644981389934607623095153589496942822, 3410888, 1410445057272208022540693755074072759714937893432, 92634822, 664, 6564, 139513674552, 204, 74027960, 1444, 7786050, 972304457115227170906085753604152838, 5720, 74362059357914437901903881861640572048440388, 23104584, 4110, 3300, 948]; s=0; b=a; while(b>1,s++;b\=prime(s)); i=#d; gettime(); while(1, s++; p=prime(s); o=a*p; c=d; e=floor(256+i*(1+2/sqrt(p))); d=vector(e); m=i; i=0; for(j=1,m, o+=c[j]*p; y=vector(p); forprime(b=3,p-2, r=b-lift(Mod(o,b)); forstep(l=r,p,b,y[l]=1) ); forprime(b=p+2,floor(p^2.1), r=b-lift(Mod(o,b)); if(r1,d[i]=q-z,a=q); z=q ) ) ) ); g=floor(gettime()/1000); x="["; f=floor(g/3600); if(f,x=Str(x,f"h ")); f=floor(g/60); if(f,x=Str(x,f%60"m ")); x=Str(x,g%60"s]"); t=Str("Level "p); print(t": "i" possibilities "x); t=Str("p#Y "t".txt"); write(t,"a="a"; d="vecextract(d,Str("1.."i))) ) } - I can't upload the full level 2111 data (6 MB zipped), but, depending on the resonance, smaller batches can be provided, so in case, just let me know which branch number (1..47) - or split number (1..46) - from the attached bifurcation picture you'd like. Attached Thumbnails

 Similar Threads Thread Thread Starter Forum Replies Last Post Hugo1177 Miscellaneous Math 17 2021-02-08 18:03 piforbreakfast Information & Answers 4 2020-12-08 11:35 a1call Miscellaneous Math 179 2015-11-12 14:59 nitai1999 Software 7 2004-08-26 18:12 juergen Math 2 2004-07-10 23:01

All times are UTC. The time now is 18:20.

Fri May 20 18:20:26 UTC 2022 up 36 days, 16:21, 0 users, load averages: 1.71, 1.78, 1.64


text:
Group V-fold cross-validation creates splits of the data based on some grouping variable (which may have more than a single row associated with it). The function can create as many splits as there are unique values of the grouping variable or it can create a smaller set of splits where more than one value is left out at a time.

group_vfold_cv(data, group = NULL, v = NULL, ...)

Arguments

data A data frame. This could be a single character value or a variable name that corresponds to a variable that exists in the data frame. The number of partitions of the data set. If let NULL, v will be set to the number of unique values in the group. Not currently used.

Value

A tibble with classes group_vfold_cv, rset, tbl_df, tbl, and data.frame. The results include a column for the data split objects and an identification variable.

Examples

set.seed(3527)
test_data <- data.frame(id = sort(sample(1:20, size = 80, replace = TRUE)))
test_data$dat <- runif(nrow(test_data)) set.seed(5144) split_by_id <- group_vfold_cv(test_data, group = "id") get_id_left_out <- function(x) unique(assessment(x)$id)

library(purrr)
table(map_int(split_by_id$splits, get_id_left_out)) #> #> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 set.seed(5144) split_by_some_id <- group_vfold_cv(test_data, group = "id", v = 7) held_out <- map(split_by_some_id$splits, get_id_left_out)
table(unlist(held_out))
#>
#>  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20
#>  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1 # number held out per resample:
map_int(held_out, length)
#> [1] 3 3 3 3 3 3 2

format: plain


text:
GEOGRAPHICAL RESEARCH ›› 2013, Vol. 32 ›› Issue (4): 755-766.

• Article •

### The derivation and application of the proportionality shift-share spatial model

LUO Jian, CAO Weidong, TIAN Yanzheng

1. College of Territorial Resources and Tourism, Anhui Normal University, Wuhu 241003, Anhui, China
• Received:2012-07-12 Revised:2012-12-26 Online:2013-04-10 Published:2013-04-10

Abstract: Shift-share model (SSM) has been viewed as an effective statistical analysis method in the research of regional economic growth. However, what the classical model of shift-share analysis contains is not the exact regional component and structural component in the true sense, two components interweave with each other, and its extensive models produce more residual component without too much explanation for separating regional component and structural component. A complete separation between regional component and structural component in the shift-share analysis has been realized in this study. On the one hand, the proportionality shift-share spatial model realized a preliminary separation through transforming share component, embedding regional component, and reorganizing residual component in component structure. On the other hand, the proportionality shift-share spatial model excluded the impact of industry structure and scale differences for the computing of regional component and structural component through standardizing the growth rates. The new model realized shift-share analysis' goal to separate the contribution of the scale and structural differences of regional economy from the regional economic increment during the study period. The new derived structural component achieved an authentic longitudinal and transverse comparison of the regional structural differences. Especially, it revealed the concentrated distribution of industry whose scale and growth rates are dominated by calculating the structural differences of industrial scale and growth rate simultaneously which amounts to increment structure. In addition, 8 decompositions were added for the existing 20 decomposition of taxonomy, and the regional economic growth of all the cities in Anhui Province from 2000 to 2010 was analyzed by the proportionality shift-share spatial model with annulus comparative dynamic algorithm. Regional economic growth depends on the economic performance of neighborhood and nation to a certain extent. The proportionality shift-share spatial model embedded spatial structure by setting the neighborhood and weighting interregional actions, which revealed the scale and structure advantage of regional economy. The growth rate, the industrial structure, and spatial weight of each stage are different in the dynamic process of regional economic growth. The effect changes of each region throughout the years can be examined by dynamic algorithm.


text:
# Equation of motion for 2-link arm

I have the following robot arm:

Now how do I obtain the equation of motion:

$$M \ddot\theta + \vec{b} + \vec{g} = \vec{\tau}$$

I am familiar with forces, torque, velocity and so on. I know that this equation follows from force and torque equations. However, I don't know how to establish these force and torque equations.

The torque is applied by motors in the joints, so that the arm does not move. No payload is attached to the end-effector.

As far as I understood, $\vec{\tau}$ contains the two scalar torques for each of the two joints. $\vec{g}$ should be the force vector in negative y-direction, although I am not quite sure. I have no idea what $\vec{b}$ might be.

Define $\vec{\tau}_1$ on the first joint and $\vec{\tau}_2$ on the second joint. The first arm is well defined. The traditional $\sum \vec{F} = m\vec{a}$ and $\sum \vec{M} = I\vec{\alpha}$, valid only when looking at the center of mass, can be applied. However, the moment equation is only valid relative to the center of mass. The general formula for motion when described by another point P on the body (travelling with the body) is $\sum \vec{M}_P = I_p\vec{\alpha} + \vec{p} \times m\vec{a}_P$, where $\vec{p}$ is the distance vector from point P to the center of mass, and $\vec{a}_P$ is the acceleration at P.

Since the pinned point doesn't have an acceleration, it can be established for pinned bodies that, with P being the point of the pin, $\sum \vec{M}_P = I_P\vec{\alpha}$. The second arm doesn't have this luxury, and we must establish an equation of motion for the body. A major note is that we need an equation to describe $\vec{p} \times m\vec{a}_J$. While $\vec{a}_J$ the acceleration of the joint, in terms of $\theta_1$, in Cartesian coordinates, is quite complex:

$$\vec{a}_J = L_1\left[\left(-\ddot{\theta_1}\sin(\theta_1)-\dot{\theta_1}^2\cos(\theta_1)\right)\hat{i} + \left(\ddot{\theta_1}\cos(\theta_1)-\dot{\theta_1}^2\sin(\theta_1)\right)\hat{j}\right]$$

Since $\theta_2$ is defined by the relative angle, this can be simplified as we evaluate across the cross product of the two vectors:

$$\vec{p} \times m\vec{a}_J = \frac{mL_1L_2}{2}\left(\ddot{\theta_1}\cos(\theta_2)-\dot{\theta_1}^2\sin(\theta_2)\right)$$

So, the equation of motion for the second body would be:

$$\vec{\tau_2} = I_J\ddot{\theta_2}+ \frac{mL_1L_2}{2}\left(\ddot{\theta_1}\cos(\theta_2)-\dot{\theta_1}^2\sin(\theta_2)\right)$$

Where $I_J$ is the inertia of the second body relative to that joint. Since $\vec{\tau_1(t)} = I_P\ddot{\theta_1}$, which implies that $\dot{\theta_1} = I_P^{-1}\int_0^t\vec{\tau_1(t)}dt$, we can simplify:

$$\vec{\tau_2(t)} = I_J\ddot{\theta_2}+ \frac{mL_1L_2}{2I_P}\left[\vec{\tau_1(t)}\cos(\theta_2)-\left(\int^t_0\vec{\tau_1(t)}dt\right)^2\frac{\sin(\theta_2)}{I_P}\right]$$

This simplification allows for solving in $\theta_2$ only, without solving for $\theta_1$ simultaneously. Assuming the input function $\tau_1(t)$ is known, the resulting equation can be simple or vastly complex.


text:
In previous post, we learned how to calculate Fibonacci numbers by Fast Doubling in math. Today, we will apply it in programming and optimize it step by step.

## Fast Doubling

\begin{align} F_{2n+1} &= {F_{n+1}}^2 + {F_n}^2 \\ F_{2n} &= F_n \cdot (F_{n+1} + F_{n-1}) \\ &= F_n \cdot (F_{n+1} + (F_{n+1} - F_n)) \\ &= F_n \cdot (2 \cdot F_{n+1} - F_n) \end{align}

It’s natural to write a recursive implementation by the above definition. In the following steps, we will implement recursive versions first, then try converting it into iterative versions.

### Recursive (Top-down) Approach

Given a $n$, we could calculate Fibonacci numbers $F_n$ by:

if (n % 2) { // n is odd: F(n) = F(((n-1) / 2) + 1)^2 + F((n-1) / 2)^2
unsigned int k = (n - 1) / 2;
return fib(k) * fib(k) + fib(k + 1) * fib(k + 1);
} else { // n is even: F(n) = F(n/2) * [ 2 * F(n/2 + 1) - F(n/2) ]
unsigned int k = n / 2;
return fib(k) * [ 2 * fib(k + 1) - fib(k) ];
}

From above code, we can know that the code stack will be entered again and again, so we need to define when to stop it.

if (n == 0) {
return 0; // F(0) = 0.
} else if (n <= 2) {
return 1; // F(1) = F(2) = 0.
} else {
// Keep calling itself recursively to get the answer.
// Put the main body here.
}

We only calculate Fibonacci numbers from $0$, so we need to stop when $n = 0$. The fib(0) may be asked from calculating fib(1) = fib(0)*fib(0) + fib(1)*fib(1) (by setting $n = 0$ to $F_{2n+1} = {F_{n+1}}^2 + {F_n}^2$, so we also need to define fib(1) = 1 directly, or it will cause an endless recursion.

Similarly, the fib(1) may be asked from calculating fib(2) = fib(1) * [2 * fib(2) - fib(1)] (by setting $n = 1$ to $F_{2n} = F_n \cdot (2 \cdot F_{n+1} - F_n)$, so fib(2) = 1 also needs to be returned directly.

As the result, the code can be written into:

///////////////////////////////////////////////////////////////////////////////
// Fast doubling: O(log(n))
//   Using 2n to the Fibonacci matrix above, we can derive that:
//     F(2n)   = F(n) * [ 2 * F(n+1) – F(n) ]
//     F(2n+1) = F(n+1)^2 + F(n)^2
//     (and F(2n-1) = F(n)^2 + F(n-1)^2)
uint64_t fib(unsigned int n)
{
if (n == 0) {
return 0; // F(0) = 0.
} else if (n <= 2) {
return 1; // F(1) = F(2) = 0.
}

unsigned int k = 0;
if (n % 2) { // By F(n) = F(2k+1) = F(k+1)^2 + F(k)^2
k = (n - 1) / 2;
return fib(k) * fib(k) + fib(k + 1) * fib(k + 1);
} else { // By F(n) = F(2k) = F(k) * [ 2 * F(k+1) – F(k) ]
k = n / 2;
return fib(k) * (2 * fib(k + 1) - fib(k));
}
}

Now, let we look where we could improve from this simple version. We use duplicated fib(k) and fib(k + 1) to calculate fib(n). That is, we will have two duplicated recursive processes to do the same work. It would be a waste of the time.

Another trick is that we could use n = n / 2 in both cases ($n$ is odd or even) since the result of n = (n - 1) / 2 is same as n = n / 2 in C/C++’s world if n is an odd integer.

Thus, we can rewrite the code into:

uint64_t fib(unsigned int n)
{
// When n = 2: k = 1 and we want to use F(k+1) to calculate F(2k),
// However, F(2k) = F(k+1) = F(2) is unknown then.
if (n <= 2) {
return n ? 1 : 0; // F(0) = 0, F(1) = F(2) = 1.
}

unsigned int k = n / 2; // k = n/2 if n is even. k = (n-1)/2 if n is odd.
uint64_t a = fib1(k);
uint64_t b = fib1(k + 1);

if (n % 2) { // By F(n) = F(2k+1) = F(k+1)^2 + F(k)^2
return a * a + b * b;
}
// By F(n) = F(2k) = F(k) * [ 2 * F(k+1) – F(k) ]
return a * (2 * b - a);
}

#### Memoization

Do we save all duplicated task now? No. Suppose we need to find $F_6$, then we need to get $F_3, F_4$ ….

$\begin{matrix} & & & & & 6 & & & & & & & \\ & & & & \diagup & & \diagdown & & & & & & \\ & & & \diagup & & & & \diagdown & & & & & \\ & & 3 & & & & & & 4 & & & & \\ & \diagup & & \diagdown & & & & \diagup & & \diagdown & & & \\ 1 & & & & 2 & & 2 & & & & 3 & & \\ & & & & & & & & & \diagup & & \diagdown & \\ & & & & & & & & 1 & & & & 2 \end{matrix}$

It’s clear that we have a duplicated $F_1, F_2, F_3$ on above figure. $F_1, F_2$ can return value directly, while $F_3$ can not. Therefore, the sub-tree(sub-process) whose root is $F_3$ will be executed twice.

The larger the $n$ is, the more duplicated sub-process will be executed. To avoid the waste, we can add an array to save all the calculated value. We check the array first when $F_n$ is calculated. If there is already a saved value in the array at $n$, then we can use it directly. Otherwise, it will be calculated as usual. It’s called memoization. We will save $F_n$ as the $n$ element in the array.

In this case, the $F_n$ is not calculated successively. For example, to get $F_6$, we only need $F_4, F_3, F_2, F_1, F_0$. We don’t need $F_5$, so there is no value at the $5$ element in the array. You can use hash map instead of array to avoid the waste of memory. However, retrieving data from array is faster than hash map, so we apply array in our sample code:

const unsigned int SIZE = 1000;
// 4 is not a fibonacci number, so using it as initialized value.
const uint64_t INIT = 4;
// In this case, F is not calculated successively. For example,
// To get F(6), we only need F(4), F(3), F(2), F(1), F(0) (no F(5)),
// so the other elements in F is still INIT.
// Another way is to use hash map(std::unordered_map), however,
// it will be slower.
uint64_t MEM[SIZE] = { [0 ... SIZE-1] = INIT };
uint64_t fib(unsigned int n)
{
if (MEM[n] != INIT) {
return MEM[n];
}

if (n == 0) {
return (MEM[n] = 0); // F(0) = 0.
} else if (n <= 2) {
return (MEM[n] = 1); // F(1) = F(2) = 1.
}

unsigned int k = n / 2; // k = n/2 if n is even. k = (n-1)/2 if n is odd.
uint64_t a = fib(k);
uint64_t b = fib(k + 1);

// By F(n) = F(2k+1) = F(k+1)^2 + F(k)^2, if n is odd.
//    F(n) = F(2k) = F(k) * [ 2 * F(k+1) – F(k) ], if n is even.
return (MEM[n] = (n % 2) ? a * a + b * b : a * (2 * b - a));
}

#### State vector

Although we can speed up the calculating by applying memoization above, the memory consumption with this approach grows with $n$. Is it possible to use a fixed memory no matter how big $n$ is? The answer is yes. Actually, we could just use a two-elements array to do it.

From the formula, we can calculate $[F_{2n}, F_{2n+1}]$ from $[F_n, F_{n+1}]$. For example, to calculate $F_{10}$, we need $F_5, F_6$. To calculate $F_5$, we need $F_2, F_3$. To calculate $F_2$, we need $F_1, F_0$. To calculate $F_1$, we need $F_0, F_1$ (so we need to stop here since $F_1$ is the dead end).

However, how do we get $F_6$ when we only have $F_2, F_3$ to calculate $F_5$? Or how to get $F_3$ when we only have $F_0, F_1$ to calculate $F_2$ …?

By applying $n = 2$ to formula, we can use $F_2, F_3$ to get $F_4, F_5$. Then we can get $F_6 = F_4 + F_5$.

Thus, we are able to get $F_{10}$ by the following procedure:

$\require{AMScd} \begin{CD} \left( \begin{array}{c} F_0 \\ F_1 \end{array} \right) @>{2n+1, 2n+2}>> \left( \begin{array}{c} F_1 \\ F_2 \end{array} \right) @>{2n, 2n+1}>> \left( \begin{array}{c} F_2 \\ F_3 \end{array} \right) @>{2n+1, 2n+2}>> \left( \begin{array}{c} F_5 \\ F_6 \end{array} \right) @>{2n, 2n+1}>> \left( \begin{array}{c} F_{10} \\ F_{11} \end{array} \right) \end{CD}$

Thus, we could keep using two-elements array for $\begin{bmatrix} F_n \\ F_{n+1} \end{bmatrix}$ to compute what we want and update it step by step.

But how to determine the state we should update from $[F_n, F_{n + 1}]$, $[F_{2n}, F_{2n + 1}]$ or $[F_{2n + 1}, F_{2n + 2}]$ ?

It’s simple. If $n$ is even, we need to find $F_k$ , where $k = \frac{n}{2}$ since $n = 2x$. Then we can use $[F_k, F_{k+1}] = [F_{n/2}, F_{n/2 + 1}]$ to calculate $[F_{2k}, F_{2k + 1}] = [F_n, F_{n + 1}]$.

Otherwise, if $n$ is odd, we need to find $F_k$ , where $k = \frac{n-1}{2}$ since $n = 2k + 1$. Then we can use $[F_k, F_{k+1}] = [F_{(n-1)/2}, F_{(n-1)/2 + 1}]$ to calculate $[F_{2k}, F_{2k+1}] = [F_{n-1}, F_n]$ and then get $[F_n, F_{n + 1}]$ by $[F_n, F_{n-1} + F_n]$.

In summary, the procedure can be organized as follows:

$k_i$ $k_1$ $k_2$ $k_3$ $k_4$ $k_5$
$n(= k_i)$ 10 5 2 1 0
$n$ is odd   v   v
$F_{2k_{i+1}}$   $F_4$   $F_0$
$F_n$ $F_{10}$ $F_5$ $F_2$ $F_1$ $F_0$
$F_{n+1}$   $F_6$ $F_3$ $F_2$ $F_1$

The last two rows, $F_n, F_{n+1}(= F_{k_i}, F_{k_i+1})$, are the state vector that contains our answer.

The first row $n$, is the index of the first element of the state vector $F_n$. The second row indicates that whether $n$ is odd or not. If $n(= k_i)$ is odd(recall what we discuss above), then we need to update state from from $[F_{k_{i+1}}, F_{k_{i+1}+1}]$ to $[F_{2k_i + 1}, F_{2k_i + 2}]$ since $k_{i+1} = \frac{k_i - 1}{2}$. The third row is used to record if we need get $[F_{2k_i + 1}, F_{2k_i + 2}]$ from $[F_{2k_i}, F_{2k_i + 1}]$. Otherwise, if $n(= k_i)$ is even, updating state from $[F_{k_{i+1}}, F_{k_{i+1}+1}]$ to $[F_{2k_i}, F_{2k_i + 1}]$ directly.

From the top-down perspective, to get $F_{10}$, we need $F_5, F_6$. To get $F_5, F_6$, we need $F_2, F_3$. To get $F_2, F_3$, we need $F_1, F_2$. To get $F_1, F_2$, we need $F_0, F_1$. We will demonstrate how we do it recursively below.

From the bottom-up perspective, we can use $F_0, F_1$ to get $F_0, F_1, F_2$, then $F_1, F_2$ to get $F_2, F_3$, $F_2, F_3$ to get $F_4, F_5, F_6$, $F_5, F_6$ to get $F_10$. We will demonstrate how we do it in iterative section.

The recursive approach is easier to understand. By what we summarized above, the simplest implementation will be:

// Set f[0], f[1] to F(n), F(n+1).
void fib_helper(unsigned int n, uint64_t f[]);

// 4 is not a fibonacci number, so using it as initialized value.
const uint64_t INIT = 4;

uint64_t fib(unsigned int n)
{
uint64_t f[2] = { INIT, INIT };
fib_helper(n, f);
return f[0];
}

void fib_helper(unsigned int n, uint64_t f[])
{
if (n == 0) {
f[0] = 0; f[1] = 1;
return;
}

unsigned int k = 0;
if (n % 2) {
k = (n - 1) / 2;
fib_helper(k, f);
uint64_t a = f[0];            // F(k) = F((n-1)/2)
uint64_t b = f[1];            // F(k + 1) = F((n- )/2 + 1)
uint64_t c = a * (2 * b - a); // F(n-1) = F(2k) = F(k) * [2 * F(k + 1) - F(k)]
uint64_t d = a * a + b * b;   // F(n) = F(2k + 1) = F(k)^2 + F(k+1)^2
f[0] = d;                     // F(n)
f[1] = c + d;                 // F(n+1) = F(n-1) + F(n)
} else {
k = n / 2;
fib_helper(k, f);
uint64_t a = f[0];            // F(k) = F(n/2)
uint64_t b = f[1];            // F(k + 1) = F(n/2 + 1)
f[0] = a * (2 * b - a);       // F(n) = F(2k) = F(k) * [2 * F(k + 1) - F(k)]
f[1] = a * a + b * b;         // F(n + 1) = F(2k + 1) = F(k)^2 + F(k+1)^2
}
}

The above fib_helper is quite tedious, we can be simplify it into:

// Set f[0], f[1] to F(n), F(n+1).
void fib_helper(unsigned int n, uint64_t f[])
{
if (!n) {
f[0] = 0;
f[1] = 1;
return;
}

fib_helper(n / 2, f);
// k = floor(n/2), so k = n / 2 if n is even, k = (n - 1) / 2 if n is odd.
uint64_t a = f[0]; // F(k)
uint64_t b = f[1]; // F(k+1)

uint64_t c = a * (2 * b - a); // F(2k) = F(k) * [ 2 * F(k+1) – F(k) ]
uint64_t d = a * a + b * b;   // F(2k+1) = F(k+1)^2 + F(k)^2

if (n % 2) {    // k = (n - 1) / 2, so F(2k) = F(n-1), F(2k+1) = F(n).
f[0] = d;     // F(n) = F(2k+1).
f[1] = c + d; // F(n+1) = F(n-1) + F(n) = F(2k) + F(2k+1).
} else {        // k = n / 2, so F(2k) = F(n), F(2k+1) = F(n+1).
f[0] = c;     // F(n) = F(2k).
f[1] = d;     // F(n+1) = F(2k).
}
}

You could also replace array with std::vector, so the code will looks more elegant. However, it will be slower than using array directly.

// Return vector [ F(n), F(n+1) ].
std::vector<uint64_t> fib_helper(unsigned int n);

uint64_t fib(unsigned int n)
{
return fib_helper(n)[0];
}

std::vector<uint64_t> fib_helper(unsigned int n)
{
if (!n) {
// [F(0), F(1)] = [0 , 1]
return { 0 , 1 };
}

std::vector<uint64_t> f(fib_helper(n / 2));
// k = floor(n/2), so k = n / 2 if n is even, k = (n - 1) / 2 if n is odd.
uint64_t a = f[0]; // F(k)
uint64_t b = f[1]; // F(k+1)

uint64_t c = a * (2 * b - a); // F(2k) = F(k) * [ 2 * F(k+1) – F(k) ]
uint64_t d = a * a + b * b;   // F(2k+1) = F(k+1)^2 + F(k)^2

if (n % 2) { // k = (n - 1) / 2, so F(2k) = F(n-1), F(2k+1) = F(n).
// [F(n), F(n+1)] = [F(2k+1), F(2k+2)] = [F(2k+1), F(2k) + F(2k+1)]
return { d, c + d };
} else { // k = n / 2, so F(2k) = F(n), F(2k+1) = F(n+1).
// [F(n), F(n+1)] = [F(2k), F(2k+1)].
return { c, d };
}
}

### Iterative (Bottom-up) Approach

The recursive approach is implemented from the top-down perspective. We could also do it in bottom-up way.

To convert the recursive steps into an iterative loop, we need to find the initialized state and the stop condition. In the recursive approach, no matter what $n$ is, the final state vector (when the recursive steps stops) is always $[F_0, F_1]$, , and it must be called from calculating the state [F_1, F_2]. Recall how we calculate $F_{10}$:

• We recursively calculate $n \leftarrow \lfloor \frac{n}{2} \rfloor$ from $n = 10$,
• then $n = \lfloor \frac{10}{2} \rfloor = 5$,
• then $n = \lfloor \frac{5}{2} \rfloor = 2$,
• then $n = \lfloor \frac{2}{2} \rfloor = 1$,
• then stop recursive steps when $n = \lfloor \frac{1}{2} \rfloor = 0$.
• Next, we get the state vector $[F_n, F_{n+1}]$ for $n = 0$,
• then return on the same track with opposite direction to calculate the state vector for $n = 1$,
• then for $n = 2$
• then for $n = 5$,
• and finally get the answer for $n = 10$.
$\require{AMScd} \begin{CD} \left( \begin{array}{c} F_0 \\ F_1 \end{array} \right) @>{2n+1, 2n+2}>> \left( \begin{array}{c} F_1 \\ F_2 \end{array} \right) @>{2n, 2n+1}>> \left( \begin{array}{c} F_2 \\ F_3 \end{array} \right) @>{2n+1, 2n+2}>> \left( \begin{array}{c} F_5 \\ F_6 \end{array} \right) @>{2n, 2n+1}>> \left( \begin{array}{c} F_{10} \\ F_{11} \end{array} \right) \end{CD}$

The recursive steps are used to get the track from $n = 0$ to $1, 2, 5, 10$, then calculate $[F_n, F_{n+1}]$ for each $n$.

To remove the recursive steps, we need to have a way to compute the track. We can use a stack to track the change for $n$, starting push $n$ from $n = 10$, then $n = 5$, $n = 2$, $n = 1$, $n = 0$, then the track can be get from popping them from $0$ to $10$.

Thus, the initialized state is $n = 0$ and the stop condition is to check whether the stack is empty.

(Using stack is one common approach to convert recursive code into the iterative one.)

uint64_t fib(unsigned int n)
{
// To compute the track from n, n/2, ..., 1, 0.
std::stack<unsigned int> s;
while(n) {
s.push(n);
n /= 2; // n = floor(n/2)
}
s.push(n); // n = 0 now.

uint64_t a; // F(n)
uint64_t b; // F(n+1)
while (!s.empty()) {
unsigned int m = s.top(); s.pop();

if (m == 0) { // Initializing a, b.
a = 0; // F(0) = 0
b = 1; // F(1) = 1
continue;
}

// Let k = floor(m/2), so a is F(k) and b is F(k+1) now.
// k = m/2, if m is even. k = (m-1)/2, if m is odd.
uint64_t c = a * (2 * b - a); // F(2k) = F(k) * [ 2 * F(k+1) – F(k) ]
uint64_t d = a * a + b * b;   // F(2k+1) = F(k)^2 + F(k+1)^2

if (m % 2) {  // m = 2k+1:
a = d;      //  F(m) = F(2k+1)
b = c + d;  //  F(m+1) = F(m) + F(m-1) = F(2k+1) + F(2k)
} else {      // m = 2k:
a = c;      //  F(m) = F(2k)
b = d;      //  F(m+1) = F(2k+1)
}
}

return a;
}

The above code is a bit ugly for simulating the recursive steps like: $\require{AMScd} \underbrace{ \begin{CD} \left( \begin{array}{c} \boldsymbol{a} = F_0 \\ \boldsymbol{b} = F_1 \end{array} \right) @>{2n+1, 2n+2}>> \left( \begin{array}{c} F_1 \\ F_2 \end{array} \right) @>{2n, 2n+1}>> \left( \begin{array}{c} F_2 \\ F_3 \end{array} \right) @>{2n+1, 2n+2}>> \left( \begin{array}{c} F_5 \\ F_6 \end{array} \right) @>{2n, 2n+1}>> \left( \begin{array}{c} F_{10} \\ F_{11} \end{array} \right) \end{CD} }_{loop}$

The initialized state is usually set outside of the loop directly like below:

...
uint64_t a = 0; // F(0) = 0
uint64_t b = 1; // F(1) = 1
while (!s.empty()) {
...
}
...

$\require{AMScd} \begin{CD} \left( \begin{array}{c} \boldsymbol{a} = F_0 \\ \boldsymbol{b} = F_1 \end{array} \right) \end{CD} \underbrace{ \begin{CD} @>{2n+1, 2n+2}>> \left( \begin{array}{c} F_1 \\ F_2 \end{array} \right) @>{2n, 2n+1}>> \left( \begin{array}{c} F_2 \\ F_3 \end{array} \right) @>{2n+1, 2n+2}>> \left( \begin{array}{c} F_5 \\ F_6 \end{array} \right) @>{2n, 2n+1}>> \left( \begin{array}{c} F_{10} \\ F_{11} \end{array} \right) \end{CD} }_{loop}$

Since initialized state is set before the loop, we should start the track from $n = 1$ to $2, 5, 10$:

std::stack<unsigned int> s;
while (n) {
s.push(n);
n /= 2;
}
// No s.push(n); // n = 0 now. here!

Therefore, the code will be:

uint64_t fib(unsigned int n)
{
std::stack<unsigned int> s;
while (n) {
s.push(n);
/*n /= 2*/n >>= 1;
}

uint64_t a = 0; // F(0) = 0
uint64_t b = 1; // F(1) = 1
while (!s.empty()) {
unsigned int m = s.top(); s.pop();

// Let k = floor(m/2), so a is F(k) and b is F(k+1) now.
// k = m/2, if m is even. k = (m-1)/2, if m is odd.
uint64_t c = a * (2 * b - a); // F(2k) = F(k) * [ 2 * F(k+1) – F(k) ]
uint64_t d = a * a + b * b;   // F(2k+1) = F(k)^2 + F(k+1)^2

if (/*m % 2*/m & 1) { // m = 2k+1:
a = d;              //  F(m) = F(2k+1)
b = c + d;          //  F(m+1) = F(m) + F(m-1) = F(2k+1) + F(2k)
} else {              // m = 2k:
a = c;              //  F(m) = F(2k)
b = d;              //  F(m+1) = F(2k+1)
}
}

return a;
}

Another trick above is to replace n /= 2 by n >>= 1 and m % 2 by m & 1. It will be faster a little bit.

#### Non-stack approach

Since applying std::stack will pay for memory allocation, so we should try not using it for better performance.

The reason we need the stack is to get the track for each $n$, where $n \leftarrow \lfloor \frac{n}{2} \rfloor$ until $n = 1$. And the track is used to determine what state we should update from $[F_n, F_{n+1}]$, to $[F_{2n}, F_{2n+1}]$ or $[F_{2n+1}, F_{2n+2}]$, by the given $n$ is even or odd.

In the above implementation, we put the $n_0 = n, n_1, n_2, ..., n_j, ..., n_{t-1}, n_t = 1$, where $n_j = \lfloor \frac{n}{2^j} \rfloor$ denotes $n$ is right shifted by $j$ bits(n_j = n >> j) and $j \geq 1$ is an integer, to the stack, and then iteratively check $n_t = 1, n_{t-1}, ..., n_2, n_1, n_0 = n$ is odd or even. We could do it without stack! Assume the highest 1-bit in $n$ is the $h$th bit from right side, then the loop will execute $h = t + 1 = \log_2 n + 1$ times. (so the time complexity is $O(\log n)$) Therefore, we could loop $h$ times to calculate $F_{n_j}$ from $j = t = h-1$ to $j = 0$. As the result, the code will be:

uint64_t fib(unsigned int n)
{
// The position of the highest bit of n.
// So we need to loop h times to get the answer.
// Example: n = (Dec)50 = (Bin)00110010, then h = 6.
//                               ^ 6th bit from right side
unsigned int h = 0;
for (unsigned int i = n ; i ; ++h, i >>= 1);

uint64_t a = 0; // F(0) = 0
uint64_t b = 1; // F(1) = 1
for (int j = h - 1 ; j >= 0 ; --j) {
// n_j = floor(n / 2^j) = n >> j, k = floor(n_j / 2), (n_j = n when j = 0)
// then a = F(k), b = F(k+1) now.
uint64_t c = a * (2 * b - a); // F(2k) = F(k) * [ 2 * F(k+1) – F(k) ]
uint64_t d = a * a + b * b;   // F(2k+1) = F(k)^2 + F(k+1)^2

if ((n >> j) & 1) { // n_j is odd: k = (n_j-1)/2 => n_j = 2k + 1
a = d;            //   F(n_j) = F(2k+1)
b = c + d;        //   F(n_j + 1) = F(2k + 2) = F(2k) + F(2k+1)
} else {            // n_j is even: k = n_j/2 => n_j = 2k
a = c;            //   F(n_j) = F(2k)
b = d;            //   F(n_j + 1) = F(2k + 1)
}
}

return a;
}

Doing AND operation(&) to the last bit of $n_j$ above is same as doing AND operation(&) from the highest bit to the lowest bit of the $n$. Thus, we could also rewrite the code into:

uint64_t fib(unsigned int n)
{
// The position of the highest bit of n.
// So we need to loop h times to get the answer.
// Example: n = (Dec)50 = (Bin)00110010, then h = 6.
//                               ^ 6th bit from right side
unsigned int h = 0;
for (unsigned int i = n ; i ; ++h, i >>= 1);

uint64_t a = 0; // F(0) = 0
uint64_t b = 1; // F(1) = 1
// There is only one 1 in the bits of mask. The 1's position is same as
// the highest bit of n(mask = 2^(h-1) at first), and it will be shifted right
// iteratively to do AND operation with n to check n_j is odd or even,
// where n_j is defined below.
for (unsigned int mask = 1 << (h - 1) ; mask ; mask >>= 1) { // Run h times!
// Let j = h-i (looping from i = 1 to i = h), n_j = floor(n / 2^j) = n >> j
// (n_j = n when j = 0), k = floor(n_j / 2), then a = F(k), b = F(k+1) now.
uint64_t c = a * (2 * b - a); // F(2k) = F(k) * [ 2 * F(k+1) – F(k) ]
uint64_t d = a * a + b * b;   // F(2k+1) = F(k)^2 + F(k+1)^2

if (mask & n) { // n_j is odd: k = (n_j-1)/2 => n_j = 2k + 1
a = d;        //   F(n_j) = F(2k + 1)
b = c + d;    //   F(n_j + 1) = F(2k + 2) = F(2k) + F(2k + 1)
} else {        // n_j is even: k = n_j/2 => n_j = 2k
a = c;        //   F(n_j) = F(2k)
b = d;        //   F(n_j + 1) = F(2k + 1)
}
}

return a;
}

All the above code are on gist here.


text:
# Analyzing DC and AC Magnetic Field Intensity, Distribution, and Relationship in a Hyundai IONIQ 2016 Electric Vehicle

## Article information

J Electromagn Eng Sci. 2021;21(4):282-290
Publication date (electronic) : 2021 September 30
doi : https://doi.org/10.26866/jees.2021.4.r.35
Department of Electronic and Electrical Engineering, Research Center for Applied Human Sciences, Hankyong National University, Anseong, Korea
*Corresponding Author: Soochan Kim (e-mail: sckim@hknu.ac.kr)
Received 2020 August 18; Revised 2020 December 31; Accepted 2021 March 3.

## Abstract

This study aimed to evaluate the direct current (DC) and alternating current (AC) electromagnetic field (EMF) intensity and distribution of an electric vehicle (EV). The results revealed that the EV generated DC and AC EMFs, which differed depending on the operation (resting, idling, and driving at speeds of 40 and 80 km/h). A correlation was established between the AC and DC components of the EMF, which was approximately 0.5 when idling and 0.8 at speeds of 40 and 80 km/h. The results obtained were below the harmful limit set by regulatory agencies, specifically the International Commission on Non-Ionizing Radiation Protection (ICNIRP) and the Institute of Electrical and Electronics Engineers (IEEE). To further contribute to this field of study, the various measurement equipment used in the literature are summarized according to their parameters.

## I. Introduction

The low electromagnetic field (EMF) produced by electric vehicle (EV) engines and electric components might pose a health risk to the driver and occupant(s) [14]. Several studies have investigated this possibility, but there is no general consensus as to whether the MF levels generated cause harm to humans. EV usage and patronage is on the rise due to global concerns regarding greenhouse gas emissions, which are projected to double by 2050 if current energy consumption indexes persist [5]. Additionally, the governments of some countries have implemented tax waivers and other benefits to entice consumers to purchase EVs [6, 7]. This is in line with global climate change policies, such as the recent Paris Agreement of 2016 [8].

To address the concern of the potential harm of EVs, several researchers have measured EMF levels and compared these measures to the limits set by regulatory agencies. Predominately, the most commonly used regulations are those of the International Commission on Non-Ionizing Radiation Protection (ICNIRP) [9, 10] and the Institute of Electrical and Electronics Engineers (IEEE) [11], but other agencies [1215] have different limits due to differences in opinion and scientific deduction [16, 17]. For example, the BioInitiative Working Group [17] argued that the ICNIRP limits were obtained using anatomical models and thus may not reflect the real human body. Other studies have observed and recorded human physiological reaction to EMF exposure, such as delayed response time [18, 19], visual problems [10, 2022], and aggravated annoyance [23].

Tell et al. [24] measured and averaged EMF emissions in 14 different EVs and hybrid EVs to obtain a mean value. Hareuveny et al. [25] assessed 10 vehicles and provided a range of average EMF values for each vehicle and levels at various points within the vehicles. They found notably stronger EMF in EVs compared to internal combustion engine vehicles. Halgamuge et al. [26] measured and reported the level from a single hybrid EV at different points in the vehicle. Vassilev et al. [27] compared the EMF levels of 11 different cars using 11 sample points. Vedholm and Hamnerius [28] measured the readings of seven cars using 20 sample points. Their study was the first to hypothesize that the battery position may have some effect on EMF emission production. Stankowski et al. [29] considered the driver’s head and feet position as important for EMF EV testing. This was based partly on the ICNIRP’s conclusion that the head (specifically the eyes) is a target area [9, 10].

Monero-Torres et al. [30] initiated EMF deduction using simulations. In their experiment, they theoretically deduced the EMF for an EV via finite models using the EV’s battery and later its inverter [31]. Campi et al. [32] used numerical characterization to assess the EMF of an EV with a wireless power transfer system. Lennerz et al. [33] assessed the EMF within several cars to investigate its effect on cardiac implants. Ruddle et al. [34] assessed EMFs caused by current transients within the EV. They hypothesized that human harm is likely. Milham et al. [35] assessed EMF considering the steel-belted radial tires of the EV. The study established that the tires are sources of EMF, but the level dropped when measurements were taken within the vehicle, which is in line with the findings of [29]. Ruddle et al. [34, 36] employed simulations to test several EV models and reported a value of 52.9 μT. Other reports have also delt with this subject matter [3742]. Snyder [43] was awarded a government grant to study EMF shielding in EVs. Pittsyna et al. [44] reviewed past studies and estimated the EMF of an EV to be 129 μT.

Although numerous studies have revealed the EMF levels generated by various EVs, these previous studies have had several drawbacks:

1. The experiments conducted were not replicable in some situations (e.g. [45]);

2. Parameters such as amplitude, field type (if DC or AC), frequency spectrum, and field distribution complicated the task of measurement with relation to biological creatures (e.g. [45]) and;

3. It remains unclear which regulatory agencies’ limits are best suited to this area of study.

The purpose of this paper is to determine the level of DC and AC EMFs generated in an EV; reveal their relationships; and obtain the EV’s EMF intensity, distribution, and frequency for different operating conditions. We reviewed previous studies to determine the best measuring equipment and environment for data collection, how to interpret the results, and which regulatory agencies’ safety limits to compare the results to.

## II. Methodology

As already mentioned, previous studies have used different protocols, such as spot measurement, continuous measurement, or measurement at varying speeds, as well as different equipment. While reviewing previous studies, we noted the EMF levels found, measuring equipment used, frequency range, vehicle type, data collection environment, and type of field measured. Based on these previous reports, we noted a gap in terms of the use of a new technologically advanced meter specifically designed for detecting extremely low-frequency (ELF) fields. The various measuring devices available were analyzed based on the device specifications.

Its AC measurement was in the range of approximately 16 to 2,000 Hz. Additionally, it used either fast Fourier transformation for frequency domain measurements or the weighted peak method in the time domain mode, which offers great precision. The Vector/Magnitude Gauss Meter (Alpha Lab, Salt Lake City, UT, USA) was also used and fitted with a Hall probe to increase its accuracy in detecting DC magnetic fields. Magnetic field data were collected using the Gauss meter for DC magnetic field information and NFA 1000 meter for AC magnetic information.

Data collected were logged into a Microsoft Excel sheet (Microsoft, Redmond, WA, USA) and statistically analyzed using the 2016 Excel toolbox feature. The NFAsoft software (Gigahertz Solutions, Langenzenn, Germany) was used for the data analysis of the obtained EMF data. Table 1 highlights the vehicle specification [46]. A fully EV, the IONIQ 2016 (Hyundai Motors, Seoul, Korea) was used.

EV (IONIQ) specifications

A route for the experiment was selected based on the following considerations. The route had to have open lanes allowing for speeds of up of 40 km/h, 80 km/h, and 100 km/h to be achieved. There also had to be comparatively low vehicular traffic and minimal interference from power transmission lines. Thus, the Anseong to Chincon expressway within the Gyeonggi-do province of South Korea was the route taken as the drive path. A map of the route is provided in Figs. 1 and 2, which show the locations of the roads travelled for fast- and slow-speed data collection.

High-speed road test route (speed at 80 km/hr; map extracted using kakaomap application, version 6.0).

Low-speed road test route (speed at 40 km/hr; map extracted using kakaomap application, version 6.0).

Data were obtained for the following conditions: at rest and at speeds of 40 km/hr and 80 km/hr. These conditions were picked based on other papers with similar conditions (e.g. [24, 25]). Hence, the data can be compared to the results of those studies.

Fig. 3 provides the sample collection point(s) [47]. The order of sample collection went from left to right (rear to front): BLMN–IJK–FGH–CDE, with position A collected only during rest, startup, or idling. Idling here refers to when the car was on, but there was no acceleration or motion. The positions CFIL-DGJM-EHKN correspond to the head, chest, and feet region, respectively.

Fig. 4 provides a diagram of the position(s) earmarked in Fig. 3 and shows how the instruments were used to conduct the EV EMF test.

Measurement setup; collection point from Fig. 3.

The equipment was calibrated at the beginning of the experiment according to the manufacturer’s specifications. NFA and NFAsoft were used to support the measurement of the working environment. In this case, the 6D feature was used to measure six positions (H, G, F, N, M, L) and to generate the EMF field pattern, as shown in Section III. In addition, the EMF field pattern in the horizontal plane was generated using the positions of nine points (HAE, F, C, between F and C, and LBI; 9D feature). The NFA software guides the user through the nine points by means of short audio signals (beeps). These nine points were processed in the order presented in Fig. 3. This method was used to ascertain if the EV emits DC and AC EMFs.

## III. Result

Table 2 provides specifications for the most used EMF meters from various studies. Based on these results, EMF data in our study were collected using the Gauss meter for DC MF and the NFA 1000 meter (Gigahertz Solutions) for AC MF due to their advantages in terms of accuracy and data logging. Table 3 displays the data obtained from the road test. The DC and AC components of the EMF generated at different operating conditions were obtained and recorded. Additionally, the frequency levels at each sample collection point were also recorded. The results revealed the difference in frequency for different sample point(s).

Data obtained at different conditions

Correlations analysis of DC to AC across conditions

As seen in Table 3, the NAF meter recorded AC and AC peak data. Fig. 5 graphically represents their relationship.

AC and AC peak relationship.

The data were analyzed using the statistical tools provided in Microsoft Excel to determine the correlation between the AC and DC fields detected. Table 4 shows the correlation coefficient between the DC and AC EMFs analyzed under different operating conditions [46, 4850]. The relationship between the DC and AC fields at rest was negligible. While idling, there was an increase, but the correlation was low. When changing speeds, they were strongly positively correlated. This can be interpreted as an increase in speed results in greater EMF generation.

EMF meter specifications

Next, the field distribution pattern was obtained using NFAsoft for the car at rest and when idling. Fig. 6 shows the field pattern using the data obtained for the EMF and the varying frequencies obtained at different points during measurement. The image shows an aerial view of the EV similar to a horizontal (or flat) plane (9D) and a vertical representation capturing the seating position from head to feet (6D).

Horizontal and vertical field distribution for the front and rear seat during rest (9D and 6D). Values are in mG. Dark green represents field levels similar to the earth natural field and brighter colors depict an increase in MF. The brighter the color, the stronger the MF intensity. Building biology standards are employed by the meter here.

As can be seen, a field pattern was found, with the bulk of the field at the front section of the EV. The seat positions were analyzed again when the car was switched on. Fig. 7 shows the field distribution. There was a considerable increase in EMF due to the change in the operating condition of the EV. A clear indication of a stronger EMF as the car moved from idling to low speeds of 40 km/hr is hereby firmly established.

MF pattern at low speed (40 km/hr) for the front and rear seat during rest (6D). Values are in mG. Dark green represents field levels similar to the earth natural field and brighter colors depict an increase in MF. The brighter the color, the stronger the MF intensity. Building biology standards are employed by the meter here.

Finally, to determine the location with the highest EMF level (potential harmful zone), a bar chart was created from the data obtained (Fig. 8). The sample points from Fig. 3 (with the exception of points A and B and peak data) are grouped.

MF sample point analysis using a bar chart.

As seen in Fig. 8, the feet/floor region emitted the highest level of EMF. The field levels were almost the same in each section, with the exception of the left rear chest and right rear chest regions. A maximum value of about 6.00 mG was obtained during the test drive, with an average of 1.41 mG and SD of 1.12 mG.

## IV. Discussion

In most of the previous research, the EMF obtained from EV(s) was compared to a regulatory limit, usually that of the ICNIRP. The majority of studies have focused on EMF emissions from EVs alone [2833, 3743, 51, 52]. Others studies have gone a step further and compared the emissions of EVs and other types of vehicles, such as hybrid EVs [2426, 35, 38, 44, 53] and conventional gasoline engine vehicles [27, 35]. However, certain parameters remain unaccounted for, and multiple regulatory bodies exist with varying limits.

Based on our literature review, we narrowed down our equipment of choice while keeping in mind the shortcomings in the overall research in this field. It was observed that some studies only recorded the DC EMF field generated. While all meters are certified by a competent authority, more recent meter(s) have some technological upgrades, such as data logging capability, temperature resistance, and a wider range of measurement. The data obtained established that both DC and AC EMFs are emitted during operation of the EV. The DC field levels were always higher than the AC field levels, as seen in Table 3. This might be due to the interaction of the AC field produced by the car components (for example, the inverter) and the earth’s natural DC field. We can infer that some of the AC fields may be superimposed, leading to higher DC levels.

Magnetic field levels increased with speed. Each field level showed a significant increase in value across each measurement position for the different operating conditions selected. Additionally, switching operating conditions resulted in a significant increase in the fields produced, with the highest values seen at the front passenger floor (DC field increased from 0.04 mG at rest to 4.8 mG at 40 km/hr).

A relationship between the DC to AC fields during different conditions was determined by means of correlation coefficient analysis. The results revealed that the fields are positively correlated when the EV is switched on (approximately 0.5 at idling and 0.8 at speeds of 40 km/hr and 80 km/hr). Thus, this implies that an increase in the DC magnetic field is accompanied by an increase in the AC magnetic field and vice versa. An increase in speed resulted in greater EMF generation.

The frequency spectrum for the fields produced in the EV fell within: 16.7 Hz, 50/60 Hz, 100/120 Hz, 150/180 Hz, R < 2 kHz and > 2 kHz. The greatest concern regarding EMF is the dominating frequency of the EV, as the other frequencies are usually negligible. The dominating frequency for the car at rest was 50/60 Hz, with < 2 kHz as the second dominating frequency. The only exception was at the driver’s foot region.

A frequency of 50 or 60 Hz is found in most household appliances [54]. However, during operation, the frequency of the EV changed from 50 or 60 Hz to < 2 kHz. The change in frequency was more predominant at the front of the EV (the front passenger and driver regions). We were unable to determine why different frequency distributions occurred at varying points.

The DC and AC values obtained were below most regulatory agencies’ safety limits except for the limit set by the Building Biology Standards [14] (2.01 mG). Table 3 shows that the AC meter recorded peak values for very strong fields. Although these fields were unsteady, they represented the highest values obtainable. Based on our sampling, these values were not constant but rather fluctuating, and they could not be obtained on repeated trials. It is reasonable to infer that this level is fleeting and unstable, thus making it not harmful.

Occupants sit close to a powerful electric system when riding in an EV. The field pattern revealed that the EMF emission levels increased when the car was on and in use. Additionally, the pattern revealed that the front seats had higher EMF levels than the rear seats, even at rest. In this study, the EV’s battery was situated beneath the vehicle.

Braking and acceleration during the road tests caused fluctuations in EMF values. As such, it can be deduced that acceleration and deceleration affect EMF levels. The EMF was observed to increase with increasing speed, which agrees with [25]. The peak values for the AC magnetic field were unpredictable and changed when the test was repeated; thus, the data cannot be interpreted with certainty.

A shortcoming of this study may be attributable to the limited sample size. Future studies should experiment with large sample sizes and more statistical tests, like analysis of variance, for comparison. Additionally, the combination of DC and AC fields may affect biological systems, but that is beyond the scope of this work. One study did infer that the combination of AC and DC fields coupled with their fluctuating levels might be harmful [55]. Future works should consider the effects of these weak fields on human subjects using physiological tests, such as heart rate variability, gaze technology, and galvanic skin response, while driving the EV.

## V. Conclusion

Similar to other studies on EV EMF emissions, the values obtained in this study were below the ICNIRP and IEEE limits. In future studies, these values can be used to replicate the level generated by an EV to determine if it is harmful. This study established that both AC and DC fields were generated in the EV during operation (switching on and in motion) of the vehicle. The driver’s and front passenger’s feet region generated stronger EMF levels than any other location, at a frequency of 50/60 Hz, which is similar to that of home appliances [45, 54]. This study provides useful information on EMF intensity, frequency, field distribution, and conditions generated in the EV.

## References

1. Ptitsyna NG, Ponzetto A, Kopytenko YA, Ismagilov VS, Korobeinikov AG. Electric vehicle magnetic fields and their biological relevance. Journal of Scientific Research and Reports 3:1753–1770. 2014;
2. WEEP News. Fear but few facts, on hybrid risk 2008. Available: http://weepnews.blogspot.com/search?q=fear-but-few-facts-on-hybrid .
3. Irvine N. Definition, epidemiology and management of electrical sensitivity Health Protection Agency. Oxfordshire, UK: Report No HPA-RPD-010. 2005.
4. Rubin GJ, Munshi JD, Wessely S. Electromagnetic hypersensitivity: a systematic review of provocation studies. Psychosomatic Medicine 67(2):224–232. 2005;
5. Yong JY, Ramachandaramurthy VK, Tan KM, Mithulananthan N. A review on the state-of-the-art technologies of electric vehicle, its impacts and prospects. Renewable and Sustainable Energy Reviews 49:365–385. 2015;
6. Un-Noor F, Padmanaban S, Mihet-Popa L, Mollah MN, Hossain E. A comprehensive study of key electric vehicle (EV) components, technologies, challenges, impacts, and future direction of development. Energies 10(8)article no 1217. 2017; https://doi.org/10.3390/en10081217 .
7. Wolsink M. The research agenda on social acceptance of distributed generation in smart grids: renewable as common pool resources. Renewable and Sustainable Energy Reviews 16(1):822–835. 2012;
8. UN Framework Convention on Climate Change. Adoption of the Paris Agreement 2015. [Online]. Available: https://unfccc.int/resource/docs/2015/cop21/eng/l09r01.pdf .
9. International Commission on Non-Ionizing Radiation Protection. Guidelines for limiting exposure to time-varying electric, magnetic, and electromagnetic fields (up to 300 GHz). Health Physics 74(4):494–522. 1998;
10. International Commission on Non-Ionizing Radiation Protection. Guidelines for limiting exposure to time-varying electric and magnetic fields (1 Hz to 100 kHz). Health Physics 99(6):818–836. 2010;
11. Lin JC. A new IEEE standard for safety levels with respect to human exposure to radio-frequency radiation. IEEE Antennas and Propagation Magazine 48(1):157–159. 2006;
12. Fragopoulou A, Grigoriev Y, Johansson O, Margaritis LH, Morgan L, Richter E, Sage C. Scientific panel on electromagnetic field health risks: consensus points, recommendations, and rationales. Reviews on Environmental Health 25(4):307–317. 2010;
13. Hyland G. The Physiological and Environmental Effects on Non-ionising Electromagnetic Radiation Luxembourg: European Parliament, Directorate General for Research; 2001.
14. Institut für Baubiologie + Nachhaltigkeit (IBN). Building biology evaluation guidelines for sleeping areas 2008. [Online]. Available: https://www.baubiologie.de/downloads/english/richtwerte_2008_englisch.pdf .
15. AVAATE. Guideline of the Austrian Medical Association for the diagnosis and treatment of EMF-related health problems and illnesses (EMF syndrome): consensus paper of the Austrian Medical Association’s EMF Working Group (AG-EMF) 2012. Available: https://avaate.org/spip.php?article2279 .
16. Starkey SJ. Inaccurate official assessment of radiofrequency safety by the Advisory Group on Non-ionising Radiation. Reviews on Environmental Health 31(4):493–503. 2016;
17. BioInitiative. BioInitiative 2012 a rationale for biologically-based exposure standards for low-intensity electromagnetic radiation 2012. Available: https://bioinitiative.org/conclusions/ .
18. Podd J, Abbott J, Kazantzis N, Rowland A. Brief exposure to a 50 Hz, 100 μT magnetic field: effects on reaction time, accuracy, and recognition memory. Bioelectromagnetics 23(3):189–195. 2002;
19. Mitchell CL, McRee DI, Peterson NJ, Tilson HA. Some behavioral effects of short-term exposure of rats to 2.45 GHz microwave radiation. Bioelectromagnetics 9(3):259–268. 1988;
20. Leitgeb N, Schrottner J. Electrosensibility and electromagnetic hypersensitivity. Bioelectromagnetics 24(6):387–394. 2003;
21. Crasson M, Legros JJ, Scarpa P, Legros W. 50 Hz magnetic field exposure influence on human performance and psychophysiological parameters: Two double-blind experimental studies. Bioelectromagnetics 20(8):474–486. 1999;
22. Barth A, Ponocny I, Ponocny-Seliger E, Vana N, Winker R. Effects of extremely low-frequency magnetic field exposure on cognitive functions: results of a metaanalysis. Bioelectromagnetics 31(3):173–179. 2010;
23. Reilly JP. Maximum pulsed electromagnetic field limits based on peripheral nerve stimulation: application to IEEE/ANSI C95. 1 electromagnetic field standards. IEEE Transactions on Biomedical Engineering 45(1):137–141. 1998;
24. Tell RA, Sias G, Smith J, Sahl J, Kavet R. ELF magnetic fields in electric and gasoline-powered vehicles. Bioelectromagnetics 34(2):156–161. 2013;
25. Hareuveny R, Sudan M, Halgamuge MN, Yaffe Y, Tzabari Y, Namir D, Kheifets L. Characterization of extremely low frequency magnetic fields from diesel, gasoline and hybrid cars under controlled conditions. International Journal of Environmental Research and Public Health 12(2):1651–1666. 2015;
26. Halgamuge MN, Abeyrathne CD, Mendis P. Measurement and analysis of electromagnetic fields from trams, trains and hybrid cars. Radiation Protection Dosimetry 141(3):255–268. 2010;
27. Vassilev A, Ferber A, Wehrmann C, Pinaud O, Schilling M, Ruddle AR. Magnetic field exposure assessment in electric vehicles. IEEE Transactions on Electromagnetic Compatibility 57(1):35–43. 2015;
28. Vedholm K, Hamnerius YK. Personal exposure resulting from low level low frequency electromagnetic fields in automobiles. In : Proceedings of the 2nd World Congress for Electricity and Magnetism in Medicine and Biology. Bologna, Italy; 1997; p. 8–13.
29. Stankowski S, Kessi A, Becheiraz O, Meier-Engel K, Meier M. Low frequency magnetic fields induced by car tire magnetization. Health Physics 90(2):148–153. 2006;
30. Moreno-Torres P, Lafoz M, Blanco M, Arribas JR. Passenger exposure to magnetic fields in electric vehicles. In : Modeling and Simulation for Electric Vehicle Applications. Rijeka, Croatia: InTech; 2016; p. 47–71.
31. Moreno-Torres PC, Lourd J, Lafoz M, Arribas JR. Evaluation of the magnetic field generated by the inverter of an electric vehicle. IEEE Transactions on Magnetics 49(2):837–844. 2013;
32. Campi T, Cruciani S, De Santis V, Maradei F, Feliziani M. Numerical characterization of the magnetic field in electric vehicles equipped with a WPT system. Wireless Power Transfer 4(2):78–87. 2017;
33. Lennerz C, O’Connor M, Horlbeck L, Michel J, Weigand S, Grebmer C, et al. Electric cars and electromagnetic interference with cardiac implantable electronic devices: a cross-sectional evaluation. Annals of Internal Medicine 169(5):350–352. 2018;
34. Ruddle AR, Armstrong R, Dawson L, Rowell A. Investigation of human exposure to magnetic fields from electrical powertrains: measured exposure levels and simulated impact on human body. In : Proceedings of the 5th IET Hybrid and Electric Vehicles Conference (HEVC). London, UK; 2014;
35. Milham S, Hatfield JB, Tell R. Magnetic fields from steel-belted radial tires: implications for epidemiologic studies. Bioelectromagnetics 20(7):440–445. 1999;
36. Ruddle AR, Low L. Assessing low frequency magnetic field exposure in hybrid and electric vehicles 2014. [Online]. Available: https://interferencetechnology.com/assessing-low-frequency-magnetic-field-exposure-in-hybrid-and-electric-vehicles/ .
37. Muc AM. Electromagnetic Fields Associated with Transportation Systems Toronto, Canada: Radiation Health and Safety Consulting; 2001.
38. Karabetsos E, Kalampaliki E, Koutounidis D. Testing hybrid technology cars: static and extremely low-frequency magnetic field measurements. IEEE Vehicular Technology Magazine 9(4):34–39. 2014;
39. Dietrich FM, Jacobs WL. Survey and assessment of electric and magnetic field (EMF) public exposure in the transportation environment Electric Research and Management Inc. State College, PA: No. PB-99-130908/XAB. 1999.
40. Schmid G, Uberbacher R, Goth P. ELF and LF magnetic field exposure in hybrid-and electric cars. In : Proceedings of the Bio-electromagnetics Conference; 2009; Davos, Switzerland.
41. Kato H, Ohkubo C, Isaka K. Measurement of the magnetic fields in cars running at constant speeds. In : Proceedings of the Joint Meeting of the Bioelectromagnetics Society and the European Bio Electromagnetics Association (BioEM). Thessaloniki, Greece; 2013; p. 10–14.
42. Karabetsos E, Kalampaliki E, Tsanidis G, Koutounidis D, Skamnakis N, Kyritsi T, Yalofas A. EMF measurements in hybrid technology cars. In : Proceedings of 6th International Workshop on Biological Effects of Electromagnetic Fields. Istanbul, Turkey; 2010; p. 10–14.
43. Snyder M. Magnetic shielding for electric vehicles 1995. [Online]. Available: http://www.engineeringmatters.com/Magnetic%20Shielding%20for%20Electric%20Vehicles.pdf .
44. Ptitsyna NG, Ponzetto A, Kopytenko YA, Ismagilov VS, Korobeinikov AG. Electric vehicle magnetic fields and their biological relevance. Journal of Scientific Research and Reports 3(13):1753–1770. 2014;
45. Barnes FS, Greenebaum B. Biological and Medical Aspects of Electromagnetic Fields Boca Raton, FL: CRC Press; 2018.
46. Hyundai Motors. IONIQ electric highlights 2020. [Online]. Available: https://www.hyundai.com/worldwide/en/eco/ioniq-electric/highlights .
47. VectorStock. Electric vehicle vector images (over 19,000) 2021. Available: https://www.vectorstock.com/royalty-free-vectors/electric-vehicle-vectors .
48. Combinova. Magnetic Field Meter 10 operator manual Available: http://manuals.repeater-builder.com/te-files/MISCELLANEOUS/COMBINOVA%20MFM10%20Operator.pdf .
49. EMDEX II Recording Meters [Online]. Available: https://emdex-llc.com/meter-sales/ .
50. NARDA. User’s manual EHP-50F 2015. Available: https://www.manualslib.com/manual/1396879/Narda-Ehp-50f.html .
51. Halgamuge MN, Abeyrathne CD, Mendis P. Influence of combined AC–DC electromagnetic fields on cell plasma membrane. In : Proceedings of BEMS/EBEA 2009 Joint Meeting. Davos, Switzerland; 2009;
52. Ruddle AR, Low L, Vassilev A. Evaluating low frequency magnetic field exposure from traction current transients in electric vehicles. In : Proceedings of 2013 International Symposium on Electromagnetic Compatibility. Brugge, Belgium; 2013; p. 78–83.
53. Shenhar G, Hard G. Mythbuster EMF levels in hybrids 2010. Available: https://www.consumerreports.org/cro/news/2010/08/mythbuster-emf-levels-in-hybrids/index.htm .
54. Aerts S, Calderon C, Valic B, Maslanyj M, Addison D, Mee T, et al. Measurements of intermediate-frequency electric and magnetic fields in households. Environmental Research 154:160–170. 2017;
55. Sastre A, Cook MR, Graham C. Nocturnal exposure to intermittent 60 Hz magnetic fields alters human cardiac rhythm. Bioelectromagnetics 19(2):98–106. 1998;

## Biography

Nelson A. Enegbuma has a B.Sc. in physics from the University of Jos, Nigeria and an M.Sc. in chemical engineering with a major in integrated chemical and environmental technologies from Hankyong National University, South Korea. He currently works as a Principal Scientific Officer at the Abuja Environmental Protection Board in Nigeria.

Soochan Kim currently works for the Department of Electronic and Electrical Engineering at the Research Center for Applied Human Sciences, Hankyong National University in South Korea. His areas of interest include bio signal measurement and instrumentation, human–computer interfaces, human magnetic sensitivity, and non-intrusive human fatigue estimation.

## Article information Continued

### Fig. 1

High-speed road test route (speed at 80 km/hr; map extracted using kakaomap application, version 6.0).

### Fig. 2

Low-speed road test route (speed at 40 km/hr; map extracted using kakaomap application, version 6.0).

### Fig. 4

Measurement setup; collection point from Fig. 3.

### Fig. 5

AC and AC peak relationship.

### Fig. 6

Horizontal and vertical field distribution for the front and rear seat during rest (9D and 6D). Values are in mG. Dark green represents field levels similar to the earth natural field and brighter colors depict an increase in MF. The brighter the color, the stronger the MF intensity. Building biology standards are employed by the meter here.

### Fig. 7

MF pattern at low speed (40 km/hr) for the front and rear seat during rest (6D). Values are in mG. Dark green represents field levels similar to the earth natural field and brighter colors depict an increase in MF. The brighter the color, the stronger the MF intensity. Building biology standards are employed by the meter here.

### Fig. 8

MF sample point analysis using a bar chart.

### Table 1

EV (IONIQ) specifications

Specification
EV type Powertrain
Engine Permanent magnet synchronous motor
Class All electric compact
Electric range 169 km (Korea)
Power Approximately 136 hp
Transmission Single speed reduction gear
Battery 28 kWh lithium-ion polymer battery

Source from [46].

### Table 2

Data obtained at different conditions

Sample points Rest (mG) Idling (mG) 40 km/hr (mG) 80 km/hr (mG) Dominating freq. (Hz) 2nd dominating freq. (Hz)

DC AC AC peak DC AC AC peak DC AC AC peak DC AC AC peak At rest During motion At rest During motion
Motor 2.8 0.79 6.45 2.15 1.8 4 - - - - - - 50/60 - < 2,000 -
Trunk 2.73 0.1 0.7 1.2 0.11 0.33 1.9 0.33 5 1.22 1.19 5.89 50/60 50/60 < 2,000 < 2,000
Left rear head 1.34 0.09 0.42 0.97 0.22 0.58 1.96 0.5 4.2 1.77 1.1 16.13 50/60 < 2,000 < 2,000 50/60
Left rear chest 0.66 0.06 0.45 1.36 0.31 0.6 1.09 0.58 4.2 2.13 1.45 36 50/60 50/60 < 2,000 < 2,000
Left rear floor 6 0.06 0.24 6.76 1.42 2.6 4.99 1.8 8.79 6 6.45 0.145×103 50/60 50/60 < 2,000 < 2,000
Right rear head 1.39 0.07 0.24 1.2 0.14 0.54 0.8 1.5 5 1.61 4.79 30.7 50/60 50/50 150/180 150/180
Right rear chest 1.26 0.05 0.21 1.34 0.14 0.39 1.36 1.46 5.69 1.59 2 16.99 50/60 < 2,000 < 2,000 50/60
Right rear floor 5.8 0.06 0.24 7.33 0.48 0.91 6 2.4 6.75 5.45 6.7 0.142×103 50/60 50/60 < 2,000 < 2,000
Passenger head 1.93 0.07 0.25 0.63 0.17 0.6 1.1 0.26 3 1.9 0.66 30.1 50/60 50/60 < 2,000 150/180
Passenger chest 1.97 0.05 0.22 1.74 0.4 0.96 2.23 0.43 3.27 1.87 0.69 30.93 50/60 < 2,000 < 2,000 >2,000
Passenger floor 4.25 0.04 0.22 3.4 2.21 4.94 4.8 2.35 8.65 4.41 6.6 0.199×103 50/60 < 2,000 150/180 50/60
Driver head 1.96 0.09 0.25 0.99 0.18 0.51 1.27 0.28 2 2.05 0.39 9.3 50/60 < 2,000 < 2,000 50/60
Driver chest 1.39 0.07 0.28 1.4 0.33 0.78 1.45 0.53 5.93 1.84 0.91 40 50/60 < 2,000 < 2,000 150/180
Driver floor 3.98 0.09 0.4 3.6 1.53 3 3.2 2.02 8.82 3.03 8.1 0.111×103 < 2,000 < 2,000 150/180 50/60

The dominating and second dominating frequency represents the highest first and second frequencies for MF detected.

Frequency detection is an added feature of the NAF meter. We measured MF at the AC band (16 to 2,000 Hz).

According to the meter manual, the NAF meter frequency-LEDs change their color in proportion to their contribution to the total field strength: 50/60 Hz, mains frequency. The bandwidth only covers individual frequencies of 50 Hz and 60 Hz with their respective lock-in ranges; 100/120 Hz, this LED indicates the contribution of the second through fourth “even” harmonics; 150/180 Hz, this LED indicates the contribution of the third through fourth “uneven” harmonics. The third harmonics will presently be found in many homes and most offices as a significant portion of the total measurement; and < 2 kHz, means remainder of frequencies below 2 kHz.

Source of the magnetic field are attributed to the motor speed.

### Table 3

Correlations analysis of DC to AC across conditions

DC/AC value
Rest 0.006
Idling 0.475
40 km/hr 0.770
80 km/hr 0.756

### Table 4

EMF meter specifications

FW BELL 5170 [46] Combinova MFM10 [48] EMDEX II [49] EMDEX Lite [49] Narda EHP-50D [50] Narda EFA-200 [50]
Price $1,482.86$1,350.00 $3,000.00$1,135.00 €5,769.20 Approx. €7,500.00