Expression to be reduced by using Boolean algebra - boolean

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

Related

AddBoolOr and AddImplication in cp_sat solver

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

Maple strange results while solving for complex equation

I'm trying to make Maple solve a complex equation, but it produces an incorrect result.
The following images tells it all :
At (3) I would expect to get something close to 1 (as (2) shows), yet it gives me something that doesn't make any sense. Is it that the || (to express the complex number modulus) operator has another significance in the solve() function?
The more appropriate function here is fsolve.
Example 1
restart:
G:=(w,L)->(5+I*L*2*Pi*w)/(150+I*L*2*Pi*w);
evalf(5*abs(G(10,1)));
fsolve(5*abs(G(10,L))=%,L=0..10)
Example 2
As above, you need to specify the interval L=0..1 where the solution might be.
G:=(f,L)->(256.4+I*L*2*Pi*f)/(256.4+9845+I*L*2*Pi*f);
evalf(5*abs(G(20000,0.03602197444)));
fsolve(5*abs(G(20000,L))=%,L=0..1);
If you are facing difficulties to specify the interval then you should plot it first, it will give you an idea about it?
plot(5*abs(G(20000,L)),L=0..1)
Restrict the values of L in the solve command with the assuming command.
Example 1:
G:= (w,L) -> (50+I*L*2*Pi*w)/(150+I*L*2*Pi*w);
result := evalf(5*abs(G(10,1)));
solve({5*abs(G(10,L)) = result},L) assuming L::real;
{L = 1.000000000}, {L = -1.000000000}
Example 2:
G:=(f,L) -> (256.4+I*2*Pi*L*f)/(256.4+9845+I*2*Pi*L*f);
result := 5*abs(G(20000,0.03602197444));
solve({5*abs(G(20000,L)) = result},L) assuming L::real;
{L = 0.03602197445}, {L = -0.03602197445}

SML or if boolean

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)"

Elusive Matlab variable syntax error

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.

How can i make the 'if' selection sturucture work for an array of inputs while doing a loop with a 'while' structure?

A=[21.04 93.3 133.5 158.5 182.5];
k=0;
while k<=length(A)
k=k+1;
if A(k) <=170
B=(4*10^-5).*(A).^2 + (0.0096).*A + 0.012;
else
B=(0.0005).*(A).^2 - (0.1503).*A + 14.131;
end
end
I was trying to use conditions to solve a problem with two outcomes, but Matlab kept telling me i cant use 'if' for an array selection. how can i improve it? please help me.
This should work as it stands now, but there are a few issues I see. It seems like you are trying to make B dependent on the value of A. I don't think you are doing what you intend to do. A much simpler way would be:
B=zeros(size(A))
B(A<=170)=(4*10^-5).*(A(A<=170)).^2 + (0.0096).*A(A<=170) + 0.012)
B(A>170)=(0.0005).*(A(A>170)).^2 - (0.1503).*A(A>170) + 14.131;
Also, you are looping too much. A for loop would be much easier to follow, and useful in this case:
for k=1:length(A)
if A(k) <=170
B=(4*10^-5).*(A).^2 + (0.0096).*A + 0.012;
else
B=(0.0005).*(A).^2 - (0.1503).*A + 14.131;
end
end