Serving the Quantitative Finance Community

 
User avatar
Amin
Topic Author
Posts: 1838
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

June 27th, 2022, 2:33 pm

Some notations and preliminaries first.

Let us suppose we denote a standard gaussian density as    [$]p(X) \, = \, \frac{1}{2 \pi} \exp(- \, \frac{ X^2 }{2})[$]

We also have hermite polynomials and first few hermite polynomials are denoted as
[$]H_0(X) \, = \, 1[$]
[$]H_1(X) \, = \, X[$]
[$]H_2(X) \, = \, X^2 \, - 1[$]
[$]H_3(X) \, = \, X^3 \, - 3 X[$]
[$]H_4(X) \, = \, X^4 \, - 6 X^2 \, +3[$]
and so on.
And I want to share an interesting property related to following integral
[$]\int_{-\infty}^{+\infty}  X^m \, H_n(X) \, p(X) dx [$]   Equation(A)
We know when m is odd and n is even or m is even and n is odd, the above integral always goes to zero.
But when m is odd and n is also odd, the above integral would always go to zero when  n > m.
Similarly when m is even and n is also even, the above integral would again always go to zero, when n > m.
To explain it in words with simple examples, when fourth power of X is integrated in the above integral (eq A) with zeroth hermite, 2nd hermite or fourth hermite, there will be a finite value but when fourth power of X is integrated with sixth hermite, eighth hermite or tenth hermite, it will always go to zero. Similarly for odd powers, when fifth power of X is integrated there is a finite value when we integrate it with first hermite, third hermite or fifth hermite in the equation (A), but when we integrate fifth power of X with seventh, ninth or 11th hermite or higher odd hermites, the value would always go to zero.
The above property is interesting since in our forthcoming framework when we have fixed some moment in our equation, adding higher hermites(for higher moments) would not change the lower moments at all.

Now we want to fix first few moments to our  proposed probability distribution so that all the moments are perfectly matched (a good property as I mentioned earlier would be that adding further higher moments would not change our lower moments that have already been matched).

The proposed probability distribution has a very simple form (upto sixth order) as

[$] q(X) \, = \, p(X) \, \big[ \, 1 \, + \, h_1 \, H_1(X)+ \, h_2/2 \, H_2(X)+ \, h_3/6 \, H_3(X)+ \, h_4/24 \, H_4(X)+ \, h_5/120 \, H_5(X)+ \, h_6/720 \, H_6(X) \, \big]  \, [$]

here [$]h_1[$] , [$]h_2[$] etc are coefficients of hermites that will be adjusted to match the moments of above probability density form to our desired moments. 
1st thing we know by inspection that above probability density equation integrates to one since all hermites (other than the first term) have an expected value of zero when integrated over normal density.
Now we write the first few raw moments of the above equation that can be verified by full-fledged integration(as I have done in my notes)

[$]E[X]\,= \int_{-\infty}^{+\infty}  X \, q(X) dX \, = \, h_1[$]
[$]E[X^2]\,= \int_{-\infty}^{+\infty}  X^2 \, q(X) dX \, = \,1 \, + \, h_2[$]
[$]E[X^3]\,= \int_{-\infty}^{+\infty}  X^3 \, q(X) dX \, = \,3  \, h_1 \, + \, h_3[$]
[$]E[X^4]\,= \int_{-\infty}^{+\infty}  X^4 \, q(X) dX \, = \, 3 \, +\,6 \, h_2 \, + \, h_4[$]
[$]E[X^5]\,= \int_{-\infty}^{+\infty}  X^5 \, q(X) dX \, = \, 15 \, +\,10 \, h_3 \, + \, h_5[$]
[$]E[X^6]\,= \int_{-\infty}^{+\infty}  X^6 \, q(X) dX \, = \, 15 \, +\,45 \, h_2 \, + \,15 \,  h_4 \, + h_6[$]

So we see that we can keep on adding more hermite polynomials to fix higher moments and it will not alter our lower moments. However higher odd/even moments take a contribution from hermite polynomial terms associated with lower odd/even moments(that have already been fixed) up to the order of moment being calculated.
It seems a better idea to try matching moments on standard gaussian as opposed to non-standard gaussian as we do when we match moments with gram-charlier or edgeworth.
Please pardon any errors.
.
.

sorry friends, one minor error, the equation for fifth raw moment should be
[$]E[X^5]\,= \int_{-\infty}^{+\infty}  X^5 \, q(X) dX \, = \, 15 \,h_1 \, +\,10 \, h_3 \, + \, h_5[$]

I have written it slightly wrong in previous post.
You think life is a secret, Life is only love of flying, It has seen many ups and downs, But it likes travel more than the destination. Allama Iqbal
 
User avatar
Amin
Topic Author
Posts: 1838
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

June 27th, 2022, 3:43 pm

Some notations and preliminaries first.

Let us suppose we denote a standard gaussian density as    [$]p(X) \, = \, \frac{1}{2 \pi} \exp(- \, \frac{ X^2 }{2})[$]

We also have hermite polynomials and first few hermite polynomials are denoted as
[$]H_0(X) \, = \, 1[$]
[$]H_1(X) \, = \, X[$]
[$]H_2(X) \, = \, X^2 \, - 1[$]
[$]H_3(X) \, = \, X^3 \, - 3 X[$]
[$]H_4(X) \, = \, X^4 \, - 6 X^2 \, +3[$]
and so on.
And I want to share an interesting property related to following integral
[$]\int_{-\infty}^{+\infty}  X^m \, H_n(X) \, p(X) dx [$]   Equation(A)
We know when m is odd and n is even or m is even and n is odd, the above integral always goes to zero.
But when m is odd and n is also odd, the above integral would always go to zero when  n > m.
Similarly when m is even and n is also even, the above integral would again always go to zero, when n > m.
To explain it in words with simple examples, when fourth power of X is integrated in the above integral (eq A) with zeroth hermite, 2nd hermite or fourth hermite, there will be a finite value but when fourth power of X is integrated with sixth hermite, eighth hermite or tenth hermite, it will always go to zero. Similarly for odd powers, when fifth power of X is integrated there is a finite value when we integrate it with first hermite, third hermite or fifth hermite in the equation (A), but when we integrate fifth power of X with seventh, ninth or 11th hermite or higher odd hermites, the value would always go to zero.
The above property is interesting since in our forthcoming framework when we have fixed some moment in our equation, adding higher hermites(for higher moments) would not change the lower moments at all.

Now we want to fix first few moments to our  proposed probability distribution so that all the moments are perfectly matched (a good property as I mentioned earlier would be that adding further higher moments would not change our lower moments that have already been matched).

The proposed probability distribution has a very simple form (upto sixth order) as

[$] q(X) \, = \, p(X) \, \big[ \, 1 \, + \, h_1 \, H_1(X)+ \, h_2/2 \, H_2(X)+ \, h_3/6 \, H_3(X)+ \, h_4/24 \, H_4(X)+ \, h_5/120 \, H_5(X)+ \, h_6/720 \, H_6(X) \, \big]  \, [$]

here [$]h_1[$] , [$]h_2[$] etc are coefficients of hermites that will be adjusted to match the moments of above probability density form to our desired moments. 
1st thing we know by inspection that above probability density equation integrates to one since all hermites (other than the first term) have an expected value of zero when integrated over normal density.
Now we write the first few raw moments of the above equation that can be verified by full-fledged integration(as I have done in my notes)

[$]E[X]\,= \int_{-\infty}^{+\infty}  X \, q(X) dX \, = \, h_1[$]
[$]E[X^2]\,= \int_{-\infty}^{+\infty}  X^2 \, q(X) dX \, = \,1 \, + \, h_2[$]
[$]E[X^3]\,= \int_{-\infty}^{+\infty}  X^3 \, q(X) dX \, = \,3  \, h_1 \, + \, h_3[$]
[$]E[X^4]\,= \int_{-\infty}^{+\infty}  X^4 \, q(X) dX \, = \, 3 \, +\,6 \, h_2 \, + \, h_4[$]
[$]E[X^5]\,= \int_{-\infty}^{+\infty}  X^5 \, q(X) dX \, = \, 15 \, +\,10 \, h_3 \, + \, h_5[$]
[$]E[X^6]\,= \int_{-\infty}^{+\infty}  X^6 \, q(X) dX \, = \, 15 \, +\,45 \, h_2 \, + \,15 \,  h_4 \, + h_6[$]

So we see that we can keep on adding more hermite polynomials to fix higher moments and it will not alter our lower moments. However higher odd/even moments take a contribution from hermite polynomial terms associated with lower odd/even moments(that have already been fixed) up to the order of moment being calculated.
It seems a better idea to try matching moments on standard gaussian as opposed to non-standard gaussian as we do when we match moments with gram-charlier or edgeworth.
Please pardon any errors.
.
.

sorry friends, one minor error, the equation for fifth raw moment should be
[$]E[X^5]\,= \int_{-\infty}^{+\infty}  X^5 \, q(X) dX \, = \, 15 \,h_1 \, +\,10 \, h_3 \, + \, h_5[$]

