Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. ExponentVector := proc (Qx,At) local x,results,tmp,Bt,a,counter2,counter;
  2. with(LinearAlgebra):
  3. tmp := Qx:
  4. Bt := Factorbase(At):
  5. x := 1:
  6. results :=[]:
  7. a := Matrix(1,nops(Bt)):
  8. counter := 0:
  9. counter2 := nops(Bt):
  10. if Qx < 0 then
  11. tmp := Qx*(-1);
  12. a[1,1] := 1;
  13. end if;
  14. while x = 1 do
  15. if Bt[-1] = 2 then
  16. if type(tmp/Bt[-1],integer) then
  17. tmp := tmp/Bt[-1];
  18. counter := counter +1:
  19. a[1,counter2] := counter:
  20. else
  21. x := 0;
  22. fi;
  23. fi;
  24. if type(tmp/Bt[-1],integer)and Bt[-1] > 2 then
  25. print(Bt[-1]);
  26. tmp := tmp/Bt[-1];
  27. counter := counter +1:
  28. else
  29. a[1,counter2] := counter:
  30. counter := 0:
  31. counter2 := counter2 - 1;
  32. Bt := subsop(-1=NULL,Bt):
  33. fi;
  34. if Bt[-1] = -1 then
  35. x := 0;
  36. fi;
  37. od;
  38. if tmp > 1 then
  39. a[1,1] := -2 fi;
  40. Transpose(a)
  41. end proc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement