So I think I've fixed that problem but made myself a new one by not knowing what I'm doing
I fixed the previous problem by removing a line of code that I'd added because I didn't understand the instructions properly
I've got this to work
X01=QuantityMagnitude[CountryData["Spain","Population"]];
X02=QuantityMagnitude[CountryData["Portugal","Population"]];
A01=CountryData["Spain", "LanguagesFractions"];
A02=CountryData["Portugal", "LanguagesFractions"];
languages=Union[A01[[All,1]],A02[[All,1]]];
# -> ((# /. Append[A01, _ -> 0])*X + (# /. Append[A02, _ -> 0])*Y)/(X01 + X02) & /@ languages
Which gives me this which seems to be correct
{Entity["Language", "Aragonese"] -> 0.00023,
Entity["Language", "Asturian"] -> 0.0026,
Entity["Language", "Basque"] -> 0.012,
Entity["Language", "Calo"] -> 0.00093,
Entity["Language", "CatalanValencianBalear"] -> 0.14,
Entity["Language", "CatalonianSignLanguage"] -> 0.00038,
Entity["Language", "Extremaduran"] -> 0.0042,
Entity["Language", "Fala"] -> 0.00022,
Entity["Language", "Galician"] -> 0.067,
Entity["Language", "Gascon"] -> 0.000080,
Entity["Language", "MirandaDoDouro"] -> 0.00028,
Entity["Language", "Portuguese"] -> 0.18,
Entity["Language", "RomaniVlax"] -> 9.2*10^-6,
Entity["Language", "Spanish"] -> 0.59,
Entity["Language", "SpanishSignLanguage"] -> 0.0021}
But I'm getting an error when I add the full list of countries, could someone tell me what I'm doing wrong please? I get the error
Part::partd: Part specification Missing[NotApplicable][[All,1]] is longer than depth of object. >>
Union::heads: Heads Part and List at positions 24 and 1 are expected to be the same. >>
When I enter:
X01 = QuantityMagnitude[
CountryData["Republic of Angola", "Population"]];
X02 = QuantityMagnitude[CountryData["Anguilla", "Population"]];
X03 = QuantityMagnitude[
CountryData["Antigua and Barbuda", "Population"]];
X04 = QuantityMagnitude[CountryData["Bangladesh", "Population"]];
X05 = QuantityMagnitude[CountryData["Barbados", "Population"]];
X06 = QuantityMagnitude[CountryData["Bermuda", "Population"]];
X07 = QuantityMagnitude[CountryData["Botswana", "Population"]];
X08 = QuantityMagnitude[
CountryData["British Virgin Islands", "Population"]];
X09 = QuantityMagnitude[CountryData["Cameroon", "Population"]];
X10 = QuantityMagnitude[CountryData["Cayman Islands", "Population"]];
X11 = QuantityMagnitude[
CountryData["Democratic Republic of the Congo", "Population"]];
X12 = QuantityMagnitude[CountryData["East Timor", "Population"]];
X13 = QuantityMagnitude[CountryData["El Salvador", "Population"]];
X14 = QuantityMagnitude[CountryData["Ghana", "Population"]];
X15 = QuantityMagnitude[CountryData["Guyana", "Population"]];
X16 = QuantityMagnitude[CountryData["Haiti", "Population"]];
X17 = QuantityMagnitude[CountryData["India", "Population"]];
X18 = QuantityMagnitude[CountryData["Indonesia", "Population"]];
X19 = QuantityMagnitude[CountryData["Ivory Coast", "Population"]];
X20 = QuantityMagnitude[CountryData["Jamaica", "Population"]];
X21 = QuantityMagnitude[CountryData["Jordan", "Population"]];
X22 = QuantityMagnitude[CountryData["Kazakhstan", "Population"]];
X23 = QuantityMagnitude[CountryData["Kenya", "Population"]];
X24 = QuantityMagnitude[CountryData["Kosovo", "Population"]];
X25 = QuantityMagnitude[CountryData["Kyrgyzstan", "Population"]];
X26 = QuantityMagnitude[CountryData["Madagascar", "Population"]];
X27 = QuantityMagnitude[CountryData["Malaysia", "Population"]];
X28 = QuantityMagnitude[CountryData["Mongolia", "Population"]];
X29 = QuantityMagnitude[CountryData["Montenegro", "Population"]];
X30 = QuantityMagnitude[CountryData["Morocco", "Population"]];
X31 = QuantityMagnitude[CountryData["Myanmar", "Population"]];
X32 = QuantityMagnitude[CountryData["Nepal", "Population"]];
X33 = QuantityMagnitude[CountryData["Niger", "Population"]];
X34 = QuantityMagnitude[CountryData["Nigeria", "Population"]];
X35 = QuantityMagnitude[CountryData["Pakistan", "Population"]];
X36 = QuantityMagnitude[CountryData["Panama", "Population"]];
X37 = QuantityMagnitude[CountryData["Philippines", "Population"]];
X38 = QuantityMagnitude[CountryData["Rwanda", "Population"]];
X39 = QuantityMagnitude[CountryData["Saudi Arabia", "Population"]];
X40 = QuantityMagnitude[CountryData["South Africa", "Population"]];
X41 = QuantityMagnitude[CountryData["Sri Lanka", "Population"]];
X42 = QuantityMagnitude[
CountryData["Saint Kitts and Nevis", "Population"]];
X43 = QuantityMagnitude[CountryData["Suriname", "Population"]];
X44 = QuantityMagnitude[CountryData["Tajikistan", "Population"]];
X45 = QuantityMagnitude[CountryData["Thailand", "Population"]];
X46 = QuantityMagnitude[
CountryData["Trinidad and Tobago", "Population"]];
X47 = QuantityMagnitude[CountryData["Tunisia", "Population"]];
X48 = QuantityMagnitude[
CountryData["Turks and Caicos Islands", "Population"]];
X49 = QuantityMagnitude[CountryData["Uganda", "Population"]];
X50 = QuantityMagnitude[CountryData["Ukraine", "Population"]];
A01 = CountryData["Republic of Angola", "LanguagesFractions"];
A02 = CountryData["Anguilla", "LanguagesFractions"];
A03 = CountryData["Antigua and Barbuda", "LanguagesFractions"];
A04 = CountryData["Bangladesh", "LanguagesFractions"];
A05 = CountryData["Barbados", "LanguagesFractions"];
A06 = CountryData["Bermuda", "LanguagesFractions"];
A07 = CountryData["Botswana", "LanguagesFractions"];
A08 = CountryData["British Virgin Islands", "LanguagesFractions"];
A09 = CountryData["Cameroon", "LanguagesFractions"];
A10 = CountryData["Cayman Islands", "LanguagesFractions"];
A11 = CountryData["Democratic Republic of the Congo",
"LanguagesFractions"];
A12 = CountryData["East Timor", "LanguagesFractions"];
A13 = CountryData["El Salvador", "LanguagesFractions"];
A14 = CountryData["Ghana", "LanguagesFractions"];
A15 = CountryData["Guyana", "LanguagesFractions"];
A16 = CountryData["Haiti", "LanguagesFractions"];
A17 = CountryData["India", "LanguagesFractions"];
A18 = CountryData["Indonesia", "LanguagesFractions"];
A19 = CountryData["Ivory Coast", "LanguagesFractions"];
A20 = CountryData["Jamaica", "LanguagesFractions"];
A21 = CountryData["Jordan", "LanguagesFractions"];
A22 = CountryData["Kazakhstan", "LanguagesFractions"];
A23 = CountryData["Kenya", "LanguagesFractions"];
A24 = CountryData["Kosovo", "LanguagesFractions"];
A25 = CountryData["Kyrgyzstan", "LanguagesFractions"];
A26 = CountryData["Madagascar", "LanguagesFractions"];
A27 = CountryData["Malaysia", "LanguagesFractions"];
A28 = CountryData["Mongolia", "LanguagesFractions"];
A29 = CountryData["Montenegro", "LanguagesFractions"];
A30 = CountryData["Morocco", "LanguagesFractions"];
A31 = CountryData["Myanmar", "LanguagesFractions"];
A32 = CountryData["Nepal", "LanguagesFractions"];
A33 = CountryData["Niger", "LanguagesFractions"];
A34 = CountryData["Nigeria", "LanguagesFractions"];
A35 = CountryData["Pakistan", "LanguagesFractions"];
A36 = CountryData["Panama", "LanguagesFractions"];
A37 = CountryData["Philippines", "LanguagesFractions"];
A38 = CountryData["Rwanda", "LanguagesFractions"];
A39 = CountryData["Saudi Arabia", "LanguagesFractions"];
A40 = CountryData["South Africa", "LanguagesFractions"];
A41 = CountryData["Sri Lanka", "LanguagesFractions"];
A42 = CountryData["Saint Kitts and Nevis", "LanguagesFractions"];
A43 = CountryData["Suriname", "LanguagesFractions"];
A44 = CountryData["Tajikistan", "LanguagesFractions"];
A45 = CountryData["Thailand", "LanguagesFractions"];
A46 = CountryData["Trinidad and Tobago", "LanguagesFractions"];
A47 = CountryData["Thailand", "LanguagesFractions"];
A48 = CountryData["Trinidad and Tobago", "LanguagesFractions"];
A49 = CountryData["Tunisia", "LanguagesFractions"];
A50 = CountryData["Turks and Caicos Islands", "LanguagesFractions"];
A51 = CountryData["Uganda", "LanguagesFractions"];
A50 = CountryData["Ukraine", "LanguagesFractions"];
languages = Union[A01[[All, 1]], A02[[All, 1]], A03[[All, 1]], A04[[All, 1]],
A05[[All, 1]], A06[[All, 1]], A07[[All, 1]], A08[[All, 1]],
A09[[All, 1]], A10[[All, 1]], A11[[All, 1]], A12[[All, 1]],
A13[[All, 1]], A14[[All, 1]], A15[[All, 1]], A16[[All, 1]],
A17[[All, 1]], A18[[All, 1]], A19[[All, 1]], A20[[All, 1]],
A21[[All, 1]], A22[[All, 1]], A23[[All, 1]], A24[[All, 1]],
A25[[All, 1]], A26[[All, 1]], A27[[All, 1]], A28[[All, 1]],
A29[[All, 1]], A30[[All, 1]], A31[[All, 1]], A32[[All, 1]],
A33[[All, 1]], A34[[All, 1]], A35[[All, 1]], A36[[All, 1]],
A37[[All, 1]], A38[[All, 1]], A39[[All, 1]], A40[[All, 1]],
A41[[All, 1]], A42[[All, 1]], A43[[All, 1]], A44[[All, 1]],
A45[[All, 1]], A46[[All, 1]], A47[[All, 1]], A48[[All, 1]],
A49[[All, 1]], A50[[All, 1]]];
# -> (((((((((((((((((((((((((((((((((((((((((((((((((((# /.
Append[A01, _ -> 0])*X01 + (# /. Append[
A02, _ -> 0])*X02) + (# /. Append[A03, _ -> 0])*
X03) + (# /. Append[A04, _ -> 0])*X04) + (# /.
Append[A05, _ -> 0])*X05) + (# /.
Append[A06, _ -> 0])*X06) + (# /.
Append[A07, _ -> 0])*X07) + (# /.
Append[A08, _ -> 0])*X08) + (# /.
Append[A09, _ -> 0])*X09) + (# /.
Append[A10, _ -> 0])*X10) + (# /.
Append[A11, _ -> 0])*X11) + (# /.
Append[A12, _ -> 0])*X12) + (# /.
Append[A13, _ -> 0])*X13) + (# /.
Append[A14, _ -> 0])*X14) + (# /.
Append[A15, _ -> 0])*X15) + (# /.
Append[A16, _ -> 0])*X16) + (# /.
Append[A17, _ -> 0])*X17) + (# /.
Append[A18, _ -> 0])*X18) + (# /.
Append[A19, _ -> 0])*X19) + (# /.
Append[A20, _ -> 0])*X20) + (# /.
Append[A21, _ -> 0])*X21) + (# /.
Append[A22, _ -> 0])*X22) + (# /.
Append[A23, _ -> 0])*X23) + (# /.
Append[A24, _ -> 0])*X24) + (# /.
Append[A25, _ -> 0])*X25) + (# /.
Append[A26, _ -> 0])*X26) + (# /.
Append[A27, _ -> 0])*X27) + (# /.
Append[A28, _ -> 0])*X28) + (# /.
Append[A29, _ -> 0])*X29) + (# /.
Append[A30, _ -> 0])*X30) + (# /.
Append[A31, _ -> 0])*X31) + (# /.
Append[A32, _ -> 0])*X32) + (# /.
Append[A33, _ -> 0])*X33) + (# /.
Append[A34, _ -> 0])*X34) + (# /.
Append[A35, _ -> 0])*X35) + (# /.
Append[A36, _ -> 0])*X36) + (# /.
Append[A37, _ -> 0])*X37) + (# /.
Append[A38, _ -> 0])*X38) + (# /.
Append[A39, _ -> 0])*X39) + (# /.
Append[A40, _ -> 0])*X40) + (# /.
Append[A41, _ -> 0])*X41) + (# /.
Append[A42, _ -> 0])*X42) + (# /.
Append[A43, _ -> 0])*X43) + (# /.
Append[A44, _ -> 0])*X44) + (# /.
Append[A45, _ -> 0])*X45) + (# /.
Append[A46, _ -> 0])*X46) + (# /.
Append[A47, _ -> 0])*X47) + (# /.
Append[A48, _ -> 0])*X48) + (# /. Append[A49, _ -> 0])*
X49) + (# /. Append[A50, _ -> 0])*X50)/(X01 + X02 + X03 +
X04 + X05 + X06 + X07 + X08 + X09 + X10 + X11 + X12 + X13 +
X14 + X15 + X16 + X17 + X18 + X19 + X20 + X21 + X22 + X23 +
X24 + X25 + X26 + X27 + X28 + X29 + X30 + X31 + X32 + X33 +
X34 + X35 + X36 + X37 + X38 + X39 + X40 + X41 + X42 + X43 +
X44 + X45 + X46 + X47 + X48 + X49 + X50) & /@ languages
Any help would be appreciated
Thanks very much
John