I want to create an iterative sequence for two Vectorfunctions, where both are dependent on the same variables and i
represents the vector.
For simplicity let's assume this Scenario:
P=Piecewise[{{G[i],i=1,...,n},{F,{i=n+1}}]
n=10
1) Suppose the first step is to evaluate G[1].
2) Dependend on that, the next step has to be the Evaluation of F.
3) Recursivley, G[2] has to be evaluated dependent on the outcome of F.
And so on until n=10 is reached. My question is, how to implement such an iterative process with which commands to us?
Edit
I couldn't find a way to create a simple in-/output example to clearify the problem, but maybe words and a simplified description of the model, which I am working on, helps to understand the issue better.
Assumptions:
n = The number of banks inside a system = 10
P=Piecewise[{{G[i],i=1,...,n},{F,{i=n+1}}]
Where G[i]
is a realized payment vector for a banks obligation and F
is a function which assesses the quantity of assets in a market. Both depend on a price p
for this asset and all Banks[i]
hold this asset.
G[i]
looks like this:
G[i]=Piecewise[{{o[i], if solvent}, {a*o[i], if not solvent}}]
Where o[i]
is the real obligation, which can be paid if Bank[i]
is solvent
and a*o[i]
is for simplicity a fraction parameter a€[0,1]
which the bank[i]
has to pay if insolvent.
1) Let's assume Bank[1]
is insolvent and has to sell assets in the market to pay off debts, then the price p
for the asset will fall according marked to market assumptions.
2) For Bank[2]
it is now necessary to evaluate how many assets are in the market with the function F
and how it is standing about its networth, since a devaluation of the asset price in this environment has an negative impact on its networth.
3) Now Bank[2]
has to calculate its payment vector G[2]
4) If Bank[2]
is still solvent, there will be no more devaluation of the assetprice p
, but if it is insolvent, the same procedure repeats itself from step one to step 3 for Bank[3]
.
So the task of these functions is to find an equilibrium price after iteratively calculating the situation for each Bank starting from Bank[1] to [n]
.