text:
计算机系统应用  2019, Vol. 28 Issue (1): 188-193 PDF

1. 福建师范大学 数学与信息学院, 福建 350117;
2. 福建师范大学 数字福建环境监测物联网实验室, 福建 350117

Defect Localization Method Based on Program Spectrum
CAI Rui1, ZHANG Shi1,2, YU Xiao-Fei1, JIANG Jian-Min1,2
1. School of Mathematics and Informatics, Fujian Normal University, Fujian 350117, China;
2. Digital Fujian Environmental Monitoring Network Laboratory, Fujian Normal University, Fujian 350117, China
Foundation item: National Natural Science Foundation of China (61772004); Open Fund of Shanghai Key Laboratory of Trustworthy Computing (07dz22304201401); Natural Science Foundation of Fujian Province (2018J01777)
Abstract: Software testing plays a vital role in producing reliable software. The debugging of software is divided into two steps: fault localization and fault modification, where the fault localization is the most time-consuming and tedious work. Generally, most of test cases in a test suite performed successfully. In order to improve the availability of the defect location method based on the program spectrum, the method should have the ability to adjust the weight of successful coverage automatically. That is, if the contribution of the number of statements to the suspiciousness is reduced gradually with the increase of the number of successful test cases, the effectiveness of fault localization method can be improved greatly. Based on this idea, this study proposes anEPStar (EP*) defect location method, which can effectively adjust the effect of successful use cases, so as to avoid the excessive influence of the number of successful use cases to the defect location effect. To improve the accuracy of error location, the experimental comparison shows that EP* method has higher defect location accuracy than several existing defect location methods.
Key words: EP* method     defect localization     program spectrum     test case     location effect

1 基于频谱的缺陷定位方法 1.1 基本概念

Reps 等人[17]首次提出程序谱概念, 后面的研究者们将程序频谱[1820]用于程序分析. 程序频谱主要是指程序执行过程中产生的关于程序语句的覆盖信息(被覆盖为1, 未覆盖为0), 以及执行是否通过信息.

Tep(s)的数值越大, 说明语句s执行且用例成功的次数多, s是缺陷语句的可能性越小; Tef(s)的数值越大, 说明语句s执行且用例错误的次数多, s是缺陷语句的可能性越大; Tnf(s)的数值越大, 则说明语句s没有被执行到的情况下错误越多, 这间接说明s是缺陷语句的可能性越小.

1.2 EP*的缺陷定位方法

Wong等人[14]总结的假设5–7说明了:可疑值与Tef(s)大小成正比, 与Tep(s)大小和Tnf(s)大小成反比, 可以设Kulczynski系数为1来表示Tef/(Tnf+Tep). 基于假设8对Tef设置更高的权重, 可以设置Kulczynski系数为2来表示2*Tef/(Tnf+Tep). 但Kulczynski系数在缺陷定位的准确性上不够. 考虑到这一点, Wong等人提出采用*系数, 取值范围从2~50增量为0.5. 提出D*方法, 通过实验验证该方法在缺陷定位上效果很好.

 $E{P^*}(s) = \frac{{T_{ef}^{}(s)}}{{{T_{nf}}(s) + {T_{ep}}{{(s)}^{\frac{1}{*}}}}}$ (1)
1.3 引例

2 实验

2.1 测试程序集

2.2 缺陷定位评测指标

 $Score = (1 - Rank({s_f})/n)*100\%$ (2)
3 实验分析

 图 1 基于Score值的缺陷定位效果对比图

4 结果与展望

 [1] Liu H, Wang WH, Zhang DF. A methodology for mapping and partitioning arbitrary n-dimensional nested loops into 2-dimensional VLSI arrays. Journal of Computer Science and Technology, 1993, 8(3): 221-232. DOI:10.1007/BF02939529 [2] Wen WZ, Li BX, Sun XB, et al. Technique of software fault localization based on hierarchical slicing spectrum. Journal of Software, 2013, 24(5): 977-992. DOI:10.3724/SP.J.1001.2013.04342 [3] Mao XG, Lei Y, Dai ZY, et al. Slice-based statistical fault localization. Journal of Systems and Software, 2014, 89: 51-62. DOI:10.1016/j.jss.2013.08.031 [4] Wong WE, Gao RZ, Li YH, et al. A survey on software fault localization. IEEE Transactions on Software Engineering, 2016, 42(8): 707-740. DOI:10.1109/TSE.2016.2521368 [5] Renieres M, Reiss SP. Fault localization with nearest neighbor queries. Proceedings of the 18th IEEE International Conference on Automated Software Engineering. Montreal, Quebec, Canada. 2003. 30–39. [6] Liu C, Yan XF, Fei L, et al. SOBER: Statistical model-based bug localization. ACM SIGSOFT Software Engineering Notes, 2005, 30(5): 286-295. DOI:10.1145/1095430 [7] Abreu R, Zoeteweij P, van Gemund AJC. On the accuracy of spectrum-based fault localization. Testing: Academic and Industrial Conference Practice and Research Techniques. Windsor, UK. 2007. 89–98. [8] Yu K, Lin MX. Advances in automatic fault localization techniques. Chinese Journal of Computers, 2011, 34(8): 1411-1422. DOI:10.3724/SP.J.1016.2011.01411 [9] Jones JA, Harrold MJ. Empirical evaluation of the Tarantula automatic fault-localization technique. Proceedings of the 20th IEEE/ACM International Conference on Automated Software Engineering. Long Beach, CA, USA. 2005. 273–282. [10] Baudry B, Fleurey F, Le Traon Y. Improving test suites for efficient fault localization. Proceedings of the 28th International Conference on Software Engineering. Shanghai, China. 2006. 82–91. [11] Wen W, Li B, Sun X, et al. Program slicing spectrum-based software fault localization. In Proceedings of the 23rd International Conference on Software Engineering and Knowledge Engineering. Miami, FL, UAS. 2011. 213–218. [12] Gonzalez A. Automatic error detection techniques based on dynamic invariants[Master’s Thesis]. Delft City: Delft University of Technology, 2007. [13] Lourenço F, Lobo V, Bação F. Binary-Based similarity measures for categorical data and their application in self-organizing maps. In Proceedings of the JOCLAD,2004-XI Jornadas de Classificacao e Anlise de Dados. Lisbon. 2004. 1–18. [14] Wong WE, Debroy V, Gao RZ, et al. The DStar method for effective software fault localization. IEEE Transactions on Reliability, 2014, 63(1): 290-308. DOI:10.1109/TR.2013.2285319 [15] Wong WE, Qi Y, Zhao L, et al. Effective fault localization using code coverage. In: Proceedings of the 31sh Annual International Computer Software and Applications Conference. Beijing, China. 2007. 449–456. [16] Wong WE, Debroy V, Li YH, et al. Software fault localization using DStar (D*). Proceedings of the 6th IEEE International Conference on Software Security and Reliability. Gaithersburg, MD, USA. 2012. 21–30. [17] Reps T, Ball T, Das M, et al. The use of program profiling for software maintenance with applications to the year 2000 problem. Proceedings of the 6th European Software Engineering Conference Held Jointly with the 5th ACM SIGSOFT International Symposium on Foundations of Software Engineering. Zurich, Switzerland. 1997. 432–449. [18] Steimann F, Frenkel M, Abreu R. Threats to the validity and value of empirical assessments of the accuracy of coverage-based fault locators. Proceedings of 2013 International Symposium on Software Testing and Analysis. Lugano, Switzerland. 2013. 314–324. [19] Xie XY, Chen TY, Kuo FC, et al. A theoretical analysis of the risk evaluation formulas for spectrum-based fault localization. ACM Transactions on Software Engineering and Methodology (TOSEM), 2013, 22(4): 31. [20] Zhang YJ, Santelices R. Prioritized static slicing and its application to fault localization. Journal of Systems and Software, 2016, 114: 38-53. DOI:10.1016/j.jss.2015.10.052 [21] Yu YB, Jones J, Harrold MJ. An empirical study of the effects of test-suite reduction on fault localization. Proceedings of the ACM/IEEE 30th International Conference on Software Engineering. Leipzig, Germany. 2008. 201–210. [22] Do H, Elbaum S, Rothermel G. Supporting controlled experimentation with testing techniques: An infrastructure and its potential impact. Empirical Software Engineering, 2005, 10(4): 405-435. DOI:10.1007/s10664-005-3861-2