I have written it slightly wrong in previous post.
.
.
Friends, I struck upon the above material when trying to find a simple algorithm that can construct Z-series of any random variable when its first few moments are given. 
In reality, for example if moments are too large, it seems like stretching a normal density way too far that might possibly not remain numerically accurate if hermites become too huge and they have to be integrated on a grid. But might be an interesting starting point for experts. There could be many variations on the theme for example, you could specify mean and variance of the normal in base normal density formula, and then use the above equation with hermite polynomials associated with that variance(that has been assigned to base normal density at start) instead of hermites associated with standard normal.
You think life is a secret, Life is only love of flying, It has seen many ups and downs, But it likes travel more than the destination. Allama Iqbal
 
User avatar
Amin
Topic Author
Posts: 1838
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

June 28th, 2022, 9:37 am

Friends, I think I have been able to find a reasonably simple way to find Z-series of a stochastic variable when all its first few moments/cumulants are given. I still have to implement everything on computer and verify it but I have settled the ideas and all analytic steps for this solution. I hope to come back in 3-4 days with a detailed post and a matlab program so when friends specify the moments of the stochastic variable, the program will automatically return all the coefficients of the powers of Z-series. The program is not based on optimization like before and is based on analytics this time. I will keep friends updated about the progress of work on this thread.
You think life is a secret, Life is only love of flying, It has seen many ups and downs, But it likes travel more than the destination. Allama Iqbal
 
User avatar
Amin
Topic Author
Posts: 1838
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

June 28th, 2022, 5:53 pm

Friends my persecution by mind control agencies continues relentlessly. I had been sleeping in the porch/garage for past three months. Now they have started to inject me with mind control drugs when I am sleeping in the garage as the garage/porch is in the pathway and (there are no walls with a door that I can close at night to restrict people from coming closer when I am sleeping) anybody can come very close. Here is the whole story: I was getting half an injection of fluanxol depot after every 15 days earlier. But practically I would get the injection after every 17 days or so since I would beg my mother to delay the injections for extra two or three days. Last time, I talked to psychiatrist, I was able to convince him that periodn of antipsychotic injection has to be increased to 21 days. I told him that for first 7-9 days after the injection, I slept a lot and I had body aches and now I had become so physically weak that I was unable to lift anything heavy or do any physical exertion. Doctor agreed. At this point I want to tell friends that I am on antipsychotics for most of the time during past twenty three years after I left united states as a masters student. Even though half injection of fluanxol might not feel very high to some friends, I am already 49 and it is very difficult for my body to stand antipsychotics now. Though the dose might not seem very high, over past twenty three years, I have been given extremely high doses of antipsychotics for very long time continuously. For example one doctor gave me two injections of fluanxol per week for more than nine months. I was kept on a combo of many antipsychotic drugs of very high potency for a very long time in order to permanently strip me of my intellectual activity. Coming back to topic, I was to be given half an antipsychotic injection after every 21 days. When I was getting half an injection after 17 days, I would sleep till late in the morning for first 7-9 days and then start getting up early and go for my morning walk for rest of the 8-10 days. I would also have good ideas about mathematics and my intellectual activity would be far better during last 8-10 days. So last time (just about three weeks ago) doctor agreed that I should be given antipsychotic injection after 21 days. After a week of the injection, I started my morning walk and continued it for several days but then I believe, mind control agencies injected me while I was sleeping in the open porch/garage and I have not been able to go for morning walk a single day after that. My intellectual activity recovered only 3-4 days ago. During this period, I became very lethargic and I would sleep at night and then sleep before noon and then sometimes again in the evening. 
American mind control agencies want to keep me sedated  so that I could not do any intellectual activity.
It is worse for my body than for my intellectual activity since I become very lethargic, and I have body aches all over and sometimes it is difficult to even pass time. I am 49 years old now and my weight is around 104 kg and I am around 30 kgs over weight. I am thankful that I am still not diabetic. When one is healthy, even just living is a great joy.
So I decided to start sleeping inside my room again to avoid being injected again at night when I would be sleeping.
Yesterday was my first day inside my room after a long time and it was better but they started giving me gas again today and I had difficulty breathing in my room.
I want to tell friends that clean fresh air and good water are some of the greatest gifts of nature that we take so thoughtlessly for granted. If these two things are stripped from us, we would be willing to give anything to get them back.
I want to request friends to please ask mind control and other secret agencies to stop releasing gas in my room.
I want to request American army to stop using cruel mind control on innocent people in order to get personal benefits from rich and wealthy.
You think life is a secret, Life is only love of flying, It has seen many ups and downs, But it likes travel more than the destination. Allama Iqbal
 
User avatar
Amin
Topic Author
Posts: 1838
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

June 30th, 2022, 9:03 am

Friends, I will recall an incident eight years ago when I myself approached a lady psychiatrist for help and how she abused me and her staff beat me for twenty minutes and then tied me and started my treatment with antipsychotics again. 
I am recalling this from early 2015. They had previously put me on extremely high antipsychotics and my creativity was all gone. I could barely do any intellectual work. At that time, I was able to convince my family to decrease the injections and they had agreed since I had already lost most of my creativity and intellectual capability. I think mind control agencies were also thinking that I had lost my creativity forever and they wanted to see if it was right time to decrease my drugs and still make sure that I would remain intellectually dull after injections had ended.
But I slowly started to work on my research and started to regain my brain. When mind control agencies realized that I had started to do better research, they asked my family to do something again to retard me. My father asked a self-stylized religious saint to come to our house and take care of me. He came to our house with one of his followers and told me that he wanted to give me injections and I would go to sleep for 24 hours and they would take scans of my brain to treat me but I continued to beg and plead him and I was able to convince him to allow me to leave the home in my car. The supposed saint allowed me to leave since he was probably sure that he would get me later as I had no other place to go other than my home and therefore I was able to convince him to let me go outside. When I left the house, I made posts about the saint on at least two different forums from outside my house and pleaded for help. Enough people were following my story even at that time and the saint had to leave. I also called my father when I was outside and protested against this.
My family still remained very tense with me and I was very afraid that they would force antipsychotics injections and mind control drugs on me therefore I stayed one night out of the home. Here is the post I made when I was away on April 14th, 2015, 2:09 pm
https://forum.wilmott.com/viewtopic.php?f=15&t=94796&start=315#p748191
"I am staying out of my home for the night since I had realized that my father will try to force me into detention again and I would request a court tomorrow for stay order to stop my father from hospitalizing me forcefully again and I would request the court that if there has to be a check on my mental health, it has to be done and investigated properly by a psychiatrist of my choice and I should remain free at the same time. I do not want to be at the mercy of my father's chosen psychiatrist as we saw in the past year that they continued to quote mental health laws and forcefully manipulate me into taking injections. If my father forcefully hospitalized me, I would be cutoff from the outer world and they would do whatever they like. My father's self-stylized saint(peer) had already hinted that he wanted to give me injections that would put me to sleep for 24 hours and he had no argument for my mental sickness at all.”

Next day, on April 15, 2015, I went to Lahore High Court to find some help but I was told that I had to submit an application that would be considered several weeks later when its turn would arrive. When I realized that there was no possibility of help from the court, I decided to see a psychiatrist on my own. I was driving in Garden town Lahore where I came across B**** psychiatric clinic and decided to see the psychiatrist Dr. N*** there. It was evening but the psychiatrist still not had arrived there. I waited for an hour in the reception and then had a consultation with her. I asked her to listen to my case carefully and then decide if I was sane enough and tell my parents about it. She said that I seemed perfectly fine and asked me that she wanted to hear what my family had to say. I agreed and took an appointment to visit her again at April 20, 2015. I took my mother on the planned day and my mother did not have anything decisive to say about any disease other than that I did not eat at home. The psychiatrist asked me to visit her after one week on 27 April 2015. The next week when I went again to visit the psychiatrist, on April 27, and was sitting in the waiting room so that I could visit the psychiatrist on my turn. Another lady who was a psychologist came to me and asked me to go with her in a different room to have a session with psychologist but I declined and said that I was only interested in seeing the psychiatrist who had promised to see me again the earlier week. After five minutes, at least four men came to the room and started besting me. They gave me slaps on my face with full force and gave me blows and they continued to do it for more than fifteen minutes. I had never been beaten like that ever before in my life. All this time, I was simply trying to raise my hand to somehow protect me. Since I was sitting on the sofa, only my face and head were the target of slaps and blows. They were very violent with all sort of slaps and blows on my face as I earlier mentioned that I was sitting and they were standing. . They literally continued to beat me and I continued to beg them to stop. After fifteen minutes of beating me, they tied my legs and lifted me and put me on a bed in a room in the psychiatrist facility and told me that doctor had gone to America and she could not see me. It was a complete lie and the psychiatrist was in her office and was interviewing other patients when I arrived. I continued to ask them to loosen the knots but they continued to make fun of me. I was totally surprised since Dr. N had behaved very nicely in the previous meeting held at 20th with my mother and myself and I was sure she would declare me mentally sane on this meeting. After I was kept tied for about half an hour, a new guard came and opened my hands and legs and said that they would keep me at the facility for three days. The next day my medication in the form of pills started and I was also given two more injections. I was given about nine pills at night and about eight pills in the morning. I was still not given the opportunity to meet the psychiatrist N, and I was told several different things by different people including that psychiatrist N had gone to America, and she had gone to Islamabad. About three days into my treatment, I saw through the glass walls that psychiatrist N was interviewing her clients in her office. After seven days, I was asked to meet psychiatrist N, and she said that she was unaware of the beating as she was in a meeting. Psychiatrist N also assured me that I had no schizophrenia and previous doctors had very wrongly diagnosed me but it was a case of some mania that she would properly treat this time.  Her staff continued to say that they were giving me drugs so that the effect of other drugs given to me by previous psychiatrists would decrease.

