Simplify the following expression to A'D' + A'B - boolean-algebra

𝑓 = 𝐴'𝐡'𝐢'𝐷' + 𝐴'𝐡'𝐢𝐷' + 𝐴'𝐡𝐢'𝐷 + 𝐴'𝐡𝐢𝐷 + 𝐴'𝐡𝐢𝐷' + 𝐴'𝐡'𝐢𝐷' + 𝐴𝐡'𝐢D'
I've done the K-Map for the following and got A'D' + A'B but can't figure out how to show the simplification that the K-Map derived.

Related

How to solve R not recognizing white-space after long line of code?

I am trying to add equations to my code which are quite long. When I do so, R does not quite grasp where the end of the equation is and when I go to the next line filled with whitespace, it puts the cursor to the middle of the line rather than the beginning, as usually.
When I run the code, it ignores the end of the long equation, as one can tell from the console output
+ # 3.b) Initialize ODEs
+ initialstate <- c(
Error: unexpected symbol in:
"# 3.b) Initialize ODEs
initialstate"
-- so using + rather than > -- following this input:
C_PL_s_ss = (Rin_s*(CL_dis_s*T1*T2*V_IS + CL_dis_s*T1*T2*V_PE + CL_dis_s*T1*T2*V_PL + CL_dis_s*T1*T3_s*V_IS + CL_dis_s*T1*T4_s*V_IS + CL_dis_s*T2*T3_s*V_IS + CL_dis_s*T2*T4_s*V_IS + CL_dis_s*T2*T5_s*V_IS + CL_dis_s*T2*T6_s*V_IS + CL_dis_s*T1*T3_s*V_PE + CL_dis_s*T1*T4_s*V_PE + CL_dis_s*T2*T3_s*V_PE + CL_dis_s*T2*T4_s*V_PE + CL_dis_s*T2*T5_s*V_PE + CL_dis_s*T2*T6_s*V_PE + CL_dis_s*T1*T3_s*V_PL + CL_dis_s*T1*T4_s*V_PL + CL_dis_s*T2*T3_s*V_PL + CL_dis_s*T2*T4_s*V_PL + CL_dis_s*T2*T5_s*V_PL + CL_dis_s*T2*T6_s*V_PL + CL_dis_s*T1*T2*V_IS*delta_Rin_s_TI + CL_dis_s*T1*T3_s*V_IS*delta_Rin_s_TI + CL_dis_s*T1*T4_s*V_IS*delta_Rin_s_TI + CL_dis_s*T2*T3_s*V_IS*delta_Rin_s_TI + CL_dis_s*T2*T4_s*V_IS*delta_Rin_s_TI + CL_dis_s*T2*T5_s*V_IS*delta_Rin_s_TI + CL_dis_s*T2*T6_s*V_IS*delta_Rin_s_TI + CL_dis_s*CLup_s^2*V_IS*V_PE*V_VC + CL_dis_s*CLup_s^2*V_IS*V_PL*V_VC + CLup_s^2*T1*V_IS*V_PE*V_PL + CLup_s^2*T2*V_IS*V_PE*V_VC + CLup_s^2*T2*V_PE*V_PL*V_VC + CLup_s^2*T3_s*V_IS*V_PE*V_PL + CLup_s^2*T4_s*V_IS*V_PE*V_PL + CLup_s^2*T5_s*V_IS*V_PE*V_PL + CLup_s^2*T6_s*V_IS*V_PE*V_PL + CLup_s^2*T3_s*V_PE*V_PL*V_VC + CLup_s^2*T4_s*V_PE*V_PL*V_VC + CLup_s^3*V_IS*V_PE*V_PL*V_VC + CL_dis_s*CLup_s*T1*V_IS*V_PE + CL_dis_s*CLup_s*T1*V_IS*V_PL + CL_dis_s*CLup_s*T2*V_IS*V_VC + CL_dis_s*CLup_s*T2*V_PE*V_VC + CL_dis_s*CLup_s*T2*V_PL*V_VC + CL_dis_s*CLup_s*T3_s*V_IS*V_PE + CL_dis_s*CLup_s*T4_s*V_IS*V_PE + CL_dis_s*CLup_s*T5_s*V_IS*V_PE + CL_dis_s*CLup_s*T6_s*V_IS*V_PE + CL_dis_s*CLup_s*T3_s*V_IS*V_PL + CL_dis_s*CLup_s*T4_s*V_IS*V_PL + CL_dis_s*CLup_s*T5_s*V_IS*V_PL + CL_dis_s*CLup_s*T6_s*V_IS*V_PL + CL_dis_s*CLup_s*T3_s*V_PE*V_VC + CL_dis_s*CLup_s*T4_s*V_PE*V_VC + CL_dis_s*CLup_s*T3_s*V_PL*V_VC + CL_dis_s*CLup_s*T4_s*V_PL*V_VC + CLup_s*T1*T2*V_IS*V_PE + CLup_s*T1*T2*V_PE*V_PL + CLup_s*T1*T3_s*V_IS*V_PE + CLup_s*T1*T4_s*V_IS*V_PE + CLup_s*T2*T3_s*V_IS*V_PE + CLup_s*T2*T4_s*V_IS*V_PE + CLup_s*T2*T5_s*V_IS*V_PE + CLup_s*T2*T6_s*V_IS*V_PE + CLup_s*T1*T3_s*V_PE*V_PL + CLup_s*T1*T4_s*V_PE*V_PL + CLup_s*T2*T3_s*V_PE*V_PL + CLup_s*T2*T4_s*V_PE*V_PL + CLup_s*T2*T5_s*V_PE*V_PL + CLup_s*T2*T6_s*V_PE*V_PL + CL_dis_s*CLup_s*T2*V_IS*V_VC*delta_Rin_s_TI + CLup_s*T1*T2*V_IS*V_PE*delta_Rin_s_TI + CLup_s*T1*T3_s*V_IS*V_PE*delta_Rin_s_TI + CLup_s*T1*T4_s*V_IS*V_PE*delta_Rin_s_TI + CLup_s*T2*T3_s*V_IS*V_PE*delta_Rin_s_TI + CLup_s*T2*T4_s*V_IS*V_PE*delta_Rin_s_TI + CLup_s*T2*T5_s*V_IS*V_PE*delta_Rin_s_TI + CLup_s*T2*T6_s*V_IS*V_PE*delta_Rin_s_TI + CLup_s^2*T2*V_IS*V_PE*V_VC*delta_Rin_s_TI))/(CLR_s*CL_dis_s*T1*T2 + CLR_s*CL_dis_s*T1*T3_s + CLR_s*CL_dis_s*T1*T4_s + CLR_s*CL_dis_s*T2*T3_s + CLR_s*CL_dis_s*T2*T4_s + CLR_s*CL_dis_s*T2*T5_s + CLR_s*CL_dis_s*T2*T6_s + CLR_s*CL_dis_s*CLup_s^2*V_IS*V_VC + CL_dis_s*CLup_s^2*Q*V_IS*V_VC + CLR_s*CLup_s^2*T1*V_IS*V_PE + CLR_s*CLup_s^2*T2*V_PE*V_VC + CL_dis_s*CLup_s^2*T1*V_IS*V_PE + CL_dis_s*CLup_s^2*T1*V_IS*V_PL + CL_dis_s*CLup_s^2*T2*V_PE*V_VC + CL_dis_s*CLup_s^2*T2*V_PL*V_VC + CLR_s*CLup_s^2*T3_s*V_IS*V_PE + CLR_s*CLup_s^2*T4_s*V_IS*V_PE + CLR_s*CLup_s^2*T5_s*V_IS*V_PE + CLR_s*CLup_s^2*T6_s*V_IS*V_PE + CLR_s*CLup_s^2*T3_s*V_PE*V_VC + CLR_s*CLup_s^2*T4_s*V_PE*V_VC + CL_dis_s*CLup_s^2*T3_s*V_IS*V_PE + CL_dis_s*CLup_s^2*T4_s*V_IS*V_PE + CL_dis_s*CLup_s^2*T5_s*V_IS*V_PE + CL_dis_s*CLup_s^2*T6_s*V_IS*V_PE + CL_dis_s*CLup_s^2*T3_s*V_IS*V_PL + CL_dis_s*CLup_s^2*T4_s*V_IS*V_PL + CL_dis_s*CLup_s^2*T5_s*V_IS*V_PL + CL_dis_s*CLup_s^2*T6_s*V_IS*V_PL + CL_dis_s*CLup_s^2*T3_s*V_PE*V_VC + CL_dis_s*CLup_s^2*T4_s*V_PE*V_VC + CL_dis_s*CLup_s^2*T3_s*V_PL*V_VC + CL_dis_s*CLup_s^2*T4_s*V_PL*V_VC + CLR_s*CLup_s^3*V_IS*V_PE*V_VC + CL_dis_s*CLup_s^3*V_IS*V_PE*V_VC + CL_dis_s*CLup_s^3*V_IS*V_PL*V_VC + CLup_s^2*Q*T2*V_PE*V_VC + CLup_s^2*Q*T3_s*V_IS*V_PE + CLup_s^2*Q*T4_s*V_IS*V_PE + CLup_s^2*Q*T5_s*V_IS*V_PE + CLup_s^2*Q*T6_s*V_IS*V_PE + CLup_s^2*Q*T3_s*V_PE*V_VC + CLup_s^2*Q*T4_s*V_PE*V_VC + CLup_s^3*Q*V_IS*V_PE*V_VC + CLup_s^2*T1*T2*V_PE*V_PL + CLup_s^2*T1*T3_s*V_PE*V_PL + CLup_s^2*T1*T4_s*V_PE*V_PL + CLup_s^2*T2*T3_s*V_PE*V_PL + CLup_s^2*T2*T4_s*V_PE*V_PL + CLup_s^2*T2*T5_s*V_PE*V_PL + CLup_s^2*T2*T6_s*V_PE*V_PL + CLup_s^3*T1*V_IS*V_PE*V_PL + CLup_s^3*T2*V_PE*V_PL*V_VC + CLup_s^3*T3_s*V_IS*V_PE*V_PL + CLup_s^3*T4_s*V_IS*V_PE*V_PL + CLup_s^3*T5_s*V_IS*V_PE*V_PL + CLup_s^3*T6_s*V_IS*V_PE*V_PL + CLup_s^3*T3_s*V_PE*V_PL*V_VC + CLup_s^3*T4_s*V_PE*V_PL*V_VC + CLup_s^4*V_IS*V_PE*V_PL*V_VC + CLR_s*CL_dis_s*CLup_s*T1*V_IS + CLR_s*CL_dis_s*CLup_s*T2*V_VC + CLR_s*CL_dis_s*CLup_s*T3_s*V_IS + CLR_s*CL_dis_s*CLup_s*T4_s*V_IS + CLR_s*CL_dis_s*CLup_s*T5_s*V_IS + CLR_s*CL_dis_s*CLup_s*T6_s*V_IS + CLR_s*CL_dis_s*CLup_s*T3_s*V_VC + CLR_s*CL_dis_s*CLup_s*T4_s*V_VC + CL_dis_s*CLup_s*Q*T2*V_VC + CL_dis_s*CLup_s*Q*T3_s*V_IS + CL_dis_s*CLup_s*Q*T4_s*V_IS + CL_dis_s*CLup_s*Q*T5_s*V_IS + CL_dis_s*CLup_s*Q*T6_s*V_IS + CL_dis_s*CLup_s*Q*T3_s*V_VC + CL_dis_s*CLup_s*Q*T4_s*V_VC + CLR_s*CLup_s*T1*T2*V_PE + CL_dis_s*CLup_s*T1*T2*V_PE + CL_dis_s*CLup_s*T1*T2*V_PL + CLR_s*CLup_s*T1*T3_s*V_PE + CLR_s*CLup_s*T1*T4_s*V_PE + CLR_s*CLup_s*T2*T3_s*V_PE + CLR_s*CLup_s*T2*T4_s*V_PE + CLR_s*CLup_s*T2*T5_s*V_PE + CLR_s*CLup_s*T2*T6_s*V_PE + CL_dis_s*CLup_s*T1*T3_s*V_PE + CL_dis_s*CLup_s*T1*T4_s*V_PE + CL_dis_s*CLup_s*T2*T3_s*V_PE + CL_dis_s*CLup_s*T2*T4_s*V_PE + CL_dis_s*CLup_s*T2*T5_s*V_PE + CL_dis_s*CLup_s*T2*T6_s*V_PE + CL_dis_s*CLup_s*T1*T3_s*V_PL + CL_dis_s*CLup_s*T1*T4_s*V_PL + CL_dis_s*CLup_s*T2*T3_s*V_PL + CL_dis_s*CLup_s*T2*T4_s*V_PL + CL_dis_s*CLup_s*T2*T5_s*V_PL + CL_dis_s*CLup_s*T2*T6_s*V_PL)
# 3.b) Initialize ODEs
initialstate <- c(*[...some other cade that work unless you add the long equation above...])*
Bizarrely, if I write more than one of these longer equations, it recognises the end of exactly every second one, i.e. it pairs two, which leads to the issue. For the ones that it does not pair, it also has the > rather than + in the respective place in the console. I could get it to work fine for 5 short equations.
As I am exporting the equations from Matlab (as I need to use the symbolics toolbox to find the solution), I checked whether any of
cutting whitespaces out online, incl. equation by equation, so line by line
pasting the many equations into Word to see whether there is a difference in the tabs/new lines etc. between the equations for which the pasting interrupts between equations appropriately versus not (no both are the same)
past into text editor before moving to R, incl. equation by equation, so line by line
using my local version of R studio rather than the R studio workbench I was using previously
would help but they did not.
I have tried for a long time now and would be super grateful for any insight!
R is built with a maximum line length of 4096 characters as shown in this thread. Lines that are longer than that will need to be broken.

Data shows n/a in a row where a value should be, why does it not show the code its supposed to show?

TrainAttempt$PriceGuess <- with(TrainAttempt,
0+(LotFrontage*1)+(LotArea*1)+
(MasVnrArea*1)+(BsmtFinSF1*1)+
(BsmtFinSF2*1)+
(BsmtUnfSF*1)+
(TotalBsmtSF*1)+
(GrLivArea*1) +
(BsmtFullBath*1) +
(BsmtHalfBath*1) +
(FullBath*1) +
(HalfBath+0) +
(BedroomAbvGr*1) +
(KitchenAbvGr*1) +
(TotRmsAbvGrd*1) +
(Fireplaces*1) +
(OpenPorchSF*1) +
(GarageArea*1) +
(WoodDeckSF*1) +
(OpenPorchSF+0) +
(EnclosedPorch*1) +
(ScreenPorch*1) +
(PoolArea*1) +
(MiscVal*1))

The leading minor of order 4 is not positive definite in npplreg

I am running the following code:
mydata1 = data.frame(dataset)
mydata1 <- na.omit(mydata1)
bw <- npplregbw(mydata1$X1 ~ mydata1$X2 + mydata1$X3 + mydata1$X4 + mydata1$effect_1993 + mydata1$effect_1994 + mydata1$effect_1995 + mydata1$effect_1996 + mydata1$effect_1997 + mydata1$country_2 + mydata1$country_3 + mydata1$country_4 + mydata1$country_5 + mydata1$country_6 + mydata1$effect_1998 + mydata1$effect_1999 + mydata1$effect_2000 + mydata1$effect_2001 + mydata1$effect_2002 + mydata1$effect_2003 + mydata1$effect_2004 + mydata1$effect_2005 + mydata1$effect_2006 + mydata1$effect_2007 + mydata1$effect_2008 + mydata1$effect_2009 + mydata1$effect_2010 + mydata1$effect_2011 + mydata1$effect_2012 + mydata1$effect_2013 + mydata1$effect_2014 + mydata1$effect_2015 + mydata1$effect_2016 + mydata1$effect_2017 + mydata1$effect_2018 + mydata1$effect_2019 + mydata1$effect_2020 + mydata1$effect_2021|mydata1$X5 + mydata1$X6 + mydata1$X7 + mydata1$X8, data = mydata1, na.action = na.omit)
summary(bw)
reg_np <- npplreg(bw)
The code is running fine except the last command which gives the following error:
Error in chol.default(t(model.matrix(model)) %*% model.matrix(model)) :
the leading minor of order 4 is not positive definite
My data do not have 0 (except the fixed effects data) or NA values.
Is there any way I can proceed with the npplreg regression without getting that error?
Thanks a lot in advance

Simplify boolean equation from truth table

I need help simplifying the following to the simplest terms. Boolean algebra just doesn't quite click with me yet, any help is appreciated.
(!A!B!C)+(!AB!C)+(!ABC)+(A!B!C)+(A!BC)+(AB!C)
I got it to the following, but I don't know where to go from here:
!A(!B!C + B!C + BC) + A(!B!C + B(XOR)C)
If you are curious and want to check my previous work, I got the original equation from the truth table:
Initially we have A(~B~C + ~BC + ~CB) + ~A(~B~C + B~C + BC)
First Term: A(~B~C + ~BC + ~CB)
= A(~B(~C + C) + ~CB)
= A(~B(True) + ~CB)
= A(~B + ~CB)
= A((~B + ~C)(~B + B))
= A((~B + ~C)(True))
= A(~B + ~C)
Second Term: ~A(~B~C + B~C + BC)
= ~A(~C(~B + B) + BC)
= ~A(~C(True) + BC)
= ~A(~C + BC)
= ~A((~C + C) (~C + B))
= ~A((True) (~C + B))
= ~A(~C + B)
So First Term + Second Term becomes: ~A(~C + B) + A(~B + ~C)
= ~A~C + ~AB + A~B + A~C
= AxorB + ~A~C + A~C
= AxorB + ~C(~A + A)
= AxorB + ~C(True)
= AxorB + ~C
Hence we end up with AxorB + ~C

Error in First Differences Model

I am very new to R and trying to tackle some homework that is giving me trouble. I think I have just about everything worked out, except last glitch.
When I create the following First differences models (using my two panel datasets):
out00 <- plm(logmrate ~ 0 + lawchange + logbeertaxa + y70 + y71 + y72 + y73 + y74 + y75 + y76 + y77 + y78 + y79 + y80 + y81 + y82 + y83 + y84 + y85 + y86 + y87 + y88 + y89 + y90 + y91 + y92 + y93 + y94 + y95 + y96, data = pdt.deaths, model = 'fd')
out01 <- plm(logmrate ~ 0 + lawchange + logbeertaxa + y70 + y71 + y72 + y73 + y74 + y75 + y76 + y77 + y78 + y79 + y80 + y81 + y82 + y83 + y84 + y85 + y86 + y87 + y88 + y89 + y90 + y91 + y92 + y93 + y94 + y95 + y96, data = pdt.deaths1, model = 'fd')
stargazer(out00, type="text")
stargazer(out01, type="text")
I get this error term returned for both models:
Error in crossprod(t(X), beta) : non-conformable arguments
The variable "lawchange" is a 1 or 0 variable, and each of the year variables ("y70"..."y96") are year indicator variables to account for time

Resources