Ask Your Question

Trouble Using QEPCAD

asked 2020-10-07 21:02:05 +0200

nkauf gravatar image

updated 2020-10-08 10:42:08 +0200

slelievre gravatar image

I'm having trouble doing even relatively basic (at least, it seems relatively basic) simplification in QEPCAD.

For instance, when I try to run the following line of code:

sage: qepcad(-k**2 + 6*k*m - 9*m**2 + 1​ > 0)

(with k, m already set as variables), the computation goes on for much longer than I want it to, and in fact I have yet to see it finish. I'm not really sure why this is the case, or if problems like this just take a long time for QEPCAD (I know that Wolfram Alpha does these very quickly). Really what I want is just to find one integer solution to the above inequality (i.e. k = m = 0) and more generally, I want to be able to take n of these kind of inequalities (I would prefer being able to do higher degrees as well, but I think just quadratic would be fine) and find integers k, m which satisfy all of them, or have the program tell me no such k, m exist. So if there's a different approach I should be taking then please let me know, or if I need to give more information on anything just say so. I have absolutely no experience programming, I'm just trying to write up a calculator for something I'm working on for my math PhD.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-10-08 12:37:19 +0200

Emmanuel Charpentier gravatar image

WorksForMe(TM) on 9.2.rc0 and a freshly installed qepcad:

sage: %time qepcad(-k^2+6*k*m-9*m^2+1>0)
CPU times: user 8.24 ms, sys: 15.8 ms, total: 24 ms
Wall time: 73.4 ms
3 m - k - 1 < 0 /\ 3 m - k + 1 > 0

However, pastingwhat you have posted :

sage: qepcad(-k**2 + 6*k*m - 9*m**2 + 1​ > 0)
  File "<ipython-input-28-63512fea48a6>", line 1
    qepcad(-k**Integer(2) + Integer(6)*k*m - Integer(9)*m**Integer(2) + Integer(1)​ > Integer(0))
SyntaxError: invalid character in identifier

Isn't there an invisible typo ? (Thank Unicode for all those exotic character indiscernible from honest-to-god ASCII to the naked eye...). emacs shows me a zero-width character after the final "1" of the left hand side of your formula. Eliminating it allows to compute the (same) result...

edit flag offensive delete link more


I think the invisible typo comes from copying this from an email sent to my advisor, I just double checked by both copy/pasting what you have as well as manually typing in this particular inequality and it still doesn't work for me. But I guess it is a good start to know that the problem is not with QEPCAD's capabilities but rather with mine. I don't really know what extra info would be helpful here, but I'm doing this on a Jupyter notebook with Sagemath 9.1 as the kernel. There's also an error message I get when I interrupt the kernel that starts with "Keyboard Interrupt Traceback (most recent call last)", would that be helpful to post?

nkauf gravatar imagenkauf ( 2020-10-08 14:36:36 +0200 )edit

A couple remarks :

  • The Sage version might be relevant : 9.2 has got tons of fixes (see this post for a good example). Your qepcad problem might be another.

  • The error message you get when interrupting the Sage kernel is normal and expected : it just tells you that you are the reason of not getting your expected result : in other words : "Hey, boss ! I stopped because you told me so...".

  • Check your qepcad installation log (under $SAGE_ROOT/logs/pkgs/). Did the install went smoothly ?

  • Can you try some simple qepcad examples (manually typed) ? There are some on the original QEPCAD web site,

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2020-10-08 19:03:22 +0200 )edit

When I try to check the log in the Jupyter notebook, I get an invalid syntax error. Same thing if I try putting "sage:" in front.

In terms of examples, for some reason when I copy/pasted an example from the sage: ?qepcad thing, "sage: qepcad('[a x + b > 0]', vars='(a,b,x)')" the program runs (it goes on to the next line, but does not output the answer), whereas if I put "sage: qepcad('[a*x + b > 0]', vars='(a,b,x)')", for some reason it gets stuck again. I have no idea if this narrows anything down. Maybe another thing that factors into it is that I'm using the notebook in my browser rather than downloading anything. I'm sure there's something really basic somewhere that I'm just missing, but I really don't know enough about programming to know what it would be.

nkauf gravatar imagenkauf ( 2020-10-08 22:20:07 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-10-07 21:02:05 +0200

Seen: 628 times

Last updated: Oct 08 '20