Powered By Blogger

Sunday, October 16, 2016

Solving a Nonlinear Equation with Many Independent Variables By Using Microsoft Excel Plus VBA

Typically, we are able to solve system of linear or nonlinear equations which are a set of simultaneous equations (SE). Definitely, solving of a linear SE is very easy while we have to use Newton's method to solve nonlinear SEs. The common case for both of them is, to generate an equation for each variable. It means, we can solve an equation with three variables, if we have three simultaneous equations or solving of four variables needs to find a system of four simultaneous equations and so on.

Can we solve a nonlinear equation with many variables? Yes. In the special conditions, the answer is 
positive.

The purpose of this article is to present some examples which show us possibility to solve a nonlinear equation with many variables where we have a good estimation for limited domain and range of variables. The method applied is the same method stated in article of "The Generating New Probability Theorems" posted on link:


The experienced physicists and engineers have usually the true speculation of domain and range for the variables while they need to obtain precise amounts for the variables. Therefore, this method can be useful for them.
At the first, I start by a nonlinear equation with three variables then four variables and finally five 
variables.

Example (1):

One of professional people asked me a question in math and statistics group of social media as follows:


"I need some help to interpret a stock regression:

SZ is high or low size of the company

BM is high or low book to market size

R is the return of the stock

R = 5% + 6%Bm +2%SZ – 2%*BM*SZ

My question is whether I should short high size and high book to market stocks (stocks that have both characteristics)?

I analyzed his problem by using above method as follows:

Here is my analysis:

1. To reach the maximum R, you should stay SZ the constant in low size and then if you increase BM, you will reach the maximum R.

2. If you increase both of them (SZ and BM), you will significantly decrease R.

3. The most important thing is about R = 0.11 because in this case, it does not take any difference. In fact, above analysis does not work for R = 0.11

4. If 0< SZ and BM <1, then maximum amount of R will be always equal to 0.11 (Rmax = 0.11)


I think that this is really a magic formula.

Example (2)

This is an example about financial and risk management.

As you know, the basic theory which links risk and return rate for all assets is, the Capital Asset Pricing Model. The equation of CAPM is as follows:











Now, suppose you want to invest on an asset in which your expected return rate (required return) is equal 12%. The question is: What are the alternatives or scenarios for three independent variables of risk – free, beta and market return?
Here, by applying the method stated in this article, I have obtained 21 answers for three independent variables as follows:






















Example (3): The equation of State for an Ideal Gas



Let me tell you an example about the equation of state for an ideal gas.

We have:

P.V = N.KB.T

Suppose we have a constant volume (V) equal to 0.03 m3

 If Boltzmann’s constant (KB) is equal to 1.38E-23 J/K, what are the answers for P and N and T?


According to my method, I found 9 answers which are as follows:



:Where

T = temperature (K) and P = pressure (Pa) and N = number of molecules


Example (4): Solve Circle Equation

  When we open a calculus book, we can see the signs and footprints of Pythagoras (582 B.C – 496 B.C) everywhere. Therefore, let me start by solving of circle equation for a limited domain and range as follows:

Consider the circle equation with below domain:     

If 

           x^2 + y^2 = r^2

x, y ϵ N,            x, y ≤ 100

Then the range will be

r ϵ N,            r ≤ 141


 Now, I apply above method and get all results of "x, y" for "r" in given range. All number of results to "r" has been presented on below graph







In this case, total sum of possible answers is equal to 126. 
For instance, above graph shows us, if r = 25, 50, 75, 100 then the number of results for "x, y" are equal to 4 and if r = 65, 85 then the number of results for "x, y" are equal to 8. The results are as follows 






 Now, consider the circle equation with below domain

    

If 

           x^2 + y^2 = r^2

    0 0 0 x, y ϵ N,            x, y ≤ 1

Then the range will be

 4 r ϵ N,            r ≤ 14 1

 If I apply above method, I will generate all results of "x, y" for "r" in given range. All number of results to "r" has been presented on below graph:






In this case, total sum of possible answers is equal to 2068. 

For instance, above graph shows us, if r = 325, 425, 650,725,850,925,975 then the number of results for "x, y" are equal to 14. The results are as follows: 