text:
# Mathematics for Technology I (Math 1131)

Durham College, Mathematics
Free
• 0 lessons
• 0 quizzes
• 10 week duration
• ##### Numerical Computation

Here you'll be introduced to the bare basics of mathematics. Topics include commonly used words and phrases, symbols, and how to follow the order of operations.

• ##### Measurements

An introduction to numerical computation. Emphasis is placed on scientific and engineering notation, the rule of significant figures, and converting between SI and Imperial units.

• ##### Trigonometry with Right Triangles

Here we focus on right angle triangles within quadrant I of an x-y plane. None of the angles we evaluate here are greater than 90°. A unit on trigonometry with oblique triangles is covered later.

• ##### Trigonometry with Oblique Triangles

This unit is a continuation of trigonometry with right triangles except we'll extend our understanding to deal with angles *greater* than 90°. Resolving and combining vectors will be covered at the end of this unit.

• ##### Geometry

This unit focuses on analyzing and understand the characteristics of various shapes, both 2D and 3D.

## Mathematics for Technology I (Math 1131)

### Order of Operations

To ensure that arithmetic calculations are performed consistently, we must follow the order of operations.

If an arithmetic expression contains brackets, exponents, multiplication, division, addition, and subtraction, we use the following procedure:

1. Perform all operations inside a bracket first (the operations inside the bracket must be performed in proper order).
• ( ) are called parentheses
• [ ] are called brackets
• { } are called braces
• If a set of brackets are within another, these different bracket styles maintain the order in which the content within should be evaluated first, i.e. {4 + [7 – (3 + 2)]}.
2. Perform exponents.
3. Perform multiplication and division in order as they appear from left to right.
4. Perform addition and subtraction in order as they appear from left to right.

Several examples are explained below:

format: plain


text:
# Math Help - Quotient Rings and Homomorphic images in F(R)

1. ## Quotient Rings and Homomorphic images in F(R)

"let g be the function from F(R) to RxR defined by g(f)=( f(0), f(1) ). Prove that g is a homomorphism from F(R) onto RxR, and describe its kernel"

I'm trying to find the kernel. so the kernel is kerf={x in F(R); g(x)= e_RxR} ? Wouldn't it just be (0,0) ? If this is right how do i prove this? If this is wrong then how do i find the kernel?

2. ## Re: Quotient Rings and Homomorphic images in F(R)

it would help if we know exactly what you meant by F(R) and R. if R is a ring, then the identity of (RxR,+) is indeed (0,0), so the kernel of g is:

ker(g) = {f in F(R): f(0) = f(1) = 0}.

my guess is that by F(R) you mean the set of all functions from R to R with:

(f+h)(x) = f(x) + h(x) and

(fh)(x) = f(x)h(x).

note that the additive identity of F(R) is the function 0(x) = 0, for all x in R, and the multiplicative identity of F(R) is the (constant) function 1(x) = 1, for all x in R.

(note that ker(g) is non-trivial, the function f(x) = x(x-1) is in it).


text:
# What can the government do with its clone army after the war is won?

In order to win the World War one faction begins producing clone super soldiers. The war is eventually won, but now the government must do something with the Clones. They can't kill them because of some Civil Right activists. At the same time, they don't have the money to substain the gigantic Army of clones that they currently have. What can they do with the clones without angering the civil rights activist?

Notes:

• The people that populate this planet are biologically identical to humans.

• The Clones are psychologically identical to humans.
Their advantage over humans: super strength, quicker reflexes, above average intelligence.

• find a new enemy, it's been working for the US military so far... – ratchet freak Mar 30 '16 at 16:48
• You are this close to writing the origin story of Warhammer 40k Ultramarines. – Sean Boddy Mar 30 '16 at 20:59
• "They can't kill them because of some Civil Right activists." Umm, who do you think could kill them? They just one a World War, so they are de facto the most powerful force in your world. The question you should be asking isn't "What will the government do with the clone army?", but rather "What will the clone army do with the government, now that they've won the war?" – RBarryYoung Mar 31 '16 at 21:22
• Was this question inspired by Star Wars? – Eithne Apr 1 '16 at 12:24
• Easy solution: they become farmers and generate their own food. They are self sustained and they can be profitable, by producing vegetables for exportation. Facy restaurans paying 3000€ to eat a scoop of "hero ice cream", made from milk of the cows that the war heroes take care of. – Ismael Miguel Apr 1 '16 at 18:39

## Assuming You Thought This Through

You should have considered this before cloning thousands of battle trained individuals with a propensity for violence.

In which case, you would have engineered them to age at a much accelerated pace, meaning that each clone would only live for maybe a decade - long enough to win the war, but certainly not long enough for the survivors to pose a problem to your government.

Alternatively, you could implement a genetic kill switch which would make them highly susceptible to a certain rare virus or bacteria. You could use that switch to kill them all whenever you wish, and plead innocence, ignorance, and grief at the terrible oversight of the genetic engineers - whom you could use as scapegoats.

I recommend against this, however, as it is a design flaw which might be discovered/exploited by your enemies.

## Assuming You Didn't

You are now stuck with tens of thousands of clone troopers who are currently lacking a purpose.

What Not To Do

Simply slipping the chain off the leash and allowing them to enter civilian life is the single, silliest thing you could attempt. They will never successfully integrate into society.

We're talking about clone-soldiers here, not former civilians. These people will have never experienced the love of a parents, will not have grown up in your society, and would not have any experience in dealing with a civilian society. On the contrary, they are trained killers who have been not just raised, but engineered to kill people. We also have to take the many cases of PTSD among their ranks into consideration.

Most people will (most likely) not feel safe having thousands upon thousands of identical, potentially dangerous individuals become a part of their communities. Especially smart ones (higher intelligence) who might replace them in a lot of lucrative positions.

The most simple example I can give you is, in fact, Rambo (first movie): a highly trained, decorated war veteran, who - in his own words (paraphrased) - had been given enormous responsibility on the front, but was not trusted, and treated with disdain back home. He became a troubled man who lived on the edge of society, and was treated poorly by his fellow countrymen.

Furthermore, flooding the workforce with so many individuals with similar skill sets will put entire industries out of business and possibly collapse your economy, or at the very least, shake it right up.

Since the societal response to their arrival will most likely be negative, the only logical outcome is that these clone troopers will form their own groups on the edges of society. Traditionally these have become gangs, which, when lead by a smart individuals (which they all are), become a network of organized crime - identical mobsters; have fun dealing with them! There could even be enough of them - and they could become angry enough - to simply assault, and take over the government outright.

A Possible Solution

What you have to do at that point is find a new enemy to fight. You should, as the present conflict ends, already have one lined up, in fact, because there's nothing more dangerous than a few thousand bored soldiers - especially if some hippies get it in their heads that they should feel slighted in some way.

At this point you're going to have to very carefully manage your troops. You should strategically set your own troops up in such a way that some of them should perish at the hands of the enemy, and no real blame can be laid at your feet.

Furthermore, some clone casualties should quietly be allowed to die, rather than be saved.

The trick here is:

• Not having the press realize you are doing this

• Not having the clones realize you are doing this

• Not killing off so many of your own troops that you lose the conflict.

