How do I discretize a closed surface in 4 dimensional space?

1 view (last 30 days)
I have this equation
(0.029066)*x1+(252.31)*x1^2+(0.031769)*x2+(171.45)*x2^2+(408.16)*x2*x1+(0.0057924)*x3+(8.3255)*x3^2+(91.306)*x3*x1+(74.526)*x3*x2+(0.00371)*x4+(2.8417)*x4^2+(53.04)*x4*x1+(43.83)*x4*x2+(9.6999)*x4*x3=0.732
This is an equation of a closed surface involving 4 variables. I need to create discrete points on this surface. Is there a way to do this? Thank you

Accepted Answer

John D'Errico
John D'Errico on 31 Jul 2016
Well, you asked ONLY to create a set of points on the surface. You said nothing about connectivity of those points.
Just pick some values for three of the variables. Then solve for the 4th.
syms x1 x2 x3 x4
E = (0.029066)*x1+(252.31)*x1^2+(0.031769)*x2+(171.45)*x2^2+(408.16)*x2*x1+(0.0057924)*x3+(8.3255)*x3^2+(91.306)*x3*x1+(74.526)*x3*x2+(0.00371)*x4+(2.8417)*x4^2+(53.04)*x4*x1+(43.83)*x4*x2+(9.6999)*x4*x3 - 0.732;
>> x4vals = double(solve(subs(E,{x1,x2,x3},{0 0 0})))
x4vals =
-0.508188700568546
0.506883144035485
>> x4vals = double(solve(subs(E,{x1,x2,x3},{.1 0 0})))
x4vals =
-1.42466062559039
-0.443133300580565
>> x4vals = double(solve(subs(E,{x1,x2,x3},{0 .1 0})))
x4vals =
-1.27072949700066
-0.272962659103084
>> x4vals = double(solve(subs(E,{x1,x2,x3},{1 0 0})))
x4vals =
-9.333094626456 - 1.19765692116068i
-9.333094626456 + 1.19765692116068i
So, just collect up sets of solutions for x4, given values for each of x1,x2,x3. Stop looking in a direction when it starts to yield only complex solutions.
You won't be able to plot the mess, since it is a 4 dimensional "thing". Unless your hyper-dimensional monitor is working. Mine is broken.
Admittedly, if you look at the function, you will realize it is just a quadratic polynomial in x4, for any fixed values of the other variables. So you could create constraints on the variables x1,x2,x3 that cause this quadratic to have real solutions. Pretty easy to do for this, but for a more complex problem, less easy in general.
c = subs(E,x4,0);
b = subs(simplify((E - c)/x4),x4,0);
a = simplify((E - b*x4 - c)/x4^2);
vpa(simplify(ans))
ans =
- 54.715708*x1^2 + 10.013312*x1*x2 - 8.8916488*x1*x3 + 0.063169391199999982297108580553413*x1 - 27.76896*x2^2 + 3.1710972*x2*x3 - 0.035893269199999984417215337373364*x2 - 0.54623339*x3^2 + 0.0061322056800000041781246729044597*x3 + 8.3205113641
So, when this expression is greater than or equal to zero, as a function of x1,x2,x3, then one or two real solutions exist. (Be careful, since I've only reported a few digits of those coefficients for brevity there.)

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!