I want to find a solution of the system $$A x = 0,\quad x>0,\ x\in\mathbb{Z}^d$$ where the matrix $A$ has integer entries. With a single solution I am happy. There is a way to do this? If not, can you recommend me a software that will do this?


closed as off-topic by Daniel Lichtblau, bobthechemist, m_goldberg, Αλέξανδρος Ζεγγ, John Doty Dec 31 '18 at 16:18

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Daniel Lichtblau, bobthechemist, Αλέξανδρος Ζεγγ, John Doty
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ Try the NullSpace function. $\endgroup$ – bbgodfrey Dec 19 '18 at 2:28
  • 1
    $\begingroup$ See the tutorial on Solving Linear Systems in the Documentation Center $\endgroup$ – Bob Hanlon Dec 19 '18 at 4:15
  • 1
    $\begingroup$ One possibility: Make the list of equations that this corresponds to, then us FindInstance with Integers as the domain. $\endgroup$ – march Dec 19 '18 at 4:40
  • 1
    $\begingroup$ the problem with NullSpace is that it give me real solutions; I need positive integers solution. I'll try with FindInstance $\endgroup$ – Veridian Dynamics Dec 19 '18 at 14:11
  • 1
    $\begingroup$ How big is $A$ typically? I found NullSpace to give me rational answers for some matrices I experimented with, up to 500 x 500 $\endgroup$ – MikeY Dec 19 '18 at 21:26

The function NullSpace[ ] works for me. Create a 500 x 500 matrix of integers

mat = Table[RandomInteger[20], {500}, {500}];

Lower its rank by replacing the first row with the last, resulting in a non-zero null space

mat[[1]] = mat // Last;

Unleash NullSpace[ ]

ns = NullSpace[mat]//Flatten;

Take a look at an element of the null space


1216466034899617700009841434407142132740354076698767801084521189694612\ 2511069260034455762795401734087601141005623713828124692569095816463659\ 2710502589527463938986193921763074208901887835981221417119041072827306\ 4631271757749595053183961653203952731021162016064130272587654354938130\ 2166261586109017842591056055927581261585252713938627078707082256186125\ 2454225107993701187501220538575122471488423940694811844961551632217472\ 7402283346491551671146711131036290870399960289049677405962387124913893\ 5129941213575270691366951939914110163294844744326279867757146219372314\ 9758713975561168144837106718996451652246452647671496605241216527957861\ 2489768530913764183650725469305319561271500664761383195214912693747729\ 8388438602988835098926610409905688093997412246500694337854741505734072\ 7841449258005930727929096262351940939259156637223692609679347619853288\ 1158801817186466110391244408712790232571183882259409557714353628382559\ 56967261900582775599830869555089887212760688681

If the rows in your null space have at least one that is mixed term (positive and negative) then it is an easy solve from there.

Did fine up to 2000 x 2000 too. Make sure you are keeping everything rational, with no decimal points appearing anywhere in your $A$ matrix.


Not the answer you're looking for? Browse other questions tagged or ask your own question.