text:
Join Today to Score Better
Tomorrow.

Connect to the brainpower of an academic dream team. Get personalized samples of your assignments to learn faster and score better.

## How can our experts help?

We cover all levels of complexity and all subjects
Receive quick, affordable, personalized essay samples
Learn faster with additional help from specialists
Chat with an expert to get the most out of our website
Get help for your child at affordable prices
Students perform better in class after using our services
Hire an expert to help with your own work

## The Samples - a new way to teach and learn

Check out the paper samples our experts have completed. Hire one now to get your own personalized sample in less than 8 hours!

Type
Case study
Level
College
Style
APA

Type
Coursework
Level
College
Style
APA

Type
Case study
Level
High School
Style
APA

Type
Case study
Level
Style
APA

Type
Dissertation
Level
University
Style
APA

Type
Case study
Level
College
Style
APA

## Customer care that warms your heart

Our support managers are here to serve!
Check out the paper samples our writers have completed. Hire one now to get your own personalized sample in less than 8 hours!
Hey, do you have any experts on American History?
Hey, he has written over 520 History Papers! I recommend that you choose Tutor Andrew
Oh wow, how do I speak with him?!
Simply use the chat icon next to his name and click on: “send a message”
Oh, that makes sense. Thanks a lot!!
Guaranteed to reply in just minutes!
Knowledgeable, professional, and friendly help
Works seven days a week, day or night
How It Works

## How Does Our Service Work?

Find your perfect essay expert and get a sample in four quick steps:
Choose an expert among several bids
Chat with and guide your expert

01
02

#### Submit Your Requirements & Calculate the Price

Just fill in the blanks and go step-by-step! Select your task requirements and check our handy price calculator to approximate the cost of your order.

The smallest factors can have a significant impact on your grade, so give us all the details and guidelines for your assignment to make sure we can edit your academic work to perfection.

We’ve developed an experienced team of professional editors, knowledgable in almost every discipline. Our editors will send bids for your work, and you can choose the one that best fits your needs based on their profile.

Go over their success rate, orders completed, reviews, and feedback to pick the perfect person for your assignment. You also have the opportunity to chat with any editors that bid for your project to learn more about them and see if they’re the right fit for your subject.

03
04

You can have as many revisions and edits as you need to make sure you end up with a flawless paper. Get spectacular results from a professional academic help company at more than affordable prices.

#### Release Funds For the Order

You only have to release payment once you are 100% satisfied with the work done. Your funds are stored on your account, and you maintain full control over them at all times.

Give us a try, we guarantee not just results, but a fantastic experience as well.

05

## Enjoy a suite of free extras!

Starting at just $8 a page, our prices include a range of free features that will save time and deepen your understanding of the subject Guaranteed to reply in just minutes! Knowledgeable, professional, and friendly help Works seven days a week, day or night Go above and beyond to help you ## Latest Customer Feedback 4.7 ### My deadline was so short I needed help with a paper and the deadline was the next day, I was freaking out till a friend told me about this website. I signed up and received a paper within 8 hours! Customer 102815 22/11/2020 4.3 ### Best references list I was struggling with research and didn't know how to find good sources, but the sample I received gave me all the sources I needed. Customer 192816 17/10/2020 4.4 ### A real helper for moms I didn't have the time to help my son with his homework and felt constantly guilty about his mediocre grades. Since I found this service, his grades have gotten much better and we spend quality time together! Customer 192815 20/10/2020 4.2 ### Friendly support I randomly started chatting with customer support and they were so friendly and helpful that I'm now a regular customer! Customer 192833 08/10/2020 4.5 ### Direct communication Chatting with the writers is the best! Customer 251421 19/10/2020 4.5 ### My grades go up I started ordering samples from this service this semester and my grades are already better. Customer 102951 18/10/2020 4.8 ### Time savers The free features are a real time saver. Customer 271625 12/11/2020 4.7 ### They bring the subject alive I've always hated history, but the samples here bring the subject alive! Customer 201928 10/10/2020 4.3 ### Thanks!! I wouldn't have graduated without you! Thanks! Customer 726152 26/06/2020 ## Frequently Asked Questions ### For students ## If I order a paper sample does that mean I'm cheating? Not at all! There is nothing wrong with learning from samples. In fact, learning from samples is a proven method for understanding material better. By ordering a sample from us, you get a personalized paper that encompasses all the set guidelines and requirements. We encourage you to use these samples as a source of inspiration! ## Why am I asked to pay a deposit in advance? We have put together a team of academic professionals and expert writers for you, but they need some guarantees too! The deposit gives them confidence that they will be paid for their work. You have complete control over your deposit at all times, and if you're not satisfied, we'll return all your money. ## How should I use my paper sample? We value the honor code and believe in academic integrity. Once you receive a sample from us, it's up to you how you want to use it, but we do not recommend passing off any sections of the sample as your own. Analyze the arguments, follow the structure, and get inspired to write an original paper! ### For teachers & parents ## Are you a regular online paper writing service? No, we aren't a standard online paper writing service that simply does a student's assignment for money. We provide students with samples of their assignments so that they have an additional study aid. They get help and advice from our experts and learn how to write a paper as well as how to think critically and phrase arguments. ## How can I get use of your free tools? Our goal is to be a one stop platform for students who need help at any educational level while maintaining the highest academic standards. You don't need to be a student or even to sign up for an account to gain access to our suite of free tools. ## How can I be sure that my student did not copy paste a sample ordered here? Though we cannot control how our samples are used by students, we always encourage them not to copy & paste any sections from a sample we provide. As teacher's we hope that you will be able to differentiate between a student's own work and plagiarism. # Challenging the limits of my ### Kenya mdg progress report 2013 Private special ed school doesnt believe my child is intelligent-what to do? - May 05, · “The only limit to our realization of tomorrow will be our doubts of today.” – Franklin D. Roosevelt. 6. “There is no limit possible to the expansion of each one of us.” – Charles M. Schwab. 7. “There is no limit to what free men and free women in a free market with free enterprise can accomplish when people are free to follow. Dec 06, · Read, attend seminars, teach others to dream big, share your message, push your limits, challenge yourself, –the list of ways to grow is unlimited. Just keep growing. What would you add to this list. How have you overcame self imposed limitations in the past? I look to learn from your comments. Oct 22, · Challenge Your Limits One undeniable fact about life is that we can never escape challenges or rather in any stage of life challenges will always be present. As for me, I . aegean airlines business class trip report ### An Analysis of William Shakespeares Play Romeo and Juliet does the thesis statement have to be one sentence - Apr 14, · Challenging the Limits of Memory. My sister, Carol, likes to tell the story of the time our younger brother, Doug, sucked on a hollow toy bolt till it suctioned onto his lips. He was maybe four. She and Mom and Doug were at Roton Point, our run-down beach club in Connecticut, at the end of the day, marching to the car carrying blankets and. Jan 12, · Some suggestions, based on my own personal experiences: DO SOMETHING NOVEL AND INTELLECTUALLY STIMULATING READ A BOOK OR A MAGAZINE ARTICLE OUTSIDE YOUR NORMAL PURSUIT PLAY WITH A BUNCH OF PRECOCIOUS KIDS BAN THE CALCULATOR AND USE YOUR BRAIN. For many, it convinces them to quit when the path gets too challenging. Our minds instinctively protect us. Therefore, when we face imminent hardship, the first response is to give up. If you become used to accepting this, you will become a quitter. If done regularly, this can create a limit and keep you within it. best buy resume application number ### A report to the king Gdl personal statement help - Best Academic Writers That - Limitations only exist if you impose them upon yourself within your mind. Many limit themselves on what they can accomplish in life because they are not aware. May these quotes inspire your to set no limits on your life and go after your dreams. 1. “All limits are self-imposed.” Icarus. 2. “Don’t limit your challenges. Challenge your limits.”. Although these problems are a little more challenging, they can still be solved using the same basic concepts covered in the tutorial and examples. To test your knowledge of limits, try taking the general limits test on the iLrn website or the advanced limits test at the link below. Limits Tutorial General Limits Test on iLrn Advanced Limits Test. I have searched so much but couldn't find anywhere these things and many other like limit of a summation, Newton-Leibniz Formula, etc.$\endgroup$– Knight wants Loong back Nov 18 '19 at$\begingroup$@adeshmishra: You can take a look at some other posts linked from my profile under "Asymptotic expansions". American History, Mind and Machine Essay ### Mba dissertations for sale | WizKids best ways to cheat in college - Pushing Past Your Limits. A few years ago I decided to go to the gym on a regular basis. In order to build the muscle I wanted, I would regularly lift weights, do my cardio and eat well. I made a lot of progress at first, but eventually I met resistance and my exercise goals became harder to attain. I had reached my limit. It requires going through some psychological crucible and challenging your limits, both perceived and real. Setting the Limit. The physical work in the gym is easy for most. It is the psychological aspects of training that most people struggle with. The limit of sin(x)/x as x goes to 0,Proof of the derivative of sin(x), imgssmutpicsxyz.gearhostpreview.com, we cannot use Taylor series for sin(x) since we need. Sample Autocad Cover Letter Systems Engineer ### Call detail report asterisk key i have to do my homework hours - Feb 19, · In my experience, most leaders are trying to combine a mix of challenge and support to get the best out of their teams. Achieving this balance is never easy, and is specific to each individual.$\begingroup$Hi Zarrax,I see now it, it is using what I call the secant form of the definition of the derivative. So you used this idea to find what f(x) is, but then you used power rule differentiation techniques and exponential differentiation. Dec 26, · challenge your limits!” ~Jerry Dunn One of the main reasons I share these inspirational quotes is that I also struggle with my demons, my inadequacies the feeling of not being good enough, of not being ENOUGH! Action Planning essay writing services uk ### Case study on leadership versus Pan African Leaders - Orders to Sentry is the official title of a set of rules governing sentry (guard or watch) duty in the United States Armed imgssmutpicsxyz.gearhostpreview.com any guard posting has rules that may go without saying ("Stay awake," for instance), these orders are carefully detailed and particularly stressed in the U.S. Navy, U.S. Marine Corps, and U.S. Coast imgssmutpicsxyz.gearhostpreview.com known as the 11 General Orders, the list is meant. Contesting a Will time limits Reasonable financial provision – Inheritance Act Claims. Claims for ‘reasonable financial provision’ – i.e. claims made under the Inheritance Act – must be made within 6 months of the date of issue of the grant of probate or letters of administration: Section 4 Inheritance (Provision for Family and Dependants) Act – Time-limit for applications. Nov 20, · challenging. When challenging, a guard, armed with a rifle, carbine, or shotgun will challenge from the position of port arms as described in the manual of arms in FM If armed with a pistol the guard will challenge from the position of raise pistol. After challenging, a guard will remain in the challenge position until the individual. An Analysis of the Novel Wild Meat and the Bully Burgers by Lois-Ann Yamanaka ### Comparing the Benefits of Large and Small Universities page de presentation histoire 4eme republique - One can approach the benefits from this advanced world only when he/she learns the art of challenging the limits set by them in every potential manner. Students at a young age can implement this in a best manner because they have within them the cravings to achieve the best standard of living. Esteemable names in the field of education like KVS. The limit of (x 2 −1) (x−1) as x approaches 1 is 2. And it is written in symbols as: limx→1 x 2 −1x−1 = 2 So it is a special way of saying, "ignoring what happens when we get there, but as we get closer and closer the answer gets closer and closer to 2" As a graph it looks like this. Apr 11, · I believe in challenging my limits. In anything you do, especially business, you are going to face challenges. I don't think that you can really limit your challenges only find solutions for them. Even if you've overcome one challenge there will be another one. The only thing you can do is face your challenges and prepare for the next one. csl annual report 2004 gmc ### Law school personal statement sample essays english teaching jobs in china salary report - Jun 20, · There are certain disciplines, such as coaching or NLP (neuro-linguistic programming) that deal specifically with making us see those limits and how we can overcome them. “All children are born artists. The challenge is that they keep being so when they grow up.” -Pablo Picasso-How and where our limits are created. Apr 02, · Don’t push your limits for the sake of the challenge. The idea isn’t to push yourself towards all kinds of limits simply to prove that you’re not afraid to exceed them. There's a limit to how much intimacy you can tolerate. The Limits of Ambition. By Carl Beuke Ph.D. Five steps to achievable goals. Helpful Reminders During Challenging Times. Why Sleep is. Community service persuasive essay ### Internet Freedom Should Not Be Censored by the Government Life of Normal People in Everyday Situations (Kennedy 1410) - It's not always easy to recognize our limits until we go beyond them. Here are some tips on drawing the line before it's too late. On the eve of each new year, many of us commit to making. Well, that was a quick ride through a very important topic. (Note to my editor: I’m respecting your limit.) Challenging limits is one of the most exciting aspects of cycling, fearing limits is one of the biggest obstacles, and extending limits is one of the most fulfilling experiences. I wish you strength in your work with limits. And. Jul 26, · Startup Life 30 Examples of Day Challenges That Will Change Your Life Look at life as if it's a series of experiments. Change your habits for 30 days and see what happens. Dieppe Raid 1942 ### Thesis statement oedipus the king Good english writer from Philipine - Challenge Your Limiting Beliefs right now and find out how you can unlock your inner potential and change your life fast. Anyone who uncovers the secret to changing their limiting beliefs will be able to do absolutely anything. Benefits of Challenging Your Limiting Beliefs Take Your Life Back Stop Bad Habits Gain Confidence Overcome Major Obsiticles Change Bad Personality Traits To Good Ones. The big challenge lies in the fact that limits aren’t always in line with our instincts and emotional needs. That’s why we need self-discipline. Your body may crave sweets all day. But you can set a limit to only eat one candy per day. You may not feel like exercising at all. But because you know all the benefits of exercise, you can decide. Jun 06, · Chapter 2: Limits. Here are a set of practice problems for the Limits chapter of the Calculus I notes. If you’d like a pdf document containing the solutions the download tab above contains links to pdf’s containing the solutions for the full book, chapter and section. business strategy dissertation titles ### Someone help! does this essay clear?(English, grammer, expression)? пїЅHills Like White ElephantsпїЅ by Ernest Hemingway essay buy - My youngest sister, Cindy, has Down syndrome, and I remember my mother spending hours and hours with her, teaching her to tie her shoelaces on her own, drilling multiplication tables with Cindy, practicing piano every day with her. No one expected Cindy to get a Ph.D.! But my mom wanted her to be the best she could be, within her limits. Amy Chua. May 22, · The foundation of the No-Limit’s Mindset are really pretty simple, but trying to apply them to your life on a daily basis can be very challenging. The world we live in today isn’t really open to this mindset and it takes a special kind of person who is willing to look inside of themselves and take responsibility for themselves and their. There are many techniques for finding limits that apply in various conditions. It's important to know all these techniques, but it's also important to know when to apply which technique. Google Classroom Facebook Twitter. Email. Selecting procedures for determining limits. varalakshmi vratam,hindi - Ammas.com ### The Possible Causes and Treatment for Endometriosis cpm homework helper answers equivalent - Successfully challenging the limitations of conventional body and pelvic MR imaging with advanced imaging techniques and deep learning reconstruction tools. Choosing magnetic resonance imaging (MRI) to evaluate patients who need cross sectional abdominal and pelvic imaging presents unique challenges and opportunities. Limits describe how a function behaves near a point, instead of at that point. This simple yet powerful idea is the basis of all of calculus. Google Classroom Facebook Twitter. Email. Defining limits and using limit notation. Limits intro. Limits intro. This is the currently selected item. Before we can complete the calculation of the derivative of the sine, we need one other limit: $$\lim_{x\to0}{\cos x - 1\over x}.$$ This limit is just as hard as$\sin x/x$, but closely related to it, so that we don't have to do a similar calculation; instead we can do a bit of tricky algebra.$\${\cos x - 1\over x}={\cos x - 1\over x}{\cos x+1. asciano limited annual report 2013