Before my computer was taken away from me, I was able to take notes for two days in the hospital on my computer that I write here. After first two days of medication, I was so extremely weak that I could barely walk and I had extreme difficulty speaking.

“My Diary for past two days.

4/27/2015
I had two sessions with the doctor N previously on the 20th of April and once before at 13 or 14th of April. I remained away from home during this time and second meeting on 20th of April, evening after the night when I remained away from home. I had told the doctor about my circumstances in the first meeting with her. She had said that I looked perfectly fine mentally but she needed to talk to my family. On 20th of April, I took my mother for a second joint session of myself and my and the psychiatrist said, after the meeting, that said she really could not call me schizophrenic but she needed one more sessions and asked me to come to her facility on 27th of April. 
When I arrived at the psychiatric facility, a psychologist had asked me to accompany her which I did and on the way to the her room, I asked for the reason, after which she replied that she wanted to take a session of mine. I told her that I already had a session with another psyc hologist and also with a psychiatrist so I would prefer to have a new session with the psychiatrist now. She agreed and I returned to the waiting room. I was sitting on a sofa in the waiting room on 27th at 8:00 PM (PST) in the line to see the psychiatrist when about five guards took control of me, while I was sitting on a sofa in the waiting room to see the doctor, and gave me an injection. I was beaten and my legs and hands were very strictly tied for more than hour. Though the doctor was in her consultation room and a lot of people were waiting to see her, I was told again and again that doctor was not present at the facility.
In the previous two sessions, she had given the impression I was healthy mentally but she used force without interviewing for the third time or seeing me and without requests to comply. If she was given any special information, she should have talked to me about it and she should have verified with me any change in circumstances.
One injection was given around 8 PM when I arrived for third session with the doctor N. I really think that the doctor was there since there was a large rush of visitors and her SUV was parked in the hospital but everybody among the staff continued to say that doctor did not come to the facility this evening.
I was kept tied for more than one hour. I was taken tied from the waiting room to my room. All these rooms have video cameras so you can ask Dr. N for a video of the events though she might make the excuse that cameras were not working. One of the staff had mentioned when they brought me into a patient room in the facility, that everything was watched by cameras.I would request people familiar with the matter to request her to show them footage of the cameras. Of course, there could be many excuses that cameras were not working but I insist that cameras were working.
Good Mental health facilities try to avoid treating humans like this.
Another injection was given at night before I slept. 
and my internet USB device was also taken. They simply took possession of everything out of my pockets and also took my laptop.
When I asked why they gave me injections, one of the staff told me you were ?hyper? and I was totally surprised since I was quietly sitting on the sofa in the waiting lounge for the doctor. I was told that I would stay in the hospital for three days. I am sure this matter can be resolved who is lying and who is truthful once you look apt video footage of cameras in most rooms.

4/28/2015
One injection was given in the morning. One injection was given around noon. All injections were IM (given in the muscle.)
Unknown pills(some pills in the morning +5 pills around noon + 3 pills at night) were given and I was told,? We will tell you know the names of these pills only when you leave.?
Computer was returned today but I was told that we did not take your mobile and they continued to say we never took my mobile. My mobile was never returned( despite I always keep my mobile on me.) 
I was also not given my EVO USB device and I was told you cannot write anything on internet. However the USB device was returned to my mother at night.
I was told today by the psychologist that doctor N had gone to America and will come back after seven days and only then she would be able to see you. I was told we are adjusting your medicine and see what was a good medicine. I was told they were discussing the drugs with her on phone and skype There were several conflicting statements about where Dr. N was. Somebody said she was just out of city and had gone to Islamabad.
When I asked my mother who is living with me at the hospital, I wanted a second opinion, because of beating and other irresponsible behavior of the psychiatrist, my mother would make all sort of excuses while the staff would say that you cannot leave the hospital until Dr. N arrives who is currently out of country.
Earlier today, I was told that I would live at the hospital for fifteen days and later I was told that I would live at the facility for seven days. When I was tied, somebody had told me that I would live in the hospital for three days only.
My mother told me please do not write anything wrong on internet otherwise, they would take your USB forcefully like Dr. A had done more than one year ago. The purpose was to threaten me to not write about any maltreatment so that the doctor would continue to freely manipulate me.
7-8 pills were given in the afternoon and similar number of pills were given at night. At many times during the day, I could barely walk and had extreme difficulty speaking.”
You think life is a secret, Life is only love of flying, It has seen many ups and downs, But it likes travel more than the destination. Allama Iqbal
 
User avatar
Amin
Topic Author
Posts: 1838
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

June 30th, 2022, 11:54 am

In this post I want to tell friends about a few things that point to elaborate infrastructure that is present in Pakistan to support US mind control. There are at least more than 500 mind control targets in Pakistan most of whom (at least 95%) are computer science majors. 
What you find out about Pakistan, you can extrapolate it to varying degrees to US and many other countries in the world.
Mind control in Pakistan is ensured by top Pakistani army generals since they are given several hundred million dollars by US army and top brass of Pakistan army divides this money among themselves with bigger fish getting larger share and smaller fish getting a smaller share. Therefore mind control infrastructure in Pakistan is very detailed and thorough.
At this point I like to tell friends that a lot of food and beverages that are drugged with mind control chemicals would be eaten or taken by most population that is not on mind control and they would never notice any anomaly in taste or any other effect since these mind control chemicals are inactive and inert and become chemically active only when targeted remotely with precise electromagnetic wave frequencies so only target victims are affected and this is a very cruel method to target intelligent people you do not like by drugging the entire water or beverage supply as victim would have to drink something somewhere. Ground water is also so thoroughly drugged with mind control chemicals that entire public water supply of the city and several kilometers out of the city would be completely drugged with mind control chemicals. Pakistan army routinely does this in Lahore city on behest of American mind control agencies.
Water and beverages are drugged with mind control chemicals by most manufacturers when they make their product. Drugged bottled water was a very huge problem for at least more than ten years. However for past one year coca-cola Dasani and Nestle water have been good even though they are drugged by army personnel by going to the shops in entire market and physically drugging each bottle on the shelves before the store staff. Store staff is used to this practice and cooperates and any resistance that was in initial years is totally gone. In a large store, typically there would be more drugged beverages than good beverages at any time. Since most of the drugging of beverages is done at manufacturing source, it is possible to completely avoid some beverage once you become certain that this is bad everywhere even at places where you would not suspect that army personnel has approached the store to drug it .
At least four or five store owners or staff admitted when I casually or jokingly asked about army coming to their stores and drugging water and beverages there and some of them told me that this happens very routinely almost every week or two.
Coffee stimulates the brain and the brain connects in new ways after taking coffee and good coffee creates problems with keeping victims on mind control since their brain starts connecting in many new ways after taking good coffee. All coffee and I repeat that entire coffee in the country present in the stores is drugged with mind control chemicals. Most of the coffee on good stores is imported from foreign countries. I do not know how it works but importer is probably told by army to drug the imported coffee before distributing it in the market. It is even very difficult or rather impossible to get good coffee beans. Two or three years ago it was possible to find some brand of coffee that was good by trying all new brands but it has not worked for past two years now for me despite that I keep trying. I even know of instances that when I was able to buy good coffee from very large and posh stores, they took entire coffee brand off the shelf from all their branches within two to three days. People know that Corrupt Army in Pakistan that ensures mind control is more powerful than any political government here.
Tea used to be good but for past one year most mainstream Pakistani brands of black tea are drugged with mind control drugs. This has still not caught up thoroughly like coffee is thoroughly drugged and it is still possible to find some good foreign brands tea that is good.
All stimulant/energy drinks including red bull are well drugged at manufacturing source. Red bull was better till last year but then it became drugged everywhere. I even tried it at remote places in several cities other than Lahore and it has always been drugged lately.
Most of the soaps, shampoos, creams, toothpastes are drugged with mind control chemicals. I do not use shampoos or creams but whatever rare I tried them once in a while they were drugged and they charged my skin. All of these have mind control chemicals that charge the skin and make mind extremely effective. Many people would be amazed when I tell them that even though I would be in my full senses before washing my head and face with a soap but after washing my head and face with a drugged soap, my eyesight would deteriorate and my conception of reality would completely change and sometimes I would face extreme anxiety. It is hard to emphasize that even a small thing like this can completely change the victim's mental state. Getting a good soap was very difficult for me till last year and I would drive for several hours in different parts of the city especially looking at all the pharmacies on the way to find some unknown brand or some soap that would have been manufactured several years ago when soaps were not getting completely drugged. I tried all the soaps including beauty soaps that are specially made for women, even many unknown brands, and specially imported soaps(which were all universally drugged thoroughly) and it was very very difficult to find a good soap. After finding a good soap, I would keep it in my pocket all the time. This is a small thing but you cannot live without it. But his year when checking soaps I realized that Dettol soap which is a mainstream brand is good and I started using it. I know very well and I tried several times and dettol soap used to be drugged a few years ago. But finding a good soap is no longer a problem since I just use a mainstream Dettol soap that is everywhere. I do not know why but they might have run out of mind control chemical given to them and they did not contact army and started manufacturing soaps without it.
Since our mouth is kept charged and some charges continue to go into victim's body from one's mouth. Therefore toothpastes are also added with mind control chemicals to charge inside of our mouth. You can imagine that after buying five or six tooth pastes of different remote brands, I would get a good tooth paste. I have recently been using toothpaste that is imported from abroad and is good. Toothpastes manufactured in Pakistan are all drugged with mind control chemicals. 
Another big problem is that pharmaceutical companies add mind control chemicals to their drugs(pills etc). Most of the mind control victims are targeted due to their talent and intelligence in mind many times might require special minerals that are rare in our food.  Most of the mineral and vitamin formulas are also drugged with mind control chemicals. Most mainstream mineral and vitamin pills in the market are thoroughly drugged with mind control chemicals. I never like to take names but I would like to tell friends that greatest crook of all times is Glaxosmithkline( I would invite them to sue me for writing this on Wilmott). GSK's mineral and vitamin formulas, effervescent calcium tablets, and toothpastes are all drugged with mind control chemicals. There is a tablet by the name Kemadrin that has to be taken with antipsychotics and GSK manufactures it and it is also drugged with mind control chemicals. My experience with GSK is so bad that If I have to buy any medicine and if it is made by GSK, I would try my utmost to avoid taking it for the fear of its being drugged with mind control chemicals and look for alternatives.
Injection fluanxol and clopixol are also drugged with mind control chemicals.
Again all this thorough infrastructure took more than fifteen years to develop in Pakistan and Pakistan army continued to work hard to develop it over the years. There are at least five hundred brilliant Pakistanis most of whom are computer scientists who are on active mind control to thwart them to contribute to society in any good way. Obviously all this infrastructure exists and was developed and perfected over fifteen years for a reason. 
I have not talked about special infrastructure that is used to project EM waves on the target and this infrastructure is present on all major roads and public places.
Again mind control in Pakistan is ensured by top Pakistani army generals since they are given several hundred million dollars by US army and top brass divides the money among themselves with bigger fish getting larger share and smaller fish getting a smaller share. Therefore mind control infrastructure in Pakistan is very detailed and thorough.
If you want to know about mind control in US or some other country, you have to project most of this to your country though obviously the degree of thoroughness of mind control infrastructure would be different. However I do know that  within Urban Unite States, there is enough thorough infrastructure to be able to project mind control on anyone anywhere. 
You think life is a secret, Life is only love of flying, It has seen many ups and downs, But it likes travel more than the destination. Allama Iqbal
 