Note: All researchers and individual people, who are interested in having this model, don’t hesitate to send their request to below addresses:




WhatsApp: +98 9109250225

  

Thursday, October 6, 2016

The Generating New Probability Theorems (Con)

Following to previous article posted on link:  http://emfps.blogspot.com/2016/09/the-generating-new-probability-theorems.htmlyou can review second theorem as follows:


 Theorem (2): Rule of sixty plus (60 %+)
I start theorem (2) just like theorem (1) by using three dices but I change the function to a Transcendental function.
As we know, there are two types of functions in mathematics (Calculus). The first functions are named Algebraic function. These ones are the functions which are applied in below equation:

  0  =  (Pn (x)y^n  +...P1(x)y  + P0 (x        

                  ......... (Where P0 (x), P1(x
 Pn (x) are the polynomials of "x
  

I used Algebraic function for theorem (1).
Second functions are named Transcendental function including two group: 1) Trigonometric function 2) Exponential function. These functions are not compatible with above equation.
In theorem (2), I will apply a type of trigonometric function.

Assume we again set three dices on the table in one row from left to right. We will have:

Dice1      Dice2     Dice3

Now, consider three dices as three variables as follows:

Dice1 = x,    Dice2 = y, Dice3 = z

I am willing to define function f (x, y) below cited:

z = f (x, y) = x + COS y

We know the domain of "x" and "y" is the same the range of "z" equal to 1, 2, 3, 4, 5 and 6.

I am willing to know, what is below probability:

P (z <= x + COS y) =?

We can calculate the probability which is exactly equal to 50.00 %.

P (z <= x + COS y) = 50.00 %

Now, I will pull out another dice from basket and add forth dice on the table right side of dice 3. We will have Dice 4 and I will assign variable "w" to this dice:

Dice 4 = w

Suppose the function will be:

w = f (x, y, z) = x + COS (y + z)

What is below probability?

P (w <= x + COS (y + z)) =?

We have 6^4 = 1296   permutations with repetition.

The probability is again calculated exactly equal to 50.00 %.

P (w <= x + COS (y + z)) = 50. 00%

Then, I will pull out another dice from basket and add fifth dice on the table right side of dice 4. We will have Dice 5 and I will assign variable "t" to this dice:

Dice 5 = t

Suppose the function will be:

t = f (x, y, z, w) = x + COS (y + z + w)

It is clear, permutations with repetition is equal to 6^5 = 7776 and the probability will again be 50%.   
P (t <= x + COS (y + z + w)) = 50%

Finally, I will pull out another dice from basket and add sixth dice on the table right side of dice 5. We will have Dice 6 and I will assign variable "r" to this dice:

Dice 6 = r

Suppose the function will be:

r = f (x, y, z, w, t) = x + COS (y + z + w + t)

What is below probability?

P (r <= x + COS (y + z + w + t)) =?

Permutations with repetition is equal to 6^6 = 46656 and the probability is again 50%.

 P (w <= x + COS (y + z + w + t)) = 50%
Therefore, we can reach to a general theorem in which there are "n" dices:

If we have "n" dices with below function:

xn = f (x1, x2, x3, ……..xn-1) = x1 + COS ( x2 + x3+ ….. xn-1) 

Then, below Probability will be 50%:

 P(x<= x1 + COS (x2 + x3+ ….. xn-1)) = 50% 

What is the application of theorem (2)?

Let me again refer to my article of "A Template for Financial Section of a Business Plan (Con)" 
posted on link:


If you want to test these theorems and see real application of these theorems in the field of financial management
you should select 10, 20, 50 or more companies and apply these theorems on growth rate of sales and costs or amount of sales and costs in the sequential years, quarters and so on.

Here, I have bought an example for 20 company that I have covered the names. You can follow me as follows:

Step 1: Select 20 companies in different industries
Step 2: Go to Google finance and search name of each company
Step 3: For each company click on Financials (left side of page)
Step 4: Copy total revenue and cost of revenue for five sequential period of 13 weeks and paste on excel spreadsheet
Step 5: Calculate growth rate for total revenue and cost of revenue
Step 6: Calculate the function of theorem (2) for two sequential period of 13 weeks and compare it with third sequential period of 13 weeks
Step 7: Calculate the probability

You can see Figure (1) which is my example:


( 1) Figure


  In my example, I am predicting the periods of 13 weeks ending 2016- 03 – 26 and 13 weeks ending 2016 – 06 – 25. You can see, for function of z = x + cos y, the probability is exactly 100% for both periods (for revenue and cost). It means that the predictions are 100% true. But these predictions are not useful because they show us very high upper stream line. It is just like, I say to you that the sales will not increase more than 150 or 200% for the next period. Therefore, there are two important questions

1. Why is there the significant difference between the probability of theorem (2) and real probability which is 100% instead of 50%?
2. How can we decrease upper stream line where the predictions will be useful for us?

Answer to question (1):

As we can see, the growth rates usually are between -100% to + 100% (-1 to +1).
 Therefore, let me consider all dices contains infinity numbers which are members of Real Number between -1 to 1 as follows 
D1 = 
 {x x ϵ R, -1< x <1}

     =  D2 
{y y ϵ R, -1< y <1}

=   D3
{z z ϵ R, -1< z <1}

Now, if we use above conditions and apply Monte Carlo method for our analysis, we will find that the probability for theorem (2) will increase to more than 85% with Average approximately 85% by standard deviation of 0.001. Please see Figure 2

 Figure (2)


Answer to question (2):

Only way to decrease upper stream line is, to divide function of theorem (2) to some numbers. For instance, I apply the Monte Carlo analysis for below functions:

z = f (x, y) = (x + COS (y)) / 4

According to Figure (1), the probabilities are 95% and 85% for my example. In the reference with Monte Carlo analysis, we can say:

P (z <= (x + COS y) /4) > 65%   with Average > 64 % and standard deviation approximately 0.0015

z = f (x, y) = (x + COS (y)) / 6

Figure (1) shows us, the probabilities are 95% and 72.5% for my example. Regarding to Monte Carlo analysis, we can say:

P (z <= (x + COS y) /6) > 60%   with Average approximately 60 % and standard deviation 0.0018

Since theorem (2) divided to 6 is more useful for us, I can say that the Rule of sixty plus (60 %+) is as follows:

P (z <= (x + COS y) /6) > 60%


The generating New probability theorems (Con)

Following to previous article posted on link:  http://emfps.blogspot.com/2016/09/the-generating-new-probability-theorems.htmlyou can review second theorem as follows:


 Theorem (2): Rule of sixty plus (60 %+)
I start theorem (2) just like theorem (1) by using three dices but I change the function to a Transcendental function.
As we know, there are two types of functions in mathematics (Calculus). The first functions are named Algebraic function. These ones are the functions which are applied in below equation:

  0  =  (Pn (x)y^n  +...P1(x)y  + P0 (x        

                  ......... (Where P0 (x), P1(x
 Pn (x) are the polynomials of "x
  

I used Algebraic function for theorem (1).
Second functions are named Transcendental function including two group: 1) Trigonometric function 2) Exponential function. These functions are not compatible with above equation.
In theorem (2), I will apply a type of trigonometric function.

Assume we again set three dices on the table in one row from left to right. We will have:

Dice1      Dice2     Dice3

Now, consider three dices as three variables as follows:

Dice1 = x,    Dice2 = y, Dice3 = z

I am willing to define function f (x, y) below cited:

z = f (x, y) = x + COS y

We know the domain of "x" and "y" is the same the range of "z" equal to 1, 2, 3, 4, 5 and 6.

I am willing to know, what is below probability:

P (z <= x + COS y) =?

We can calculate the probability which is exactly equal to 50.00 %.

P (z <= x + COS y) = 50.00 %

Now, I will pull out another dice from basket and add forth dice on the table right side of dice 3. We will have Dice 4 and I will assign variable "w" to this dice:

Dice 4 = w

Suppose the function will be:

w = f (x, y, z) = x + COS (y + z)

What is below probability?

P (w <= x + COS (y + z)) =?

We have 6^4 = 1296   permutations with repetition.

The probability is again calculated exactly equal to 50.00 %.

P (w <= x + COS (y + z)) = 50. 00%

Then, I will pull out another dice from basket and add fifth dice on the table right side of dice 4. We will have Dice 5 and I will assign variable "t" to this dice:

Dice 5 = t

Suppose the function will be:

t = f (x, y, z, w) = x + COS (y + z + w)

It is clear, permutations with repetition is equal to 6^5 = 7776 and the probability will again be 50%.   
P (t <= x + COS (y + z + w)) = 50%

Finally, I will pull out another dice from basket and add sixth dice on the table right side of dice 5. We will have Dice 6 and I will assign variable "r" to this dice:

Dice 6 = r

Suppose the function will be:

r = f (x, y, z, w, t) = x + COS (y + z + w + t)

What is below probability?

P (r <= x + COS (y + z + w + t)) =?

Permutations with repetition is equal to 6^6 = 46656 and the probability is again 50%.

 P (w <= x + COS (y + z + w + t)) = 50%
Therefore, we can reach to a general theorem in which there are "n" dices:

If we have "n" dices with below function:

xn = f (x1, x2, x3, ……..xn-1) = x1 + COS ( x2 + x3+ ….. xn-1) 

Then, below Probability will be 50%:

 P(x<= x1 + COS (x2 + x3+ ….. xn-1)) = 50% 

What is the application of theorem (2)?

Let me again refer to my article of "A Template for Financial Section of a Business Plan (Con)" 
posted on link:


If you want to test these theorems and see real application of these theorems in the field of financial management
you should select 10, 20, 50 or more companies and apply these theorems on growth rate of sales and costs or amount of sales and costs in the sequential years, quarters and so on.

Here, I have bought an example for 20 company that I have covered the names. You can follow me as follows:

Step 1: Select 20 companies in different industries
Step 2: Go to Google finance and search name of each company
Step 3: For each company click on Financials (left side of page)
Step 4: Copy total revenue and cost of revenue for five sequential period of 13 weeks and paste on excel spreadsheet
Step 5: Calculate growth rate for total revenue and cost of revenue
Step 6: Calculate the function of theorem (2) for two sequential period of 13 weeks and compare it with third sequential period of 13 weeks
Step 7: Calculate the probability

You can see Figure (1) which is my example:


( 1) Figure


  In my example, I am predicting the periods of 13 weeks ending 2016- 03 – 26 and 13 weeks ending 2016 – 06 – 25. You can see, for function of z = x + cos y, the probability is exactly 100% for both periods (for revenue and cost). It means that the predictions are 100% true. But these predictions are not useful because they show us very high upper stream line. It is just like, I say to you that the sales will not increase more than 150 or 200% for the next period. Therefore, there are two important questions

1. Why is there the significant difference between the probability of theorem (2) and real probability which is 100% instead of 50%?
2. How can we decrease upper stream line where the predictions will be useful for us?

Answer to question (1):

As we can see, the growth rates usually are between -100% to + 100% (-1 to +1).
 Therefore, let me consider all dices contains infinity numbers which are members of Real Number between -1 to 1 as follows 
D1 = 
 {x x ϵ R, -1< x <1}

     =  D2 
{y y ϵ R, -1< y <1}

=   D3
{z z ϵ R, -1< z <1}

Now, if we use above conditions and apply Monte Carlo method for our analysis, we will find that the probability for theorem (2) will increase to more than 85% with Average approximately 85% by standard deviation of 0.001. Please see Figure 2

 Figure (2)


Answer to question (2):

Only way to decrease upper stream line is, to divide function of theorem (2) to some numbers. For instance, I apply the Monte Carlo analysis for below functions:

z = f (x, y) = (x + COS (y)) / 4

According to Figure (1), the probabilities are 95% and 85% for my example. In the reference with Monte Carlo analysis, we can say:

P (z <= (x + COS y) /4) > 65%   with Average > 64 % and standard deviation approximately 0.0015

z = f (x, y) = (x + COS (y)) / 6

Figure (1) shows us, the probabilities are 95% and 72.5% for my example. Regarding to Monte Carlo analysis, we can say:

P (z <= (x + COS y) /6) > 60%   with Average approximately 60 % and standard deviation 0.0018

Since theorem (2) divided to 6 is more useful for us, I can say that the Rule of sixty plus (60 %+) is as follows:

P (z <= (x + COS y) /6) > 60%