Here is expression that we have to minimize with boolean algebra:
y = /A/B/C/D + /A/B/CD + /AB/CD + A/B/C/D + A/B/CD + A/BC/D + A/BCD.
I know little bit about that, please help!!!
The answer is /A/CD + /B/C + A/B
You need to put those minterms on a Karnaugh Map and find the minimized form after grouping.
Related
I'm new to Mathematica I was hoping that this is a functionality built in. I am calculating the conditional entropy of a table and have the following 4 variables:
a = 1/8*Log[(1/8)/(1/2)] + 1/16*Log[(1/16)/(1/2)] + 1/16*Log[(1/16)/(1/2)] + 1/4*Log[(1/4)/(1/2)]
b = 1/16*Log[(1/16)/(1/4)] + 1/8*Log[(1/8)/(1/4)] + 1/32*Log[(1/32)/(1/4)] + 0
c = 1/32*Log[(1/32)/(1/8)] + 1/32*Log[(1/32)/(1/8)] + 1/16*Log[(1/16)/(1/8)] + 0
d = 1/32*Log[(1/32)/(1/8)] + 1/32*Log[(1/32)/(1/8)] + 1/32*Log[(1/32)/(1/8)] + 0
Then the final calculation is:
a + b + c + d
I was hoping there was a way to display the expanded a + b + c + d as a output so I can right-click/copy as latex to past into a document so I don't have to type it out. I can't figure out how to do it though. I'm guessing there is a way to expand those variables in the output to show the full calculation but maybe it is not possible. Thanks for any help.
I'm not sure how expanded you wanted the mathematical expression to be. See if the following expression is in the form you want to convert to LaTeX: (1/16 Log[1/(16/4)]+1/8 Log[1/(8/4)]+1/32 Log[1/(32/4)]+0)+(1/32 Log[1/(32/8)]+1/32 Log[1/(32/8)]+1/16 Log[1/(16/8)]+0)+(1/32 Log[1/(32/8)]+1/32 Log[1/(32/8)]+1/32 Log[1/(32/8)]+0)+(1/8 Log[1/(8/2)]+1/16 Log[1/(16/2)]+1/16 Log[1/(16/2)]+1/4 Log[1/(4/2)]).
You can get that by using HoldForm on the right-hand side of your assignments. Then use TeXForm[a+b+c+d] to convert:
a = HoldForm[
1/8*Log[(1/8)/(1/2)] + 1/16*Log[(1/16)/(1/2)] +
1/16*Log[(1/16)/(1/2)] + 1/4*Log[(1/4)/(1/2)]];
b = HoldForm[
1/16*Log[(1/16)/(1/4)] + 1/8*Log[(1/8)/(1/4)] +
1/32*Log[(1/32)/(1/4)] + 0];
c = HoldForm[
1/32*Log[(1/32)/(1/8)] + 1/32*Log[(1/32)/(1/8)] +
1/16*Log[(1/16)/(1/8)] + 0];
d = HoldForm[
1/32*Log[(1/32)/(1/8)] + 1/32*Log[(1/32)/(1/8)] +
1/32*Log[(1/32)/(1/8)] + 0];
TeXForm[a + b + c + d]
I am searching for a solution to just and only consider real forex pairs in my loop. I don't want CFDs, commodities, silver, gold, etc. to be included because they have a complete different logic when it comes to calculating pips etc. etc. (I want to use the data for a FX dashboard).
How can I implement a filter to do so without building if-statements for every FX pair existing?
If possible, the solution should be independent of the broker used (since the offered FX pairs might be different from broker to broker, so a common approach would be the all-in solution).
This is my current code that doesn't seperate between fx and non fx:
/*
2.) Create a string format for each pending and running trade
*/
int live_orders = OrdersTotal();
string live_trades = "";
for(int i=live_orders; i >= 0; i--)
{
if(OrderSelect(i,SELECT_BY_POS)==false) continue;
live_trades = live_trades +
"live_trades|" +
version + "|" +
DID + "|" +
AccountNumber() + "|" +
IntegerToString(OrderTicket()) + "|" +
TimeToString(OrderOpenTime(), TIME_DATE|TIME_SECONDS) + "|" +
TimeToString(OrderCloseTime(), TIME_DATE|TIME_SECONDS) + "|" +
IntegerToString(OrderType()) + "|" +
DoubleToString(OrderLots(),2) + "|" +
OrderSymbol() + "|" +
DoubleToString(OrderOpenPrice(),5) + "|" +
DoubleToString(OrderClosePrice(),5) + "|" +
DoubleToString(OrderStopLoss(),5) + "|" +
DoubleToString(OrderTakeProfit(),5) + "|" +
DoubleToString(OrderCommission(),2) + "|" +
DoubleToString(OrderSwap(),2) + "|" +
DoubleToString(OrderProfit(),2) + "|" +
"<" + OrderComment() + ">|";
}
This is probably the easiest way. Prefix symbols might be a problem (e.g. mEURUSD) but easily solved by shifting the StringSubstr values by the prefix size. Suffix is not a problem as we take the first 6 chars of the symbol string.
const string FX_CURRENCIES[]={"EUR","GBP","USD","NZD","AUD","CHF","CAD","JPY"};//add other currencies if needed
bool isFxPair(const string symbol){
return StringLen(symbol)>=6 && getCurrencyIdx(StringSubStr(symbol,0,3))>=0 &&
getCurrencyIdx(StringSubStr(symbol,3,3))>=0;
}
int getCurrencyIdx(const string smb){
for(int i=ArraySize(FX_CURRENCIES)-1;i>=0;i--){
if(FX_CURRENCIES[i]==smb)
return i;
}
return -1;
}
Use of CStringArray and caching FX symbols might be another good idea that may potentially work faster, but it seems to use the similar logic as above(but you'll have to sort the cache every time you add something in order to have CStringArray collection to work fast).
There is no direct method to ask whether a symbol is FX, CFD, Stock, Crypto or anything else.
I am not sure what to do when R tells me it can't find a package that has been installed. Any suggestions?
model1 = glm( RESPONSE ~ AGE + as.factor(SEX) + SYSBP +
as.factor(DIABETES) + LDLC + as.factor(BPMEDS) +
as.factor(CURSMOKE) + HDLC + HEARTRTE + TIME,
data=trVal, family=binomial(link=logit))
glm.predict has been installed successfully
library(glm.predict)
glm.predict(model1)
Error: could not find function "glm.predict"
glm.predict is the package's name, not a function. What you are looking for is probably the function discrete.changes() from the glm.predict package.
the question is to give a possible formula for the rth term.
i'm able to solve two questions but rest i can't seems to be of a different way or like weird.as i'm studying alevels i think there's a common rule or maybe an easy way to solve sequence related problems.i never understood sequence well enough-it's just that hard for me.
6 18 54 162
i'm able to solve it by 2*3^r
4 7 12 19
by r^2+3
but
4 12 24 40 60
i'm trying so many ways but i can't find the answer.i think there's a common rule for solving all these not much marks are there so it should be solved in an easy way but i'm not getting how to.please help
Here's a formula in R for the sequence:
g <- function(n) 6*n + 2*n^2 + 4
g(0:4)
[1] 4 12 24 40 60
Here is one way to solve this relation. First, recognize that it is quadratic as the difference is an arithmetic sequence (linear).
Then note that g(x + 1) = g(x) + 8 + 4x. Represent g(x) = a*x^2 + b*x + c.
Then:
g(x+1) = a(x+1)^2 + b(x+1) + c = g(x) + 8 + 4x = a*x^2 + b*x + c + 8 * 4x
ax^2 + 2ax + a + b*x + b + c = a*x^2 + b*x + c + 8 + 4x
Thus
2ax + a +b = 8 + 4x
As this holds for all x, it must be that 2ax = 4x or a = 2. Thus
4x + 2 + b = 8 + 4x
So b = 6. With these known, c is determined by g(0) = c = 4.
So i have used the following code
If (txtbedroom + txtkitchen + txtbathroom + txtlivingroom + 0) > 9 Or (txtbedroom + txtkitchen + txtbathroom + txtlivingroom + 0) < 7 Then
If MsgBox("Please ensure the number of rooms you entered is entered correctly.", vbYesNo) = vbNo Then
Exit Sub
End If
End If
even if the result of the following is less than 9 and greater than 7 the if function still gets satisfied... what can be done??
Anyway I solved the problem. I used a variable and the code CInt() like x = CInt(txtbedroom) to convert the text to number and then it worked...