User avatar
Amin
Topic Author
Posts: 1838
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

July 1st, 2022, 7:01 am

Friends, I am showing graph of a density made with the algorithm presented in previous page of this thread. Later today, I will upload a matlab program where you would specify your moments and the density would be graphed by the program.
Not every arbitrary combination of moments can be fitted since if input moments are out of whack, the density becomes negative. There has to be some restriction on moments for the density to remain positive. I will upload an advanced version(in which base gaussian will not be a unit variance but rather with a given mean and variance) of the program later today where you could define moments and the program will automatically draw a graph of pdf and cdf.

I am just posting a graph below to show how some very interesting densities can be made out of this method based on gaussian density.
On this graph, red line is cdf while blue line is pdf.
.
.
Image
You think life is a secret, Life is only love of flying, It has seen many ups and downs, But it likes travel more than the destination. Allama Iqbal
 
User avatar
Amin
Topic Author
Posts: 1838
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

July 2nd, 2022, 3:03 am

Friends, I could not get myself to work a lot of time yesterday. When standardized hermite polynomials are applied on the same idea, result of some integrations change and they have to be properly calculated. Not theoretically difficult/different from before  but a bit of work.
I received antipsychotic injection on this Thursday so I have some difficulty working well.
I hope to complete the work with construction of probability densities tonight. The other work that constructs Z-series for probability densities given the moments/cumulants will also follow very soon after this work since there is no difficulty there anymore and I have perfectly worked out all the details.  
You think life is a secret, Life is only love of flying, It has seen many ups and downs, But it likes travel more than the destination. Allama Iqbal
 
User avatar
Amin
Topic Author
Posts: 1838
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

July 2nd, 2022, 9:36 am

Friends I hope to be able to post the density generation program sometime today. I am working on it.
In the meanwhile, I am posting a graph similar to graph I posted yesterday. This graph is based on non-standard Gaussian and normalized hermite polynomials. I only used first four hermite polynomials in this graph density generation. I will be using six polynomials in the program that I will post later today.
.
.Image 
You think life is a secret, Life is only love of flying, It has seen many ups and downs, But it likes travel more than the destination. Allama Iqbal
 
User avatar
Amin
Topic Author
Posts: 1838
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

July 2nd, 2022, 5:21 pm

Friends, I have done most of the work and calculations but still have to delay remaining work till tomorrow. 
I do not want to complain since I have been able to work quite well for this part of the time cycle after the the injection. May be mind control agencies are far better since I complained that they want to keep me sedated and people protested about it. Or I might be under observation by some more independent people so mind control agencies are quite better to give an impression that this is how my mental situation is after the injections every time. Usually after the injections, mind control agencies try to drug my food and my 3rd day after the injection to 9th day after the injection is very bad for me since even minor amount of drugs in my food can play havoc with my condition.
I hope to post the program tomorrow. I want to relate the program to central moments since they are more intuitive. Sorry for this delay. 
You think life is a secret, Life is only love of flying, It has seen many ups and downs, But it likes travel more than the destination. Allama Iqbal
 
User avatar
Amin
Topic Author
Posts: 1838
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

July 3rd, 2022, 3:43 pm

Friends, I have completed work on the program and checking it. If everything goes well, I will try to post it tomorrow or day after tomorrow.
I will write a more detailed post tomorrow.
You think life is a secret, Life is only love of flying, It has seen many ups and downs, But it likes travel more than the destination. Allama Iqbal
 
User avatar
Amin
Topic Author
Posts: 1838
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

July 4th, 2022, 6:21 pm

Friends, I am posting the new program in which you specify first six central moments  and it produces a density so that the first six central moments of this density match the specified moments. Try fitting the moments with different base densities.
I will be writing and explaining relevant equations tomorrow.
.
.
function [] = GenerateDensityFromCentralMomentsX()


%In this program, you specify the first six central moments and the program creates a density based on these 
%central moments.
%First six central moments are specified below, feel free to alter them and
%find new densities

mu1=3.0;
mu2=10.999;
mu3=-17.9999;
mu4=253;
mu5=-800;
mu6=8500;


%The algorithm takes a base gaussian density that has it mean mu and
%sq-root of variance given by sigma.
%This mean and sigma can be different from first and sq-root of second
%central moment(variance) of the target density that we specified as mu1 and mu2 earlier.

mu=2;
sigma=2.0;

%Below is the construction of grid to calculate pdf, numerically integrate the pdf 
%to find cdf. And to numerically calculate the six moments on the constructed density 
%so they can be matched with input moments.

dNn=.02/10;
Nn=1250*10;
X(1:Nn)=-10+dNn+dNn*(1:Nn);


%Below, we calculate first six raw-moments from the input central moments.
%These raw moments would be used to calculate the coefficients of hermite
%polynomials so that output central moments calculated on new density match
%the input central moments.

rmu1=mu1;
rmu2=mu2+mu1^2;
rmu3=mu3+3*mu2*mu1+mu1^3;
rmu4=mu4+4*mu3*mu1+6*mu2*mu1^2+mu1^4;
rmu5=mu5+5*mu4*mu1+10*mu3*mu1^2+10*mu2*mu1^3+mu1^5;
rmu6=mu6+6*mu5*mu1+15*mu4*mu1^2+20*mu3*mu1^3+15*mu2*mu1^4+mu1^6;

%Below I calculate the coefficients of hermite polynomials so that output 
%central moments calculated on new density match
%the input central moments.

a1=(rmu1-mu)/sigma;
a2=(rmu2-mu^2-2*a1*mu*sigma-sigma^2)/sigma^2;
a3=(rmu3-mu^3-3*a1*mu^2*sigma-3*mu*sigma^2-3*a2*mu*sigma^2-3*a1*sigma^3)/sigma^3;
a4=(rmu4-mu^4-4*a1*mu^3*sigma-6*mu^2*sigma^2-6*a2*mu^2*sigma^2-12*a1*mu*sigma^3-4*a3*mu*sigma^3-3*sigma^4-6*a2*sigma^4)/sigma^4;
a5=(rmu5-mu^5-5*a1*mu^4*sigma-10*mu^3*sigma^2-10*a2*mu^3*sigma^2-30*a1*mu^2*sigma^3-10*a3*mu^2*sigma^3-15*mu*sigma^4-30*a2*mu*sigma^4-5*a4*mu*sigma^4-15*a1*sigma^5-10*a3*sigma^5)/sigma^5;
a6=(rmu6-mu^6-6*a1*mu^5*sigma- 15*mu^4*sigma^2-15*a2*mu^4*sigma^2-60*a1*mu^3*sigma^3-20*a3*mu^3*sigma^3-45*mu^2*sigma^4-90*a2*mu^2*sigma^4-15*a4*mu^2*sigma^4-90*a1*mu*sigma^5-60*a3*mu*sigma^5-45*a2*sigma^6-15*a4*sigma^6-15*sigma^6-6*a5*mu*sigma^5)/sigma^6;