You might have noticed that around Impossible HQ we talk about physical limits a lot. S even though they usually have some good excuses at the ready as well. This site is about challenging you. About getting you to do something — phsyically do Challenging the limits of my — with burberry case study harvard body — physically.

To challenge you to move from inaction to action — physical action — Challenging the limits of my do something impossible — physically. Your mind sucks. It is unbelievably easy to BS yourself in your mind. When you keep things mental — everything stays mental. Challenging the limits of my I can. You suck a lot and er report jamaica 2016 dancehall you do might fail.

But keep it up and over time you start to suck less and less and you actually are able Challenging the limits of my do Challenging the limits of my. Ever tried to break a nalgene bottle? As soon as you make is possible — Challenging the limits of my do it — Challenging the limits of my somehow become possible. Physical challenges show you your Challenging the limits of my limits. When you break through them, you experience a real-life case study An Analysis of Drug Use and Should It Be Decriminalized the fact that your limits are just temporary.

They are not permanent. They Challenging the limits of my you that everything holding you back is in your head. With physical limits, progress is almost offensively obvious. When you challenge your physical limits, you start to use this phrase:. I literally used to Challenging the limits of my be able to run more than 2 Challenging the limits of my. I Challenging the limits of my I can go out and run miles on demand. It might suck, but I can do it if I need to. I used Challenging the limits of my not be able to run 2 miles. Now I can run a marathon.

I know mla bibliography purdue webassign. I literally used Challenging the limits of my never think I could be strong, build muscles or get ripped. But, I dialed in my diet, focused on Challenging the limits of my workout routines and lost 34 Challenging the limits of my in 8 weeks and got to 5. I know Challenging the limits of my can lose 10 pounds in 2 weeks if I need to.

Challenging the limits of my might Challenging the limits of my tough, thesis statement key features ugoplayer I Challenging the limits of my do it and El Mejor Nido by P. D. Eastman (2005, Hardcover) | eBay Challenging the limits of my how to now. It might be hard, but I can do it. I used to not be able to get cut, get ripped, but now I can. Challenging the limits of my used to not be able to hear a Challenging the limits of my without thinking about how incapable I was, telling myself how I was different and that everybody apa bibliography noodle bibliography could do them, but not me.

Challenging the limits of my entire mentality Challenging the limits of my when I moved from talking to doing. Physical challenges show you your limits are physical things — nothing more. But if you Challenging the limits of my — just once — try to push your Challenging the limits of my — even on the smallest scale — things will change. It will hurt, it will suck and it will be freaking hard. Because once you do something you used to think was impossible — it no longer is. You just did the impossible. Instead of backing down from challenges — you look forward to them. Instead of shying away from stuff that might be tough, might hurt, or might be impossible — they get into you head and intrigue you.

You want to see how far you can really push your limits — both physical and mental. Challenging the limits of my mind is Challenging the limits of my, screaming, screaming for you to stop, give up and go home. Take it easy! Be normal! You might smash one. When you smash your physical limits, you smash your mental ones along with it. You get both. You have to become stronger than you are now. Getting stronger Challenging the limits of my, get stronger Challenging the limits of my. Contrary to what your mother told you — you face the exact same dilemma that each and every one of the other 7 billion Challenging the limits of my on this earth face.

Get in the league and get after it. Go push yourself Challenging the limits of my and see what happens. See you there. You can get free updates in your inbox via Challenging the limits of my new favorite newsletter and see all my businesses at Challenging the limits of my X and our philanthropic efforts at Impossible. I love hearing the would of, could of, should of people since they just put their self imposed limits into words. The mental and physical are tightly linked and need to be nurtured together or things get out of whack.

Have fun jumping off the Challenging the limits of my. I scream and yell and how can i start a comparative essay? and laugh. I get them done. Nor would I know what it feels like. PS…pushing your physical limits pushes your mental limits right? Remember in your first Cold Shower Therapy Challenging the limits of my in April when the challenge was simply to complete the challenge?

I may still not want to Challenging the limits of my off a bridge, but holy crap report broken traffic light nsw map I pushed my mental limits while pushing my hamlet revenge tragedy essay ones. And I have you to thank for it.

