Tag Info

Hot answers tagged

8

The following may be useful as starters: WolframAlpha["femme from french to german",{{"Translation:TranslationData", 1}, "ComputableData"}] (* {" Frau | Ehefrau", " Frau"} *)


7

Part a response, Because you do not show additional information and do not describe the problem with the code, I show one approach. First we construct some helpers : ClearAll["Global`*"] SetDirectory@NotebookDirectory[]; siz1 = 250; siz2 = 500; tex1 = "What a long and interesting and certainly necessary title for \ a panel of functions."; title = ...


5

Try using Column and Alignment: Column[BaseForm[#, 7] & /@ Range[30], Alignment -> Right] which produces the following right-adjusted output: Thanks, how would you make a multi-column. Say I also want to print i in base 5 in a second column? Try this: Grid[Outer[BaseForm[#1, #2] &, Range[30], Range[2, 16]], Alignment -> Right] ...


4

primeFactorForm[n_Integer] := Module[{fact = FactorInteger[n]}, If[Length[fact] == 1, Superscript @@ fact[[1]], CenterDot @@ Superscript @@@ fact]] primeFactorForm[9] primeFactorForm[72]


4

The existing answers work but I offer two improvements: terse code via pattern replacement making an actual formatting wrapper This replacement rule strips the heads of any expressions with only one argument: foo[1] /. _[x_] :> x foo[1, 2] /. _[x_] :> x 1 foo[1, 2] Format is used to describe the output format without losing the original ...


4

exp = {Sign[a], Sign[1 - b], Sign[1 - a - b], Sign[a (1 - a) (1 - a - b)]}; ref = Assuming[{0 < a < 1 && Element[a, Reals] 0 < b < 1 && Element[b, Reals] && a + b > 1}, Refine[exp]]; Grid[{exp, ref /. {1 -> "+", -1 -> "-"}}, Dividers -> {{True, {None}, True, True}, {{True}}}]


3

Try this: Table[x^n, {n, 1, 5}] /. x -> "2"


3

Table[With[{n = n}, HoldForm[2^n]], {n, 1, 5}] (* or Table[With[{n = n}, Defer[2^n]], {n, 1, 5}] *) Table[With[{n = n}, HoldForm@n^2], {n, 1, 5}] (* or Table[With[{n = n}, Defer@n^2], {n, 1, 5}] *) Update: If 1 and 1^2 (similarly, 2 and 2^1) are both acceptable, then you can use a simpler variant of Alexey's answer without the need for ReplaceAll: ...


3

The file is gigantic because Mathematica is putting vector objects in the file in an inefficient way, meaning a LOT of vector objects, fonts, etc, as you suspect. The best procedure is to generate the page as an image, save the image then add the image to the PDF. This loses the capability to make the PDF page scalable, but you probably don't care about ...


2

stf[{_, 1}] := StringTemplate["`1`"]; stf[{_, _}] := StringTemplate["\!\(\*SuperscriptBox[\(`1`\), \(`2`\)]\)"]; funcn[u_] := StringJoin[ Riffle[TemplateApply[stf[#], #] & /@ FactorInteger[u], "\[CenterDot]"]] Testing: Grid[Style[#, 20] & /@ ({#, "=", funcn[#]}) & /@ Range[100]]


2

One option is to define the formatting of CenterDot for the one argument case: Format[CenterDot[a_]] := Format[a] In[13]:= CenterDot @@ Apply[Superscript, FactorInteger[9], {1}] Out[13]= $3^2$ Note that the FullForm of this output is CenterDot[Subscript[3,2]].


2

expressions = {a, 1 - a, 1 - b, a + b, a (1 - b) (1 - a - b)}; assumptions = 0 < a < 1 && 0 < b < 1 && a + b > 1; signF = Simplify[Sign@#, #2] /. {1 -> "+", -1 -> "-"} &; signF[expressions, assumptions] (* {"+","+","+","+","-"} *) Grid[{expressions, signF[expressions, assumptions]}, Dividers -> All]


2

I prefer Mr Wizard's answer, but here is a method using the properties of Power and Times to deal with exponent 1 and single prime factors. Specifically: Power[x, 1] gives x Times[x] gives x The prime factors are wrapped in Defer to prevent any further evaluation. So: primeFactorForm = Times @@ Power @@@ MapAt[Defer, FactorInteger@#, {All, 1}] /. ...


1

You have not specified why do you actually need to have your graphics in the PDF format and why (actually) the 16 Mb size is a problem for you. I'll only comment about the appearance. From your description I can conclude that you have generated a nice-looking graphics inside of the Mathematica's FrontEnd but when you Export it as PDF your graphics does not ...


1

Thanks to kguler's marvelous solution I was able to write a little translation program. Due to a certain unreliability of WolframAlpha results it is far from being perfect, but fun to play with. ToWords[res_] := DeleteDuplicates @ StringTrim @ Flatten @ Map[StringSplit[#, "|"] &, res] Translator[word_, from_, to_] := ToWords @ WolframAlpha[word ...


1

Another almost identical way: primeFactorForm[n_] := If[Length@# == 1, First@#, CenterDot @@ #] &[ Superscript @@@ FactorInteger[n]]; Example output: Column[primeFactorForm /@ RandomInteger[{0, 10000}, 10]]


1

Is this question about using two column in the Mathematica Frontend (and do you need the flow of text to be automatic from one to the next column). Then the answer is no not possible. or is it about generating a report with multiple columns. Then yes possible but not with auto flow.



Only top voted, non community-wiki answers of a minimum length are eligible