%Below is base gaussian pdf.
pdfG=exp(-0.5* ((X-mu)/sigma).^2)/sigma/sqrt(2*pi);

%Below is the newly constructed density so that its output central moments
%match the central moments input by the user.
pdf=exp(-0.5* ((X-mu)/sigma).^2)/sigma/sqrt(2*pi).* (1+ a1* ((X-mu)/sigma)+  a2/2* (((X-mu)/sigma).^2-1) + ... 
    a3/6* ( ((X-mu)/sigma).^3 - 3*((X-mu)/sigma) )+ ...
    a4/24* (((X-mu)/sigma).^4 - 6* ((X-mu)/sigma).^2 + 3)+ ...
    a5/120* (((X-mu)/sigma).^5 - 10* ((X-mu)/sigma).^3 + 15*((X-mu)/sigma))+ ...
    a6/720* (((X-mu)/sigma).^6 - 15* ((X-mu)/sigma).^4 + 45*((X-mu)/sigma).^2-15));

%Below cdf is calculated by doing numerical integration of the density. I
%have replaced integration with summations.
cdf0(1:Nn)=0;
for nn=2:Nn
cdf0(nn)=cdf0(nn-1)+exp(-0.5* ((X(nn)-mu)/sigma).^2)/sigma/sqrt(2*pi).* (1+ a1* ((X(nn)-mu)/sigma)+ a2/2* (((X(nn)-mu)/sigma).^2-1) + ... 
    a3/6* ( ((X(nn)-mu)/sigma).^3 - 3*((X(nn)-mu)/sigma) )+ ...
    a4/24* (((X(nn)-mu)/sigma).^4 - 6* ((X(nn)-mu)/sigma).^2 + 3) + ...
    a5/120* (((X(nn)-mu)/sigma).^5 - 10* ((X(nn)-mu)/sigma).^3 + 15*((X(nn)-mu)/sigma))+ ...
    a6/720* (((X(nn)-mu)/sigma).^6 - 15* ((X(nn)-mu)/sigma).^4 + 45*((X(nn)-mu)/sigma).^2-15))*dNn;
end

%Below is numerically calculated value of first moment. N in mu1N
%stands for numerical.

mu1N=0;
for nn=2:Nn
mu1N=mu1N+X(nn) .*exp(-0.5* ((X(nn)-mu)/sigma).^2)/sigma/sqrt(2*pi).* (1+ a1* ((X(nn)-mu)/sigma)+ a2/2* (((X(nn)-mu)/sigma).^2-1) + ... 
    a3/6* ( ((X(nn)-mu)/sigma).^3 - 3*((X(nn)-mu)/sigma) )+ ...
    a4/24* (((X(nn)-mu)/sigma).^4 - 6* ((X(nn)-mu)/sigma).^2 + 3) + ...
    a5/120* (((X(nn)-mu)/sigma).^5 - 10* ((X(nn)-mu)/sigma).^3 + 15*((X(nn)-mu)/sigma))+ ...
    a6/720* (((X(nn)-mu)/sigma).^6 - 15* ((X(nn)-mu)/sigma).^4 + 45*((X(nn)-mu)/sigma).^2-15))*dNn;
end

%Below is numerically calculated value of second central moment.

mu2N=0;
for nn=2:Nn
mu2N=mu2N+(X(nn)-mu1N).^2 .*exp(-0.5* ((X(nn)-mu)/sigma).^2)/sigma/sqrt(2*pi).* (1+ a1* ((X(nn)-mu)/sigma)+ a2/2* (((X(nn)-mu)/sigma).^2-1) + ... 
    a3/6* ( ((X(nn)-mu)/sigma).^3 - 3*((X(nn)-mu)/sigma) )+ ...
    a4/24* (((X(nn)-mu)/sigma).^4 - 6* ((X(nn)-mu)/sigma).^2 + 3) + ...
    a5/120* (((X(nn)-mu)/sigma).^5 - 10* ((X(nn)-mu)/sigma).^3 + 15*((X(nn)-mu)/sigma))+ ...
    a6/720* (((X(nn)-mu)/sigma).^6 - 15* ((X(nn)-mu)/sigma).^4 + 45*((X(nn)-mu)/sigma).^2-15))*dNn;
end

%Below is numerically calculated value of third central moment.
mu3N=0;
for nn=2:Nn
mu3N=mu3N+(X(nn)-mu1N).^3 .*exp(-0.5* ((X(nn)-mu)/sigma).^2)/sigma/sqrt(2*pi).* (1+ a1* ((X(nn)-mu)/sigma)+ a2/2* (((X(nn)-mu)/sigma).^2-1) + ... 
    a3/6* ( ((X(nn)-mu)/sigma).^3 - 3*((X(nn)-mu)/sigma) )+ ...
    a4/24* (((X(nn)-mu)/sigma).^4 - 6* ((X(nn)-mu)/sigma).^2 + 3) + ...
    a5/120* (((X(nn)-mu)/sigma).^5 - 10* ((X(nn)-mu)/sigma).^3 + 15*((X(nn)-mu)/sigma))+ ...
    a6/720* (((X(nn)-mu)/sigma).^6 - 15* ((X(nn)-mu)/sigma).^4 + 45*((X(nn)-mu)/sigma).^2-15))*dNn;
end

%Below is numerically calculated value of fourth central moment.
mu4N=0;
for nn=2:Nn
mu4N=mu4N+(X(nn)-mu1N).^4 .*exp(-0.5* ((X(nn)-mu)/sigma).^2)/sigma/sqrt(2*pi).* (1+ a1* ((X(nn)-mu)/sigma)+ a2/2* (((X(nn)-mu)/sigma).^2-1) + ... 
    a3/6* ( ((X(nn)-mu)/sigma).^3 - 3*((X(nn)-mu)/sigma) )+ ...
    a4/24* (((X(nn)-mu)/sigma).^4 - 6* ((X(nn)-mu)/sigma).^2 + 3) + ...
    a5/120* (((X(nn)-mu)/sigma).^5 - 10* ((X(nn)-mu)/sigma).^3 + 15*((X(nn)-mu)/sigma))+ ...
    a6/720* (((X(nn)-mu)/sigma).^6 - 15* ((X(nn)-mu)/sigma).^4 + 45*((X(nn)-mu)/sigma).^2-15))*dNn;
end

%Below is numerically calculated value of fifth central moment.
mu5N=0;
for nn=2:Nn
mu5N=mu5N+(X(nn)-mu1N).^5 .*exp(-0.5* ((X(nn)-mu)/sigma).^2)/sigma/sqrt(2*pi).* (1+ a1* ((X(nn)-mu)/sigma)+ a2/2* (((X(nn)-mu)/sigma).^2-1) + ... 
    a3/6* ( ((X(nn)-mu)/sigma).^3 - 3*((X(nn)-mu)/sigma) )+ ...
    a4/24* (((X(nn)-mu)/sigma).^4 - 6* ((X(nn)-mu)/sigma).^2 + 3) + ...
    a5/120* (((X(nn)-mu)/sigma).^5 - 10* ((X(nn)-mu)/sigma).^3 + 15*((X(nn)-mu)/sigma))+ ...
    a6/720* (((X(nn)-mu)/sigma).^6 - 15* ((X(nn)-mu)/sigma).^4 + 45*((X(nn)-mu)/sigma).^2-15))*dNn;
end

%Below is numerically calculated value of sixth central moment.
mu6N=0;
for nn=2:Nn
mu6N=mu6N+(X(nn)-mu1N).^6 .*exp(-0.5* ((X(nn)-mu)/sigma).^2)/sigma/sqrt(2*pi).* (1+ a1* ((X(nn)-mu)/sigma)+ a2/2* (((X(nn)-mu)/sigma).^2-1) + ... 
    a3/6* ( ((X(nn)-mu)/sigma).^3 - 3*((X(nn)-mu)/sigma) )+ ...
    a4/24* (((X(nn)-mu)/sigma).^4 - 6* ((X(nn)-mu)/sigma).^2 + 3) + ...
    a5/120* (((X(nn)-mu)/sigma).^5 - 10* ((X(nn)-mu)/sigma).^3 + 15*((X(nn)-mu)/sigma))+ ...
    a6/720* (((X(nn)-mu)/sigma).^6 - 15* ((X(nn)-mu)/sigma).^4 + 45*((X(nn)-mu)/sigma).^2-15))*dNn;
end

%Below is analytically calculated cdf.

