result expanded to maximum (more) on wolfram alpha query - wolfram-mathematica

I am using mathematica to query wolfram alpha for a query. for that purpose I use:
WolframAlpha["prime minister of france", "PodPlaintext"]
I took the options from here: http://reference.wolfram.com/language/ref/WolframAlpha.html
My problem is that I need info that is hidden at first and is located under the more option on the page. I was unable to find a way to query the full data (after more was clicked) from the mathematica.
Any ideas how to achieve it?

For anyone who encounters this problem in the future, I will post the answer in case someone else will have this problem. You have to use the more option combined with asynchronous and change the timeout:
WolframAlpha["prime minister of france", Asynchronous -> True,
PodStates -> {"More"}, TimeConstraint -> 20000]

Related

Excel cube: create new measure as sum of existing measures

I have no idea what to put in the formula box, and the help (https://support.microsoft.com/en-us/office/create-a-measure-in-power-pivot-d3cc1495-b4e5-48e7-ba98-163022a71198?ns=excel&version=90&syslcid=1033&uilcid=1033&appver=zxl900&helpid=149601&ui=en-us&rs=en-us&ad=us) says simple enter a formula.
Is there any documentation?
Neither
=SUM(dsv_FactIncome[ClientValue], dsv_FactIncome[PartnerValue])
nor
=SUMX(dsv_FactIncome[ClientValue], dsv_FactIncome[PartnerValue])
are acceptable to it, either.
This is DAX and your syntax is incorrect. Try
=SUM(dsv_FactIncome[ClientValue]) + SUM(dsv_FactIncome[PartnerValue])

Mathematica does not evaluate cell to a numerical value

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].

A "display" that always displays in prolog

I have a predicate check(Data,Res) that checksDats according to some rules and returns Res (a function result on Data, assuming Data answers to several criteria).
I have another function generate(N,Data) which generates a N-size Data.
My main program begins with generating many 1-size Data, then if none answered the criteria, we go on to 2-size Data and so on until we reach a certain M upper limit.
main(M):- next_number(N,M), generate(N,Data), check(Data,Res).
However, the program runs for very long time. I wanted to make sure it does not get stuck. For this, I wanted to print the generated Data each time before its being checked. But adding display did not assist, because it only actually displayed if the entire statement was true.
That's not what I want.
I want to keep track of the progran using display, similarly to System.out.println in Java.
Is there any other function that displays anyway? Or an idea how to use display in a way that will always display, regardless if the Data answered the criteria or not?
I thought to do:
(check(Data,Res) -> display(Data);display(Data)).
But I am not sure. Any ideas?
Your long process is likely to be within check - or more precisely, that check fails for most data, causing the system to backtrack repeatedly.
If you display a result in check, you'll have line upon line of tracing. Instead, you could add a write statement to generate, or even to your number generation:
main(M):-
next_number_and_tick(N,M),
generate(N,Data),
check(Data,Res).
next_number_and_tick(N,M) :-
next_number(N,M),
write('Tick - now doing '),
writeln(N).
Upon backtracking, the program will signal the data size it is now working on, giving you an idea of the volume of work it is doing.
The problem in the way you use display is that the entire statement must be true for it to display. Your idea of using "if-then" is good but not accurate. If you want to use it, you should "trick" prolog the following way:
new_check(Data,Res) :- (check(Data,Res) -> display('Victory!'),!; display('Failed Data: '), display(Data), nl, fail).
This way, if the check fails, you will get a report on which Data failed, and if it succeeded everything stops (assuming you want only 1 solution. If you want more, remoce the ! predicate).

Report Builder Expressions

Im new to Report Builder and having issues with some expressions that Im trying to implement in a report. I got the standard ones to work however as soon as I try any distinctions, I get error messages. Over the last couple weeks, Ive tried many combinations, read the expression help, google and looking at other questions at internet sites. To reduce my frustrations, I even would jump to other expressions and walk away hoping I would have different insight coming back.
Its probably something simple or something I dont know about writing expressions.
Im hoping that someone can help with these expressions; they are the versions I get the least errors with(usually just expression expected) and show what Im trying to accomplish.
=IIF((Fields!RECORDFLAG.Value)='D',COUNTDISTINCT(Fields!TICKETNUM.Value),0)
=IIF((Fields!TRANSTYPE.Value)='1' and (Fields!RECORDFLAG.VALUE)='A' or
'B',SUM(Fields!DOLLARS.Value),0)
=IIF((Fields!TRANSTYPE.Value)='1' and
(Fields!RECORDFLAG.VALUE)='P',SUM(Fields!DOLLARS.Value),0)
=Sum([DOLLARS] case when [RECORDFLAG]='P' then -1*[DOLLARS])
Thank You.
=IIF((Fields!RECORDFLAG.Value)=”D”,COUNTDISTINCT(Fields!TICK‌​ETNUM.Value))
The error message gives you the answer here - no false part of the iif() has been specified. Use =IIF((Fields!RECORDFLAG.Value)=”D”,COUNTDISTINCT(Fields!TICK‌​ETNUM.Value), 0)
=IIF((Fields!TRANSTYPE.Value)="1" and (Fields!RECORDFLAG.VALUE)="A" or "B",SUM(Fields!DOLLARS.Value),0)
This is not how an OR works in SSRS. Use:
=IIF((Fields!TRANSTYPE.Value)="1" and (Fields!RECORDFLAG.VALUE="A" or Fields!RECORDFLAG.Value = "B"),SUM(Fields!DOLLARS.Value),0)
The 0s are returned due to your report design. countdistinct() is an aggregate function - it's meant to be used on a set of data. However, your iif() is only testing on a per row basis - you're basically saying "if the current row is thing, count all the distinct values" which doesn't make sense. There are a couple of ways forward:
You can count the number of times a certain value occurs in a given condition using a sum(). This is not the same as the countdistinct(), but if you use =sum(iif(Fields!RECORDFLAG.Value = "D", 1, 0)) then you will get the number of times RECORDFLAG is D in that set. Note: this requires the data to be aggregated (so in SSRS, grouped in a tablix).
You can use custom code to count distinct values in a set. See https://itsalocke.com/aggregate-on-a-lookup-in-ssrs/. You can apply this even if you have only one dataset - just reference the same one twice.
You can change the way your report works. You can group on Fields!RECORDFLAG.Value and filter the group to where Fields!RECORDFLAG.Value = "D". Then in your textbox, use =countdistinct(Fields!TICKETNUM.Value) to get the distinct values for TICKETNUM when RECORDFLAG is D.

Translate WolframAlpha query to Mathemtaica code

There is a way to convert question from wolframalpha to mathematica code?For example, I asked the question "notable people born in France" on [wolframalpha:http://www.wolframalpha.com/], and I want to do the same on mathematica (Version 10). Thanks.
As mentioned in a comment above, you can enter "=" at the beginning of a cell and then type your query.
However, you can also get more fine-grained control using WolframAlpha["your query"] or WolframAlpha["your query", format].
Further information is available at the following URLs:
http://reference.wolfram.com/language/ref/WolframAlpha.html
http://reference.wolfram.com/language/guide/WolframAlphaIntegration.html

Resources