Advertisement
rsvaco

tal pract 2 ej 3

Oct 27th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. Ejercicio3[afd_] := Module[{i, res, pozos, nopozos, transaux},
  2. res = {{}, {}, {}, {}, {}};
  3. pozos = {};
  4. nopozos = {};
  5. transaux = {};
  6.  
  7. pozos = Complement[afd[[1]], afd[[5]]];
  8. Print[pozos];
  9. For[i = 1, i <= Length[pozos], i++,
  10. If[Length[Cases[afd[[3]], {pozos[[i]], _, pozos[[i]]}]] ==
  11. Length[afd[[2]]],
  12. transaux =
  13. Join[transaux, Cases[afd[[3]], {pozos[[i]], _, pozos[[i]]}]];
  14. ,
  15. AppendTo[nopozos, pozos[[i]]];
  16. ];
  17. ];
  18.  
  19. pozos = Complement[pozos, nopozos];
  20. Print[pozos];
  21. Print[nopozos];
  22. Print[transaux];
  23.  
  24. For[i = 1, i <= Length[pozos], i++,
  25. transaux = Join[transaux, Cases[afd[[3]], {_, _, pozos[[i]]}]];
  26. ];
  27. Print[transaux];
  28.  
  29. res[[1]] = Complement[afd[[1]], pozos];
  30. res[[2]] = afd[[2]];
  31. res[[3]] = Complement[afd[[3]], transaux];
  32. res[[4]] = afd[[4]];
  33. res[[5]] = res[[5]];
  34.  
  35.  
  36. Return[res];
  37. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement