Mathematica does not evaluate cell to a numerical value - wolfram-mathematica

I simply want to calculate the log[2] e. g. in Mathematica and the result I get is log[2]. The same happens with sin and so on. But it calculates something like 5*5. What is the reason for this? I can't find anything in the settings and I tried some commands too (like calculate).

The first word of the function must be capitalized log -> Log
Log[1.9999999999000005*^-13]
-29.240459028412648`

Try log[2.] instead of log[2].

Related

Google Sheets/Excel: Checking if a time falls within a range

I'm trying to find a way to see if I can find a way to determine if a time that I stipulate falls between two other times. For example:
Start End
11:33:48 11:53:48
12:20:22 12:38:21
12:39:27 13:00:09
14:16:23 14:20:49
14:20:54 14:22:56
Then, I want to check if a cell (here the value of 12:50 in cell E30) falls between ANY two values in a range in THE SAME ROW. For me, I can get the obvious way to check for this in one row, and this simple version totally works:
=If(AND(E30>A4,E30<B4), "TRUE", "FALSE")
However, I want to check if that number falls within ANY of the values within the ROWS above cells in a range, and I can't get that to work. For example, I tried this and it didn't work:
=If(AND(E30>A:A,E30<B:B), "TRUE", "FALSE")
I also tried a simple countif variation but that didn't do it either:
=COUNTIFS(A:A,">"&E30,B:B,"<"&E30)
Any advice on how to adjust one of these formulas to get it to work?
Try switching the angle brackets around:
=COUNTIFS(A:A,"<"&E30,B:B,">"&E30)
I think this should work for the above data set -
=IF((FILTER(A2:B6, D2>A2:A6,D2<B2:B6)),TRUE,FALSE)
This will give you if there is any match or not.
For the number of rows count that match -
=ROWS((FILTER(A2:B6, D2>A2:A6,D2<B2:B6)))
Alomsot =IF(Q2>R2,IF(AND($X$16>HOUR(Q2),$X$16<(HOUR(R2)+12)),1,0),IF(AND(HOUR($X$14)>=HOUR(Q2),HOUR($X$14)<=HOUR(R2)),1,0))

Excel - Search an exact match within a string

I'm currently struggling on finding the formula that will resolve my problem.
Here's the status quo:
In Sheet 1, column A, I have a set of string, such as:
/search.action?gender=men&brand=10177&tag=10203&tag=10336
/search.action?gender=women&brand=11579&tag=10001&tag=10138
/search.action?gender=men&brand=12815&tag=10203&tag=10299
/search.action?gender=women&brand=1396&tag=10203&tag=10513
/search.action?gender=women&brand=11&tag=10001&tag=10073
/search.action?gender=women&brand=1396&tag=10203&tag=10336
/search.action?gender=women&brand=13
In Sheet 2, column A, I have a set of strings such as:
brand=10177
brand=12815
brand=13
brand=1396
brand=11579
Finally, in sheet 1, column B will be my "filter" with the formula I'm struggling to find. The goal of my formula is to detect in any of the strings in sheet 1 if one of the string in sheet 2 is present (as an exact match!). Indeed, now it only finds approximative matches. As you can see, the row 5 shouldn't return anything. But with my current formula it does.
Here's the formula:
{=IFERROR(INDEX('Sheet 2'!$A$1:$A$5;MATCH(1;COUNTIF(A1;"*"&'Sheet 2'!$A$1:$A$5&"*");0));"")}
Any idea on the matter?
Please note that I don't want to use VBA, macros, but only a formula.
Thanks a lot for your help!
Following will solve your problem I guess:
=VLOOKUP(MID(A2,FIND("&",A2)+1,FIND("&",A2,FIND("&",A2)+1)-FIND("&",A2)-1),Sheet2!A:A,1,FALSE)
Basically with find function I have identified the start and length of the string in between "&" signs. and used in vlookup.
Another point to mention is this formula is only looking for the first 2 "&" signs.
For completeness, here is another solution based on this answer
=INDEX(Sheet2!$A$1:$A$5,MAX(IF(ISERROR(FIND(Sheet2!$A$1:$A$5,A1)),-1,1)*(ROW(Sheet2!$A$1:$A$5)-ROW(Sheet2!$A$1)+1)))
This is a bit more general and it doesn't matter how many search tags there are.
However as it stands it would match brand=13 in the second sheet with brand=1396 in the first sheet. To avoid that you could add an ampersand to the search strings:-
=INDEX(Sheet2!$A$1:$A$5,MAX(IF(ISERROR(FIND(Sheet2!$A$1:$A$5&"&",A1&"&")),-1,1)*(ROW(Sheet2!$A$1:$A$5)-ROW(Sheet2!$A$1)+1)))
This formula throws a #VALUE error if there is no match: to avoid this, you would need to put an IFERROR statement round it:-
=IFERROR(INDEX(Sheet2!$A$1:$A$5,MAX(IF(ISERROR(FIND(Sheet2!$A$1:$A$5&"&",A1&"&")),-1,1)*(ROW(Sheet2!$A$1:$A$5)-ROW(Sheet2!$A$1)+1))),"")
All these are array formulae.

Multiple Conditions In Excel

I entered the below formula into excel. When I copy the formula down for the rest of my sheet, it gives the "eligible" value to all fields even when the J field has no data to pull from. What am I missing?
=IF(J3<=40,"Eligible",IF(AND(J3<=30, J3>=39.99), "Particially","No"))
Blank is interpreted as zero, so J<=40 will be true. You probably need to put an IsNumber check in there too.
=IF(AND(J3<=40,ISNUMBER(J3)),"Eligible",....
EDIT: based on your comment, you can simplify this by reversing the logic, and you don't need an and clause.
=IF(J1<30,"no",IF(J1<40,"partial","eligible"))
I think logic is wrong.
Try this (included remark by John Barça):
=IF(ISNUMBER(J3),IF(J3<30,"Eligible",IF(AND(3<=39.99,J3=30),"Partially","no")),"Not a number")
Or please describe what you want to get.

Using SWI-Prolog Interactively - Output Taken off

I'm using SWI-Prolog interactively. When I run my query, I get a prefix of the output and the rest is taken off (marked using the string ...|...). Is this normal or should I go back and fix my program?
The number of items shown is controlled by a prolog flag.
You can remove it by issuing
remove_max_depth:-
current_prolog_flag(toplevel_print_options,Options),
select(max_depth(_), Options, NOptions)->
set_prolog_flag(toplevel_print_options, NOptions); true.
Nothing to worry about. It's just abbreviating it visually... just press 'w' (write) to display the complete internal representation of the list.

Mathematica output formatting

How does Mathematica decide when to round numbers in its output? For example,
giving the input
250000.5
gives the output
2500001
While
25000.5
is indeed printed as
25000.5
N[] isn't helpful here either, I need to use NumberForm[] to get it to actually print 250000.5 as 250000.5
I'm a Mathematica newbie, and I'm sure its ridiculously easy to control this threshold for when it starts ignoring decimals in its output, but could somebody please point me in the right direction?
another option for you to try, you can go to options and change the default PrintPrecision from 6 to say 16, and now you will see that it will print what you typed above
after I changed that to 16 (click on the field itself, and type 16 into the field to replace the 6, and hit return), then
Nasser is correct that PrintPrecision is the right setting.
You have a number of options for its use. You can set it Globally or for the specific Notebook using the Options Inspector. You can also use it directly with Style:
Style[250000.5, PrintPrecision -> 10]
250000.5
You can set it temporarily for one session like this:
SetOptions[$FrontEndSession, PrintPrecision -> 10]
Finally you can set it using Style Sheets (select cell type Output).
In the default TraditionalForm and StandardForm output modes Mathematica only shows a certain number of most significant digits. You can use InputForm to get the full precision number.

Resources