cdf(1:Nn)=normcdf(((X(1:Nn)-mu)/sigma))+exp(-0.5* ((X(1:Nn)-mu)/sigma).^2)/sqrt(2*pi).* (- a1 - a2/2* ((X(1:Nn)-mu)/sigma) - ...
    a3/6* ( ((X(1:Nn)-mu)/sigma).^2 - 1 )- ...
    a4/24* (((X(1:Nn)-mu)/sigma).^3 - 3* ((X(1:Nn)-mu)/sigma)) - ...
    a5/120* (((X(1:Nn)-mu)/sigma).^4 - 6* ((X(1:Nn)-mu)/sigma).^2 + 3) - ...
    a6/720* (((X(1:Nn)-mu)/sigma).^5 - 10* ((X(1:Nn)-mu)/sigma).^3 + 15*((X(1:Nn)-mu)/sigma)));
   
   
plot(X(1:Nn),cdf0(1:Nn),'g',X(1:Nn),cdf(1:Nn),'r',X(1:Nn),pdf(1:Nn),'b',X(1:Nn),pdfG(1:Nn),'m');
legend({'Numerically Calculated CDF','Analytically Calculated CDF','Newly Constructed Moment Matched PDF','Base Gaussian PDF'},'Location','northeast')

%cdf
%Below compare the input central moments mu's with moments calculated on
%newly constructed density denoted by mu*N
mu1N
mu1
mu2N
mu2
mu3N
mu3
mu4N
mu4
mu5N
mu5
mu6N
mu6

%Below are coefficients on hermite polynomials found out so that output
%moments in newly constructed density match input central moment values.

a1
a2
a3
a4
a5
a6

end

.
.
Here is the graph for density you will see when you run the program.
.
.
Image

.
.
Here is the output of the program you will see.
mu1N =

   3.000001166106365


mu1 =

     3


mu2N =

  10.998976156785789


mu2 =

  10.999000000000001


mu3N =

 -17.999654577054343


mu3 =

 -17.999900000000000


mu4N =

     2.529958480636926e+02


mu4 =

   253


mu5N =

    -7.999500779717981e+02


mu5 =

  -800


mu6N =

     8.499249720514237e+03


mu6 =

        8500


a1 =

   0.500000000000000


a2 =

   1.999750000000001


a3 =

   0.499637499999999


a4 =

   0.501150000000003


a5 =

  -0.121656249999994


a6 =

   1.571921874999852
You think life is a secret, Life is only love of flying, It has seen many ups and downs, But it likes travel more than the destination. Allama Iqbal
 
User avatar
Amin
Topic Author
Posts: 1838
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

July 5th, 2022, 9:54 am

The following slightly changed program takes cumulants as input and creates a density. It might be slightly easier to specify good cumulants than trying to specify good moments.
.
.
function [] = GenerateDensityFromCumulantsX()


%In this program, you specify the first six cumulants and the program creates a density based on these 
%cumulantsents.
%First six cumulants are specified below, feel free to alter them and
%find new densities

% mu1=1.0;
% mu2=1.0;
% mu3=3.9999;
% mu4=9;
% mu5=-8;
% mu6=85;

k1=1.0;
k2=(1.55)^2;
k3=1.5;
k4=3.50;
k5=1;
k6=1;


%The algorithm takes a base gaussian density that has it mean mu and
%sq-root of variance given by sigma.
%This mean and sigma can be different from first and sq-root of second
%central moment(variance) of the target density that we specified as mu1 and mu2 earlier.

mu=1;
sigma=1.55;

%Below is the construction of grid to calculate pdf, numerically integrate the pdf 
%to find cdf. And to numerically calculate the six moments on the constructed density 
%so they can be matched with input moments.

dNn=.02/10;
Nn=1250*10;
X(1:Nn)=-10+dNn+dNn*(1:Nn);


%Below, we calculate first six raw-moments from the input cumulants.
%These raw moments would be used to calculate the coefficients of hermite
%polynomials so that output central moments calculated on new density match
%the input central moments.

%mu1=k1;
rmu1=k1;
rmu2=k1*rmu1+k2;
rmu3=k1*rmu2+2*k2*rmu1+k3;
rmu4=k1*rmu3+3*k2*rmu2+3*k3*rmu1+k4;
rmu5=k1*rmu4+4*k2*rmu3+6*k3*rmu2+4*k4*rmu1+k5;
rmu6=k1*rmu5+5*k2*rmu4+10*k3*rmu3+10*k4*rmu2+5*k5*rmu1+k6;



% rmu1=mu1;
% rmu2=mu2+mu1^2;
% rmu3=mu3+3*mu2*mu1+mu1^3;
% rmu4=mu4+4*mu3*mu1+6*mu2*mu1^2+mu1^4;
% rmu5=mu5+5*mu4*mu1+10*mu3*mu1^2+10*mu2*mu1^3+mu1^5;
% rmu6=mu6+6*mu5*mu1+15*mu4*mu1^2+20*mu3*mu1^3+15*mu2*mu1^4+mu1^6;

%Below I calculate the coefficients of hermite polynomials so that output 
%central moments calculated on new density match
%the input central moments.

a1=(rmu1-mu)/sigma;
a2=(rmu2-mu^2-2*a1*mu*sigma-sigma^2)/sigma^2;
a3=(rmu3-mu^3-3*a1*mu^2*sigma-3*mu*sigma^2-3*a2*mu*sigma^2-3*a1*sigma^3)/sigma^3;
a4=(rmu4-mu^4-4*a1*mu^3*sigma-6*mu^2*sigma^2-6*a2*mu^2*sigma^2-12*a1*mu*sigma^3-4*a3*mu*sigma^3-3*sigma^4-6*a2*sigma^4)/sigma^4;
a5=(rmu5-mu^5-5*a1*mu^4*sigma-10*mu^3*sigma^2-10*a2*mu^3*sigma^2-30*a1*mu^2*sigma^3-10*a3*mu^2*sigma^3-15*mu*sigma^4-30*a2*mu*sigma^4-5*a4*mu*sigma^4-15*a1*sigma^5-10*a3*sigma^5)/sigma^5;
a6=(rmu6-mu^6-6*a1*mu^5*sigma- 15*mu^4*sigma^2-15*a2*mu^4*sigma^2-60*a1*mu^3*sigma^3-20*a3*mu^3*sigma^3-45*mu^2*sigma^4-90*a2*mu^2*sigma^4-15*a4*mu^2*sigma^4-90*a1*mu*sigma^5-60*a3*mu*sigma^5-45*a2*sigma^6-15*a4*sigma^6-15*sigma^6-6*a5*mu*sigma^5)/sigma^6;

%Below is base gaussian pdf.
pdfG=exp(-0.5* ((X-mu)/sigma).^2)/sigma/sqrt(2*pi);

%Below is the newly constructed density so that its output central moments
%match the central moments input by the user.
pdf=exp(-0.5* ((X-mu)/sigma).^2)/sigma/sqrt(2*pi).* (1+ a1* ((X-mu)/sigma)+  a2/2* (((X-mu)/sigma).^2-1) + ... 
    a3/6* ( ((X-mu)/sigma).^3 - 3*((X-mu)/sigma) )+ ...
    a4/24* (((X-mu)/sigma).^4 - 6* ((X-mu)/sigma).^2 + 3)+ ...
    a5/120* (((X-mu)/sigma).^5 - 10* ((X-mu)/sigma).^3 + 15*((X-mu)/sigma))+ ...
    a6/720* (((X-mu)/sigma).^6 - 15* ((X-mu)/sigma).^4 + 45*((X-mu)/sigma).^2-15));

%Below cdf is calculated by doing numerical integration of the density. I
%have replaced integration with summations.
cdf0(1:Nn)=0;
for nn=2:Nn
cdf0(nn)=cdf0(nn-1)+exp(-0.5* ((X(nn)-mu)/sigma).^2)/sigma/sqrt(2*pi).* (1+ a1* ((X(nn)-mu)/sigma)+ a2/2* (((X(nn)-mu)/sigma).^2-1) + ... 
    a3/6* ( ((X(nn)-mu)/sigma).^3 - 3*((X(nn)-mu)/sigma) )+ ...
    a4/24* (((X(nn)-mu)/sigma).^4 - 6* ((X(nn)-mu)/sigma).^2 + 3) + ...
    a5/120* (((X(nn)-mu)/sigma).^5 - 10* ((X(nn)-mu)/sigma).^3 + 15*((X(nn)-mu)/sigma))+ ...
    a6/720* (((X(nn)-mu)/sigma).^6 - 15* ((X(nn)-mu)/sigma).^4 + 45*((X(nn)-mu)/sigma).^2-15))*dNn;
end

%Below is numerically calculated value of first raw moment. N in mu1N
%stands for numerical.

rmu1N=0;
for nn=2:Nn
rmu1N=rmu1N+X(nn) .*exp(-0.5* ((X(nn)-mu)/sigma).^2)/sigma/sqrt(2*pi).* (1+ a1* ((X(nn)-mu)/sigma)+ a2/2* (((X(nn)-mu)/sigma).^2-1) + ... 
    a3/6* ( ((X(nn)-mu)/sigma).^3 - 3*((X(nn)-mu)/sigma) )+ ...
    a4/24* (((X(nn)-mu)/sigma).^4 - 6* ((X(nn)-mu)/sigma).^2 + 3) + ...
    a5/120* (((X(nn)-mu)/sigma).^5 - 10* ((X(nn)-mu)/sigma).^3 + 15*((X(nn)-mu)/sigma))+ ...
    a6/720* (((X(nn)-mu)/sigma).^6 - 15* ((X(nn)-mu)/sigma).^4 + 45*((X(nn)-mu)/sigma).^2-15))*dNn;
