f



Re: Re: EUREKA Re: Types in Mathematica, a practical example

Hi David,
Comments are interlaced in the text below, 

> -----Original Message-----
> From: David Bailey [mailto:dave@Remove_Thisdbailey.co.uk] 
> Subject:  Re: EUREKA Re: Types in Mathematica, a 
> practical example
> 
> Hello,
> 
> If you want to compute with undefined array elements, why not 
> use subscript elements such as Subscript[a,1,2].

Hmmm, maybe... Let's see

ax := {{Subscript[ax, 1, 1], Subscript[ax, 1, 2]}, {Subscript[ax, 2, 1],
Subscript[ax, 2, 2]}}

is not a good idea, since evaluation of ax gives an infinite loop. (There
are of course cases when this is not a problem. )

ax := {{Subscript[HoldForm[ax], 1, 1], Subscript[HoldForm[ax], 1, 2]},
{Subscript[HoldForm[ax], 2, 1], Subscript[HoldForm[ax], 2, 2]}}

is better according to my criteria. The suggestion has the benefit that we
can keep a name connection between the elements and the matrix.
Subscript[HoldForm[ax], 1, 1] can be used almost in the same way as a single
variable. Another possibility almost in the same style is

SetAttributes[listelement, HoldFirst];
ax := {{listelement[ax, 1, 1], listelement[ax, 1, 2]}, {listelement[ax, 2,
1], listelement[ax, 2, 2]}};

In both suggestions ax can be seen as a function of its elements and the
elements can be seen as  functions of ax, in a circular manner. I wonder if
anyone of these suggestions would be acceptable from the point of view of a
functional programmer. Anyway we are quite near my suggestion in mg63184,
but with both these variants the elements will have a different appearance
from the standard list parts ax[[i,j]].

> 
> More generally, the concept of a matrix can mean a number of different
> things:
> 
> 1)	A fully filled rectangular array of numbers or other 
> expressions. 
> (SparseArray is simply a variant of this).
> 
> 2)	An array in which some or all of the elements are undefined.
> 
> 3)	An array in which even the dimensions are undefined, 
> but in which you 
> can refer to individual elements.
> 
> 4)	In some work a single symbol is used to represent a 
> matrix together 
> with a non-commutative multiplication.
> 
> Clearly a system cannot be expected to cater for all of these 
> and all possible transitions between one and another. In 
> practice, of course, Mathematica caters for case 1, and you 
> have to supply your own notation to work with the others. 
> This seems reasonable to me.
 
a) Indexed elements are not only occurring as matrix elements, even if the
discussion here has been about such. A mechanism should be applicable to any
expression with a head.  

b) My question was partly how I could supply my own notation in consistence
with how Mathematica works. But I think it is reasonable that I could
suggest points where I think Mathematica could be improved, and I also think
that MathGroup is a good place to discuss such things, since other users
might have valuable information or opinions about the suggestions. Maybe
Mathematica could be improved in such a way that it becomes easier for the
users to supply their own notation for some of the cases above?

> In practice, I find that error messages generated by Part are 
> quite common and extremely useful, and I think it would be 
> most unhelpful if Part expressions that could not be 
> evaluated silently returned unchanged.

I do not think you have to worry about this. What I suggested was that Part
expressions deliberately declared as undefined should be returned unchanged.
If the indices of Part point outside the list, you could still obtain error
messages. How often do you deliberately declare Part expressions as
undefined by mistake and then forget to give them a value? If you have used
any other undefined variable or function, or use the Array method in sec.
2.5.5. for defining matrices with undefined elements, you do not get any
warning for undefined variables. Also I think it anyway is a natural way to
improve and extend Mathematica to replace some error messages with some kind
of regular action, if that could be done in a logical and consistent manner.

> 
> David Bailey
> http://www.dbaileyconsultancy.co.uk
> 
> 

Best regards

Ingolf Dahl
Sweden
http://web.telia.com/~u31815170/Mathematica/


0
ingolf.dahl (179)
1/7/2006 7:42:33 AM
comp.soft-sys.math.mathematica 28821 articles. 0 followers. Follow

0 Replies
635 Views

Similar Articles

[PageSpeed] 25

Reply:

Similar Artilces:

Re: EUREKA Re: Types in Mathematica, a practical example
I forgot one thing: how to deal with your original problem. In[1]:= a=Array[Unique[a]&,{2,2}] Out[1]= {{a$17,a$18},{a$19,a$20}} In[2]:= a-x/.Flatten[Thread/@Thread[a->x]] Out[2]= {{0,0},{0,0}} Seems to me a little simpler than with the HoldForm approach. Andrzej On 17 Dec 2005, at 13:48, Andrzej Kozlowski wrote: > If you feel really want do it in this sor of way, I suggest the > following approach: > > > x=Array[Unique[x]&,{2,2}] > > > {{x$23,x$24},{x$25,x$26}} > > etc. > > I think in this way you get...

