Post Reply 
[SOLVED] Given (|) in programming?
05-29-2016, 04:57 AM (This post was last modified: 06-21-2016 11:27 AM by CH3791.)
Post: #1
[SOLVED] Given (|) in programming?
Hi, I am trying to make a program that calculates x intercepts. Right now, it can calculate the answer, but I can't make it restrict the domain.

I understand you can do this directly in the CAS app:
solve(SIN(x)=0,x)|{(x>-10) AND (x<10)}
{-3*pi, -2*pi, -pi, 0, pi, 2*pi, 3*pi}

But when I put that kind of syntax into my program, it returns "Error: Invalid input".
Code:

EXPORT XINT(expression,domainlow,domainhigh)
BEGIN
  LOCAL equation;
  LOCAL variable;
  LOCAL answer;
  variable:="x";
  equation:=EXPR(LOWER(STRING("0="+expression)));
  answer:=CAS.solve(EVAL(equation),EVAL(variable))|{(EVAL(variable)>-10) AND (EVAL(variable)<10)};
  print("X-INTERCEPT(S)");
  print(answer);
  RETURN "DONE";
END;

Any ideas?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[SOLVED] Given (|) in programming? - CH3791 - 05-29-2016 04:57 AM
RE: Given (|) in programming? - roadrunner - 05-29-2016, 08:24 AM
RE: Given (|) in programming? - CH3791 - 05-29-2016, 08:47 AM



User(s) browsing this thread: 1 Guest(s)