f



Re: Chained-functional notation examples?

On 5/6/14 at 2:26 AM, dog@gmail.com (Unknown) wrote:

>I came to 'Mathematica' via Xahlee's criticism of the ad-hoc nature
>of unix-piping [functional notation].  He claims [& I believe him]
>that Mathematica has a better, more consistent notation.  But the
>facility of PRE, IN & POST-fix alternatives, seems bad.  You want
>ONE way of acieving the goal. More rules just increases mental load.

If you are looking for a system with one way to achieve a given
goal, Mathematica isn't it. There are multiple ways of achieving
a result without using different notations. For example,
consider how you might find the sum of the first n integers. All
of the following will work:

limit = 10^6;
For[sum = 0; n = 1, n <= 10, n++, sum += n]; sum

Plus@@Range[limit]

Total[Range@limit]

Sum[n,{n,m}]/.m->limit

Intelligent use of pre-, post- and in-fix notations generally
makes Mathematica code easier to read/understand. For example, I
could have written

Total[Range@limit] as

Total[Range[limit]]

but fewer levels of [] makes it easier from my perspective to read.

>Just as a test, how would Mathematica handle the following [or part
>of] little task:

>search all files in Dir=tree D |
>which are less than N days-old | and which contain string S1 | and
>which contain string S2 .

