soft question – Why does Wolfram Alpha multiply matrices wrong?

Thanks for contributing an answer to Mathematics Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

dataset – In Wolfram Mathematica, who do I query the result of a Counts operation efficiently and conveniently?

Setup

Say, I’m given a dataset, like the one below:

titanic = ExampleData({"Dataset", "Titanic"}); titanic

Answering with:

Sample of the Titanic example data

And I want to count the occurrences of any combination between { "1st", "2nd"} and {"female", "male"}, using the Counts operator on the dataset, like:

genderclasscounts = titanic(All, {"class", "sex"})(Counts)

Gender Class combination counts

Problem statement

This is not a “flat” dataset and I don’t have a clue how to query in the usual way, like:

genderclasscount(Select( ... ), ...)

The resulting dataset doesn’t provide “column” names to be used as parameters in the Select nor can I refer to the number representing the count by a name.

And I’ve no clue how to express an Association as a value in a Select!?

Furthermore, try genderclasscount(Print), this demonstrates the values presented to the operation over this dataset are just numbers!

An unsatisfactory attempt

Of course, I can “flatten” the Counts result, by doing something horrific and inefficient like:

temp = Dataset((row (Function) 
     AssociationThread({"class", "sex", "count"} -> row)) /@ (Nest(
      Normal, genderclasscounts, 3) /. 
     Rule({Rule("class", class_), Rule("sex", sex_)}, 
       count_) -> {class, sex, count}))

Flattened Counts over a dataset result

In this form it is easy to query a count result:

First@temp(Select(#class == "1st" (And) #sex == "female" &), "count")

Question

So, my questions are

  1. How can I query the (immediate) result of the Count operation in a convenient and efficient fashion, like using a Select operation on the resulting dataset? Or, if that is not possible;

  2. Is there an efficient and convenient transformation of the Counts result dataset possible facilitating such a query? With “convenient” I mean, for example, that you just provide the dataset and the transformation handles the rest. So, not something like I’ve shown above in my unsatisfactory “solution” 😉

Thanks for reading this far and I’m looking forward to anwsers and inspiration.

/@nanitous

How can I reproduce the Wolfram Language base64-encoded string using the command line tool?

With Wolfram language:

In[7]:= ExportString["foo中文", "Base64"]

Out[7]= "Zm9vXDo0ZTJkXDo2NTg3

With the next command line software I can think of

echo -n 'foobar中文' | openssl base64                                                                       
Zm9vYmFy5Lit5paH

Why the difference? What is the best way to reproduce Mathematica behavior?

Record – Save an audio file in HSQLDB in Wolfram Mathematica

Thank you for your reply to Mathematica Stack Exchange!

  • Please be sure answer the question. Provide details and share your research!

But avoid

  • Ask for help, clarify, or respond to other answers.
  • Make statements based on opinions; Support them with references or personal experiences.

Use MathJax to format equations. MathJax reference.

For more information, see our tips on writing great answers.

Version 12 – ImageContents does not work with the Wolfram Cloud iOS app

I tried to use the experiment ImageContents() Function, introduced in MMA 12, on my PC (with Mathematica) and on my iPad (with Wolfram Cloud App). It worked on my PC, but not on Wolfram Cloud. It was said to download about 200 MB of data from their servers, just like Mathematica. However, nothing happened after the download.

This was the picture: https://i.stack.imgur.com/6Fd4n.jpg

And this is the result on my PC: ImageContents results

Does anyone know what it's about?

Wolfram Cloud – Can Mathematica evaluate a continued fraction with the Gauss $ K $ operator?

I don't know much about Mathematica and this is a rather unusual notation.

How can I tell Mathematica to rate this? $$ 1 + underset {i = 1} { overset { infty} {K}} frac {(- 1) ^ {i-1}} {i + 1} $$

Where $$ underset {i = 1} { overset { infty} {K}} frac {a_i} {b_i} = cfrac {a_ {1}} {b_ {1} + cfrac {a_ {2} } {b_ {2} + cfrac {a_ {3}} {b_ {3} + cfrac {a_ {4}} {b_ {4} + ddots {}}}} $$

Do I have to convert to another notation first? Or can I create a custom notation like this? Thanks for your time.

P.S. I work in my browser in Wolfram Cloud Open Access if that is important.

Extract COVID AdministrativeDivision data from Wolfram Resource

Wolfram provides the COVID case data in a form that is conveniently formatted for processing in Mathematica.

Access is via:

data2 = ResourceData(ResourceUpdate("Epidemic Data for Novel Coronavirus COVID-19"))

(Syntax of swish in its response to COVID-19 Wolfram Data Repository Retrieval)

Enter the image description here

Suppose I want to extract the case data for New York State. Since the state of NY is in the third row, I can get it with the following information:

data2((3))

However, the state of NY may not always be in the third row. Instead, how would I extract this row by naming it in the AdministrativeDivision ("New York, USA") column?

Compatibility – Is there a place where Wolfram Research announces important changes for new versions?

Mathematica version 12.1 was introduced numerous Break changes (as far as my code base is concerned). Here is a simple example:

ClearAll(sml, mol1, mol2);
sml = "O=C(NCC1=CC(NC(C2=CN=C3C=CC=CN23)=O)=C(C)C=C1)NC4=CC=CC(F)=C4";
mol1 = Molecule(sml);
mol2 = Molecule(sml, IncludeHydrogens -> True);

MoleculeContainsQ(mol1, MoleculePattern({"C", "H", "H"}, {Bond({1, 2}), Bond({1, 3})}))
(* Returns False in Version 12.1; used to return True in Version 12.0 *)

MoleculeContainsQ(mol2, MoleculePattern({"C", "H", "H"}, {Bond({1, 2}), Bond({1, 3})}))
(* Returns True in Version 12.1 *)

For what it's worth, I look at the behavior of Version 12.0 being correct.

This is not the only change. There are many others. But instead of scolding, I just want to know if there is a way to find out about such changes before uninstalling the old version and installing the new one. Is there a place where Wolfram Research announces API changes and asks for feedback?

Thank you in advance.