EUREKA Re: Types in Mathematica, a practical example
EUREKA! I have found a (for me) new and alternative way to define matrices and list structures, which allows me to define the elements afterwards, and leave some elements undefined. From the Book, 2.5.5: "You can define a list, say a = {x, y, z, ... }, then access its elements using a[[i]], or modify them using a[[i]] = value. This approach has a drawback, however, in that it requires you to fill in all the elements when you first create the list. Often, it is more convenient to set up arrays in which you can fill in only those elements that you need at a particular time. You...

Re: Re: Types in Mathematica
I like this idea. Does the mathematical/algebraic "programming" style scale up to large problems? Are there examples? Or perhaps it doesn't strictly scale, but is better applied judiciously. It could be used to steer a code at a very high level, or conversely, used in the gaps (the Mathematica-in-the-gaps argument). Conventional programming would make up the difference. If indeed mathematical programming is not the silver-bullet paradigm, where should the conventional (though modern) programming be done? Within or without Mathematica? If within, then we've c...

Re: Re: Re:
>From: David Elliott <elliott@stcnet.com> >To: "Yue Huang" <yue31@hotmail.com> >Subject: Re: Re: Re: >Date: Tue, 9 Dec 2003 23:29:13 -0500 > >On Dec 9, 2003, at 10:41 PM, Yue Huang wrote: > >> >>----- Original Message ----- >>From: "David Elliott" <elliott@stcnet.com> >>Newsgroups: comp.soft-sys.wxwindows >>Sent: Tuesday, December 09, 2003 12:44 AM >>Subject: Re: >> >> >>>You'll notice the code in that wxMac method sets the >>>kFloatingWindowClass Mac...

Re: Re: Re: Mathematica language issues
I think most people this entire discussion does not have any practical importance. Obviously something like this: 2*Unevaluated[1+1] 2 Unevaluated[1+1] is extremly unlikely to have any practical use. After all, we use Unevaluated when we want something to remain unevaluated, whereas here only two things can happen: either one will be left with Unevaluated[something] or the "something" will evaluate. Both of these outcomes are obsiously undesirable. Why should one ever use anything like this in a program? In fact if for some unimaginable reason somone neede...

Re: Re: Types in Mathematica #2
On Dec 4, 2005, at 6:16 AM, Steven T. Hatton wrote: I started this reply before seeing your conversations with Kris Carlson, he seems to have better elucidated the points I was trying to make. > On Saturday 03 December 2005 21:37, Sseziwa Mukasa wrote: > >> On Dec 3, 2005, at 6:52 PM, Steven T. Hatton wrote: >> An example of a strong and >> dynamic language is LISP, and this is one respect in which >> Mathematica >> differs from LISP. >> > > (setq f 1) > (setq g 2.2) > (setq h (+ f g)) > (print h) > =>3.2...

RE: RE: Re: Mandelbrot Set & Mathematica
Sorry again, but your previous message said >=, not <=. It's still posted on Google Groups, and I checked to make sure. DrBob www.eclecticdreams.net -----Original Message----- From: AGUIRRE ESTIBALEZ Julian [mailto:mtpagesj@lg.ehu.es] Subject: RE: Re: Mandelbrot Set & Mathematica On Tue, 11 May 2004, DrBob wrote: > Sorry, but that just doesn't work, even after changing =BE to >=. There are > only two colors (even using your rainbow function), and no fractal > "antennae". As noted in a previous message, it should be "<=...

Re: Re: Re: Mathematica language issues #2
So far I could resist the temptation to participate in this discussion. However, in his mail Maxim Rytin presents some examples of which he thinks the result is unpredictable. Maybe there is some interest in how I predict the results of simple commands in which Unevaluated occurs. Of course these examples are of no practical interest. Unevaluated is meant to pass unevaluated arguments to a function body and as such it works perfectly. No one in practice is interested in (1+1)*Unevaluated[2+2]. The basic principle has been clearly explained by Andrzej Kozlowsky. Suppose we have a ...

Re: Re: Re: Any Mathematica 6 book yet?
I must agree about the debugger. I was very excited by the release of Workbench 1.0 because of the promise of a good debugger. I even took a course on it. The reality is that Workbench is so hard to use ( I can't bring in my old code and debug changes- it just doesn't work) that I never use it. So I'm back to using Print statements again. I love Mathematica but would love to have an easy to use debugger with break points, etc. Oh well. Cliff Nasser Abbasi <nma@12000.org> wrote: "Murray Eisenberg" wrote in message news:fdf236$20u$1@smc.vnet.net... &...

