MathGroup Archive 1992

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Array problems in Mathematica

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Re: Array problems in Mathematica
  • From: a_rubin at dsg4.dse.beckman.com (arthur rubin)
  • Date: Wed, 12 Feb 92 07:39:07 PST

>Secondly, using CForm on arrays gives the output in unappropriate form.
>i.e. CForm[a[1]] = a(1) and not a[1]
>Now try to write a C program splicing in output from Mathematica containing
>arrays and the compiler recognises a() as a function, not an array.
>Is there a way round this? I really can't understand the logic here, since
>both Mathematica and C use [] for array arguments, so why should CForm[] convert
>to ()?

A C array is more like a Mathematica list, as you can see below:

In[8]:= CForm[HoldForm[a[[1]]]]

Out[8]//CForm= a[1]

In[9]:= CForm[HoldForm[a[1]]]

Out[9]//CForm= a(1)

Arthur L. Rubin
216-5888 at mcimail.com 70707.453 at compuserve.com arthur at pnet01.cts.com (personal)
a_rubin at dsg4.dse.beckman.com (work)    Beckman Instruments/Brea
My opinions are my own, and do not represent those of my employer.





  • Prev by Date: Mouse input on X-windows
  • Next by Date: graphing strange stuff
  • Previous by thread: Array problems in Mathematica
  • Next by thread: Mouse input on X-windows