SetDirectory[dirname];
Cases[FileNames[],
   (FileType[#]===File &&
    StringCases[#, s1]!={} &&
    StringCases[#, s2]!={} &&
    (Subtract@@(AbsoluteTime /@ {Date[][[;; 3]], FileDate[#][[;; 3]]}/86400)<age)&]

No need to pipe results from one operation to the next. And the
above syntax is platform neutral.

>Try: Search in table of ListOfOpenFiles for lineS with path-P
>[field] | which have same tty-field as line with path-P2 & program-M [field]

Less clear here to me what it is you are looking for, but
FindList is probably the right function.


0
Bill
5/7/2014 6:44:45 AM
comp.soft-sys.math.mathematica 28821 articles. 0 followers. Follow

0 Replies
638 Views

Similar Articles

[PageSpeed] 13

Reply:

Similar Artilces:

Re: Chained-functional notation examples? #5
On 5/7/14 at 2:44 AM, dog@gmail.com (Unknown) wrote: >Here's a related real-live problem: >list all files in Dir-tree:D | which are less-than daysOld:N | and >contain "egal" in the FullPathName | and contain String:"uid" OR >"UID" It is not entirely clear what it is you are trying to do. There are a couple of ways to obtain a list of files in a given directory. First, if the directory is the current working directory, then FileName[] will return a list of every thing at the top level of the directory. But in this case, only the...

Re: Chained-functional notation examples? #4
A query such as this might do what you have in mind. Here directoryname should be changed to whatever directory you want searched. Select[FileNames[("*uid*" | "*UID*"), directoryname, Infinity], ((StringMatchQ[DirectoryName[#] , "*egal*"] && Today < DayPlus[FileDate[#], 3]) &] Also there is a case sensitive switch if you want to allow strings with e.g. "uID". If you want to allow that uid only in the name and not full string Daniel Lichtblau Wolfram Research ------------------- On Tue, 06 May 2014 06:26:46 +0...

Re: Chained-functional notation examples? #3
A query such as this might do what you have in mind. Here directoryname should be changed to whatever directory you want searched. Select[FileNames[("*uid*" | "*UID*"), directoryname, Infinity], ((StringMatchQ[DirectoryName[#] , "*egal*"] && Today < DayPlus[FileDate[#], 3]) &] Also there is a case sensitive switch if you want to allow strings with e.g. "uID". If you want to allow that uid only in the name and not full string Daniel Lichtblau Wolfram Research ------------------- On Tue, 06 May 2014 06:26:46 +0...

Re: Chained-functional notation examples? #2
A query such as this might do what you have in mind. Here directoryname should be changed to whatever directory you want searched. Select[FileNames[("*uid*" | "*UID*"), directoryname, Infinity], ((StringMatchQ[DirectoryName[#] , "*egal*"] && Today < DayPlus[FileDate[#], 3]) &] Also there is a case sensitive switch if you want to allow strings with e.g. "uID". If you want to allow that uid only in the name and not full string Daniel Lichtblau Wolfram Research ------------------- On Tue, 06 May 2014 06:26:46 +0...

Chained-functional notation examples?
I came to 'Mathematica' via Xahlee's criticism of the ad-hoc nature of unix-piping [functional notation]. He claims [& I believe him] that Mathematica has a better, more consistent notation. But the facility of PRE, IN & POST-fix alternatives, seems bad. You want ONE way of acieving the goal. More rules just increases mental load. A major benefit of functional [unix-piping] programming style, is that you don't need to remember the-full-journey: you just need to remember the previous stage's output. Nor do you need to remember several names: the previous outp...

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: 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 o...

Re: Re: function of a function
On 30 Nov 2005, at 14:07, Narasimham wrote: > Jens-Peer Kuska wrote: > >> it can't work because f [0] ==1 given in your differential equation >> f ' [0]==f [1] and NDSolve[] can't find the value for >> f[1] until it has integrated the equation. > > ??? > >> The nested dependence is equivalent to an infinite >> system of ordinary differential equations and it seems to be >> hard to do this by a finte computer. > > I cannot understand this. In the following two examples the first one > works, not the second...

RE: Re: scaled complementary error function in Mathematica?
It would seem that by the time Exp[x^2]*Erfc[x] runs into exponent trouble, that the approximation 1/(x Sqrt[Pi]) would be sufficiently accurate for most numeric calculations. Thus, you might form a function like scaledErfc[ x_ ] := If[ x < 25000, Exp[x^2]*Erfc[x] , 1/(x Sqrt[Pi]) ] -----Original Message----- From: Peter Pein [mailto:petsie@dordos.net] Subject: Re: scaled complementary error function in Mathematica? Tanim Islam schrieb: > Hi: > > I was wondering if anyone had a package or notebook file that computes > the scaled complementary error functi...

Re: Re: Mathematica bug in handling trigonometric functions? (and more)
On Tue, 5 Apr 2005, dh wrote: > Hi APC, > I tried to simplify the problem a bit. There is definitly a bug that > Wolfram should take notice. It would be nice if WRI could give an answer . > > The folllowing is obviously correct: > Sum[Sin[k]*Cos[k + 1], {k, 1, 1}] > Out: Cos[2] Sin[1] > > When we do the same with indefinite summation: > Sum[Sin[k]*Cos[k + 1], {k, 1, n}] /. n -> 1 // Simplify // Expand > Out: Sin[1]/2 + Cos[2] Sin[1] > > we get an additional term: Sin[1]/2 !!! > > Sincerely, Daniel > > APC wrote: &g...

Re: Re: Output display of exponential function in Mathematica
Log[1/E^.5] -0.5 Log[1/E^-.5] � .5 True Refine[1/E^x, 0<x<1] E^-x Or if you need to, Refine[Log[1/E^x], 0<x<1] -x Kris -------------- Original message -------------- > On Sun, 27 Nov 2005 08:24:53 +0000 (UTC), Bob Hanlon > wrote: > > >The output that you want is "unstable", i.e., Mathematica automatically > >converts it. > > > > Thanks. > > I have another question if you don't mind. > > I'm trying to just check and see if I got a whole bunch of > even-numbered study exercises r...

Re: Re: math glyphs from non-Mathematica font
On Fri, 22 May 2009 01:50:51 -0400 (EDT), skkaul wrote: > On May 10, 5:13 am, John Fultz <jfu...@wolfram.com> wrote: > >> <install= >> directory>/SystemFiles/FrontEnd/TextResources/UnicodeFontMapping.tr >> > Besides the comments, is there any documentation on this file? In > particular, what are type V and H entries, and what font is referenced > by -2? > > Thanks, > Shiva It's not documented because it's not intended for user consumption, although being able to edit it very rarely allows working around certain issues...

Re: Novice problem in mathematica syntax : Function of a function
hi, What I want to do is to : Plot Reflectivity: Refelectivity is an expression ( or a function ) depending on nfilm which in turn depends on epsmodel( which in itself is a function of 3 parameters and a variable ) therefore : epsmodel = f(a,b,c,d,x) (* result is a comlpex number *) nfilm = sqrt[epsmodel] reflectivity = ((nfilm - 1) / (nfilm +1))^2 I just want to plot reflectivity and see the variation in it when (a,b,c,x) varies ( using the Manipulate[] tool ) Please let me know how to do this in term of these functions ? the exact formalism for which I got the error : ...

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...

Web resources about - Re: Chained-functional notation examples? - comp.soft-sys.math.mathematica

Resources last updated: 1/26/2016 11:15:10 PM