end

%Below is numerically calculated value of second raw moment.

rmu2N=0;
for nn=2:Nn
rmu2N=rmu2N+(X(nn)-0*rmu1N).^2 .*exp(-0.5* ((X(nn)-mu)/sigma).^2)/sigma/sqrt(2*pi).* (1+ a1* ((X(nn)-mu)/sigma)+ a2/2* (((X(nn)-mu)/sigma).^2-1) + ... 
    a3/6* ( ((X(nn)-mu)/sigma).^3 - 3*((X(nn)-mu)/sigma) )+ ...
    a4/24* (((X(nn)-mu)/sigma).^4 - 6* ((X(nn)-mu)/sigma).^2 + 3) + ...
    a5/120* (((X(nn)-mu)/sigma).^5 - 10* ((X(nn)-mu)/sigma).^3 + 15*((X(nn)-mu)/sigma))+ ...
    a6/720* (((X(nn)-mu)/sigma).^6 - 15* ((X(nn)-mu)/sigma).^4 + 45*((X(nn)-mu)/sigma).^2-15))*dNn;
end

%Below is numerically calculated value of third raw moment.
rmu3N=0;
for nn=2:Nn
rmu3N=rmu3N+(X(nn)-0*rmu1N).^3 .*exp(-0.5* ((X(nn)-mu)/sigma).^2)/sigma/sqrt(2*pi).* (1+ a1* ((X(nn)-mu)/sigma)+ a2/2* (((X(nn)-mu)/sigma).^2-1) + ... 
    a3/6* ( ((X(nn)-mu)/sigma).^3 - 3*((X(nn)-mu)/sigma) )+ ...
    a4/24* (((X(nn)-mu)/sigma).^4 - 6* ((X(nn)-mu)/sigma).^2 + 3) + ...
    a5/120* (((X(nn)-mu)/sigma).^5 - 10* ((X(nn)-mu)/sigma).^3 + 15*((X(nn)-mu)/sigma))+ ...
    a6/720* (((X(nn)-mu)/sigma).^6 - 15* ((X(nn)-mu)/sigma).^4 + 45*((X(nn)-mu)/sigma).^2-15))*dNn;
end

%Below is numerically calculated value of fourth raw moment.
rmu4N=0;
for nn=2:Nn
rmu4N=rmu4N+(X(nn)-0*rmu1N).^4 .*exp(-0.5* ((X(nn)-mu)/sigma).^2)/sigma/sqrt(2*pi).* (1+ a1* ((X(nn)-mu)/sigma)+ a2/2* (((X(nn)-mu)/sigma).^2-1) + ... 
    a3/6* ( ((X(nn)-mu)/sigma).^3 - 3*((X(nn)-mu)/sigma) )+ ...
    a4/24* (((X(nn)-mu)/sigma).^4 - 6* ((X(nn)-mu)/sigma).^2 + 3) + ...
    a5/120* (((X(nn)-mu)/sigma).^5 - 10* ((X(nn)-mu)/sigma).^3 + 15*((X(nn)-mu)/sigma))+ ...
    a6/720* (((X(nn)-mu)/sigma).^6 - 15* ((X(nn)-mu)/sigma).^4 + 45*((X(nn)-mu)/sigma).^2-15))*dNn;
end

%Below is numerically calculated value of fifth raw moment.
rmu5N=0;
for nn=2:Nn
rmu5N=rmu5N+(X(nn)-0*rmu1N).^5 .*exp(-0.5* ((X(nn)-mu)/sigma).^2)/sigma/sqrt(2*pi).* (1+ a1* ((X(nn)-mu)/sigma)+ a2/2* (((X(nn)-mu)/sigma).^2-1) + ... 
    a3/6* ( ((X(nn)-mu)/sigma).^3 - 3*((X(nn)-mu)/sigma) )+ ...
    a4/24* (((X(nn)-mu)/sigma).^4 - 6* ((X(nn)-mu)/sigma).^2 + 3) + ...
    a5/120* (((X(nn)-mu)/sigma).^5 - 10* ((X(nn)-mu)/sigma).^3 + 15*((X(nn)-mu)/sigma))+ ...
    a6/720* (((X(nn)-mu)/sigma).^6 - 15* ((X(nn)-mu)/sigma).^4 + 45*((X(nn)-mu)/sigma).^2-15))*dNn;
end

%Below is numerically calculated value of sixth raw moment.
rmu6N=0;
for nn=2:Nn
rmu6N=rmu6N+(X(nn)-0*rmu1N).^6 .*exp(-0.5* ((X(nn)-mu)/sigma).^2)/sigma/sqrt(2*pi).* (1+ a1* ((X(nn)-mu)/sigma)+ a2/2* (((X(nn)-mu)/sigma).^2-1) + ... 
    a3/6* ( ((X(nn)-mu)/sigma).^3 - 3*((X(nn)-mu)/sigma) )+ ...
    a4/24* (((X(nn)-mu)/sigma).^4 - 6* ((X(nn)-mu)/sigma).^2 + 3) + ...
    a5/120* (((X(nn)-mu)/sigma).^5 - 10* ((X(nn)-mu)/sigma).^3 + 15*((X(nn)-mu)/sigma))+ ...
    a6/720* (((X(nn)-mu)/sigma).^6 - 15* ((X(nn)-mu)/sigma).^4 + 45*((X(nn)-mu)/sigma).^2-15))*dNn;
end

%Below is analytically calculated cdf.

cdf(1:Nn)=normcdf(((X(1:Nn)-mu)/sigma))+exp(-0.5* ((X(1:Nn)-mu)/sigma).^2)/sqrt(2*pi).* (- a1 - a2/2* ((X(1:Nn)-mu)/sigma) - ...
    a3/6* ( ((X(1:Nn)-mu)/sigma).^2 - 1 )- ...
    a4/24* (((X(1:Nn)-mu)/sigma).^3 - 3* ((X(1:Nn)-mu)/sigma)) - ...
    a5/120* (((X(1:Nn)-mu)/sigma).^4 - 6* ((X(1:Nn)-mu)/sigma).^2 + 3) - ...
    a6/720* (((X(1:Nn)-mu)/sigma).^5 - 10* ((X(1:Nn)-mu)/sigma).^3 + 15*((X(1:Nn)-mu)/sigma)));
   
   
plot(X(1:Nn),cdf0(1:Nn),'g',X(1:Nn),cdf(1:Nn),'r',X(1:Nn),pdf(1:Nn),'b',X(1:Nn),pdfG(1:Nn),'m');
legend({'Numerically Calculated CDF','Analytically Calculated CDF','Newly Constructed Moment Matched PDF','Base Gaussian PDF'},'Location','northeast')

%Below program checks if density becomes slightly negative.
IsNegative=0;
for nn=2:Nn
    if(pdf(nn)<0)
        IsNegative=1;
    end
end

%cdf
%Below compare the input raw moments rmu's with moments calculated on
%newly constructed density denoted by rmu#N
rmu1N
rmu1
rmu2N
rmu2
rmu3N
rmu3
rmu4N
rmu4
rmu5N
rmu5
rmu6N
rmu6

%Below are coefficients on hermite polynomials found out so that output
%moments in newly constructed density match input central moment values.

a1
a2
a3
a4
a5
a6

IsNegative
end

.
.
You think life is a secret, Life is only love of flying, It has seen many ups and downs, But it likes travel more than the destination. Allama Iqbal
 
User avatar
Amin
Topic Author
Posts: 1838
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

July 7th, 2022, 3:34 pm

Some notations and preliminaries first.

Let us suppose we denote a standard gaussian density as    [$]p(X) \, = \, \frac{1}{2 \pi} \exp(- \, \frac{ X^2 }{2})[$]

We also have hermite polynomials and first few hermite polynomials are denoted as
[$]H_0(X) \, = \, 1[$]
[$]H_1(X) \, = \, X[$]
[$]H_2(X) \, = \, X^2 \, - 1[$]
[$]H_3(X) \, = \, X^3 \, - 3 X[$]
[$]H_4(X) \, = \, X^4 \, - 6 X^2 \, +3[$]
and so on.
And I want to share an interesting property related to following integral
[$]\int_{-\infty}^{+\infty}  X^m \, H_n(X) \, p(X) dx [$]   Equation(A)
We know when m is odd and n is even or m is even and n is odd, the above integral always goes to zero.
But when m is odd and n is also odd, the above integral would always go to zero when  n > m.
Similarly when m is even and n is also even, the above integral would again always go to zero, when n > m.
To explain it in words with simple examples, when fourth power of X is integrated in the above integral (eq A) with zeroth hermite, 2nd hermite or fourth hermite, there will be a finite value but when fourth power of X is integrated with sixth hermite, eighth hermite or tenth hermite, it will always go to zero. Similarly for odd powers, when fifth power of X is integrated there is a finite value when we integrate it with first hermite, third hermite or fifth hermite in the equation (A), but when we integrate fifth power of X with seventh, ninth or 11th hermite or higher odd hermites, the value would always go to zero.
The above property is interesting since in our forthcoming framework when we have fixed some moment in our equation, adding higher hermites(for higher moments) would not change the lower moments at all.