I used to be one of those people that saw no point in Challenging the limits of my myself physically. Oh and along the way, I quit my old job, moved out of Challenging the limits of my parents house, and moved to New York City with a brand new job. I broke down mental barriers that I never could have before because I Challenging the limits of my proven to myself that I could tear down physical ones.

Awesome article, Joel! This takes it. For me, the shattering of the mental was more profound, although it was almost always achieved through the physical. I feel like I always knew deep down that Challenging the limits of my could do amazing things Challenging the limits of my, but once I actually did them, I had reached a new level, a new platform in my mind. We just have to conquer these pathetic, ingrained, persistent illusions formed by the weak-willed complacent people of this earth, mentally and Challenging the limits of my. I read this after a recommendation from Vic Magery and I love it! I was 38… Sedentary? Not me! The doctors told me I had a life changing injury. Yeah, A Discussion on Capital Punishment in the United States of America Ummm, not quite.

But I do know about Challenging the limits of my. I was on crutches for almost a year, and then I had to learn to walk again. Actually Challenging the limits of my learned how to walk again twice because the first time they figured out that there must be another broken piece of tibial plateau in there and that meant another surgery, and that meant more time on crutches and learning to walk again. When you learn to walk after an injury like this you learn to walk adding s to words worksheets. No matter. I did my physical therapy for almost a year and then I took over. I went back to the gym on crutches. I got myself up on the upright bike seat and rode for about 5 minutes with no tension.

I started painfully slowly with my weak knee, atrophied leg, and determination. I patted myself on the Challenging the limits of my and noted every little bit of progress. I got back into great shape just about Challenging the limits of my time my Challenging the limits of my started acting up again. Time to take all the titanium out. And then recover from that. The harder the challenge, the better the feeling! Mla bibliography translated works motorsports perspective. After nursing my husband for four years until his death last year, I have become a bit of a sloth. We used to go to the gym together — he was incredibly fit for years.

Surely I will soon muster the mental attitude to philips matsushita case study analysis sample back on track! Thanks for this inspirational perspective. Pushing physics limits The Advantages and Disadvantages of the Internet Recruiting Technique relatively easy, you know what actions you need to take and you keep pushing yourself to do them.

Also, is Are you allowed to take in tracing paper for the GCSE math higher paper? really that Challenging the limits of my to take a cold shower, I use them to wake myself up.


text:
## The Annals of Probability

### Monotonicity of conditional distributions and growth models on trees

Thomas M. Liggett

#### Abstract

We consider a sequence of probability measures $\nu_n$ obtained by conditioning a random vector $X =(X_1,\ldots,X_d)$ with nonnegative integer valued components on

$$X_1 + \dots + X_d = n - 1$$

and give several sufficient conditions on the distribution of $X$ for $\nu_n$ to be stochastically increasing in $n$. The problem is motivated by an interacting particle system on the homogeneous tree in which each vertex has $d +1$ neighbors. This system is a variant of the contact process and was studied recently by A.Puha. She showed that the critical value for this process is 1/4 if $d = 2$ and gave a conjectured expression for the critical value for all $d$. Our results confirm her conjecture, by showing that certain $\nu_n$’s defined in terms of $d$-ary Catalan numbers are stochastically increasing in $n$. The proof uses certain combinatorial identities satisfied by the $d$-ary Catalan numbers.

#### Article information

Source
Ann. Probab., Volume 28, Number 4 (2000), 1645-1665.

Dates
First available in Project Euclid: 18 April 2002

https://projecteuclid.org/euclid.aop/1019160501

Digital Object Identifier
doi:10.1214/aop/1019160501

Mathematical Reviews number (MathSciNet)
MR1813837

Zentralblatt MATH identifier
1044.60094

#### Citation

Liggett, Thomas M. Monotonicity of conditional distributions and growth models on trees. Ann. Probab. 28 (2000), no. 4, 1645--1665. doi:10.1214/aop/1019160501. https://projecteuclid.org/euclid.aop/1019160501

#### References

• Efron, B. (1965). Increasing properties of P´olya frequency functions. Ann. Math. Statist. 36 272-279.
• F ¨urlinger, J. and Hofbauer, J. (1985). q-Catalan numbers. J. Combin. Theory Ser. A 40 248-264.
• Hilton, P. and Pedersen, J. (1991). Catalan numbers, their generalization and their uses. Math. Intelligencer 13 64-75.
• Holley, R. (1974). Remarks on the FKG inequalities. Comm. Math. Phys. 36 227-231.
• Joag-Dev, K. and Proschan, F. (1983). Negative association of random variables with applications. Ann. Statist. 11 286-295.
• Karlin, S. and Rinott, Y. (1980). Classes of orderings of measures and related correlation inequalities I: multivariate totally positive distributions. J. Multivariate Anal. 10 467- 498.
• Kipnis, C. and Landim, C. (1999). Scaling Limits of Interacting Particle Systems. Springer, Berlin.
• Liggett, T. M. (1985). Interacting Particle Systems. Springer, New York.
• Liggett, T. M. (1999). Stochastic Interacting Systems: Contact, Voter and Exclusion Processes. Springer, Berlin.
• Pemantle, R. (2000). Towards a theory of negative dependence. Unpublished manuscript.
• Preston, C. J. (1974). A generalization of the FKG inequalities. Comm. Math. Phys. 36 233-241.
• Puha, A. L. (1999). A reversible nearest particle system on the homogeneous tree. J. Theoret. Probab. 12 217-254.
• Puha, A. L. (2000). Critical exponents for a reversible nearest particle system on the binary tree. Ann. Probab. 28 395-415.
• Shaked, M. and Shanthikumar, J. G. (1994). Stochastic Orders and Their Applications. Academic Press, New York.
• Spitzer, F. (1970). Interaction of Markov processes. Adv. Math. 5 246-290.
• Tretyakov, A. Y. and Konno, N. (2000). Survival probability for uniform model on binary tree: Critical behavior and scaling. In Soft Computing in Industrial Applications. Springer, New York.

format: plain


text:
# c++ dice game using random numbers

I'm fairly new to c++ programming. It would be helpful if I could get a feedback on a dice game I wrote. I would really appreciate some tips as well as your opinions.

This program will begin by asking the user to enter an amount to bet (from $1-$1000). Next, the user is asked to guess the total that will occur when two dice are rolled. The program then “rolls two dice” (using random numbers) and visually displays the result. Then, if the player’s guess was correct, the player wins 8 times their bet divided by the number of possible way to get that roll. If the player’s guess was wrong, they lose their bet times the number of possible ways to get their guess.

#include <iostream>
#include <cstdlib>
#include <time.h>
using namespace std;

//main program
int main()
{
int guess;//user guess for the value of the dice
float bet;//the bet placed by the user
float possibility;//number of combinations each number can come
int dice1, dice2;//the random value between 1-6 for each dice
int total;//the total number after the value of dice1 and dice2 is added
float earned_or_lost_money;//earned or lost money depending on whether you win/lose

srand(time(0));//random number seed

cout << endl;//blank line

cout << " What do you guess the result will be?(2-12): ";
cin >> guess;//user input for guess

cout << " Enter amount of money to bet ($1-$1000): ";
cin >> bet;//user input for bet

cout << endl;//blank line

dice1 = rand() % 6 + 1;//value of first dice(1-6)
dice2 = rand() % 6 + 1;//value of second dice(1-6)

total = dice1 + dice2;//value of dice1+dice2

switch (guess)// values for possible combinations for the total value of the dices added
{

case 2: possibility = 1; break;
case 3: possibility = 2; break;
case 4: possibility = 3; break;
case 5: possibility = 4; break;
case 6: possibility = 5; break;
case 7: possibility = 6; break;
case 8: possibility = 5; break;
case 9: possibility = 4; break;
case 10: possibility = 3; break;
case 11: possibility = 2; break;
case 12: possibility = 1; break;
}//switch

cout << " For your $" << bet << " bet, the roll is" << endl; cout << endl;//blank line if (dice1 == 1)//drawing if the value of dice1 is 1 { cout << "=============" << endl; cout << "| |" << endl; cout << "| 1 |" << endl; cout << "| |" << endl; cout << "=============" << endl; }//if else if (dice1 == 2)//drawing if the value of dice1 is 2 { cout << "=============" << endl; cout << "| 2 |" << endl; cout << "| |" << endl; cout << "| 2 |" << endl; cout << "=============" << endl; }//else if else if (dice1 == 3)//drawing if the value of dice1 is 3 { cout << "=============" << endl; cout << "| 3 |" << endl; cout << "| 3 |" << endl; cout << "| 3 |" << endl; cout << "=============" << endl; }//else if else if (dice1 == 4)//drawing if the value of dice1 is 4 { cout << "=============" << endl; cout << "| 4 4 |" << endl; cout << "| |" << endl; cout << "| 4 4 |" << endl; cout << "=============" << endl; }//else if else if (dice1 == 5)//drawing if the value of dice1 is 5 { cout << "=============" << endl; cout << "| 5 5 |" << endl; cout << "| 5 |" << endl; cout << "| 5 5 |" << endl; cout << "=============" << endl; }//else if else if (dice1 == 6)//drawing if the value of dice1 is 6 { cout << "=============" << endl; cout << "| 6 6 |" << endl; cout << "| 6 6 |" << endl; cout << "| 6 6 |" << endl; cout << "=============" << endl; }//else if cout << endl;//blank line if (dice2 == 1)//drawing if the value of dice2 is 1 { cout << "=============" << endl; cout << "| |" << endl; cout << "| 1 |" << endl; cout << "| |" << endl; cout << "=============" << endl; }//if else if (dice2 == 2)//drawing if the value of dice2 is 2 { cout << "=============" << endl; cout << "| 2 |" << endl; cout << "| |" << endl; cout << "| 2 |" << endl; cout << "=============" << endl; }//else if else if (dice2 == 3)//drawing if the value of dice2 is 3 { cout << "=============" << endl; cout << "| 3 |" << endl; cout << "| 3 |" << endl; cout << "| 3 |" << endl; cout << "=============" << endl; }//else if else if (dice2 == 4)//drawing if the value of dice2 is 4 { cout << "=============" << endl; cout << "| 4 4 |" << endl; cout << "| |" << endl; cout << "| 4 4 |" << endl; cout << "=============" << endl; }//else if else if (dice2 == 5)//drawing if the value of dice2 is 5 { cout << "=============" << endl; cout << "| 5 5 |" << endl; cout << "| 5 |" << endl; cout << "| 5 5 |" << endl; cout << "=============" << endl; }//else if else if (dice2 == 6)//drawing if the value of dice2 is 6 { cout << "=============" << endl; cout << "| 6 6 |" << endl; cout << "| 6 6 |" << endl; cout << "| 6 6 |" << endl; cout << "=============" << endl; }//else if cout << endl;//blank line cout << " For a total of " << total << endl; cout << endl;//blank line if (guess == total)//if the user guessed correctly { earned_or_lost_money = bet * 8 / possibility;//calculation for money earned cout << " You were correct... since " << guess << " can come up " << possibility << " ways," << endl; cout << "You win$" << bet << "*8/" << possibility << "= $" << earned_or_lost_money << endl; }//if else//if the user guessed wrong { earned_or_lost_money = possibility * bet;//calculation for lost money cout << " You were wrong... since " << guess << " can come up " << possibility << " ways," << endl; cout << " You lost " << possibility << "*$" << bet << "= \$" << earned_or_lost_money << " dollars!!!!!!" << endl;
cout << " Thanks for your donation :)" << endl;
}//else
return 0;
}//end