What might happen in the final days of this new war is that non-clone soldiers might be brought in to "reinforce" the clones and thus cover up the fact that you've been killing so many of them, not to mention reinforce to the public that you didn't really need the clones in the first place - give the glory to the "regular" soldiers instead.

The surviving clone soldiers - a much smaller group than what you started with - may now be used in other ways (such as what others have suggested), or even allowed to integrate into society (as best they can). The problem you should aim to avoid is having tens of thousands of them do this. (all at once, or at all)

• Yeah, well, if those commissioning the army had thought before creating it, the problems would be only half as big (not least of all that they'd probably have gotten rid of the Civli Rights activists back then already , to allow them to create your cloned army...) – subrunner Mar 30 '16 at 17:21
• @AndreiROM How do we know they have never experienced having parents, and have never experienced civilian life? We have no info on how they were raised between ages 1 - 15, they could have been raised by civilian foster parents until they were old enough to begin training. They weren't necessarily dumped straight from the clone vat to the training field to the battle field. It isn't stated in the question why are we asserting it? – sdrawkcabdear Mar 30 '16 at 19:56
• @AndreiROM Why would the reaction be negative when a host of for real war hero's return home? Surely a significant number of these "significantly more intelligent" men and women weren't rendered psychotic by the war, and most could be fully rehabilitated. Also if the alternative to a bad civilian life is death we should let them choose, most people think a bad life is better than none. As to public hatred couldn't we just deal with it the same way we deal with hatred of a minority today, enforce equal legal rights and over the course of a generation they reintegrate into the population. – sdrawkcabdear Mar 31 '16 at 1:02
• @sdrawkcabdear Well, even the recent past has proved AndreiROM true... – MakorDal Mar 31 '16 at 8:08

Start a super-sports organization and have them compete in various sports. Hopefully, the increases in strength and speed will draw large enough crowds that the admissions will pay for the upkeep of the (former) super soldiers. There is a reason that current sports stars gain so much popularity: they do amazing things. Imagine athletes who are specifically bred to do amazing things.

• +1 haha, I was just about to answer with putting these clones into the sports trade. What better way to ensure glory and fame as you "re-integrate" then making a clone into a super athlete. Surprised all the other answers are about putting to work or something useful. I'd bet with all the war-mongering that went on, you probably need some way to distract all the mindless public from your misdoings. You might even make some of that war money back through marketing deals. – coblr Mar 30 '16 at 21:54
• This is a great lateral-thinking idea, but unfortunately I can see a flaw: they are clones. Spectator sports thrive on the fact that the athletes are distinct people with personalities and back-stories. If they were all clones it would greatly diminish the draw from the spectators' point of view. – user2390246 Mar 31 '16 at 15:40
• @user2390246 They have backstories from the war. Or writers could give them made-up characters to play like in professional wrestling. – Torisuda Mar 31 '16 at 15:53
• @user2390246 I imagine these clones would be very heavily in to assorted body modifications (with a particular focus on things like facial tattoos) once they're out of the military. They'd be very easy to tell apart after a few years. – Tacroy Apr 1 '16 at 16:22
• I like it Ryan, a belated welcome to the site. – James Apr 1 '16 at 20:06

This situation really isn't terribly complicated. In the scenario you have set up the fact that your soldiers are "super" is irrelevant to how to proceed.

There is an abundance of historic documentation out there for what countries have done with militaries after major conflicts.

The most obvious example would be World War II, it fits your volume of troops better than any other situation from history.

At the end of World War II there were in the neighborhood of 12 MILLION active duty US military personnel.

The post war demobilization effort was named Operation Magic Carpet (which isn't really relevant I just really like the name) took a few years and reduced the active military force to just over 1.5 million.

Most went back to lives in the civilian sector. The expectation of 'care' provided for veterans by the government was significantly less expansive at the time.

Concerns in other answers of soldiers messing up the economy and taking jobs is overblown. If we continue to use the WWII United States as an example we can find that the US total population in 1946 was 141 million. This included the soldiers. Now in the case of the US those people were actually missing from the workforce and returned so there was no issue.

Now if you add 10 million clones to the population (leaving a standing force of 2 million) you are talking about roughly 12 percent more people. While not insignificant it will still not flood the national stage too badly. When you consider that the economy also normally grows after a major conflict, finding jobs should not be too big a deal.

And if I may extrapolate, your society is likely much farther in the future if you are able to create cloned soldiers, you would generally expect that the population would be larger as well. The larger a population gets the smaller the percentage that are in the military becomes, this reduces the impact of integrating these clones into society even further.

To effectively integrate these soldiers you will need a few things.

• Job training and placement. Many military roles have associated roles in the civilian world, if you can fix a tank you can fix a cadillac, a mechanic is a mechanic. Some specialties do not and those troops would need some job training assistance.

• Societal integration. Your soldiers have likely experienced the world outside the military in some way. If they are modified humans they still need down time. Maybe they spent their down time on the town hitting bars and erm...dance houses. If that is not the case your military expectations are still going to translate in some ways to the expectations of your society at large. In my personal experience the military culture is a slightly constrained version of our standard culture. So while there is an adjustment to be made that is still true of troops coming back from war today.

• Education and medical assistance. Get them educated and make sure they have access to both physical and mental health care. War leaves scars on the mind, super soldier or regular soldier.

One additional complication I can see is resentment among the general populace. These soldiers will be better, faster, and smarter than the average worker, meaning odds are they will end up in high paying jobs...that could cause some...consternation.

• This is not the same situation at all, since those soldiers had left behind positions which other men had not been around to fill. These people were already members of society, and already had families, jobs, etc. in America. When they returned they tried to take up their old lives. These clones are not in the same boat. They are strangers to civilian life, and to your society. Furthermore, they are genetically enhanced, so they're not your average human being either. People will most likely hate them as being "better than me", as well as maladjusted to civvy life. – AndreiROM Mar 30 '16 at 19:39
• @AndreiROM but there may have been casualties in the war or a worker shortage it might be that society needs the new workers. People already hate those they consider better or worse than them see treatment of "the 1 %" or just plain racism. If society can survive the those why not some clones? – sdrawkcabdear Mar 30 '16 at 19:47
• @sdrawkcabdear Because they are trained killer that WILL be recruited by criminal organisation as they allready did in a lot of countries post war. – MakorDal Mar 31 '16 at 8:16
• With returning soldiers, there are places to return to. With a clone army, it's more like the unchecked immigration issue the US and many others face today. – JDługosz Mar 31 '16 at 12:00
• @JDługosz and AndreiROM I specifically mention in my answer that it is different but then explain the impact is not as dramatic as perhaps first expected. – James Mar 31 '16 at 13:35

Just some ideas, combine them or ignore them or whatever...

Cheap work force

When they don't have any education beyond what is necessary for fighting, use them as cheap manual labor. Surely you have a couple of bombed out cities to clean up and rebuild? Some dangerous territories to decontaminate? With the right spin on media reports, your Civil Rights activist will be entirely satisfied.

Put them on ice

Save them for the next world war. Will be a cost-benefit calculation, of course, how long keeping your 2 Million clones frozen is cheaper than constructing a new 2 Million clone army. If the Civil Rights activists complain, ask them where they were when the 2 Million clone army was commissioned.

Give them a one-time severance pay

Dismiss them from the standing army, hand every clone a thousand dollars to get started on their own life and then hope they won't mix up society too much. (PTSD? Since they are clones, they will all be the same gender, so what if they now all want to marry? No clue how to behave as a civilian?)

Reuse specialists

Some of them will inevitably be highly trained specialists with deep knowledge in Mathematics, Technology, and other important specialist areas. Your engineering companies will love you for providing them with such rare talent!

Space, the Last Frontier

Let them explore where no man has set foot before! They are out of your way, and also contribute a lot to science and society!

• "Cheap workforce/One time severance/Reuse specialists" <- this will crash your economy and cause a lot of anger as newly graduated students find no jobs within their industries. Furthermore, there's simply too many of them to simply integrate! All these people will have known is war, and they will not easily adapt to civilian life. Then you'll have tens of thousands of unemployed, violent, well trained individuals who feel rejected by society. That right there is a recipe for disaster. You can afford to integrate a few thousand of them - maybe. But the vast majority have to go. – AndreiROM Mar 30 '16 at 17:06
• Same issue with the 'one-time severance pay' -- just probably with the job in the low-wages sector. Never said it was a good option... – subrunner Mar 30 '16 at 17:08
• @AndreiROM You are far to eager to say the economy would crash. This is coming off a world war. If there are no crippling reparations the extra work force is needed to feed the new demand for civilian goods. There will be some difficulty in transitioning soldiers to be civilians so keep them under military discipline. Most units could transition to civilian tasks. Engineering units build, aviation units run air ports, transport units haul cargo. Tank units get transitioned into transportation or engineering. Infantry are the hardest, but put them into parks projects or fighting wildfires. – PCSgtL Mar 30 '16 at 17:29
• Also, you have no idea how much it costs to put someone on ice. In the 1980s the actual cost was $10,000-$12,000 for whole body deep freeze. With future tech and in bulk it would be even cheaper. That is far less then paying them. I'd say put infantry on ice, and put the rest to work. alcor.org/Library/html/CostOfCryonics.html – PCSgtL Mar 30 '16 at 17:30
• @AndreiROM The question doesn't state clones or how large the work force is or how much of a worker shortage there is. How do you know there are to many to integrate? The clones are fast and smart why couldn't they be educated and successful. The question doesn't state they were philologically conditioned for war or overly aggressive. – sdrawkcabdear Mar 30 '16 at 19:42

## Some Assumptions

For starters, I'm going to assume you made some good choices both before building the clone army and in your actual management of your soldiers.

In particular, I'm going to assume that your clones have the following features:

1. They are clones of some good soldier who also represents your ideal man in other respects. Think Marvel Cinematic Universe Captain America. Honest, brave, loyal, with a natural sense of morality. What I'm going to suggest won't work with Jango Fett clones.
2. While you have improved the strength and intelligence of your clones, you haven't boosted their aggression "artificially". They will be more aggressive and violent than normal people because of their life experiences, not because of their biology.
3. Your training and propaganda has instilled in them a love (from a distance) for you country and culture. While they may have no actual idea how to live in a nice house with a picket fence, you have raised them to believe this is what they want.
4. You have commanded them reasonably and capably. If you treated ordinary soldiers as you treated these soldiers, they would not be mutinous. You have not treated them like battle droids.
5. You have encouraged a degree of individuality in your troops. The troops may all be identical, and their gear may all be identical, but each trooper still has "my rifle" and "my cot" and "my helmet". You want your troops to form a cohesive military unit, but you don't want them to form a collective organism like described in Plato's Republic or Halderman's The Forever War.
6. You have exposed them to many non-clones and non-combatants during their growth and training. Especially women. They need to have had female caregivers, teachers, and commanders. You do not want them to be like young spartan men who had no idea how to relate to half the population.

If you haven't followed these best practices, the rest of this guide may not work for you, though some of the suggestions might work with some modifications.

## Discipline

Throughout the following steps, you are going to have to keep better control of your troops than is typical with a victorious army. You have some advantages on your side: your troops have uniform upbringing that you have controlled, so you know that you don't have any career criminals or men with heritable mental illnesses in your ranks. On the other hand, your men have less than typical understanding of peaceful civilian life, so you cannot expect your society's norms to apply by default to your soldiers.

Your discipline will have to be unusually firm. There's no dishonorable discharge for a super-soldier clone. He's either going home as a model citizen or not at all. Rape, murder, and desertion will be death penalty offenses.

## Occupation

You don't want to bring all your clone soldiers home at once? Well, great news! You don't have to! To keep your soldiers from taking the food, jobs, and women of your homeland, there's really only one solution: your vanquished enemy. No, I don't mean brutal raiding and pillaging, I just mean that (like the US and USSR in Europe after the second world war), you're going to want to stick around in the previous enemy territory for some time.

During this time, give your soldiers intensive training in aspects of ordinary life (ideally you have been doing this since birth). How to shop. How to throw a birthday party. How to sit quietly through an inane romantic comedy. How to change a diaper. Have psychologists document everything a typical man in your society does in his daily life, and compare it to what a typical clone does. Use education and field trips to help repair the deficits. Expose your troops to civilian life in the occupied territory first, so that if one of your soldiers freaks out at the variety of choices in the coffee aisle of a supermarket, it will not be on the home turf of your civilians.

The defeated enemy is likely suffering a manpower shortage, so put your troops to work securing and rebuilding the occupied nation. This gives you great opportunities to teach your troops valuable civilian trades, without immediately upsetting your own economy. Give your troops plenty of opportunity to meet the locals in low-stress situations like helping a farmer remove unexploded bombs from his field.

Historically, there has always been reluctance in conquered populations to marry the occupiers, but there has always been many thousands of cases of it happening. While your soldiers are clones and therefore more undesirable than a typical foreigner, they are young attractive men in a country with a shortage of young attractive men. This is where it's important that you have indoctrinated your soldiers with images of white picket fences rather than strip clubs. When TK421 meets a nice girl (maybe the daughter of the farmer he helped with that UXB), you need him to want to marry her and get a nice ranch house in Wyoming, not have a brief hookup.

Of course you're not going to marry off anywhere near all of your clones this way, but it will help with your problem.

## Draw Down

Accept that the occupation will last longer than militarily necessary, as you need it as a place to keep your clones. As you begin bringing your clones home, prioritize those who are married or have at least demonstrated ability to live successfully outside the barracks.

You are going to need a ton of social services, especially for the first clones to arrive. You will need to build tons of cute little ranch houses with nice lawns and white picket fences (fortunately you have the manpower). You will need to have low-cost mortgages for veterans. You will need a GI bill to send your clones to college (to meet girls, if nothing else). Your civilian population will resent your soldiers, but each one is a 6'5" heavily-muscled killing machine with a friendly, respectful, and upbeat attitude who wants nothing more than a minivan, 2.5 kids, and to go bowling with his buddies on Wednesday nights. Your society will get used to him eventually.

Some of your clones will never adapt. You are going to have a large army for a long time, so I hope you have the budget. But overall, a human being is a wonderfully multipurpose piece of equipment, just because you built him for war doesn't mean that's all he's good for.

## Economy

So the bad news is over a number of years you're going to be inserting millions of new workers into your economy, and they may displace existing workers. The good news is you're introducing millions of new consumers to your economy, and each one is going to need a TV and a barbecue grill and a station wagon. If you allow it to, and you don't have other serious economic problems, this massive boost to your consumer economy can lead to a great period of growth. I wouldn't worry too much if I were you.

## Politics

Raise your clones to be political moderates, so that they are unlikely to form a single voting block. This will allow various political movements to appeal to them and keep the rest of the population from resenting their political influence.

## Final Thoughts

Admittedly, this is a pretty rosy outlook. The key here is that good preparation avoids problems down the road. It is extremely important that you build your clone soldiers as "dual-use" technology. Normally the term "citizen-soldier" refers to citizens who can also become soldiers, you need to build your clones as soldier-citizens.

## Occupation force

You have won the war, and it is time to settle terms. With your non-clone based army, as soon as the people feels that the country is safe, you begin to be pressured by soldiers and civilians alike to end the war as soon as possible, to avoid the loss of more lives, so you are interested in reaching a fair settlement.

But now there is no such pressure, so you can impose harsher terms to your enemies. Take a chunk of their territory; you already have made an investment in the troops you need to control it, so it is time to get a return of investment from taxing enemy civilians. If reaching to that settlement means that the war lasts one or two months more, it is not much an issue, since your casualties during that period help you solve your clone army problem.

## Start a new war

A time honored (Che Guevara in Bolivia, Ifni War) way of disposing of armed elements that supported your bid to power and now might object to your policies is to send them to wage war against someone else. Preferibly, an "unofficial" war against a powerful enemy, in order that you are not dragged in when your agents (hopefully) are defeated. The worst possible outcome is that your troops win and you get to control a new territory.

• This seems to be the most likely outcome, if integration into society fails for some reason. Keep them busy soldiering. – Chieron Mar 31 '16 at 9:51

Give half of them red shirts and the other half blue shirts. The problem will solve itself.

• You may want to try fleshing out this answer a little, but nonetheless a good idea. – fi12 Apr 1 '16 at 22:47

## Peacekeeping Forces

Fighting a World War is a serious endeavor, and ending one is not a simple process. You are not going to be able to simply retire your entire army once the fighting is over no matter if they are clones are mundane soldiers. You now have a (presumably) large number of foreign countries that have just lost a war, and are going to be feeling bitter and resentful of that fact.

Stationing your clone troops throughout the defeated countries will let you use them as peacekeeping forces to prevent that resent from turning violent. Or you could use them as "peacekeeping forces" and have them act more as an occupying army, keeping the defeated populaces in line more forcefully.

Regardless of how they get used you should be charging the countries where they are stationed fees for the service, essentially making them pay for your soldiers. Remember, those countries have just lost a World War, and according to our planet's history that means that they are going to have to suffer through some sanctions put in place by the victors.

## The Legion of One

Another alternative is to use all or part of this new clone army as a mercenary group. Think of something along the lines of the French Foreign Legion. You have a large number of trained soldiers, presumably loyal to their causes, and designed to be stronger, faster, and smarter than regular humans. They would be the obvious choice for anyone in the market for hired soldiers.

This would, again, allow you to foist the cost of the army off onto others. The War may be over, but there is a very good chance that during the conflicts different countries or groups on both sides will have come into contact and formed some grudges. Or could be ready to settle existing grudges in the chaotic aftermath of the main fighting. Either way, as long as those groups have money and need soldiers your clone mercenaries will have plenty of opportunity to be useful without being a burden on your citizens.

## The Best There is at What They Do

Given the cloned soldiers enhanced abilities, there are a handful of very specialized public- and private-sector jobs that they would be ideally suited to fill. Chances are you will have more clones than these roles, but they should still be considered. Private security forces are the most obvious job, again assuming that an increased sense of loyalty is included with the enhanced strength and intelligence.

Bodyguards that are stronger and faster than normal, plus with known military training, would be in perfect for various high ranking public officials or private individuals. Same with security officers at important locations, defense research centers and the like. There may be some public outcry at replacing the general police force with military trained cloned supersoldiers, but you may be able to convince John Q Public that using the clones for SWAT teams or something similar is better than the alternative.

## Mix and Match

Chances are that no single one of these suggestions would be a good, long-term fix for what to do with the clone army. But if you took all of those soldiers and broke them up into a mixture of the three, plus whatever else you can come up with, then you should be able to get most of the clones in a place where they are being useful, without being a huge sink on your own resources.

Militaries spend a surprising amount of time doing non military tasks. Depending on the context?

Private armed security - or to take a page from the singapore government Auxillary police. Basically well armed, extremely disciplined security guards for banks and installations that need extra security - oil refineries, military bases and so on. Keep em on as reservists, and give them refresher training as needed.

As an extension of that idea - it might be worth looking at the gurkas, who while citizens of one country, have served with distinction and honour in both the militaries of the united kingdom and india as well as an elite wing of the singapore police force. They might be allowed to serve, as a unit in allied militaries, possibly in places that were defeated but are nor friendly.

Peace Corps. You've won the war, but you need to keep the peace. Have these guys build schools, and other infrascture. Have them assist in periods of humanitarian disaster (Which modern militaries are actually really good at). There's also something to be said for big menacing nice guys to convince the local riff raff that trying to snatch whatever they can is bad.

Space exploration You have a large, well trained group of folk, who have many of the skills needed to survive in a hostile environment. Depending on your universe, they might be the perfect folk to act as interplanetary or interstellar scouts and the first wave of colonists - this might also deal with the resentment - since these folks might been as heros instead and in a sense gets them out of the way.

The obvious answer to me is to put them to work. You say that the government doesn't have the money to sustain the very large population of new citizens, but the question there is why?

If it is due to lack of food, portion off some of the clones to food development. If it is lack of housing, then you teach some of them to build homes and such. Pretty much the only real issue that might be truly limiting would be space, but considering they managed to house the clones during the war, plus there is no doubt a decent number of casualties from the war, then there should be enough space for them to live. This might entail some social changes such as group housing or building more vertically, but it should still be able to be done.

By having the clones trained and doing the work to support themselves, the burden is eased on the government to figure it all out. Plus you get the bonus of keeping all of these likely trained killers under watch and busy doing something productive rather than deciding to go off and conquer a land area of their own.

• Won't work. You have a large number of individuals who are battle hardened, and you expect them to become the equivalent of slave labor? Not only will you bankrupt the construction industry, you will also flood the market with cheap labor. You will not have enough projects to keep them busy, not to mention housing for them, etc. You might do this with a few thousand of them, but not the full army. You need to get rid of a very large number of them before you attempt anything like this. – AndreiROM Mar 30 '16 at 17:11
• @AndreiROM I don't see why not... They were slaves before, they are slaves now. The clones never chose to fight, and if they never questioned it before, who is to say that they would question their transition to farming. The scope of the question implies that the clones are subservient. – FiringSquadWitness Mar 31 '16 at 1:28

As AndreiROM pointed out, you can't really afford to let them loose on society, since they probably don't have the social background to handle non-war life.

They do have a certain set of skills though that could be useful to society.
They are disciplined, and used to hard work, so put that to use.

First, turn the swords to plowshares. Start something like a farm or kibbutz where they would grow their own food and try to be self sufficient. If there is any excess it can be sold to help pay for necessities.
Provide training, especially in things like law enforcement, where their training as a soldier would be useful, but let them have other choices.
Also provide mental health services to work through any war time mental scarring.

Loan some out to help protect people who are doing humanitarian aid in war torn areas. This will let them use their training, and would also give them opportunities to be around civilians and learn how to interact with people.
These could be short shifts, with a couple months protecting a school for girls in Pakistan then back to the farm for some R&R, while the next shift relieves them.

Bring groups in to work alongside them on the farm, both so that they can learn to be around civilians, but also so that civilians can learn to be around them.
Acceptance is a two way street.

Given enough time they will learn how to integrate, and then you can start phase 3 where some will be allowed to choose if they want to move off the farm.

## Core of Engineers Infrastructure Program

Keep them in the military, but retrain them to be army engineers. Keep rank, orders, barracks, and other military routines nearly identical. Then put them to work in major infrastructure projects.

Psychologically paint the work as a nationalistic and patriotic challenge(or whatever rationale was used in their military training - religion, democracy, communism whatever). It should be reminiscent of battle, but without the danger, killing or anxiety. Rework the conflict into constructive struggle, filling that psychological gap with work, challenge and purpose so the ghosts of battle don't fill it. Treat it like therapy.

Focus on major public infrastructure, dams, roads, railways, hyperloops, bridges, spaceports, fusion reactors and the like. These things are typically too big to be financed by the private sector, and so won't compete for jobs or paying clients. In fact, it will provide a huge boost to your economy. Granted, it will be very, very expensive(though not as expensive as a war), but the immediate economic boost will offset it somewhat, and the long term payoff should put you back in the black in a decade or two.

Meanwhile, your clones are focused, trained and busy. People are enjoying power, transportation, and growth. Your activists are happy because we are making roads not war(Insert catchy flower power slogan here. Hey, it's true!), and the new lifestyle is legitimately healthier and recuperative for the clones.

The only major problem is that if you are close to bankruptcy, the scale of these projects may be too much for you to finance.

Some old movies come to mind, you might watch Demolition Man (rewiring to normal life), Universal Soldier (problem with mindless mercenaries) and Rambo (problems resocializing). Best so far would be reintegration in an own community outside of civilization (like tibetian monks) and letting them out for mercenary services. Maybe Judge Dreed like police service. You can also "figure out what they want" and let them lead those lifes.

• Hello user19608 and welcome to this realm of the internet.I like your first take on an answer and hope you find yourself comfortable and stick around some more. While I have seen only one of these films personally I think that they (just as other films/literature) can often serve as source of ideas.Could you maybe add some more information about how every film is relevant here,for people like me who haven't seen them?Try to play a bit with the formatting in the text-editor and add a short description of every film (how it handles the situation), that would change this from good to great (IMHO) – J_F_B_M Mar 31 '16 at 17:12

It is a very common fallacy that there is only so much work to do, and that any additional workers only hurt. The soldiers-now-civilians need food, shelter, and clothing, so by their existence they create the need for more work to be done.

The soldiers have the capacity for ordinary civilian work. Anyone who has worn the uniform of any military service can tell you that the bulk of any soldier's duty hours, when not in actual combat operations, are consumed by duties that are similar (if not identical) to work done in the civilian sector. There are ditches to dig, papers to push, machinery to maintain, etc. The Army doesn't care how fearless you are or how well you can shoot. There are 1,001 peacetime functions that soldiers do every day, and if you can't do them, the Army most definitely does not have a uniform in your size.

So it's an issue of matching ex-soldiers to jobs for which they are suited, and providing education for the rest to fill openings in the economy of your fictitious world; unless you have wished away the laws of economics, your fictional world has many, many labor positions for which no suitable candidate has applied.

It is true that some of your clones have PTSD issues that preclude an immediate return to civilian life. However, these are in the minority (or else American society would have self-destructed in 1946); if you have the resources to field all of those guys, you have the resources to provide treatment for the minority who need it.

You have won the world war, so the world is yours. Use your clone soldiers as a security force in all countries. They are the best in doing their kind of work, so give that work only to them. Bring back your original human soldier to the country and ask them to rebuild the nation. This will result in financial growth for the country that you can use for maintenance of the clone soldiers.

It will take some time but you will recover quickly from the war and that is the most important goal at that time.

Do not disturb society by including them in the society.

• This is very similar to how Rome kept it's military apart from the populace, until it was time to discharge them from service. – Efialtes Mar 12 '18 at 0:49

One situation you need to take into account is how the Civil Rights Groups felt about the creation of clone soldiers just for the purpose of fighting a war. If the soldiers were created to advance in age quickly, what would those groups have said about the age advancement? And then come care of cloned troops. LEt's say that the creation passes the civil rights groups, what kind of care do you give them during the war? Were they treated like regular folks who are in the war? Are there any regular people in the fighting ranks? Do the clones have a rank system allowed to them? Now for after the war, are there more clones being created, or did they cancel the program once the war was over? Or can the program be used for other clone types (labor for instance)? Perhaps what made the clones fighters (mind-manipulation) could be used to reprogram them to do other jobs. A few questions to think about before wondering what to do wtih them after the war.

The government will do whatever the clone soldiers want them to do because the clone soldiers will be the government.

As Mao observed in one his breaks from sociopathic mass murder, "political power flows from the barrel of a gun." Governments are at their heart merely instruments for collective violence. The most basic government is a general/warlord and his victorious army. In all times and places, the military decides the form and nature of the government.

I consider the idea of the malicious creation of super-soldiers even on the small scale in "secret" experiments to be one of the stupidist tropes in Science Fiction. You don't give off scale military effectiveness to someone you don't trust and don't deal fairly with because they will kill you.

There are many historical precedents for the scenario you envision. The two most famous would be Malmuks of Egypt and the Janissari of the Ottoman Empire. In both cases, rulers created armies of foreigners, usually starting with slaves.

The Malmuks, were a mishmash of young men of many different subcultures and non-muslims faiths swept up in the Islamic conquest of Christian north Africa and their non-Christian surrounds. With their homes destroyed and the under foreign rule, their families dead, enslaved or scattered, the opportunities offered by a life of slave soldier didn't seem so bad. At least you got to eat.

The Janissary where Christian children from the area of modern Romania, Bulgarian and Balkans taken around the ages of 6-9 as a mandatory tax tithe (hand over your son or we burn your village down.) Christians were taken, as enslaving fellow muslims, well true muslims often defined on the fly, is forbidden by the Koran and the Ottomans didn't want the hassle. When they grew to adulthood they could convert to Islam and "volunteer" to continue serving. But as they had no memory of their families or how to find them again, they had little choice but stay. Telling, the symbol of the Janissary was a large wooden spoon worn on the front of their headgear, a symbol of the Sultan's pledge they would never go hungry. (Food was the major concern of humanity until the Corporate-Industrial-Fossil-Fuel Age.)

The Sultans turned to slave armies first as internal security troops, as a force wholly dependent and loyal to the Sultans and not some noble or clan as were the rest of military. If some noble rebelled, the slave armies put it down. (Its the same reason they relied on eunuchs. Family pull was so strong only someone without testicles and a hope for a descendants could be trusted. Eunuch taken as slave from far away where even better)

Since the slave armies lacked any families or birth status, the only means of promoting them lay in judging merit. Very quickly the officers of slave armies became comprised of individuals who rose by proving themselves in battle. They soon became the most elite units of their respective polities.

As time passed the Sultan became more and more dependent on the elite slave armies. Things worked fine for a century or so but eventually there was some instability in the realm and the slave armies looked around and thought, hey, we don't have to take orders anymore.

In the case of he Malmuks, they merely replaced the ruling class of Egypt and survived until Napoleon crushed them. The Janissary kept the superficial appearance of the Sultan being in charge but were in fact a Praetorian guard who selected who could and could not be Sultan. In both cases, as they came to power, began to marry and form clans, they lost merit promotion and with it military effectiveness.

The moral is that its impossible to politically control highly effective soldiers if they don't want to be controlled since they themselves form the basis of coercive political power of the state.

The form of government is dictated by dispersion of military force in a society. If most of the population is disarmed and only a small elite allowed weapons and training, you have an oppressive, authoritarian regime. If the majority of the population is armed and trained, you get some form of democracy e.g. Athens, Roman Republic, Britain and the U.S.

There are no historical examples of any degree of democracy in societies where the majority of the population is disarmed and conversely, no examples of authoritarian regimes where the majority of the population is armed.

So, the real question in your scenario is not what the "government" will do with the clone army but what the clone army will with the government.

I would also point out that any society which cannot muster enough internal cohesion and form enough political consensus to muster an army from its own population, is dead anyway.

You can see this in history in Carthage, the late Roman empire and Byzantium. Once they could no longer raise a military from their own population, they spiraled down hill. All had plenty of population, they just did not have the internal cohesion and trust to build a military.

So, the fact that your society resorted to a clone army, unless faced with an enemy using super soldiers themselves, would indicate a disintegrating polity.

Even if the society was willing and capable of defending itself without the clone super-soldiers, the clones will still be the de facto rulers of the society once the war ends. They might take over like the Mamaluks, or they might leave the illusion that the old regime is still intact like the Janissary but they will still rule.

You might want to investigate the actual scientific evidence about what makes a good soldier. To much of what we think we know comes from smug, morally self-rightous pseudo-intellectuals who bloviate with based on no empirical evidence.

In the case of industrial warfare, strength is largely irrelevant but low term physical endurance and ability to function with less sleep become more important. Intelligence might be a bonus depending on what you mean by "intelligence." Visual spatial skills are the most important for all types of soldiers from ground pounders to pilots to generals.

The most important qualities for soldiers are emotional, not cognitive.

You'd want to make them calm and hard to excite so they keep aware and thinking as everything explodes around them. Also, give them a touch a ADD to they will be more aware of changes in their environment and not get fixated on one aspect of it.

The most important quality for military effectiveness is unit cohesion i.e. how strongly individuals bond with and trust other soldiers both those immediately around and the greater organization. Highly cohesive militaries have defeated much larger otherwise equivalent militaries repeatedly throughout history.

The second most important quality is a belief in a higher good, something the soldier will love enough to willing die (and kill for.) Both these attributes require that the soldiers have high levels of empathy, something counter-intutive but obvious once you think of it.

You could create "super-soldiers" merely by making clones highly empathetic, cooperative, trusting and then indoctrinate them with an ideal to protect. They would be more effective than ordinary people even with the same IQ and strength.

The problem you might have after the war would be when the clones encounter the real world and find out that the rest of society is cynical about the clones ideals and that far to many civilians lack empathy, won't cooperate and don't trust each other. The clones might be shocked to be lied to or cheated by individuals that they consider part of their group instead of enemy.

The clones might well decide to take over in order to enforce their ideals and ernest behaviors on their imperfect natural brethren.

Regardless, the super-soldiers will decide the outcome and no one else.

• There are no historical examples of any degree of democracy in societies where the majority of the population is disarmed and conversely, no examples of authoritarian regimes where the majority of the population is armed. Western Europe for the first point, look at this map (Saudi Arabia, Yemen, Libia, Angola) for the second point upload.wikimedia.org/wikipedia/commons/0/0d/… (Yes I know you will try to pull a "true scotsman" fallacy here, but you are simply wrong). – SJuan76 Mar 31 '16 at 9:07
• "There are no historical examples of any degree of democracy in societies where the majority of the population is disarmed" is ridiculous and certainly does not apply to the UK. – pjc50 Mar 31 '16 at 9:37
• Once you got to that passage that earns all the downvotes, I don't know whether to beleive anything that came before. Prior to that, I supposed it to be a good answer with reference to actual history. So, how about editing: remove the contentious part and editorializing and keep only the historical examples, and add references. That woukd turn it into an answer that should get a lot of upvotes. – JDługosz Mar 31 '16 at 11:58


text:
# Next number in the sequence -2 3 27 69 129 .. [closed]

I was asked this on an aptitude test recently

Determine the next number in the sequence: $-2, 3, 27, 69, 129, \ ..$
A: $178$
B: $207$
C: $288$
D: $312$

I've been racking my brain for a few days trying to find the solution but I can't figure it out.

## closed as off-topic by JMoravitz, mechanodroid, Henrik, kingW3, user296602 Oct 24 '17 at 19:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – mechanodroid, Henrik
If this question can be reworded to fit the rules in the help center, please edit the question.

• What exactly have you tried? – StubbornAtom Oct 24 '17 at 18:01
• OEIS doesn't have anything. Where did you get this from? – Kaynex Oct 24 '17 at 18:02
• Define $$f(x) = 14 - \frac{329 x}{12} + \frac{287 x^2}{24} - \frac{7 x^3}{12} + \frac{x^4}{244}$$ Then $(-2,3,27,69,129) = (f(1),f(2),f(3),f(4),f(5))$. So naturally the next number is $f(6) = 208$ ;) – Clive Newstead Oct 24 '17 at 18:03
• The next number is $42$. You can't prove me wrong. But, at the same time you can't prove the person who says the next number is $43$ wrong either, or $44$ for that matter, or $\pi$ or $\sqrt{e-3.4}$ or anything else. There is simply not enough information to determine the next entry uniquely. – JMoravitz Oct 24 '17 at 18:06
• Then whoever wrote the test should be slapped across the face repeatedly unless they include an option for "not enough information" which is always the correct answer. Such questions are not well formed and do not have any way of answering. – JMoravitz Oct 24 '17 at 18:14

The next number would be 207. Look into the differences between terms 5, 24, 42, 60 And the difference between these is 19, 18, 18, So i thought the first 19 should be 18 also i. e. Our sequence will be -3, 3, 27, 69, 129, 207, ...

It is $207$ and the OP made a typo The original sequence is

$-3, 3, 27, 69, 129, 207,\ldots$

$a_n=3 (3 - 7 n + 3 n^2)$ for any $n\in\mathbb{N}\land n\geq 1$

Hope this helps

I think most smart comments agree that there is no real mathematical progression to be discovered here. Unless you may assume typos

So either this is an aptitude test on how you would solve impossible problems (being able to quickly acknowledge you don't know and able to tell why),

or this could be some tricky calculation where you'd have to transcribe the numbers and count the values of letters and add and/or multiply values, which probably is only valid in the mind of the developer of the test

or this is an aptitude test where the developer of the test failed. Sort of a special case of the previous case.

-- note: I love the '207' answers that make my answer look stupid ;) I'll +1 them. The approach is quite typical for such problems, and the assumption of a typo should be a question but is valid.


text:
# Definition:Partial Derivative/Real Analysis/Point

## Definition

Let $U \subset \R^n$ be an open set.

Let $f: U \to \R$ be a real-valued function.

Let $a = \tuple {a_1, a_2, \ldots, a_n}^\intercal \in U$.

Let $f$ be differentiable at $a$.

Let $i \in \set {1, 2, \ldots, n}$.

#### Definition 1

The partial derivative of $f$ with respect to $x_i$ at $a$ is denoted and defined as:

$\map {\dfrac {\partial f} {\partial x_i} } a := \map {g_i'} {a_i}$

where:

$g_i$ is the real function defined as $\map g {x_i} = \map f {a_1, \ldots, x_i, \dots, a_n}$
$\map {g_i'} {a_i}$ is the derivative of $g$ at $a_i$.

#### Definition 2

The $i$th partial derivative of $f$ at $a$ is the limit:

$\map {\dfrac {\partial f} {\partial x_i} } a = \displaystyle \lim_{x_i \mathop \to a_i} \frac {\map f {a_1, a_2, \ldots, x_i, \ldots, a_n} - \map f a} {x_i - a}$


text:
# Math Help - Does this sequence converge or diverge?

1. ## Does this sequence converge or diverge?

$f= (-1)^n \frac{n}{n+1}$

If it converges find the limit and if it diverges justify why.

2. ## Re: Does this sequence converge or diverge?

I recommend calculating the first several elements and making a conjecture.

3. ## Re: Does this sequence converge or diverge?

It definitely does not converge. \displaystyle \begin{align*} \frac{n}{n + 1} \to 1 \end{align*} as \displaystyle \begin{align*} n \to \infty \end{align*}, so eventually the terms will oscillate between -1 and 1.

4. ## Re: Does this sequence converge or diverge?

$\lim_{n\to\infty}(-1)^n\frac{n}{n+1}$

$\rightarrow \lim_{n\to\infty}(-1)^n\frac{n/n}{n/n+1/n}$

$\rightarrow \lim_{n\to\infty}(-1)^n\frac{1}{1+0}$

$\rightarrow \lim_{n\to\infty}(-1)^n(1)$

5. ## Re: Does this sequence converge or diverge?

Thanks for the replies. I understand the sequence definitely diverges.

Please note my brother asked me this question and it is not part of my coursework(and i have never done anything like this before), which is why i didn't make an attempt at a solution, however i am still interested in the answer.

His question asked to find an appropriate epsilon and n to justify why the series diverges.

6. ## Re: Does this sequence converge or diverge?

Originally Posted by linalg123
Please note my brother asked me this question and it is not part of my coursework(and i have never done anything like this before), which is why i didn't make an attempt at a solution, however i am still interested in the answer.
His question asked to find an appropriate epsilon and n to justify why the series diverges.
If $f_n=\frac{(-1)^nn}{n+1}$ and $n>1$ then it can be shown that $f_n>\tfrac{1}{2}$ if $n$ even and $f_n<-\tfrac{1}{2}$ if $n$ is odd.

That means $|f_{n+1}-f_n|>1.$


text:
Running preCICE simulations on a distributed system involves additional setup steps which are covered on this page.

## Distributed vs local

A distributed system and a single local system differ in two major ways:

1. The local system can rely on a loopback interface for internal communication. A distributed system requires communication between nodes using a common network.
2. The local system has unhindered access to the local files. A distributed system requires to use a shared network drive with higher latency.

So, there is additional work involved to set the simulation up.

## Common network interface

To setup communication, preCICE needs to exchange the endpoint information between participants. When using sockets, preCICE defaults to endpoints of the loopback interface, which only works on the local system. Follow the instructions on how to configure the communication to select an appropriate network.

## Common filesystem

The common working directory requires a common filesystem.

Most cluster administrators provide a shared filesystem by default. It is used to share datasets and provide common software to all nodes in the system. preCICE does not require a fast underlying filesystem, but high latency on file creation can noticeably slow the initialization down.

In case you don’t have access to a managed cluster and you want to use available workstations, then you have to setup this shared filesystem yourself. The simplest may be to use a common network file share using samba. This is available on virtually all Linux distributions. Another option is to mount a remote directory using an SSH Filesystem (sshfs). In any case, make sure that both are available as the same path on both machines. You can use symbolic links to simplify this task.

## Running the simulation

Now open a terminal on each machine and navigate to the test setup. Then run your solvers.

If you have logged into remote machine via SSH, then be careful to use a tool such a screen or tmux. This allows to safely detach from a session without the running process getting killed.

If your cluster is managed using SLURM, then further steps may be necessary.


text:
Recently I asked Faltings for some references for a self-study of Arakelov theory beyond Lang’s Arakelov theory.

He suggested the following (all revolving around the arithmetic Riemann-Roch theorem):

1. Papers by Gillet and Soule on arithmetic intersection theory

2. Papers by Bismut, Gillet and Soule on determinant of cohomology of an arithmetic variety (towards Riemann-Roch for this determinant.)

It seems that these papers are summarized in Soule’s book. Also there is a nice book by Faltings that modesty prevented him from referring it to me: Lectures on the arithmetic Riemann-Roch theorem.

Speaking of Arakelov theory, two final comments:

(1) The best place to get into the right frame of mind for these type of questions in an elementary setting is Neukirch’s book Algebraic number theory

(2) Our fellow student here Nikolai Durov has recently reworked the foundations of the entire theory from the point of view of generalized rings (including exotic objects like the field with one element $\mathbb{F}_1$). His thesis is available here.


text:
# Unexpected value for scaled encoders

Hi all,

In order to be able to recreate a previously trained ensemble, one has to use the encoder values, and not the scaled_encoders, from an ensemble at the end of a training stage to initialize a identically behaving ensemble (explained in NengoDL simulator provides different results in training network - #4 by xchoo). The NengoDL simulator provides a function to get these parameters, aptly named get_nengo_params, but the Nengo Core simulator does not. I am using the nengo_dl.simulator.get_nengo_params function as a template for a function so that allows me to later create an Ensemble with the same scaled_encoders as that of a previously trained ensemble.

Instead of starting with a trained network, I just start with a model that has a single ensemble

I have the following code:

import numpy as np
import nengo
from nengo.dists import Uniform

def calculate_params(simulator, ens, s_encoders):
# calculate the "unscaled" encoders
# based on the get_nengo_params func from the nengoDL simulator

gain = sim.model.params[ens].gain

encoders = s_encoders * radius / gain[:, None]

n_neurons = 2
Dim = 1
seed = 1

model = nengo.Network()

intercepts = [0,0]
encoders = np.array([[.5],[.3]])

with model:

A = nengo.Ensemble(
n_neurons,
dimensions=Dim,
intercepts=intercepts,
encoders=encoders,
seed=seed
)

probe_encoders = nengo.Probe(A, 'scaled_encoders')

sim = nengo.Simulator(model, progress_bar=False)

sim.run(0.001)

scaled_encoders = sim.data[probe_encoders][0]

encoders_calculated, gain, radius = calculate_params(sim, A, scaled_encoders)

print(f"initalized encoders: \n{encoders}")

print(f"gain: {gain}")

print(f"probed scaled_encoders: \n{scaled_encoders}")

print(f"calculated encoders: \n{encoders_calculated}")

The output is:

initalized encoders:
[[0.5]
[0.3]]
gain: [29.76470771 36.98730496]
probed scaled_encoders:
[[29.76470771]
[36.98730496]]
calculated encoders:
[[1.]
[1.]]

As you see, the initialized encoders and calculated encoders are not the same. However, the values for the calculated encoders are correct given the value for the scaled encoders of the ensemble A, and the gain values.

The problem is then that is look to me like the scaled_encoder values are not correct. Given how scaled_encoders are calculated during the build process, I would expect these to be

[[0.5 * 29.76470771]
[0.3 * 36.98730496]]

How the scaled encoders are now, it looks like the nengo simulator acts as if the (not scaled) encoders are set as [[1.],[1.]], while I explicitly set them to [[0.5], [0.3]]

So my question is: Am I misunderstanding how scaled encoders are calculated? What is going on?

Apparently 1D neurons do not really have encoders. The method, sort of, works for higher dimension neurons (which I am using for my actual project).

setting Dim=2 and encoders = np.array([[.5,1],[-1,.3]])

The output is:

initalized encoders:
[[ 0.5  1. ]
[-1.   0.3]]
gain: [ 7.48478721 12.16548901]
probed scaled_encoders:
[[  3.3472986    6.6945972 ]
[-11.65242515   3.49572754]]
calculated encoders:
[[ 0.4472136   0.89442719]
[-0.95782629  0.28734789]]

Now the initialized and calculated encoders are rather similar, but not exactly the same, why not?

Comparing the scaled encoders of A and another ensemble that is created using the calculated encoders, the actual scaled_ecoders are the same (sometimes different at the 8th or so decimal, but that is the same in my book), which is what matter after all.

Hi @ChielWijs,

If you look at the Nengo code, by default, Nengo will normalize all encoder values provided to an ensemble when it is created. You can turn off this feature by specifying normalize_encoders=False when creating the ensemble.

As an example, if I ran your code with normalize_encoders=False, this is the output I get:

initalized encoders:
[[0.5]
[0.3]]
gain: [16.9719751   6.58907043]
probed scaled_encoders:
[[8.48598755]
[1.97672113]]
calculated encoders:
[[0.5]
[0.3]]

The reason Nengo does this is to avoid unexpected behaviour (unexpected from the user’s perspective) when using non-normalized decoders. If you look at the equation Nengo uses to calculate the input current to a neuron:

J(\mathbf{x}) = \alpha (\mathbf{e} \cdot \mathbf{x}) + J^{bias}

You’ll see that there is a dot product between the input vector \mathbf{x} and the neuron’s encoder \mathbf{e}. If the encoder is not of unit magnitude (i.e., the L2 norm is not 1), this dot product will throw in a scaling factor that may be unexpected by the user. Thus, Nengo normalizes all encoder values before building the ensemble. If you look at the outputs of your 2D example, you’ll notice that this is what is happening too. Normalizing [0.5, 1] gives you [0.447, 0.894], and normalizing [-1, 0.3] gives you [-0.958, 0.287].


text:
Home Cast everything for 2 decimal points?
 I want to divide two integers: 8/15 and return "53.33". I've tried every single combination, and I've found that this is the only way I can return the desired value: select cast(100*cast(8/cast(15 as decimal(10,4)) as decimal(18,4)) as decimal(18,2)) Is there a shorter way? Thanks.