Re: Re: Mathematica Programmer vs. Programming in Mathematica
> -----Original Message----- > From: Steven T. Hatton [mailto:hattons@globalsymmetry.com] > Sent: 15 December 2005 10:30 > Subject: Re: Mathematica Programmer vs. Programming > in Mathematica > ....... > > I wonder what value there woudl be in trying to explain what makes > > Mathematica "functions" different from functions in > languages such as > > C in a book addressed to readers most of whom have no > knowledge of C > > and are not particualry interested in getting it? > > I suspect you will not fi...

Re: Types in Mathematica, a practical example
I like to use Array when I want a variable to be treated as a matrix. [[Expression:||| Array[x,{2,2}] |||]] This is probably not what you want since the output is a nested list. This is not the same as declaring a variable as a matrix. But now, this approach works: [[Expression:||| a={{1,2},{3,4}}|||]] [[Expression:||| Array[x,{2,2}] - a /. x[k__]:>a[[k]] |||]] Link to the forum page for this post: http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Special:Forum_ViewTopic&pid=6675#p6675 Posted through http://www.mathematica-users.org [[postId=6675]...

Re: Re: Re: Marc Re: Andreessen Re: created Re: the Re: first Re: web Re: browser
no. ...

RE: Re: Re: Suggestion: Visualization of complex functions with Mathematica
I'd like to add the ComplexAnalysis package at my web site below: This package contains complex analysis routines and complex graphics routines. There are routines that convert the regular 2D Graphics into equivalent complex forms. For example ComplexLine[{z1,z2,z3...}] takes complex numbers for the point coordinates. There are routines for producing one or two panel plots or animations of complex functions. Each panel may be one of the following plot types. 1) Cartesian/PolarSurface - Plots the surface s[f[z]] where f is a complex function and s is a real function. 2) Cartesian...

Re: Re: Re: Do Mathematica applications EVER get updated?
atul wrote: > I'm not entirely sure what prompts your anxiety, as I have used several > packages over the years, including Time Series, Wavelet Explorer and > Mathematica Link for Excel. While some functions (from both Time > Series and > Mathematica Link) were incorporated into the kernel over time, updates to > ensure compatibility with new versions of Mathematica were timely and > unobtrusive. > This has not been the case for me and I subscribe to "Premier Service". I must always ask (usually more than once) for updates to the "Mec...

Web resources about - Re: Re: EUREKA Re: Types in Mathematica, a practical example - comp.soft-sys.math.mathematica

Philosophiæ Naturalis Principia Mathematica - Wikipedia, the free encyclopedia
The Principia states Newton's laws of motion , forming the foundation of classical mechanics , also Newton's law of universal gravitation , and ...

image processing - How do I find Waldo with Mathematica? - Stack Overflow
This was bugging me over the weekend: What is a good way to solve those Where's Waldo? [ 'Wally' outside of North America] puzzles, using Mathematica ...

Stephen Wolfram: The Background and Vision of Mathematica - YouTube
During the Wolfram Mathematica Virtual Conference 2011, Wolfram founder Stephen Wolfram shared the background and vision of Mathematica, including ...

Wolfram Mathematica coming to the iPad
It would appear that Wolfram, the company behind the Siri search engine is bringing its original product, Mathematica , to the iPad. In response ...

Premium Mathematica software free on budget Raspberry Pi
Wolfram Research is giving away its Mathematica software for use on the diminutive, $25 Raspberry Pi computers and debuting a brand-new programming ...

Stephen Wolfram: It was Steve Jobs who named 'Mathematica'
The creator of the answer engine in Siri writes about his long relationship with Jobs Wolfram. Photo: Creative Commons There are a several novel ...

700 New Functions In Wolfram Mathematica 10
Single biggest jump in new functionality in the software's history

New Wolfram Language Brings The Power Of Mathematica To Any Device
... is being expanded into a logic and knowledge engine that can operate locally or in the cloud. Wolfram Research's flagship program Mathematica ...

Mathematica and Wolfram On The Raspberry Pi
[Stephen Wolfram], possibly the only person on Earth who wants a second element named after him, is giving away Mathematica for the Raspberry ...

Wolfram Brings Mathematica Technical Computing to the Web
If you’re a fan of Wolfram’s Mathematica app, you’ll be pleased to hear its comprehensive tools for technical computing are now more accessible. ...

Resources last updated: 2/5/2016 10:13:34 AM