0

I am working on solving inequality problems using prolog.I have found a code and it solves ax+b>=0 type equations.

The code I have used is as follows.

:-use_module(library(clpr)).
dec_inc(left,right):-
      copy_term(left-right,Copyleft-Copyright).
      tell_cs(Copyleft).
      max(Copyright,right,Leq).
      tell_cs(Leq).

max([],[],[]).
max([E=<_|Ps],[_=<P1|P1s],[K=<P1|Ls]):-
      sup(E,K),
      max(Ps,P1s,Ls).

tell_cs([]).  
tell_cs([C|Cs]):-
      {C},
      tell_cs(Cs).

for example

  1. when we give {2*X+2>=5}. it gives the correct answer. {X>=1.5}.

    2.But if I enter fraction like {(X+3)/(3*X+1)>=1}. it gives {1- (3+X)/ (1+3.0*X)=<0.0}.

How can I solve this type of inequality questions to find the final answer.(questions which include fractions).
Please help me.
If there is any learning material I can refer please let me know.

false
  • 10,182
  • 12
  • 93
  • 182
ict
  • 105
  • 1
  • 5

1 Answers1

1

library(clpr) documentation advises that it deals with non linear constraints only passively, so you're out of luck. You need a more sophisticated algebra system.

CapelliC
  • 57,813
  • 4
  • 41
  • 80
  • Thanks.And what is the easiest way to solve this without coding a new program.Any changes I can do???Any place to find guidance code ????/ – ict Nov 23 '14 at 07:58