[Date Index]
[Thread Index]
[Author Index]
Re: C-formatted strings back to Expressions
*To*: mathgroup at smc.vnet.net
*Subject*: [mg69960] Re: C-formatted strings back to Expressions
*From*: dimmechan at yahoo.com
*Date*: Thu, 28 Sep 2006 06:16:01 -0400 (EDT)
*References*: <efdkii$v7$1@smc.vnet.net>
Hello.
It is very easily to convert one form to another.
CForm[Expand[(x+Sqrt[y])^2]]
Power(x,2) + 2*x*Sqrt(y) + y
InputForm[%]
x^2 + 2*x*Sqrt[y] + y
StandardForm[%]
\!\(x\^2 + 2\ x\ \@y + y\)
CForm[Expand[(x+Sqrt[y])^2]]
Power(x,2) + 2*x*Sqrt(y) + y
FortranForm[%]
x**2 + 2*x*Sqrt(y) + y
StandardForm[%]
\!\(x\^2 + 2\ x\ \@y + y\)
TeXForm[Sqrt[x^2+y^2]]
\sqrt{x^2+y^2}
MathMLForm[%]
<math>
<msqrt>
<mrow>
<msup>
<mi>x</mi>
<mn>2</mn>
</msup>
<mo>+</mo>
<msup>
<mi>y</mi>
<mn>2</mn>
</msup>
</mrow>
</msqrt>
</math>
OutputForm[%]
2 2
Sqrt[x + y ]
As another example consider
str=FromCharacterCode[Table[Random[Integer,{90,120}],{20},{2}]]
{x],rm,]q,_i,v`,to,jm,pq,mh,jx,Zi,a],]n,gm,r^,ci,`w,qf,kg,e[}
CForm[str]
List("x]","rm","]q","_i","v`","to","jm","pq","mh","jx","Zi","a]","]n","gm","r^","ci","`w","qf","kg","e[")
InputForm[%]
{"x]", "rm", "]q", "_i", "v`", "to", "jm", "pq", "mh", "jx", "Zi",
"a]", "]n", "gm", "r^", "ci", "`w", "qf", "kg", "e["}
Prev by Date:
**Wolfram Technology Conference 2006**
Next by Date:
**Re: How to remove just the outermost braces of a list?**
Previous by thread:
**C-formatted strings back to Expressions**
Next by thread:
**Re: C-formatted strings back to Expressions**
| |