Hi I have difficulty understand the following code, can anyone help to explain? Thanks in advance!
model.AddBoolOr(x, y.Not(), b)
model.AddImplication(b, x)
model.AddImplication(b, y)
It is most likely wrong. It should be x.not() in the addboolor
It encodes b <=> x && y
Related
I have a problem in maple, someone can help me.
I want to write collect function generality in maple. Example, i have
f := a(ak+bk+c)+b(bk+ck+a)+c(ak+ck+b)
I call gcollect(f,a^2+b^2+c^2) then we get
k(a^2+b^2+c^2)+abk+ack+bck+ab+ac+bc,
or gcollect(f,a^2+b^2) then we get
k(a^2+b^2)+kc^2+abk+ack+bck+ab+ac+bc.
Thank you very much.
Here's something to start with..
restart:
gcollect:=(expr,t)->
thaw(collect(algsubs(t=freeze(t),
expand(expr)),freeze(t),_rest)):
f := a*(a*k+b*k+c)+b*(b*k+c*k+a)+c*(a*k+c*k+b):
gcollect(f, a^2+b^2+c^2);
gcollect(f, a^2+b^2+c^2, expand);
gcollect(f, a^2+b^2);
gcollect(f, a^2+b^2, expand);
I am new to SML and don't know how to use the "or" operator in an if statement. I would be really grateful if someone explains it to me, since I have checked multiple sources and nothing seems to work.
Thank you !
In SML, logical or is called orelse and logical and is called andalso.
As an example
if x = 2 orelse x = 3 orelse x = 5
then print "x is a prime"
else print "x is not a prime (also, I don't believe in primes > 5; please respect my beliefs)"
Hi I have this expression XY'Z+YY'+X+XY'+XZ ( ' means not) Can anyone please show me the simplification of this expression? Thanks in advance.
This is what i got so far:
XY'Z+YY'+XY'+X(1+Z)
XY'Z+YY'+XY'+XY'+X
Y'(XZ+Y)+X(1+Y')
Y'(XZ+Y)+X
I know 1+Y=1 but 1+Y'=1 too?
Y'(XZ+Y)+X
change this back to:
XY'Z+YY'+X
Then simplify a bit:
XY'Z+YY'+X
YY' + X(1+Y'Z)
0 + X
X
u and v and r should be vectors.
function [g] = kast(m,k,u,v,n)
g = 9.80;
t = 0:0.1:n;
r = [u.*(m/k).*(1-exp(-k.*t./m),((-m*g/k).*t) + (v.*(m/k).+m^2*g/k^2).*( 1.-exp(-k.*t./m)))];
plot(t,r)
end
I've spent about an hour, but I cannot work out what is wrong. Are any of you able to spot my error?
Thank you for your time.
Kind regards,
Marius
.+m^2
looks suspicious. Try remove the dot before the +. And add a closing bracket before the comma in the assignment of r.
Can anyone help me with a little Boolean algebra. Wolfram alpha doesn't seem to like this very much. The problem is huge so I'm only showing a small small part of it.
( ( A' or B or C )' or ( A or D )' or D')'
thank you.
This is the whole problem.
the blue is what i have posted
The DNF form of your written equation is (A'D)+(BD)+(CD)
More forms on Wolfram|Alpha
If the ' in your sample code stands for negativity, then in C# or Java you'd have:
boolean A,B,C,D;
and then:
if(!(!A || B || C) || !(A || D) || !D)
{
//Do something
}