Reputation: 109
I am currently working on a concentration based gas dispersion model and I am having some issues with the data analysis. I currently have a model that outputs Concentration formula as a function of x,y,z. I was wondering if it was possible to write a program that would find all of the points (x,y,z) that output a concentration value greater than 0. For example
My equation looks something like this (The equation is a lot more complicated, but you see what I mean).
Concentration Value (ppm) = C(x,y,z) = (2*X) + (5*Y) + 6(Z^2)
and I am looking for all int plots (so x, y, and z) that return a concentration value of greater than 0 as well as the corresponding output value.
Any help or links would be greatly appreciated.
Upvotes: 1
Views: 403
Reputation: 32571
Not sure if this is what you need, but try this simple approach, which uses the [-10,10)
values range for x
,y
and z
:
class Program
{
static void Main(string[] args)
{
int x = 0, y = 0, z = 0;
int x1 = -10, x2 = 10,
y1 = -10, y2 = 10,
z1 = -10, z2 = 10;
for (int ix = x1; ix < x2; ix++)
{
for (int iy = y1; iy < y2; iy++)
{
for (int iz = z1; iz < z2; iz++)
{
var result = (2 * ix) + (5 * iy) + 6 * (Math.Pow(iz, 2));
if (result > 0)
{
Console.WriteLine("x {0} y {1} z {2} : {3}",
ix, iy, iz, result);
}
}
}
}
}
}
Upvotes: 3