43visualizaciones (últimos 30días)
Mostrar comentarios más antiguos
Valeria Ramirez Ariiola hace alrededor de 24 horas
Comentada: Valeria Ramirez Ariiola hace alrededor de 13 horas
Abrir en MATLAB Online
Hi guys, I have a code that should give me some results. Unfortunately when I insert k>3, the program collapses and says there isn't enought RAM to run it. I'm just texting to know if anyone has ever worked with symbolic variables before and can help me. If anyone knows how to work with this please I'll be really glad to talk to you via email or Telegram.
function [S,Gnew,Enew] = BGroebner1(k)
M = 3*k + 1;
x = sym('x');
r = sym('r');
c = sym('c', [1 M+1]);
% Define the sum of monomials with negative coefficients
CC = x;
for i = 1:M+1
CC = CC + c(1,i)*x^(-i);
end
sM = expand(CC^(3));
for i = M:1:3*M+3
sM = subs(sM, x^(-i), r);
end
sMnew = sM;
sMnew = subs(sMnew,r,0);
sMnew1 = expand(x^(M-1)*sMnew);
C =coeffs(sMnew1,x);
E =sym('E',[1,M-1]);
for i= M-1:-1:1
E(1,M-i) = C(1,i);
end
% Calculate Groebner basis,
num_syms = M+1;
syms_cell = cell(1, num_syms);
for i = M+1:-1:1
syms_cell{i} = sym(['c', num2str(M+2-i)]);
end
c = [syms_cell{:}];
G = gbasis(E,c,"MonomialOrder",'Lexicographic');
J = (M+1)*M;
sM1 = expand(CC^{M});
sMnew2 = expand(x^(J)*sM1);
E2 = coeffs(sMnew2,x);
EM = E2(J);
EM1=E2(J-1);
F= sym('F');
Enew = [E,EM,EM1+F];
% Groebner basis with (E^M)_1, (E^M)_2 + F
Gnew = gbasis(Enew,[F c],"MonomialOrder",'Lexicographic');
%% Calculate the solutions of the E_{1}, E_{2},...
eqn =sym('eqn', [1 M-1]);
for i=1:1:M-1
eqn(i)= Enew(i)==0;
end
d = sym('c', [1 M+1]);
S = vpasolve(eqn,d);
end
Looking forward your replies.
0 comentarios Mostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos
Mostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos
Iniciar sesión para comentar.
Iniciar sesión para responder a esta pregunta.
Respuestas (2)
John D'Errico hace alrededor de 20 horas
Editada: John D'Errico hace alrededor de 20 horas
Abrir en MATLAB Online
When k is even slightly large (apparently 4 is large enough) things go to hell. Did I not answer this question before? I know I wrote the answer, since I computed eqn when k=2. In fact, I even set my computer running on the case when k==4. I broke out of the computations before it melted into a pile of hot slag though.
eqn =
[3*c1^2 + 3*c3 == 0, 3*c4 + 6*c1*c2 == 0, c1^3 + 6*c3*c1 + 3*c2^2 + 3*c5 == 0, 3*c2*c1^2 + 6*c4*c1 + 3*c6 + 6*c2*c3 == 0, 3*c1^2*c3 + 3*c1*c2^2 + 6*c5*c1 + 6*c4*c2 + 3*c3^2 + 3*c7 == 0, 3*c4*c1^2 + 6*c3*c1*c2 + 6*c6*c1 + c2^3 + 6*c5*c2 + 3*c8 + 6*c3*c4 == 0]
That is only for k=2. When k is larger, we see a far more messy, far less managable system of nonlinear polynomial equations. Any computations with those equations for values of k as large as k=4 prbably have many thousands, if not millions of terms in them.
Now, do you have an infinitely large, infinitely fast computer? Probably not, at least, not unless you are a character on a TV show or in the movies, where computers always are immensely powerful.
It is very easy to write code for an insolvable problem, or even one that is practically insoluble today on any computer you will find in your lap or a desktop. I'm sorry, but there is no magic to be found here. (And please don't send me e-mail pleading for direct e-mail consiulting. I'm saying this because you seem to be asking for someone to perform that service for you.)
What should you do? Well, you might turn the problem into one that fsolve can handle. vpasolve still uses symbolic computations, and they wil get incredibly messy, and incredibly CPU intensive. But since fsolve will be working purely in double precision arithmetic, it will have at least a chance of finding a solution. The problem is, the system you are computing will still be immensely messy. Just generating the equations is itself a computational nightmare. So you will not want to perform all of those computations using symbolic tools. You will need to work in floating point all the way. That means you need to completely reformulate how this problem will be handled.
I'm sorry, but the easy problems were all solved many years ago.
1 comentario Mostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Mostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Valeria Ramirez Ariiola hace alrededor de 13 horas
Enlace directo a este comentario
https://la.mathworks.com/matlabcentral/answers/2129796-someone-that-works-with-symbolic-variables#comment_3190331
Hey dude, you are really mean with me, what's your problem?. I'm just asking for some support online. If you are not going to help then do not comment on my publications. I have seen that you have commented on both of them in a disrepectul way and I do not care about your personal opinions. Thanks
Iniciar sesión para comentar.
Walter Roberson hace alrededor de 20 horas
Abrir en MATLAB Online
When k = 4,
size(char(sM1))
ans =
1 945926142
and it takes numerous minutes just to calculate the char(sM1) .
You have an explosion in terms that makes calculations impractical.
G = gbasis(E,c,"MonomialOrder",'Lexicographic');
The results in G are not used, so there is no point in computing that.
0 comentarios Mostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos
Mostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos
Iniciar sesión para comentar.
Iniciar sesión para responder a esta pregunta.
Se ha producido un error
No se puede completar la acción debido a los cambios realizados en la página. Vuelva a cargar la página para ver el estado actualizado.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom(English)
Asia-Pacífico
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
Comuníquese con su oficina local