Now we want to fix first few moments to our  proposed probability distribution so that all the moments are perfectly matched (a good property as I mentioned earlier would be that adding further higher moments would not change our lower moments that have already been matched).

The proposed probability distribution has a very simple form (upto sixth order) as

[$] q(X) \, = \, p(X) \, \big[ \, 1 \, + \, h_1 \, H_1(X)+ \, h_2/2 \, H_2(X)+ \, h_3/6 \, H_3(X)+ \, h_4/24 \, H_4(X)+ \, h_5/120 \, H_5(X)+ \, h_6/720 \, H_6(X) \, \big]  \, [$]

here [$]h_1[$] , [$]h_2[$] etc are coefficients of hermites that will be adjusted to match the moments of above probability density form to our desired moments. 
1st thing we know by inspection that above probability density equation integrates to one since all hermites (other than the first term) have an expected value of zero when integrated over normal density.
Now we write the first few raw moments of the above equation that can be verified by full-fledged integration(as I have done in my notes)

[$]E[X]\,= \int_{-\infty}^{+\infty}  X \, q(X) dX \, = \, h_1[$]
[$]E[X^2]\,= \int_{-\infty}^{+\infty}  X^2 \, q(X) dX \, = \,1 \, + \, h_2[$]
[$]E[X^3]\,= \int_{-\infty}^{+\infty}  X^3 \, q(X) dX \, = \,3  \, h_1 \, + \, h_3[$]
[$]E[X^4]\,= \int_{-\infty}^{+\infty}  X^4 \, q(X) dX \, = \, 3 \, +\,6 \, h_2 \, + \, h_4[$]
[$]E[X^5]\,= \int_{-\infty}^{+\infty}  X^5 \, q(X) dX \, = \, 15 \, +\,10 \, h_3 \, + \, h_5[$]
[$]E[X^6]\,= \int_{-\infty}^{+\infty}  X^6 \, q(X) dX \, = \, 15 \, +\,45 \, h_2 \, + \,15 \,  h_4 \, + h_6[$]

So we see that we can keep on adding more hermite polynomials to fix higher moments and it will not alter our lower moments. However higher odd/even moments take a contribution from hermite polynomial terms associated with lower odd/even moments(that have already been fixed) up to the order of moment being calculated.
It seems a better idea to try matching moments on standard gaussian as opposed to non-standard gaussian as we do when we match moments with gram-charlier or edgeworth.
Please pardon any errors.
.
.
.
Some notations and preliminaries first.

Let us suppose we denote a standard gaussian density as    [$]p(X) \, = \, \frac{1}{\sigma \sqrt{2 \pi}} \exp(- \, \frac{ {(X-\mu)}^2 }{2 {\sigma}^2})[$]

We also have standardized  hermite polynomials and first few standardized  hermite polynomials are denoted as
[$]H_0(X) \, = \, 1[$]
[$]H_1(X) \, = \,   (\frac{X- \mu}{\sigma})[$]
[$]H_2(X) \, = \, {(\frac{X- \mu}{\sigma})}^2 \, - 1[$]
[$]H_3(X) \, = \, {(\frac{X- \mu}{\sigma})}^3 \, - 3 {(\frac{X- \mu}{\sigma})}[$]
[$]H_4(X) \, = \, {(\frac{X- \mu}{\sigma})}^4 \, - 6 {(\frac{X- \mu}{\sigma})}^2 \, +3[$]


Now we want to fix first few moments to our  proposed probability distribution so that all the moments are perfectly matched (a good property as I mentioned earlier would be that adding further higher moments would not change our lower moments that have already been matched).

The proposed probability distribution has a very simple form (upto sixth order) as

[$] q(X) \, = \, p(X) \, \big[ \, 1 \, + \, h_1 \, H_1(X)+ \, h_2/2 \, H_2(X)+ \, h_3/6 \, H_3(X)+ \, h_4/24 \, H_4(X)+ \, h_5/120 \, H_5(X)+ \, h_6/720 \, H_6(X) \, \big]  \, [$]

here [$]h_1[$] , [$]h_2[$] etc are coefficients of hermites that will be adjusted to match the moments of above probability density form to our desired moments. 
1st thing we know by inspection that above probability density equation integrates to one since all hermites (other than the first term) have an expected value of zero when integrated over normal density.
Now we write the first few raw moments of the above equation that can be verified by full-fledged integration(as I have done in my notes)

[$]E[X]\,= \int_{-\infty}^{+\infty}  X \, q(X) dX \, = \mu \, + \, h_1 \, \sigma[$]
[$]E[X^2]\,= \int_{-\infty}^{+\infty}  X^2 \, q(X) dX \, = \, {\mu}^2 + 2 \, h_1 \mu \sigma + \, {\sigma}^2 \, + \, h_2 \, {\sigma}^2 \,[$]
[$]E[X^3]\,= \int_{-\infty}^{+\infty}  X^3 \, q(X) dX \, = \, {\mu}^3 + 3 \, h_1 {\mu}^2 \sigma  + 3  \mu {\sigma}^2 + 3 h_2 \, \mu {\sigma}^2 + \, 3 h_1 \, {\sigma}^3 \, \, + \, h_3 \, {\sigma}^3 \,[$]
[$]E[X^4]\,= \int_{-\infty}^{+\infty}  X^4 \, q(X) dX \, = \, {\mu}^4 + 4 \, h_1 {\mu}^3 {\sigma}  + 6  {\mu}^2 {\sigma}^2 + 6 h_2 \, {\mu}^2 {\sigma}^2 + \, 12 h_1 \, \mu \, {\sigma}^3 \, \, +4 \, h_3 \, \mu \,  {\sigma}^3 \,+ 3 \, {\sigma}^4 \, +6 \, h_2 \, {\sigma}^4 \, + \, h_4[$]
[$]E[X^5]\,= \int_{-\infty}^{+\infty}  X^5 \, q(X) dX \, =  \, {\mu}^5 + 5 \, h_1 {\mu}^4 {\sigma}  + 10  {\mu}^3 {\sigma}^2 + 10 h_2 \, {\mu}^3 {\sigma}^2 + \, 30 h_1 \, {\mu}^2 \, {\sigma}^3 \, \, +10 \, h_3 \, {\mu}^2 \,  {\sigma}^3 \,[$]
[$]+ 15 \, \mu  {\sigma}^4 \, +30 \, h_2 \, \mu {\sigma}^4 \, +5 \, h_4 \, \mu {\sigma}^4 + 15 h_1 {\sigma}^5  + 10 h_3  {\sigma}^5 \, + \, h_5 \,  {\sigma}^5[$]
[$]E[X^6]\,= \int_{-\infty}^{+\infty}  X^6 \, q(X) dX \, =
 \, {\mu}^6 + 6 \, h_1 {\mu}^5 {\sigma}  + 15  {\mu}^4 {\sigma}^2 + 15 h_2 \, {\mu}^4 {\sigma}^2 + \, 60 h_1 \, {\mu}^3 \, {\sigma}^3 \, \, +20 \, h_3 \, {\mu}^3 \,  {\sigma}^3 \,[$]
[$]+ 45 \, {\mu}^2  {\sigma}^4 \, +90 \, h_2 \, {\mu}^2 {\sigma}^4 \, +15 \, h_4 \, {\mu}^2 {\sigma}^4 + 90 h_1 \, \mu {\sigma}^5  + 60 h_3 \, \mu {\sigma}^5 \, + 6 \, h_5 \,  \mu {\sigma}^5 \, + 15 \, {\sigma}^6 \,\, + 45 \, h_2 {\sigma}^6 \, + 15 \, h_4 {\sigma}^6 \, + \, h_6 \, {\sigma}^6 \,[$]

So we see that we can keep on adding more hermite polynomials to fix higher moments and it will not alter our lower moments. However higher odd/even moments take a contribution from hermite polynomial terms associated with lower odd/even moments(that have already been fixed) up to the order of moment being calculated.

Though I posted some programs to calculate densities from central moments or cumulants, we can notice that changing mean/variance of base gaussian also have a great effect towards the shape of new density and fixing first six moments with different base gaussians can results in different densities though first few moments would still be matched. I think it has to be further studied by friends how to systematically choose the parameters of base gaussian towards the best matching density. Sometimes, density becomes slightly negative for parameters of base gaussian but becomes perfectly positive when parameters of base gaussian are slightly changed.
You think life is a secret, Life is only love of flying, It has seen many ups and downs, But it likes travel more than the destination. Allama Iqbal
 
User avatar
Amin
Topic Author
Posts: 1838
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

July 11th, 2022, 12:05 pm

Friends, I tried working on finding a Z-series representation of a general density when its moments are given. But I might be making a mistake and I could not get it right. I really think my ideas are sound but I might possibly be making some mistake. I will try again in a day or two and see how it goes.
I have not been able to work well and only started working yesterday and slightly came out of the effect of the antipsychotic injection. I had basically been wasting time all along before this.
I will check my work for accuracy again and also try alternatives. I will come back to friends in another two or three days.
You think life is a secret, Life is only love of flying, It has seen many ups and downs, But it likes travel more than the destination. Allama Iqbal