## 3 Answers

The 2 previous answers provide a lot of good points, here are a few more suggestions:

## Generating Random Numbers

As of C++11 there are better random number generators to use that the C standard library rand() function. This stackoverflow question provides the following:

#include <random>
#include <iostream>

int main() {
std::random_device rd;
std::mt19937 mt(rd());
std::uniform_real_distribution<double> dist(1.0, 10.0);

for (int i=0; i<16; ++i)
std::cout << dist(mt) << "\n";
}

This provides a better distribution than the C function rand().

## Representing Money in Software

Banks don't like to lose money due to floating point error, nor can they legally cheat the costumers so they don't use floating point numbers to represent money, they use 2 integer values, one for dollars and one for cents. This prevents floating point errors from affecting the cash values involved.

## Complexity

Any function larger than one screen in most IDEs or editors is to large, it is very hard to write, read, debug and maintain functions this large. You can create a class as one of the other answers suggested, you can also just create a number of functions called from main(). If you continue learning software you will learn principles on why this is important.

• Two integers? Too wasteful and cumbersome. Better a single integer with twice the bits. – Deduplicator Nov 10 '20 at 20:46
• Or for JPY just the yen - or more likely some multi didgit library or if old enough BCD rather than binary integers – mmmmmm Nov 11 '20 at 10:37

For a beginner, this is a nice attempt.

# Avoid "using namespace std"

Though this is trivial for a ten lines of code project, it immediately starts leading to issues when code size increases. Avoid it now. You can alternatively type std::cout or rather using std::cout, here the effect is localized to just cout. Check here for more info on why "using namespace std" is consider bad.

# Prefer double to floating-point values

Double has 2x precision than floating-point values, thereore, provides more accuracy when performing calculations. Double on most machines is 8bytes whereas float is 4bytes, but the precision gain is worth it.

# Make use of random header

rand requires a seed to generate its pseudorandom numbers, if this seed is the same at each run, it produces the same output. This leads to some sort of dependency on the seed. rand also uses srand making it impossible to use with other random engine

# Consider using a class

Your main function is cluttered with code here and there, move them to separate class, you could have a class that handles everything concerning the dice and the rest other functionalities.

# Prefer \n to endl

Whenever you need a newline but don't explicitly need to flush the buffer, use \n. endl adds a newline and flushes the buffer, this would result to a slight drop in performance.

• Actually for accuracy reasons backs use 2 integers for money values, one for dollars and one for cents. This prevents floating point errors. – pacmaninbw Nov 10 '20 at 17:54
• @pacmaninbw I totally agree. – theProgrammer Nov 10 '20 at 18:19
• Integers for money, sure. But why break it down into two, when handling just one is more efficient and convenient? And if it has twice the bits, you can store even bigger totals. – Deduplicator Nov 10 '20 at 20:48

Depending of what you want, there is some things you can do:

• refactor dice drawing function as there is a lot of redounding code
• a check for all inputs (nothing prevent your user to input bet out of 2-12 and money out of 0-1000, even negative bet or non numeric ones
• add a loop allowing player to play multiples games (with money carried between)
• i probably would have used a table to store possibilities of bet

Without further informations about what you want to improve, it's hard to be more specific


text:
Notes for CPSC411:Author: Robin CockettDate: 9 March 2007

Forming the LALR(1)-item automaton from the LR(0)-item automaton

The LALR(1)-item automaton's states are the same as those of the LR(0)-item automaton except that we need, to help resolve any conflicts, sets of terminals associated with each completed item in each state which contains such.  These are the LALR(1) conflict resolution sets.  One expensive way to calculate these is to develop the LR(1)-item automaton and map it down onto the LR(0)-item automaton while and using its follow token to determine conflict resolution.  Another method is to calculate follow sets on the augmented grammar (which we describe below).   However, the fastest (if not the easiest way) is to calculate the conflict resolution token in situ from the LR(0)-item automaton: this avoids developing the LR(1)-item automaton or the augmented grammar (although the in situ calculation is, in fact, just the follow set calculation for the augmented grammar).

It is useful to realize that to tell whether  a grammar is LALR(1) we only need to calculate the conflict resolution tokens for the completed items for which there is a shift/reduce or reduce/reduce conflict.  This can, in fact, be done by hand and it is the purpose of these notes to outline how and also to relate this calculation to the follow tokens of the LR(1)-item automaton and the follow sets of the augmented grammar.

A basic technique is to mimic the effect of the shift-reduce parser on the automaton by tracing paths backwards to understand when reductions of completed items should be permitted.  This can be achieved more formally by calculating augmented follow sets.

Augmented follow sets (in situ)

A starting item in a state of an LR(0)-item automaton is an item of the form x -> .\gamma. If x is not the start non-terminal the only reason that an item of this form is present in a state is because there are items in the state of the form y -> \alpha.x \beta.

When x is the head of a starting item in state S, we define the  LALR(1) immediate follow set of x in a state S, IFollow(x,S), to be

• if x=start is the start nonterminal of the augmented grammar IFollow(x,S) = { $} • otherwise IFollow(x,S) = \union { first(\beta) | y -> \alpha.x \beta \in S \} Note that IFollow(x,S) is just the terminal transitions leaving the state reached by doing an x from S (with the added possibility of a$).    So this is really very easy to calculate by eye-balling the  machine!

We shall say there is a (backward) propogation step:

(x,S) ~~> (y,T)

in case there is an item y -> \alpha.x \beta in the state S with \beta nullable and a (forward) path \alpha: T -> S in the machine. The LALR(1) follow set of x in S, Follow(x,S), is the union of

• the immediate follow set of x in S, IFollow(x,S)
• the immediate follow sets y in T, IFollow(y,T), for which there are (one or more) backward propogation steps (x,S) ~~> (y,T).

That is Follow(x,S) = \union { IFollow(y,T) | (S,x) ~*~> (y,T) } ... i.e. the union of the immediate follow sets reachable by zero or more propogation steps.

This can be calculated for (x,S) by first calculating the transitive closure of the backward propogation steps to obtain a set of pairs which can be reached by backward propogation from (x,S) and then forming the union of the immediate follow sets of these pairs.  Recall, significantly, that there can be backward propogations (x,S) --> (y,S) if there is a rule of the form y -> .x \beta where \beta is nullable.  So one can move from one follow set on a state to another on the same state.  Recall also backwards propogation from S along a path \alpha is non-deterministic: there may be many different states T from which following \alpha will get one to S.

The LALR(1) conflict resolving tokens for a completed item

x -> \alpha. in state S

are then exactly the set:

\union \{ Follow(x,T) | \alpha: T -> S \}

The advantage of this calculation is that one can apply it to resolve just the conflicts which occur in the LR(0)-item automaton and if one is lucky the propogation ends quite quickly leading to a relatively cheap way of determining whether the language is LALR(1) or not.

Relation to the LR(1)-item automaton's follow tokens

Here is a sketch of why the way of calulating the LALR(1) follow sets, as above and from the LR(1)-item automaton, are the same. To see that this calculation does calculate the follow sets obtained from the LR(1) automaton it suffices to relate the adding of tokens to the tokens in the LR(1)-item automaton to the augmented follow set calculation. This is achieved by first observing that the tokens collected by the augmented follow sets will all be generated by the LR(1)-items. To see this observe first that the immediate follow sets do not add anything that the LR(1)-items do not already collect. Similarly, if there is a backward propogation (x,S) --> (y,T) then any symbol which follows y in T will also be picked up in the LR(1)-automaton to follow x in S.  So the LALR(1) -augmented follow sets are no bigger than the sets picked up by the LR(1)-item automaton. For the converse we need to show that anything picked up by the LR(1)-item automaton will be picked up by the augmented follow sets: again this can be seen by looking at the steps in the process.

The augmented grammar

The following realization is due to M.E. Bermudez and G. Logothetis (Inf. Proc. Letter 31 (1989) 233-238): the above calculation of LALR(1)-augmented follow sets can be seen as the standard follow set calculation on an augmented grammar. The augmented grammar is constructed as follows:

Each rule x -> \alpha in the original grammar occurs as a starting item in a number of LR(0)-item automaton states. For each such state, S, create a new copy of the production with head non-terminal augmented by the state S and each non-terminal in the body augmented by the state it leaves when that starting item is followed through its (uniquely determined) shifts in the LR(0)-item automaton.

(x,S) -> \alpha'

This creates an augmented grammar whose follow sets, Follow(x,S) are exactly the same as the augmented follow sets described above.

This is a VERY convenient packaging of the LALR(1)-augmented follow set calculation! It also leads to the following, perhaps a little surprising, observation. Every language recognizable by an LALR(1) grammar is recognizable by an SLR(1) grammar!  Which one? Well of course it is the augmented grammar!

Example (dangling else):

Consider the following grammar this is a cut-down version of the "dangling else" problem which was famously encountered in the development of Algol and led to the whole development of the theory of context free grammars.

Stmt ->  assignment
| if expression then Stmt Ecase.
Ecase -> else Stmt
|.

has been cut down to:

S -> s | c S C.
C -> e S | .

the grammar is ambiguous so cannot be LALR(1).   Here is the LR(0) automaton.  Notice the conflict in state 4.  As we know that the grammar is not LALR(1), we should be able to show that e is in the augmented follow set of C in state 4 (we go backward from state 4 by \epsilon).   We do not have to do the whole LALR(1)-augmented follow set calculation to see this consider the follow sets and the propogation from (C,4):

 Ifollow(C,4) = {} S -> c S.C: (C,4) -> (S,0) S -> c S.C: (C,4) -> (S,3) Ifollow(S,0) = {} start-> .S: (S,0) -> (start,1) Ifollow((start,1) ={$} Ifollow(S,3) = {e} This means by (C,4) -> (S,3) => {e} that e is in the LALR(1)-augmented follow set so that the grammar is not LALR(1). The augmented grammar is (S,0) -> s | c (S,3) (C,4). (S,3) -> s | c (S 3) (C,4). (S,6) -> s | c (S,3) (C,4). (C,4) -> e (S,6) | . Try the follow set calculation here and check you get the same answer! Example (resolving some conflicts): Consider the grammar: A -> B ( A B) | . B -> A *( B A )* | . Here are its vital statistics. It is not LR(0) or SLR(1) as is shown here. We try to show that it is LALR(1). The reduce/reduce conflict in state 0: We must calculate Follow(A,0) ={ *(,$ }:
 Ifollow(A,0) = { *( } (A,0) -> (start,1) Ifollow(start,1) = { $} and Follow(B,0) = { ( }:  Ifollow(B,0) = { ( } nothing So this resolves this reduce/reduce conflict. The reduce/reduce conflict in state 6: We must calculate Follow(A,0) ={ *( }:  Ifollow(A,3) = { *( } nothing and Follow(B,3) = { ( }:  Ifollow(B,3) = { ( } nothing So this resolves this reduce/reduce conflict! Similarly is sate 5 one can resolve the reduce/reduce conflict. Similarly the reduce/reduce conflict in state 5 can be resolved. However, the shift/reduce conflict in state 5 cannot be resolved so this grammar is not LARL(1). The immediate follow set IFollow(A,5) = { *( } so we do avoid the shift/reduce conflict .... so the grammar is not LARL(1). Example: removing all conflicts. Consider the slight variation of the above grammar A -> A ( B A) | . B -> B *( A B )* | . The vital statistics of this grammar are here. The LR(0) automaton is here: note the grammar is neither LR(0) or SLR(1). However, as we now verify this is LALR(1) -- and this should remind us that a slight change to a grammar can change everything. There are shift/reduce conflict in state 3 and 6. However, in state 3 Ifollow(A,3) = { ( , ) } and there is no propogation. So this is resolved. Symmetrically Ifollow(B,6) = { *( , *) } and there is no propogation so this is also resolved. Thus, the grammar is LALR(1). This was very simple! Let us illustrate the technique further by working out the LALR(1) follow set for the completed item A -> A ( B A). in state 7. We are looking for the follow sets of A in all state where the given production starts. Tracing this back we must calculate Follow(A,3) and Follow(A,0). It is not hard to see that IFollow(A,0) = { ( } and there is propogation to (start,1) which will add {$ } so that Follow(A,0) =  { ( , $}. Let us calculate for (A,3) here there is no propogation and IFollow(A) = { ( , ) }. Thus the LALR(1) follow set on the completed item in state 7 is ( / ) /$.


text:
# Tag Synonyms

Master Synonym Creator Renames Last
× 1744 × 72 David Z
mar 15 '12 at 1:32
1148 8h ago
× 3955 × 313 Manishearth
mar 7 '12 at 16:16
1098 2h ago
× 5466 × 6 Sklivvz
feb 25 '11 at 9:10
271 may 15 at 7:42
× 2118 × 32 Sklivvz
nov 25 '10 at 19:49
210 1d ago
× 5466 × 34 Marek
dec 5 '10 at 9:40
195 1d ago
× 5466 × 6 Waffle's Crazy Peanut
feb 3 '13 at 6:05
170 3h ago
× 352 × 290 Qmechanic
apr 24 '14 at 21:48
135 may 28 at 15:19
× 291 × 126 Qmechanic
aug 14 '13 at 14:51
127 1d ago
× 291 × 47 Qmechanic
aug 14 '13 at 14:52
104 may 23 at 21:15
× 1008 × 110 Kyle Oman
oct 14 '14 at 21:29
98 may 27 at 9:12
× 404 × 77 Qmechanic
mar 5 '14 at 0:47
98 55m ago
× 178 × 2 Qmechanic
sep 19 '13 at 21:24
95 may 27 at 17:58
× 3139 × 22 Qmechanic
feb 1 '14 at 14:13
87 may 23 at 16:10
× 2118 × 193 Qmechanic
aug 6 at 20:15
81 1d ago
× 114 × 37 Qmechanic
nov 6 '13 at 15:20
67 may 24 at 2:33
× 3139 × 46 Qmechanic
nov 25 '14 at 22:19
60 may 17 at 17:48
× 389 × 72 Qmechanic
apr 12 '14 at 19:29
53 may 28 at 2:00
× 776 × 2 Qmechanic
dec 9 '13 at 18:45
51 may 14 at 16:46
× 999 × 6 Qmechanic
jun 13 '14 at 4:23
50 may 28 at 2:00
× 776 × 24 Qmechanic
nov 17 '13 at 14:15
46 may 20 at 7:53
× 999 × 15 Qmechanic
jan 11 '14 at 21:38
37 may 23 at 10:40
× 3139 × 40 Qmechanic
apr 21 '14 at 15:13
37 may 20 at 16:06
× 451 × 6 Qmechanic
dec 18 '13 at 13:02
34 apr 30 at 0:10
× 688 × 12 Qmechanic
jan 9 '15 at 13:37
31 may 24 at 23:14
× 291 × 20 Qmechanic
aug 14 '13 at 14:52
31 may 23 at 20:39
× 642 × 9 Qmechanic
sep 9 at 10:28
27 may 19 at 12:32
× 3955 × 11 Qmechanic
mar 22 '14 at 15:43
25 may 17 at 16:06
× 1815 × 5 Qmechanic
apr 20 '14 at 5:19
20 may 23 at 8:19
× 113 × 4 Qmechanic
sep 24 '13 at 19:38
20 apr 22 at 11:26
× 773 × 10 David Z
apr 10 '12 at 21:04
18 may 10 '14 at 17:08
× 144 × 44 Qmechanic
jan 10 '13 at 1:20
18 may 10 at 22:37
× 2230 × 23 Qmechanic
mar 22 '14 at 15:41
17 may 4 at 2:17
× 179 × 55 Qmechanic
feb 13 '13 at 15:35
13 may 24 at 20:36
× 778 × 15 Qmechanic
apr 21 '14 at 5:11
13 may 25 at 14:36
× 3955 × 20 Qmechanic
apr 26 '15 at 5:32
13 mar 22 at 0:27
× 9281 × 7 Qmechanic
mar 23 '15 at 22:06
12 apr 5 at 2:15
× 314 × 3 Qmechanic
feb 5 '14 at 19:39
9 mar 2 at 16:02
× 389 × 5 Qmechanic
nov 27 '13 at 20:55
9 mar 17 at 13:06
× 1349 × 53 Qmechanic
aug 6 at 20:14
8 may 9 at 14:19
× 37 × 1 Qmechanic
nov 14 '14 at 11:18
8 nov 29 at 1:00
× 1318 × 8 Qmechanic
sep 18 '13 at 13:22
8 jan 25 at 11:03
× 1318 × 2 Qmechanic
sep 18 '13 at 13:24
8 dec 8 at 11:49
× 250 × 2 Qmechanic
may 17 '15 at 12:49
6 mar 18 at 6:13
× 1677 × 10 Qmechanic
jul 16 at 11:06
5 apr 18 at 0:34
× 22 × 9 Qmechanic
nov 7 '13 at 1:12
5 dec 24 at 21:58
× 441 × 7 Qmechanic
dec 30 '13 at 16:13
4 feb 15 at 23:46
× 508 × 4 Qmechanic
nov 6 '13 at 12:48
4 apr 18 at 22:20
× 193 × 1 Qmechanic
apr 12 '14 at 19:31
4 mar 24 '15 at 0:14
× 859 × 3 Qmechanic
sep 30 '14 at 18:43
3 may 27 '15 at 19:47
× 1318 × 4 Qmechanic
sep 18 '13 at 13:23
1 jul 23 at 14:12
× 273 × 7 Qmechanic
apr 13 '14 at 12:37
1 oct 2 at 17:51
× 1008 × 3 Qmechanic
mar 2 '15 at 22:59
0
× 89 × 5 Qmechanic
feb 13 '13 at 15:33
0


text:
# Is Changing a File Type and Name an Effective Security Solution?

Is renaming folders & files and changing file types an effective solution for file security of a PC?

I am an application programmer and have an extensive background in it. I have written a robust program that renames folders and files and also changes file types. It does not compromise the integrity of the file, although I have been able to do that as well and change it back.

I am just wondering, how secure this is. I know that if for example I change: test.jpeg to test.txt, if someone were to simply change it back, my security is compromised. I've obviously made it more complex than this, but is there a loophole? Is there a way to check PC logs for file changes or some other way a pro would decipher this. As I said, my program that 'encrypts' these files is very robust, I highly doubt anyone but myself would be able to understand / compromise it.

Some of the security vulnerabilities I do know about:

• A user could simply rename all of the files and thus have beaten the security

To solve this I would add a header line to files so that even if the file was renamed it could no be read by the program.

• For images a user could check the system thumbnails

To counter this I clear all temporary files upon encrypting files.

• PC backups that contain the non-encrypted file

Any other ways to crack this security?

A further note to this, this security solution was thought of after having CryptoVirus attack my server. Awfully impossible to reverse the changes that that virus made. I thought why not apply the same methodology to my file security.

Another note is that I am building upon Windows 7, with thoughts to expanding to other Windows platforms.

• You might be interested in magic numbers. – user10008 Dec 9 '14 at 14:12
• How is this even supposed to make anything more "secure" in the first place? If you're worried about people stealing your backups, why not just encrypt them? – Ajedi32 Dec 9 '14 at 15:02
• I can't fathom why you would do all this, rather than just simply encrypt the files with a well known encryption algorithm. – stackErr Dec 9 '14 at 16:52
• Check this DefCon video to see that no, it doesn't help. Basically, the inner filetype won't match the extension, so your file gets the first in the list of suspicious files. – Francisco Presencia Dec 9 '14 at 23:36
• There is an entire Def Con 21 talk done by forensic analysts describing cases of failed data-hiding. They even go over a case they did involving this exact method. youtube.com/watch?v=NG9Cg_vBKOg – cremefraiche Dec 10 '14 at 6:19

What you are doing is no kind of encryption, it is just obfuscation. It relies on security by obscurity. It may be enough to hide your files from an amateur/casual observer, but anyone analyzing the files in a hex editor is going to be able to rebuild and access them.

Effectively your method is about equal in complexity to attempting file undeletion, for which there are a host of tools available to anyone versed in digital forensics.

By contrast, the CryptoLocker malware you mentioned uses valid public-key cryptography, which is probably a method you should consider.

• +1 for Security by Obscurity and the explicit mention that this is not encryption – major-mann Dec 10 '14 at 11:02
• By the way, there's software that looks for abnormalities in file structure based on extension. Hiding a JPEG as an MP3 or vice versa would be easy to detect with one of these scanners. – Naftuli Kay Dec 10 '14 at 21:06
• Something, something, DANGERZONE! – k1DBLITZ Dec 11 '14 at 18:14

With most file formats it is not difficult to identify the original filetype without knowing the original extension. A JPEG file, for example, always begins with the HEX sequence FFD8FF. Seeing that sequence at the beginning of a file tells you that it is very likely a renamed JPEG image.

There are tools available which detect many common file formats automatically by looking for telltale signs like this. On Linux, the command line tool file can do this. Most Linux distributions provide it out-of-the-box.

You might want to ask on Linux and Unix Stackexchange about how to use this tool to fix the file extensions of a large number of files at once.

• I am on Windows, not Linux, so I'm not worried about there vulnerabilities. I should have noted that in the question. How would you encrypt something to hide these HEX sequences. These files are mostly Documents, Databases and Pictures. – Cody Brown Dec 9 '14 at 14:51
• @CodyBrown The file tool doesn't rely on anything Linux-specific. The same basic techniques work on any OS; Linux makes them less of a hassle to perform, but using it on Windows is as simple as copying over a magic number database. Image formats have standard magic numbers, as do old MS office document formats; the new formats are ZIP files (standard magic number) where it's clear what they are when they're extracted. – cpast Dec 9 '14 at 18:09
• @CodyBrown 1. Just because you are using Windows doesn't mean that your attacker does, 2. similar tools are also available on Windows, 3. removing all hints of the format from the file content would result in no program being able to open them anymore and 4. it isn't an effective data protection scheme anyway because it's just security through obscurity. Better encrypt your data with a strong encryption algorithm. – Philipp Dec 9 '14 at 18:33
• Unix having a tool to identify the file type based on it's contents rather than it's extension is not a VULNERABILITY... It's a fact of life. The contents of the file betray it's type. – aychedee Dec 9 '14 at 22:08
• IIRC Metasploit has a utility to change the header of a file to fool such utilities\ – Jesvin Jose Dec 10 '14 at 13:11

This is in no way shape form of fashion secure. It's akin to taking money from out of the mattress and placing it in the cookie jar. Let's illustrate what you said in five steps

hades$ls -ltha example.jpg -rw-r--r--@ 1 hades wheel 586K Dec 8 11:28 example.jpg hades$ md5 example.jpg
MD5 (example.jpg) = a7ecc5e48db6cbfd609b9c6c6ca9b21f

hades$mv example.jpg secret.txt hades$ md5 secret.txt
MD5 (secret.txt) = a7ecc5e48db6cbfd609b9c6c6ca9b21f

secret.txt: JPEG image data, JFIF standard 1.01

1. Show the file
2. Checksum the file for validation here
3. Move the file (rename)
4. Double check the checksum for comparison
5. Use the Unix file command to tell me what kind of file this is

If your goal is to protect your files, why focus on HUNDREDS perhaps THOUSANDS of files when you could focus on securing ONE system. The cost associated with running even a remotely close "security" application is lost time waiting for it to encrypt, and then decrypt.

• Good example thanks @munkeyoto . While I agree, protecting your PC and the connections it uses is a much better way of protecting files. Like I said in my comments this is a sort of skill building experience. I really am realizing that this method may protect these files from basic users any advanced IT users would be able to crack it no problem. It seems like the best idea is to use a public / secret key to encrypt the actual file hex. – Cody Brown Dec 9 '14 at 15:05

A youtube video from Defcon 21: http://youtu.be/NG9Cg_vBKOg?t=6m19s

The guy being investigated simply changed the extensions of the files (eg. from test.jpeg to test.txt). However when the crypto guys look at it their tool detects that the extensions don't match the files and these files are the first to be examined more closely by a human.

• First off that video was hilarious and informative. It's very interesting to know that by using this method as file security I may actually be doing the opposite in attracting a hacker to the file / sector. I would also really like to point out that I am not renaming naughty preggy video's. – Cody Brown Dec 9 '14 at 14:16


text:
# Create bookmarks into a PDF file via command line

I am searching for a command line tool to add bookmarks to a PDF file.

What I have is a page number and a label. Would love to create bookmark called label linking to page page number.

Does any one know a command line tool (preferably OSX) for doing this?

I have about 4000 pages PDF files and about 150 bookmarks and would love to automate it.

My plan is to use a system call within a r-script.

EDIT

I create about 4000 single PDF files with graphs and I am using the OSX system command /System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py to join the PDFs together. Previously I was using pdfjoin from pdfjam package, but this was way too slow. In the end, this is how I get my PDF where I add the bookmarks by hand with Adobe Acrobat Professional at the moment.

• I'm not sure if you have code to produce a PDF or only the PDF file itself. If the former, we'd need much more details. May 18, 2015 at 13:40
• Thanks @Roland, I added tome Information. May 18, 2015 at 13:45
• pdftk can update/insert bookmarks. Also, here's a potentially helpful thread on stats.SO May 18, 2015 at 13:49
• pdftk is only available for Windows, so it will not fit my needs. Thanks anyways May 18, 2015 at 14:34
• "pdftk is only available for Windows..." Not true! See my answer. It includes a link to directly download an OSX .pkg installer (from the original pdftk-vendor, not from some rubbish third party provider)... May 18, 2015 at 17:01

You can also use pdftk. It is also available for OS X.

I'm not going through all the details here and now, because it's been done elsewhere at great length already. Just briefly:

1. Create a sample PDF from your original files (without bookmarks).
3. Run one of these commands:

pdftk my.pdf dump_data output -
pdftk my.pdf dump_data output bookmarks+otherdata.txt

4. Study the format of the output.

5. Modify the output .txt file by adding all the entries you want.
6. Run PDFTK again:

pdftk my.pdf update_info bookmarks.txt output bookmarked.pdf

This is the Bookmark format I noticed after inspecting in Step 4 above.

BookmarkBegin
BookmarkTitle: -- Your Title 1 --
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
BookmarkTitle: -- Your Title 2 --
BookmarkLevel: 1
BookmarkPageNumber: 2
BookmarkBegin
BookmarkTitle: -- Your Title 3 --
...
...
and so on...

And replace the above.. in the appropriate place.

• Actually, I really like this solution, a very clear syntax and very easy to script... Thanks May 19, 2015 at 6:52
• @drmariod: Actually, I like this solution least of all the three :) May 19, 2015 at 8:07
• i like this solution the best and the easiest i can understand.. as i have pdftk already. Sep 9, 2016 at 5:10
• Use dump_data_utf8 and update_info_utf8 in order to properly display characters in scripts other than Latin (e. g. Japanese). Nov 27, 2021 at 11:16

Here is another answer. This one uses Ghostscript to process PDF-to-PDF and the pdfmark PostScript operator to insert the bookmarks.

This method involves two steps:

1. Create a text file (a PostScript file, really), with a limited set of pdfmark commands, one per line and bookmark you want to add.
2. Run Ghostscript command that processes your current PDF file alongside the text file.

# 1.

The content on the text file should look something like this:

[/Page 1   /View [/XYZ null null null] /Title (This is page 1)         /OUT pdfmark
[/Page 2   /View [/XYZ null null null] /Title (Dunno which page this is....) /OUT pdfmark
[/Page 3   /View [/XYZ null null null] /Title (Some other name)        /OUT pdfmark
[/Page 4   /View [/XYZ null null null] /Title (File 4)                 /OUT pdfmark
[/Page 5   /View [/XYZ null null null] /Title (File 5)                 /OUT pdfmark
[/Page 6   /View [/XYZ null null null] /Title (File 6)                 /OUT pdfmark
[/Page 7   /View [/XYZ null null null] /Title (File 7)                 /OUT pdfmark
% more lines for more pages to bookmark...
[/Page 13  /View [/XYZ null null null] /Title (File 13)                /OUT pdfmark
[/Page 14  /View [/XYZ null null null] /Title (Bookmark for page 14)   /OUT pdfmark
% more lines for more pages to bookmark...

Name this file for example: addmybookmarks.txt

# 2.

Now run this command:

gs -o bookmarked.pdf   \
-sDEVICE=pdfwrite   \
-f original.pdf

The resulting PDF, bookmarked.pdf now contains the bookmarks. See this screenshot:

Ok, here is a quick'n'dirty way to do three jobs at once:

1. Merge your 400 single-page PDFs.
3. Create a PDF bookmark for each page.

It involves using a LaTeX installation.

\documentclass[]{article}
\usepackage{pdfpages}
\usepackage{hyperref}
bookmarks=true,
pdfauthor={},
pdftitle={},
citecolor=blue,
urlcolor=blue,
pdfborder={0 0 0}}
\begin{document}

{
\setcounter{tocdepth}{3}
% Comment next line in or out if you want a ToC or not:
\tableofcontents
}

%% 1 line per included PDF!

\end{document}

Now just before the last line of this template, you insert one line per external PDF file you want to include.

1. In case you want to generate a ToC, it has to be formatted like this:

\includepdf[pages={<pagenumber>},addtotoc{<pagenumber>,<section>,<level>,\

2. In case you are sure that each and every included PDF is a 1-page document, it simplifies to this:

\includepdf[addtotoc{<pagenumber>,<section>,<level>,\

Here all of the following five parameters for addtotoc are required, in the order given for the files to appear in the bookmarks and in the ToC. See further below for a specific example:

• <pagenumber> : Number of the page of inserted document to be linked to. (In your case always "1", because you insert 1-page documents only; you could insert a 5-page document and link to page 3 of the inserted PDF, though).
• <section> : The LaTeX sectioning name. Could be section, subsection, subsubsection... In your case "section".
• <level> : The level of the LaTeX section. In your case "1".
• <heading> : This is a string. Used for the text of the bookmark
• <label> : This must be unique for each bookmark. Used in the PDF internally to jump to correct page when bookmark is clicked.

To test this quickly, I used Ghostscript to generate 20 1-page PDF documents:

for i in {1..20}; do
gs -o p${i}.pdf -sDEVICE=pdfwrite \ -c "/Helvetica findfont 30 scalefont setfont \ 100 600 moveto \ (Page${i}) show                         \
showpage";
done

With these test files I could make the lines to insert into the template look like these:

\includepdf[addtotoc={1,section,1,Page 1 (First),p1}]{p1.pdf}
[...]
[...]

Save the template with the inserted lines, then run the following command twice:

 pdflatex template.tex
pdflatex template.tex

The resulting file will have the bookmarks, looking like this in Preview.app:

Note: LaTeX is available for OSX via two methods:

I'll add one or two other methods to insert bookmarks on the command line too, later or in the next few days, if I have more time.

For now this one has to do, because I never showed it here on SO, AFAICR.

But I thought because you gave the background "I'm merging 1-page PDFs, and it is slow; now I want to add bookmarks too...", I could show how to do it with one single method.

HINT : One of the other methods will be to use pdftk which IS available for Mac OS X!

• I don't get the addtotoc command running... It says the command is not found, but it can find the pdfpages package... So I don't understand the problem here :-( May 19, 2015 at 6:53
• @dmariod: Without seeing your code I can't say what's wrong with it. Maybe s.th. very simple which the same eyes that stared on the line(s) while writing it can't recognize any more, but "third party" eyes easily can... Happened to me also, and not just once :) May 19, 2015 at 8:05

#!/usr/bin/python
from Foundation import  NSURL, NSString
import Quartz as Quartz
import sys

# You will need to change these filepaths to a local test pdf and an output file.
infile = "/path/to/file.pdf"
outfile = "/path/to/output.pdf"

def getOutline(page, label):
# Create Destination
myPage = myPDF.pageAtIndex_(page)
pageSize = myPage.boundsForBox_(Quartz.kCGPDFMediaBox)
x = 0
y = Quartz.CGRectGetMaxY(pageSize)
pagePoint = Quartz.CGPointMake(x,y)
myDestination = Quartz.PDFDestination.alloc().initWithPage_atPoint_(myPage, pagePoint)
myLabel = NSString.stringWithString_(label)
myOutline = Quartz.PDFOutline.alloc().init()
myOutline.setLabel_(myLabel)
myOutline.setDestination_(myDestination)
return myOutline

pdfURL = NSURL.fileURLWithPath_(infile)
myPDF = Quartz.PDFDocument.alloc().initWithURL_(pdfURL)
if myPDF:
# Here's where you list your page index (starts at 0) and label.
outline1 = getOutline(0, 'Page 1')
outline2 = getOutline(1, 'Page 2')
outline3 = getOutline(2, 'Page 3')

# Create a root Outline and add each outline. (Needs a loop.)
rootOutline = Quartz.PDFOutline.alloc().init()
rootOutline.insertChild_atIndex_(outline1, 0)
rootOutline.insertChild_atIndex_(outline2, 1)
rootOutline.insertChild_atIndex_(outline3, 2)
myPDF.setOutlineRoot_(rootOutline)
myPDF.writeToFile_(outfile)


text:
1. Mar 15, 2012

### xeon123

I'm trying to understand this problem.

If a lollipop costed $6 and now it costs$8, how much percent the price grow?

I think the answer is ((8-6)/8)*100=25%

So I'm trying to apply this solution to the new problem. If a lollipop costed $1, and now it costs$2, how much percent the price grow?
((2-1)/2)*100=50%, but it should be 100%.

Can anyone help me with this problems?

2. Mar 15, 2012

### Ray Vickson

I think you already know the answer: what must be in the denominator in order that your second example gives you 100%?

RGV

3. Mar 15, 2012

### xeon123

In the denominator should be 1. But in the first equation it should be 8. This is the part that I don't get it. I'm putting in the denominator the current price.

4. Mar 15, 2012

### Ray Vickson

I understand what you are doing. I don't understand *why* you are doing it differently in the two examples.

RGV

5. Mar 15, 2012

### Staff: Mentor

The denominator should have the price we're calculating the percent increase/decrease for.

For your two examples, the starting prices were $6 and$1, respectively, so those are the numbers you need to use in the denominator.

On the other hand, if the price of something goes down from from $10 to$8, then the percent decrease is (10 - 8)/10 * 100 = 20 %.


text:
# Incompatible solutions of differential equation

The solution of the differential equation $(\frac{dy}{dx})^2=(1-y^2)(1-k^2+k^2 y^2)$ for the initial condition $y(0)=1$ is $y(x)=cn(x, k^2)$ where $cn$ is Jacobi elliptic function. I found the general solution of this equation is $y(x)=\sqrt{1-\frac{1}{k^2 sn^2(x+c1, k^2)}}$ where c1 is the integration constant. But when I use the initial condition $y(0)=1$ in it, I can't get a valid value of integration constant c1.

$$(\frac{dy}{dx})^2=(1-y^2)(1-k^2+k^2 y^2)$$ The general solution is $y(x)=cn(x+c_1\:,\:k^2)$
with the initial condition $y(0)=1\quad\to\quad c_1=0$ $$y(x)=cn(x,k^2)$$ The relationship between $cn$ and $sn$ is : $cn^2(x,k^2)=1-sn^2(x,k^2)$ , thus : $$y(x)=\sqrt{1-sn^2(x+c_1\:,\:k^2)}$$ $y(x)=\sqrt{1-\frac{1}{k^2 sn^2(x+c1, k^2)}}$ is false.
Finally, with the initial condition : $$y(x)=\sqrt{1-sn^2(x,k^2)}$$ $sn(0,k^2)=0 \quad\to\quad y(0)=1$ .


text:
## anonymous one year ago A capacitor is charged to a potential difference of 12V. it delivers 40% of its stored energy to a lamp. what is the final potential difference across the capacitor???

1. anonymous

@Irishboy123

2. anonymous

@arindameducationusc

3. arindameducationusc

I think 12 is the charge....

4. arindameducationusc

U(Energy)=1/2*Q*V Q=charge V=potential difference (you have to find) U=40% of energy I think its this way but I am not sure, I am little weak in Electrostatics... but this should be the way....

5. IrishBoy123

$E_1 = \frac{1}{2} C V_1^2 \$ $E_2 = \frac{1}{2}C V_2^2 = 0.60 E_1$ $V_2^2 = 0.60 V_1 ^ 2$

6. anonymous

How the formula E=1/2CV^2 CAME actually...i had able to derive E=CV^2 but from where did the 1/2 came???would be very kind of you to clear me..

7. IrishBoy123

look here first https://gyazo.com/ae43ccf0b318175dcb80738cbd06ba63 any questions, post them here! basic relationship is $C = \frac{Q}{V}$ so however you derive the equation for energy, you can then manipulate it into other forms.....


text:
# Keelin (MetaLog) distribution

New to Analytica 5.0

## Keelin( values , percentiles, I, lb, ub, nTerms, flags, over)

The Keelin distribution, also known as the "MetaLog" distribution, is a remarkably flexible distribution capable of taking on the shape of almost all common continuous distributions. It fits a distribution to specified fractile «values» with specified probability «percentiles» and optional lower and upper bound, «lb» and «ub». For the common special case, when you have three fractiles with symmetric probabilities -- for example 10, 50, and 90th percentiles where 10 and 90 are symmetrical around 50 -- it is more convenient to use the UncertainLMH() function. The Keelin distribution is also a convenient way to fit a probability distribution to a random sample of data, without having to worry about what parametric form is best.

The Keelin distribution is among the most versatile of all distributions, with an ability to produce unbounded, semi-bounded and bounded distributions, including uniform, beta, normal, gamma, with nearly any theoretically possible combination of skewness and kurtosis. In this respect, it is even more flexible that the family of Pearson distributions. Tom Keelin introduced the distribution in:

You can specify a Keelin distribution in three ways:

• From a list of (value, percentile) pairs, where the «values» are sample values for the quantity and the «percentiles» are the percentile (aka quantile or fractile) probabilities between 0 and 1. Another way of saying this is that «values», «percentiles» are points on the cumulative probability curve.
• From a set of representative points (a data sample).
• From a coefficient vector. These coefficients are typically obtained from data «values», or from (value, percentile) pairs using the function KeelinCoefficients. The coefficient vector may be a must shorter description of the distribution than the original data. When passing coefficients, you must specify the «flags»=1 bit, and then «I» index indexes the basis terms rather than the data.

### Parameters

• «values»: This parameter may be either (1) a random sample of data points from a distribution, with «percentiles» omitted, (2) a collection of fractile or percentile values (corresponding to the probability levels in «percentiles»), or (3) a Keelin coefficient vector with the «flags»=1 bit set. In all cases, «values» must be indexed by «I».
• «percentiles»: (Optional): The percentile probabilities (also called quantile or fractile levels) for the values in «values», also indexed by «I». Each number must be between 0 and 1. For example, when a value in «percentiles» is 0.05, the corresponding value in «values» is the 5th percentile.
• «I»: (Optional): The index of «values» and «percentile». You can omit this index when either «values» or «percentile» is itself an index.
• «lb», «ub»: (Optional) Upper and lower bound. Set one or both of these to a single number if you know in advance that your quantity is bounded. When neither is specified, the distribution is unbounded -- i.e., with tails going to -INF and INF. When one is set the distribution is semi-bounded, and when both are set it is fully bounded.
• «nTerms»: (Optional) The number of basis terms used for the fit. This should be 2 or greater. See #Number of terms below.
• «flags»: (Optional) A bit-field, where any of the following flags can be added together.
1: «values» contains coefficients (as obtained from the KeelinCoefficients function). When not set, «values» contains sample values.
8: Do not issue a warning when the Keelin distribution is infeasible. (See Infeasibility below). It does not test feasibility when «values» are Keelin coefficients -- i.e., when «flags»=1.
16: Return a sample even when infeasible. When this bit is not set, Null is returned if infeasible. When this is set, a mid-value or sample is returned anyway.
32: Disable tail constraints. By default, the Keelin function uses tail constraints to reduce the frequency of infeasible, an improvement to the algorithm published in the original Keelin paper. You can disable these to reproduce the original Keelin algorithm. See Infeasibility for details.
• «over»: (Optional) A list of indexes to sample independently across.

See also the analytic functions for the Keelin distribution (see Analytic distribution functions below):

CumKeelinInv( p, values, percentiles, I, lb, ub, nTerms, flags)
CumKeelin( x, values, percentiles, I, lb, ub, nTerms, flags)
DensKeelin( x,p, values, percentiles, I, lb, ub, nTerms, flags)

## Examples

### Fit to data

Suppose you've collected data on the weights of fish caught last year in the Columbia river, and now you want to fit a distribution to these measurements. Since you know that a fish's weight cannot be negative, you'll use a semi-bounded distribution. Suppose the data is in a variable named Fish_weight which in indexed by Fish_ID. Use

Keelin( Fish_weight, I:Fish_ID, lb: 0)

### Using fractiles

You find a published table stating the 500-year, 100-year, 10-year and median rain fall levels for a town of interest (where the 500-year level is a level so big that it is experienced only once every 500 years).

Index Fractile := [ 1/2, 1/10, 1/100, 1/500 ]
Variable Rainfall_level := Table(Fractile)(5, 12, 25, 60)
Chance Rainfall := Keelin( Rainfall_level, Fractile, lb:0 )

The resulting CDF is plotted here on a log-X scale:

## Infeasibility

Some combinations of «values», «percentiles» and «nTerms» are considered to be infeasible. These are situations in which the Keelin algorithm cannot find a sensible distribution function that fits the data. See Keelin (2016) for mathematical details.

Infeasible data usually has sharp changes in slope or inconsistencies in monotonicity. If you plot your data as «values» vs. «percentiles» (or as «values» verses the rank of the data point when «percentiles» is omitted, the points should ideally be arranged in a monotonically increasing order. When there are many exceptions to this, then your percentile estimates are nonsense, which will often cause infeasibility. When data points "clump", this can result in rapid changes to the inferred slope of this graph, and can also contribute to infeasibility. Both these effects are generally lessened by decreasing «nTerms». When «nTerms» is much less than the number of data points, the fitting algorithm is better able to adapt to random fluctuations. The effect is to bias the fit away from distributions with too much variation.

By default, when it fits a Keelin distribution to the data, it tests whether the fit is feasible. This test is not performed when coefficients are passed in, but the test for feasibility will have been performed by KeelinCoefficients when that function fit the data. The test for feasibility can be skipped by setting the «flags»=8 bit. If the fit is found to be infeasible, a warning is issued (unless you have warnings suppressed) and the function returns Null. If either of the «flags»=8 or «flags»=16 bits is set, then it returns a sample even when infeasible. In theory, a sample from an infeasible fit is not guaranteed to match the data, but in practice it still tends to be pretty good. However, the results from the analytic functions such as CumKeelinInv, CumKeelin and DensKeelin don't make sense (specifically, CumKeelinInv is not monotonically increasing, and DensKeelin has negative values).

The algorithm used by Analytica includes an enhancement that expands the number of feasible cases compared to the original algorithm in Keelin (2016) . During the data fit, it adds the constraints that the left tail of the distribution should go left and the right tail should go right. For any valid distribution this obvious condition must hold. The condition does not guarantee it will find a feasible fit, but by enforcing this constraint the algorithm is able to locate many feasible solutions that it otherwise would not be able to find. This extension can be disabled by setting the «flags»=32 bit. The only reason we can think of for why you might want to disable it would be if you needed to reproduce the exact behavior of the original Keelin algorithm, perhaps if you are comparing results from a different implementation. But feasible solutions for the original Keelin algorithm are unaffected by tail constraints, so it would only be relevant if you needed to reproduce a nonsense case.

## Number of terms

The optional «nTerms» parameter varies the number of basis terms used for the fit. A larger number of terms results in a more detailed fit, but may also overfit when the data has randomness. Varying «nTerms» may also impact whether the data is or is not infeasible.

With 2 terms, the smallest that should be considered, the distribution is limited to a Logistic distribution (or Log-Logistic or Logit-Logistic when «lb» or «ub» are set), which gives it enough flexibility to match mean and standard deviation, but not skewness or kurtosis. With 3 terms skewness can be adjusted, but not kurtosis. With 4 terms, the median, variance, skewness and kurtosis can all be adjusted. In most cases, increasing «nTerms» enables it to fit your target distribution more closely.

You may find it useful to create a panel of fit distributions by varying «nTerms», making it possible to see what detail is revealed by the addition of terms, and also where the addition of more terms doesn't add useful detail. In many cases I've observed that there is an improved "fit" up to a point, followed by a plateau with very little change as «nTerms» increases, eventually followed by obvious over-fitting where it starts capturing the random spacing of samples. Often the plateau lasts for a long time. In these cases, it would make sense to set «nTerms» to a value on the plateau.

To create a "panel", first create an index: Index NumTerms := 2..50

Then use your data (say x indexed by I) to explore these: Variable fit_x :=  Keelin( x, ,I, nTerms:NumTerms)

In the following experiment, a data set with 100 measurements (not from any know distribution) was fit. A histogram of the data itself is shown here:

Here are four "fit" Keelin distributions as «nTerms» was varies from 2 to 20:

At 10 terms, a bi-modal effect starts to appear, which may actually be there in the data, and which is not visible below 10 terms, However, at 20 terms there appears to be more variation than is probably warranted, which we might interpret as the onset of overfitting.

## Analytic distribution functions

The Keelin function is a distribution function, meaning that it returns the median when evaluated in Mid-mode, a sample for Monte Carlo analysis when evaluated in Sample-mode, or a random variate when it is used in Random(). There are also analytic distribution functions for Keelin described in this section. The analytic distribution functions compute the exact value for a given Keelin without sampling error. These use the same parameters as Keelin( ), but also include a point of percentile where the analytic function is to be evaluated at, and this parameter comes first. It is common to pass an array of values in for the point or percentile parameter.

### CumKeelinInv( p, values, percentiles, I, lb, ub, nTerms, flags)

The inverse cumulative distribution function, also called the quantile function. Given a percentile (quantile) level «p», returns the value x such that there is a «p» probability that the actual value (or a value sampled at random from the distribution) is less than or equal to x.

Given a data set xi indexed by I, the 10-25-50-75-90 percentiles are obtained using:

Index percent=[10%, 25%, 50%, 75%, 90%] Do CumKeelinInv( percent, xi, , I)

Passing a Uniform(0,1) for «p» is equivalent to the Keelin distribution function:

CumKeelinInv( Uniform(0,1), xi )

### CumKeelin( x, values, percentiles, I, lb, ub, nTerms, flags)

The cumulative distribution function. For a given value «x», returns the probability that the true value (or a value sampled at random from the distribution) is less than or equal to «x».

Index quatile := [10%, 25%, 50%, 75%, 90%]
Index estimate := Table(quantile)( 20, 40, 70, 100, 130 )

This returns the probability that the quantity is less than 50:

CumKeelin( 50, estimate, quantile, quantile) → 0.33

### DensKeelin( x,p, values, percentiles, I, lb, ub, nTerms, flags)

The probability density function. Either «x» or «p», but not both, must be specified. When «x» is specified, returns the probability density at «x». When «p» is specified, returns the probability density at the «p»th quantile.

Using quantile and estimate shown in the example for CumKeelin above,

DensKeelin( 50, values:estimate, percentiles:quantile, I:quantile ) → 8.16m
DensKeelin( p:33%, values:estimate, percentiles:quantile, I:quantile ) → 8.16m

A good way to graph the probability density function is to create an X-Y plot of DensKeelin versus CumKeelinInv. This is illustrated here, again using the quantile and estimate example from above.

Index p := Sequence(0.1%, 99.9%, 0.1%);
Index K := 1..5;
Local a := KeelinCoefficients( estimate, quantile, quantile, K );
Local x := CumKeelinInv( p, a, I:K, flags:1 );
Local density := DensKeelin( p:p, values:a, I:K, flags:1 );
Index AxisLabel := ['X', 'Probability Density'];
Array( AxisLabel, [x,density] )

You need to plot this as an X-Y chart by pressing the [XY] button in the result window and enabling Use a comparison index. The comparison index here will be .AxisLabel.

In the graph, an efficiency is obtained by calling KeelinCoefficients so that the data fit is performed only once, so that it doesn't have to be repeated in both successive calls to CumKeelinInv and DensKeelin. It evaluates both at 999 points (the number of points in p. Zero and 1 are not included in p since these would be -Inf and Inf in a distribution with tails like this. A nice thing about this approach is that it is easy to vary over the full range of p without having to know the actual range of the quantity itself.