A107 === Subject: Re: Defining derivatives > Hello All, does anybody know how to define symbolic derivatives. E.g.: f[x_]:=f1[x]; f'[x_]:=f2[x]; this does not work because f on the lefthand side is evaluated. To prevent this (do not forget to remove f before redefining it): f[x_]:=f1[x]; HoldPattern[f'[x_]]:=f2[x]; this gives no message, but f'[x] returns f1[x] instead of f2[x]. The same thinhg happens when you change the sequence of definitions: f'[x_]:=f2[x]; f[x_]:=f1[x]; Daniel, *UpSetDelayed[]*. For instance, In[1]:= Remove[f] f[x_] := f1[x] f'[x] ^:= f2[x] f'[x] Out[4]= f2[x] -- === Subject: Re: How to solve this simple equation? How to import a column from excel 2007 in data format for mathematica? > For example if I have: > column1 = a b c d e f g h > > how I can obtain: > data = {a,b,c,d,e,f,g,h} > in mathematica? AFAIK, Mathematica does not handle Microsoft Excel 2007 file format > yet. So use an XLS or CSV file format, for instance. Assuming a file saved in XLS format that contains one sheet of 3 rows > by 4 columns, you can use Inport[] as follow: In[145]:= imp = Import[Workbook1.xls] Out[145]= {{{11., 21., 31.}, {12., 22., 32.}, {13., 23., 33.}, {14., > 24., 34.}}} In[155]:= data = Transpose[Sequence @@ imp][[1]] Out[155]= {11., 12., 13., 14.} You can shorten those steps by telling Import[] what data you want to import. In the following example we import the values of the third column for all the lines that compose the second sheet of the Excel workbook. In[6]:= Import[Workbook1.xls, {Data, 2, All, 3}] Out[6]= {213., 223., 233., 243.} HTH, -- === Subject: Polygon cutter A programming style question. The code fragments below come from conversion to Mathematica (they must work on versions >=4.0) of an ancient Fortran IV contourplot program written in 1966 for my thesis. They are key part of the inner loop polygon cutter. ----------------------------------------------------------- Version 1. Straight translation from Fortran: p={Null}; If [tb>0&&tb==tt, p={P1,P2,P4,P3}]; If [tb==1&&tt==2, p={Pc2,P1,P2,P4,P3}]; If [tb==-1&&tt==-1,p={}]; If [tb==-1&&tt==0, p={Pc1,Pc2,Pc3}]; If [tb==-1&&tt==1, p={Pc1,P4,P3}]; If [tb==-1&&tt==2, p={Pc1,Pc2,P3,P4}]; If [tb==0&&tt==0, p={}]; If [tb==1&&tt==0, p={Pc3,Pc2,P1,P2}]; If [tb==2&&tt==0, p={Pc3,P1,P2}]; poly=Graphics[Polygon[p]]; V1 was actually a separate subroutine, with a RETURN after each match, but in Mathematica it goes inline. tb (tag-bottom) and tt (tag-top) are integers in range -1 through 2 whereas P1, ... etc, are point coordinates. ----------------------------------------------------------- Version 2. Table driven variant of above: p={{{},{Pc1,Pc2,Pc3},{Pc1,P4,P3},{Pc1,Pc2,P3,P4}}, {{Null},{},{Null},{Null}}, {{Null},{Pc3,Pc2,P1,P2},{P1,P2,P4,P3},{Pc2,P1,P2,P4,P3}}, {{Null},{Pc3,P1,P2},{Null},{P1,P2,P4,P3}}} [[tb+2,tt+2]]; poly=Graphics[Polygon[p]]; Impossible (tb,tt) combinations return {Null}. V2 was actually that implemented when V1 was later converted to Univac 1110 machine language. ---------------------------------------------------------- Question: which version is preferable in Mathematica, or is there a better one? Both run roughly at the same speed (about 25 microsec under 5.2 on an Intel MacBook Pro). Since this loop is traversed once for each polygon, efficiency is important. === Subject: Re: Scaling Plot inside Row > Also, you can get finer control of the spacing by using Spacer[15] rather > than t. And you don't have to use both Print and Row. plot = Plot[Sin[x], {x, 0, 6 Pi}, ImageSize -> 300]; > matrix = TableForm[Table[10 i + j, {i, 4}, {j, 3}]]; > Row[{plot, matrix}, Spacer[15]] plot = Plot[Sin[x], {x, 0, 6 Pi}, ImageSize -> 300]; > matrix = TableForm[Table[10 i + j, {i, 4}, {j, 3}]]; > Print[plot, Spacer[15], matrix] -- > David Park > djmp...@comcast.nethttp://home.comcast.net/~djmpark/ Row without Print does not print anything when it is inside While: i = 0; While[i < 2, plot = Plot[Sin[x], {x, 0, 6 Pi}, ImageSize -> 300]; matrix = TableForm[Table[10 i + j, {i, 4}, {j, 3}]]; i += 1; Row[{plot, matrix}, Spacer[15]] ] === Subject: How to remove unneeded constraints Hello The problem I am working on is a pretty large problem, which I am solving by dividing it into a lot of subproblems. As such, I have a large list of constraints that apply to the entire problem, but are not relevant for each individual subproblem. This becomes a problem when I use Refine, as it takes a very long time when you have a lot of conditions, even though the conditions don't pertain to the problem. Example: In[25]:= Table[Timing@Refine[p>q,Map[Subscript[x,#]>0&,Range[i]]],{i,1000,5000,1000}] Out[25]= {{0.547,p>q},{1.797,p>q},{3.875,p>q},{8.594,p>q},{10.468,p>q}} And it only gets worse. However, for each individual call to Refine I make, I only need a small subset of the total constraints. So what I want to do is something like this: expr = some expression of n different variables; cond = DeleteCases[totalConstraints, all cases which do not contain a variable from expr]; result = Refine[expr,cond]; I have no idea how to construct a pattern powerful enough to do what is required for the DeleteCases call, though. All of the variables are of the form Subscript[s,_,_,_] or Subscript[b,_,_] and the conditions can also contain expressions of several variables. === Subject: Re: NDSolve with Piecewise function > into some trouble. Basically what I want to do is this: NDSolve[ > {Piecewise[{{FunctionsA, -.001 < x < .001}}, FunctionsB]} > , {x, y, z}, {t,10^-5}] So I have x,y,z as functions of t that I want to solve for and in a > certain region of x I want to use a different set of equations. I am > not really sure if I can go about it this way or not though. Any help > on how to tackle such an equation would be greatly appreciated. > Basically it should work as intended, but remember that you need to give arguments to x,y,z in all your equations. The following works: NDSolve[{ x'[t] == Piecewise[{{Sin[x[t] + y[t]], y[t] > 0.2}}], y'[t] == Cos[x[t] + y[t]], x[0] == 0, y[0] == 0 }, {x, y}, {t, 0, 1} ] hth, albert === Subject: Print[Plot] vs Print[text,Plot]? I've just executed a test cell containing Print[Plot[---]]; Print[Some textn, Plot[---]]; (same simple plot in both lines; objective of 2nd line being to get the text and the plot -- eventually several plots -- into the same output cell) Result from first line is expected plot; result from second line is a miniaturized plot about 1/4 the size of the first one. * This is sensible or useful? * This is what a novice user should expect as consistent and reasonable behavior from the above commands? (Print[Plot] doesn't do the same thing with a given Plot as does Print[----, Plot[], ----] ???) * This is documented --or better, warned about -- where? (since it looks like I'll have to, once again, step aside from attempting to accomplish anything useful with 6.0 and burn up more time digging into its arcane documentation, trying to understand this. Apologies for the sarcasm -- but that's the way it feels.) === Subject: Re: A Problem with Simplify > Indeed. However, there would be two problems. First, > someone would > have to devise suitable algorithms and implement > them. This may not be > totally impossible, but it would certainly take a lot > of effort. But > then, we would see the second problem. This ideal > integrate would > run for ever on almost any non-trivial problem. You > would get nice > mathematical answers to trivial ones, which would > make you feel > good, and no answers to non-trivial ones, which would > probably make > you a annoyed enough to complain (to the MathGroup?). > Would that be a good way to use the time and effort > of programmers and > your own money? As for Reduce - you should try it a little more on > harder problems > than the one you have just presented. It uses some > very beautiful and > powerful algorithms like Cylindrical Algebraic > Decomposition but they > have exponential or in this case double exponential > complexity (in > the number of variables) so if you it try on > something with more than > 3 variables involved you will see what I mean. Given > the choice > between a program that does everything in the spirit > of true > mathematics but can only sole trivial problems that > can be done by > hand and one that gives only generic solutions but > can deal with > cases that would take you a hundred years to do by > hand, which one > would you choose? Andrzej Kozlowski > I do not see the reason why in the case of Integrate keeping track for the conditions will take more time than in the case of Reduce. As I understand it is just the same or something like. === Subject: Re: A kernel, multiple notebooks, and Global? I partly agree with the conclusions and I disagree with most of the supporting argument. I agree that Mathematica has little chance to > displace and/or replace many other current publication formats > like TeX, PDF... many current media applications like reports, > journal publications, presentations, dissertations, and so on. My reasons, are however, completely different. Basically I believe that at the research level there is not that much demand for the sort of live computation capability that Mathematica offers. In my own case the benefits of adding some live content to most of my papers would amount to just one thing: they would become somewhat cuter. I don't think such material would make any difference to the the sort of people who might choose to read such papers; they would still remain incomprehensible to those to whom they are incomprehensible in their present form, and they would not become any clearer to those who understand them now. So the benefits would be marginal. However, live contents is of huge benefit in undergraduate teaching in practically every respect. But this is not journal level staff. I completely disagree with the part about Mathematica's complexity. On the contrary, if we discount the mathematical and algorithmic aspects of the program (which are very complex, but no more in Mathematica than in any other CAS) they we are left with a basic core language that has remained largely stable as it expanded its scope to include typesetting, live graphics etc, interface building. Of course many functions have been added, but I don't consider this as an increase in complexity (they tend to make using the language simpler). Fundamental changes in syntax would represent a serious increase in complexity and there have been very few of these over the many years of Mathemaitca's existence. Indeed, it is this underlying simplicity that made the rapid expansion of the scope of the Mathematica language possible. Andrzej Kozlowski > David, I'll not try to respond to your (appreciated) response, as appended > below for completeness, by interpolating a lot of comments into your > message (always find lengthy posts like that, with interpolated > replies, > hard to read, in fact); but will instead top-post a few more general > responses as follows: > NO OBJECTIONS TO DISTRIBUTING MATHEMATICA NOTEBOOKS, AS A > LIMITED MEANS OF COMMUNICATION TO SMALL AND SPECIALIZED > AUDIENCES -- FINE IDEA, IN FACT I have no basic objections at all to distributing notebooks I've > created > -- even interactive ones -- to colleagues, or pretty much any one who > wants them. In fact, I've mentioned the availability of notebooks > in a > few journal publications, and gotten a few email requests for some of > them as a result. Can be a useful means of technical communication, > in > a limited universe of users. > BUT MATHEMATICA CAN NEVER BECOME A UNIVERSAL OR EVEN VERY > WIDESPREAD MEDIUM OF COMMUNICATION, EVEN FOR THAT TYPE OF > AUDIENCES -- **AND THE VERY ATTEMPT TO EXPAND MATHEMATICA I am totally unsupportive of the proposition that Mathematica can > become > a universal, or even very widespread, publication medium, where I use > become universal to mean that Mathematica notebooks will displace > and/or replace many other current publication formats like TeX, PDF, > or > even Word or PowerPoint (as much as I loathe Microsoft!), for many > current media applications like reports, journal publications, > presentations, dissertations, and so on. In fact, I think the attempt to expand Mathematica to accomplish > this is > not just misguided but actively damaging, to Mathematica and to its > users. Reasons for this include: a) I view Mathematica as a very sophisticated *computational* tool, > and > secondarily as a similarly sophisticated graphical and textual > *display* > for outputting its computed results -- and I consider it to be of high > quality and highly successful at both of these tasks. But, viewed just as a high-grade and sophisticated computational tool, > Mathematica is already (and unavoidably) enormously large, enormously > complex, with complex syntax, and many complex internal interactions > -- > which means a large learning curve, and a huge documentation, just > to do > the computational task. Don't try to tell me about how a novice can type in and evaluate > a=2;b=3;c=a+b;Plot[c x, {x,0,5}] the first time they sit down in front > of it. That's certainly true, but as soon as you get to any > significant > level of computational sophistication, there's a _large_ learning > curve, > and many ways to go wrong in using what you've learned -- and a very > large remembering task, to retain all this knowledge from one time > you > use it to the next. [As I worked my way from v1 through v5, each time I leaned some new > coding trick, or got one of the more sophisticated commands to work, I > would toss a brief template and explanation into my own personal > notes > notebook, which was permanently accessible by being locked at the > bottom > of the Open Recent menu. It's now 0.5 MB in size -- and of course > made more or less useless by 6.0.] b) Add to this the graphic and textual (and animation) display > capabilities that we all want to have from Mathematica, not as > publication quality output but just as useful output. Adding these > display capabilities may not exactly double the size and complexity of > Mathematica, and of the learning curve, and of the documentation, > and of > the remembering task associated with it -- but doing so very > substantially expands all of these aspects, as well as introducing > all > the complexities of interactions between the output routines and the > computational routines. [Plotting a result, or making a Table, can leave the _computational_ > state of Mathematica different from what it was before you produced > this > output, right? And Plot and Table change it in _different_ ways. Not > complaining about this -- just noting it.] c) So, you're proposing to add publication-quality output and > presentation quality capabilities to the Mathematica core -- meaning > adding all the added complexity of the program, the added syntax, the > added learning curve, the added documentation, and the added > remembering task associated with this function on top of the > computational and display complexities already present. Forget it! ***Doing this is simply going to seriously damage the > utility -- and commercial value of Mathematica for its primary > computational and display functions, and for its ordinary users***. d) And, from what I know of journal publishing, commercial and by > professional societies, it's not going to happen! > Finally: THE MULTIPLE NOTEBOOK PARADIGM IS FINE, FOR THOSE WHO LIKE > IT -- WHICH I THINK CAN INCLUDE A LOT OF ORDINARY USERS In arguing this, some interpolation can help: > If you follow the multiple notebook paradigm, you also have to >> devise some >> kind of organization for the notebooks. All the organization that's needed is that all the notebooks that are > needed for a given project are right there, visible and editable, in > the > folder (or a subfolder) for that project! > You have to remember that for >> WorkingNotebookA you need ModuleNotebooks a, c and f. But for >> WorkingNotebookB you need ModuleNotebooks a, b, and c. Pretty soon >> you are >> designing your own system, which is not the standard Mathematica >> system. Nope. If I need (more accurately, want to re-use some part) of > notebooks a or c from project A in project B, I just copy 'em over to > the Project B folder! (Rule #N -- Disk space is cheap!). And once there, I can modify them for project B -- without screwing > up > the copies left back in the project A folder. And nothing I do will be modifying Mathematica itself -- don't > intend to > get into that (I'm after max simplicity, not complications). > People who might use your notebooks not only have to learn the >> standard >> system (because they might be doing other things as well) but they >> also have >> to learn your special system. The only thing they have to do to _use_ my notebooks as written (i.e., > to produce further results from them) is start a standard copy of > Mathematica fresh, open my notebooks, and run 'em. If they've modified their copy of Mathematica itself to be non- > standard > in some way, well, they've produced problems that may occur however If they want to merge my notebooks into some notebooks of theirs, > well, > I'm afraid this is do this at your own risk situation -- and I've > not > made it more difficult. > In the time it took you to devise your own system, you could have >> learned >> the standard package system. It is really not that difficult. Sorry -- can't agree. There are not a lot of complex steps involved > in > defining or using packages, agreed. **But digging the exact correct > steps out of the documentation, learning the vocabulary, avoiding > missteps, and remembering these steps after a time lag, are all > frustrating and time-consuming**. > If you organize your notebooks using Sections (and I wonder if using >> multiple notebooks is a substitute for using Sectional organization >> within a >> notebook?), then you can initially put >> your routines in a Routines Section. The notebook does not have to be >> 'visually large' because the Routines Section can usually be closed >> up. I don't like long notebooks -- navigating through them is awkward and > tedious. I don't like open and closing selected cells -- tedious and > awkward also. Since it makes no difference in functionality, why > don't > I put the Routines Section in a separate notebook, meaning a separate > window -- which, on a Mac, I can instantaneously, with a single mouse > click or key command, fold down into the Dock, or WindowShade (still > functional), and equally quickly recover to edit if needed. --------- Enough for now -- and quite a while beyond that. Over and out, AES >> AES, >> I would like to put in a pitch for using the standard Mathematica >> package >> method and maybe even go further and learn something about >> documentation. >> I think one of the unstated assumptions here is that no one else is >> going to >> see your Mathematica work because all of the pertinent results will >> be >> Exported or copied out into non-Mathematica documents before being >> transmitted to a larger public. In that case why not organize the >> internal >> work in the way that seems most convenient to you? >> But another assumption that we can make for certain is that you >> have expert >> knowledge and a lot of experience in optical fibers. You also have >> done, and >> will do a lot of work in organizing the theory and calculation >> methods for >> the field. This is valuable stuff! So why not make it available to >> others in >> the Mathematica format with all of its advantages of dynamics and >> interactivity. In addition to the final results, if you have worked >> out >> various algorithms, calculation and display routines these are >> valuable. Why >> not make them available to other people as Mathematica packages? >> If you follow the multiple notebook paradigm, you also have to >> devise some >> kind of organization for the notebooks. You have to remember that for >> WorkingNotebookA you need ModuleNotebooks a, c and f. But for >> WorkingNotebookB you need ModuleNotebooks a, b, and c. Pretty soon >> you are >> designing your own system, which is not the standard Mathematica >> system. >> People who might use your notebooks not only have to learn the >> standard >> system (because they might be doing other things as well) but they >> also have >> to learn your special system. >> Rule Number 1: WRI has put a lot of thought into designing a user >> interface. >> It work's fairly well. Be very wary of interposing your own >> interface. >> In the time it took you to devise your own system, you could have >> learned >> the standard package system. It is really not that difficult. A >> Mathematica >> package is just a simple particular form of notebook with >> Initialization >> cells. You just save it as an Auto Generated Package and that is >> all there >> is to it. >> If you organize your notebooks using Sections (and I wonder if using >> multiple notebooks is a substitute for using Sectional organization >> within a >> notebook?), then you can initially put >> your routines in a Routines Section. The notebook does not have to be >> 'visually large' because the Routines Section can usually be closed >> up. >> Other things should also be in Sections. (When I'm working on a >> particular >> derivation of development I put it in its own Section. If I don't >> especially >> like it or get stuck I usually mark it as Try 1, close it up, copy >> and paste >> it and work on a Try 2. When I finally get something I like I throw >> all the >> false steps away.) When you develop a routine in a >> working notebook, move it to the Routines Section and write a usage >> message >> for it and make it an Initialization cell. If you start a new working >> notebook, copy the Routines Section over. At some point, you will be >> convinced that some of the routines are in good shape for general >> use. Then >> move them to your OpticalFiber package. Then you will have one simple >> working structure. A single package and working notebooks that load >> the >> package. You or your readers don't have to look at any of the >> package code >> anymore. You may still have some things in your Routines Sections >> that >> haven't yet made it to the package. >> Documentation is another question, but again, if you have worked >> out good >> routines and methods they are really worth something to other >> people and >> deserve to be documented. (And in any case, I find that I am always >> forgetting how some of my own routines work and have to refer to my >> own >> documentation!) With a little cleverness the documentation can also >> serve as >> a set of test cases if you make changes to your routine. Working on >> documentation also helps to perfect a routine. Sometimes if it is >> difficult >> to explain and illustrate a routine one might wonder about it basic >> design. >> It's true that this takes time, but it's a focused and productive >> use of >> one's time. >> David Reiss has put up a good introduction to creating Version 6 >> documentation. >> http://www.scientificarts.com/worklife/notebooks/ >> and the Workbench application for documentation is coming along. >> Rule Number 2: Most users of Mathematica are pretty capable people. >> Turn >> your hard work into permanently useful and active knowledge for >> yourself and >> other people. >> -- >> David Park >> djmpark@comcast.net >> http://home.comcast.net/~djmpark/ > --Apple-Mail-6-516361386 I partly agree with the = conclusions and I disagree with most of the supporting argument. I agree = that Mathematica has little chance to

 displace and/or replace many other current = publication formats like TeX, PDF... many current media applications = like reports, journal publications, presentations, dissertations, = and so on.

My reasons, are = however, completely different. Basically I believe that at the = research level there is not that much demand for the sort of live = computation capability that Mathematica offers. In my own case the = benefits of adding some live content to most of my papers would amount = to just one thing: they would become somewhat cuter. I don't think = such material would make any difference to the the sort of people who = might choose to read such papers; they would still = remain incomprehensible to those to whom they = are incomprehensible in their present form, and they would not = become any clearer to those who understand them now. So the benefits = would be marginal. However, live contents is of huge benefit in = undergraduate  teaching in practically every respect. But this is = not journal level staff.

I completely disagree = with the part about Mathematica's complexity. On the contrary, if we = discount the mathematical and algorithmic aspects of the program (which = are very complex, but no more in Mathematica than in any other CAS) they = we are left with a basic core language that has remained largely stable = as it expanded its scope to include typesetting, live graphics etc, = interface building. Of course many functions have been added, but I = don't consider this as an increase in complexity (they tend to make = using the language simpler). Fundamental changes in syntax would = represent a serious increase in complexity and there have been very few = of these over the many years of Mathemaitca's existence. Indeed, it is = this underlying simplicity that made the rapid expansion of the scope of = the Mathematica language possible.

Andrzej = Kozlowski


On 19 Apr = type=cite>
David,

I'll not try to respond to your = (appreciated) response, as appended
below for completeness, by = interpolating a lot of comments into your
message (always find = lengthy posts like that, with interpolated replies,
hard to read, in = fact); but will instead top-post a few more general
responses as = follows:


NO OBJECTIONS TO DISTRIBUTING MATHEMATICA NOTEBOOKS, = AS A
LIMITED MEANS OF COMMUNICATION TO SMALL AND SPECIALIZED =
AUDIENCES -- FINE IDEA, IN FACT

I have no basic objections at = all to distributing notebooks I've created
-- even interactive ones = -- to colleagues, or pretty much any one who
wants them.  In = fact, I've mentioned the availability of notebooks in a
few journal = publications, and gotten a few email requests for some of
them as a = result.  Can be a useful means of technical communication, in
a = limited universe of users.


BUT MATHEMATICA CAN NEVER BECOME A = UNIVERSAL OR EVEN VERY
WIDESPREAD MEDIUM OF COMMUNICATION, EVEN FOR = THAT TYPE OF
AUDIENCES -- **AND THE VERY ATTEMPT TO EXPAND = ITSELF**

I am totally unsupportive of the proposition that = Mathematica can become
a universal, or even very widespread, = publication medium, where I use
become universal to mean that = Mathematica notebooks will displace
and/or replace many other = current publication formats like TeX, PDF, or
even Word or = PowerPoint (as much as I loathe Microsoft!), for many
current media = applications like reports, journal publications,
presentations, = dissertations, and so on.

In fact, I think the attempt to expand = Mathematica to accomplish this is
not just misguided but actively = damaging, to Mathematica and to its
users.  Reasons for this = include:

a)  I view Mathematica as a very sophisticated = *computational* tool, and
secondarily as a similarly sophisticated = graphical and textual *display*
for outputting its computed results = -- and I consider it to be of high
quality and highly successful at = both of these tasks.  

But, viewed just as a high-grade and = sophisticated computational tool,
Mathematica is already (and = unavoidably) enormously large, enormously
complex, with complex = syntax, and many complex internal interactions --
which means a = large learning curve, and a huge documentation, just to do
the = computational task.  

Don't try to tell me about how a = novice can type in and evaluate
a=2;b=3;c=a+b;Plot[c x, = {x,0,5}] the first time they sit down in front
of it.  That's = certainly true, but as soon as you get to any significant
level of = computational sophistication, there's a _large_ learning curve,
and = many ways to go wrong in using what you've learned -- and a very =
large remembering task, to retain all this knowledge from one time = you
use it to the next.

[As I worked my way from v1 through = v5, each time I leaned some new
coding trick, or got one of the more = sophisticated commands to work, I
would toss a brief template and = explanation into my own personal notes
notebook, which was = permanently accessible by being locked at the bottom
of the Open = Recent menu.  It's now 0.5 MB in size -- and of course
made = more or less useless by 6.0.]

b)  Add to this the graphic = and textual (and animation) display
capabilities that we all want to = have from Mathematica, not as
publication quality output but just as = useful output.  Adding these
display capabilities may not = exactly double the size and complexity of
Mathematica, and of the = learning curve, and of the documentation, and of
the remembering = task associated with it -- but doing so very
substantially =  expands all of these aspects, as well as introducing all
the = complexities of interactions between the output routines and the =
computational routines.

[Plotting a result, or making a = Table, can leave the _computational_
state of Mathematica different = from what it was before you produced this
output, right?  And = Plot and Table change it in _different_ ways.  Not
complaining = about this -- just noting it.]

c)  So, you're proposing to = add publication-quality output and
presentation quality capabilities = to the Mathematica core -- meaning
adding all the added complexity = of the program, the added syntax, the
added learning curve, the = added documentation, and the added
remembering task associated = with this function on top of the
computational and display = complexities already present.

Forget it!  ***Doing this is = simply going to seriously damage the
utility -- and commercial value = of Mathematica for its primary
computational and display functions, = and for its ordinary users***.

d)  And, from what I know = of journal publishing, commercial and by
professional societies, = it's not going to happen!


Finally:

THE MULTIPLE = NOTEBOOK PARADIGM IS FINE, FOR THOSE WHO LIKE
IT -- WHICH I THINK = CAN INCLUDE A LOT OF ORDINARY USERS

In arguing this, some = interpolation can help:

If you follow = the multiple notebook paradigm, you also have to devise = some
kind of organization for = the notebooks.

All the organization that's needed = is that all the notebooks that are
needed for a given project are = right there, visible and editable, in the
folder (or a subfolder) = for that project!

You have to remember = that for
WorkingNotebookA you = need ModuleNotebooks a, c and f. But for
WorkingNotebookB you need ModuleNotebooks a, b, and c. = Pretty soon you are
designing = your own system, which is not the standard Mathematica = system.

Nope.  If I need (more accurately, = want to re-use some part) of
notebooks a or c from project A in = project B, I just copy 'em over to
the Project B folder! (Rule #N -- = Disk space is cheap!).

And once there, I can modify them for = project B  -- without screwing up
the copies left back in the = project A folder.

And nothing I do will be modifying Mathematica = itself -- don't intend to
get into that (I'm after max simplicity, = not complications).

People who might = use your notebooks not only have to learn the = standard
system (because they = might be doing other things as well) but they also = have
to learn your special = system.

The only thing they have to do to _use_ my = notebooks as written (i.e.,
to produce further results from them) is = start a standard copy of
Mathematica fresh, open my notebooks, and = run 'em.  

If they've modified their copy of Mathematica = itself to be non-standard
in some way, well, they've produced = problems that may occur however

If they want to merge my = notebooks into some notebooks of theirs, well,
I'm afraid this is = do this at your own risk situation -- and I've not
made it more = difficult.

In the time it took you to = devise your own system, you could have = learned
the standard package = system. It is really not that difficult.

Sorry -- = can't agree.  There are not a lot of complex steps involved in =
defining  or using packages, agreed.  **But digging the = exact correct
steps out of the documentation, learning the = vocabulary, avoiding
missteps, and remembering these steps after a = time lag, are all
frustrating and = time-consuming**.

If you organize your = notebooks using Sections (and I wonder if = using
multiple notebooks is a = substitute for using Sectional organization within = a
notebook?), then you can = initially put
your routines in = a Routines Section. The notebook does not have to = be
'visually large' because = the Routines Section can usually be closed up.

I = don't like long notebooks -- navigating through them is awkward and =
tedious.  I don't like open and closing selected cells -- = tedious and
awkward also.  Since it makes no difference in = functionality, why don't
I put the Routines Section in a separate = notebook, meaning a separate
window -- which, on a Mac, I can = instantaneously, with a single mouse
click or key command, fold down = into the Dock, or WindowShade (still
functional), and equally = quickly recover to edit if needed.

---------

Enough for = now -- and quite a while beyond that.

Over and out, = href=mailto:fu9fps$cbb$1@smc.vnet.net>fu9fps$cbb$1@smc.vnet.net>,<= br> David Park <djmpark@comcast.net> = type=cite>
I would like to = put in a pitch for using the standard Mathematica = package
method and maybe even = go further and learn something about = documentation.

I think one of = the unstated assumptions here is that no one else is going = to
see your Mathematica work = because all of the pertinent results will be
Exported or copied out into non-Mathematica documents = before being
transmitted to a = larger public. In that case why not organize the = internal
work in the way that = seems most convenient to you?

But another = assumption that we can make for certain is that you have = expert
knowledge and a lot of = experience in optical fibers. You also have done, = and
will do a lot of work in = organizing the theory and calculation methods = for
the field. This is = valuable stuff! So why not make it available to others = in
the Mathematica format with = all of its advantages of dynamics and
interactivity. In addition to the final results, if you = have worked out
various = algorithms, calculation and display routines these are valuable. = Why
not make them available to = other people as Mathematica packages?

If you follow = the multiple notebook paradigm, you also have to devise = some
kind of organization for = the notebooks. You have to remember that for
WorkingNotebookA you need ModuleNotebooks a, c and f. But = for
WorkingNotebookB you need = ModuleNotebooks a, b, and c. Pretty soon you = are
designing your own system, = which is not the standard Mathematica = system.
People who might use = your notebooks not only have to learn the = standard
system (because they = might be doing other things as well) but they also = have
to learn your special = system.

Rule Number 1: = WRI has put a lot of thought into designing a user = interface.
It work's fairly = well. Be very wary of interposing your own = interface.

In the time it = took you to devise your own system, you could have = learned
the standard package = system. It is really not that difficult. A = Mathematica
package is just a = simple particular form of notebook with = Initialization
cells. You just = save it as an Auto Generated Package and that is all = there
is to = it.

If you organize your notebooks using Sections (and I = wonder if using
multiple = notebooks is a substitute for using Sectional organization within = a
notebook?), then you can = initially put
your routines in = a Routines Section. The notebook does not have to = be
'visually large' because = the Routines Section can usually be closed = up.
Other things should also = be in Sections. (When I'm working on a = particular
derivation of = development I put it in its own Section. If I don't = especially
like it or get = stuck I usually mark it as Try 1, close it up, copy and = paste
it and work on a Try 2. = When I finally get something I like I throw all = the
false steps away.) When = you develop a routine in a
working notebook, move it to the Routines Section and = write a usage message
for it = and make it an Initialization cell. If you start a new = working
notebook, copy the = Routines Section over. At some point, you will = be
convinced that some of the = routines are in good shape for general use. = Then
move them to your = OpticalFiber package. Then you will have one = simple
working structure. A = single package and working notebooks that load = the
package. You or your = readers don't have to look at any of the package = code
anymore. You may still = have some things in your Routines Sections = that
haven't yet made it to = the package.

Documentation = is another question, but again, if you have worked out = good
routines and methods they = are really worth something to other people = and
deserve to be documented. = (And in any case, I find that I am always
forgetting how some of my own routines work and have to = refer to my own
documentation!) = With a little cleverness the documentation can also serve = as
a set of test cases if you = make changes to your routine. Working on
documentation also helps to perfect a routine. Sometimes = if it is difficult
to explain = and illustrate a routine one might wonder about it basic = design.
It's true that this = takes time, but it's a focused and productive use = of
one's = time.

David Reiss has = put up a good introduction to creating Version = 6
documentation.

http://www.scie= ntificarts.com/worklife/notebooks/

and the = Workbench application for documentation is coming = along.

Rule Number 2: = Most users of Mathematica are pretty capable people. = Turn
your hard work into = permanently useful and active knowledge for yourself = and
other = people.

-- =
David = Park
djmpark@comcast.net
http://home.comcast.net/~djmpar= k/


= = --Apple-Mail-6-516361386-- === Subject: Re: Directory of Mathematica Add-Ons Partnerships group... >http://partnerships.wolfram.com/ > I don't think that would cover the many Mathematica packages - free an= d > otherwise - published independently of Wolfram. >> Correct. it includes only those that have negotiated a partnership >> agreement with Wolfram. What does that negotiation entail? I chose to keep my Super Widget Package outside any partnership deal > because I decided to offer it free of charge and make money from > associated consultancy. This has worked reasonably well, and I presume > that there must be many other free packages out there. I guess the only > directory of all packages is called GOOGLE! That's one way to go. Perhaps it's worth exploring the hosting of a basic list. Would people be interested in having me do such a thing? Another resource is also the Wolfram Library Archive (http:// library.wolfram.com/)... I don't know how active that is these days since. Long ago (ah, actually very long ago... time flies...I edited it when it was MathSource... --David David Baileyhttp://www.dbaileyconsultancy.co.uk === Subject: Re: Directory of Mathematica Add-Ons > On Apr 13, 3:32 am, David Bailey > Contact the Wolfram Partnerships group... >>http://partnerships.wolfram.com/ >> I don't think that would cover the many Mathematica packages - free and= >> otherwise - published independently of Wolfram. Correct. it includes only those that have negotiated a partnership > agreement with Wolfram. What does that negotiation entail? Generally the mutual interest on both sides, the suitability of the relationship and the cost/revenue structure. Each case is different and to the best thing to do, if it makes sense for you, is to have a preliminary discussion with them to see how you feel about it after some initial exploration... --david -- > Dr Jon D Harrop, Flying Frog Consultancyhttp://www.ffconsultancy.com/produ= cts/?u === Subject: Re: DifferenitalD vs CapitalDifferenitalD After applying correction, I was hoping to be able to use the = DifferentialD with x, etc. and then use the 'dx' , where 'd' here is = DifferentialD (just dont know how to add it here in the email), so it = would be a Symbol....but this didnt work....I realize I can use the = straight forward dx , etc. symbol but I want to highlight the = Differential....any way to 'fix' this?....when I type in DifferentialD = , from the Palette, and then add x to it and perform //Head on it , it = just returns DifferentialD thank you....jerry blimbaum ----- Original Message ----- === Subject: Re: DifferenitalD vs CapitalDifferenitalD this is a bug, add MakeBoxes[DifferentialD[x_], fmt_] := RowBox[{[DifferentialD], ToBoxes[x, fmt]}] > The documentation for DifferenitalD states: DifferenitalD[x] displays as dx , where instead of d appears the > smybol entered as esc dd esc (without the spaces). Yet when I > enter DifferentialD[x] and evaluate I get back DifferenitalD[x] (not > esc dd esc x ). The documentation for CapitalDifferentialD seems identical to that for = > DifferentialD. Yet when I enter CapitalDifferentialD[x] I get Dx > where D is the symbol entered as esc DD esc. Moreover, esc dd esc x evaluates to DifferenitalD[x] but esc DD esc = > x evaluates to esc DD esc x. It is all so confusing I feel like giving up on Mathematica > typesetting altogether. Can anyone explain what is going on here? This is with $Version > 6.0 for Mac OS X x86 (64-bit) (March 13, 2008) > $ReleaseNumber > 2 Andrzej Kozlowski > === Subject: Re: A kernel, multiple notebooks, and Global? >>You have to remember that for >>WorkingNotebookA you need ModuleNotebooks a, c and f. But for >>WorkingNotebookB you need ModuleNotebooks a, b, and c. Pretty soon >>you are designing your own system, which is not the standard >>Mathematica system. >Nope. If I need (more accurately, want to re-use some part) of >notebooks a or c from project A in project B, I just copy 'em over >to the Project B folder! (Rule #N -- Disk space is cheap!). >And once there, I can modify them for project B -- without screwing >up the copies left back in the project A folder. I agree with your observations here. And in an ideal world that is all there is to it. But in the real world, I find every now and then one or more of the functions I've created and copied to various notebooks needs improvement. Perhaps, I didn't think of found a more efficient algorithm. Or any number of other reasons could make it desirable to alter the original code. But now that the code is in several notebooks, it is difficult to remember which notebooks need revision. Also, if one or more have been modified in some way, a revision to one will not necessarily be the same as needed for another notebook. And finally, getting back to your original thoughts about having several notebooks open at once, there is the problem of which version of the function is active at any given time. The solution to these issues is to encapsulate the functions into a package so that each of the notebooks calls the same code. But of course this gets back to writing packages, something you seem to be trying to avoid. >>In the time it took you to devise your own system, you could have >>learned the standard package system. It is really not that >>difficult. >Sorry -- can't agree. There are not a lot of complex steps involved >in defining or using packages, agreed. **But digging the exact >correct steps out of the documentation, learning the vocabulary, >avoiding missteps, and remembering these steps after a time lag, are >all frustrating and time-consuming**. Yes, it is time consuming and can be frustrating as can be the case with any learning. But there is payoff. === Subject: Re: Problems to find the local extrema of an InterpolatingFunction >does anyone know how to find all the local extrema of an >InterpolatingFunction in a specified interval? The only thing that >seems to work is Findroot, but it only finds a single root each >time. Other rootfinding commands do not seem to work. http://library.wolfram.com/infocenter/MathSource/4482/ === Subject: Re: Comments on the .m file editor > I don't see the advantages of writing package with the .m file editor. > Normally I don't even look at the .m file. I would be interested in hearing > comments from some of the sophisticated users about when writing .m files > directly might be advantagous. Normally a routine should be written and debugged in a regular Mathematica > ..nb notebook. A debugging method that works for almost all cases and is very > easy to use is just to insert temporary Print statements into the routine. When a routine is debugged, and a usage message and SyntaxInformation are > written it can just be moved to a package.nb notebook with Initialization > cells that has been saved as an Auto Generated Package. That is by far the easiest method. You can put (* comments *) anywhere in a Mathematica expression but one very > negative feature of Mathematica is that if one uses Shift-Ctrl-N or > Shift-Ctrl-I to convert and reformat a cell it strips out all the comments. > I think comments should be considered a permanent part of an expression and > never stripped out by such reformating. -- > David Park > djmp...@comcast.nethttp://home.comcast.net/~djmpark/ > As essentially a new user of Mathematica since v6, I'd like to share a > couple of comments about using Mathematica itself to write .m packages > directly. I'm only using v6.0.1 because I can't afford the bug-fix > update right now, so a couple of these comments may no longer be > relevant. Firstly, the positives: It's great to be able to write code in an > editor that explicitly understands the syntax. Brace matching and > selection are good, and syntax colouring is excellent. Being able to write comments in outline mode is also great; especially > with input cells that aren't part of the package but allow you to > execute code; this makes testing and code exposition very convenient > because it can be done inline with the code itself. Now, the negatives. The first complaint is more ignorance than > anything: I've got no idea how to use the debugger. It's great that > it's there, but I don't understand how it's supposed to be used. Are > there any tutorials on this feature? Next: the editor *really* needs to make up its mind whether it's going > to support nice Mathematica symbols or not. It's ridiculous that > typing -> gives you a nice arrow, but then closing and re-opening > the file gives you the literal ascii. Worse, typing a complex > expression involving Greek letters and subscripts and accents looks > fine to start with but then turns into an unreadable mess when > re-opening the package. Since Mathematica can understand the FullForm in package files, I can't > see the harm in displaying it nicely in the .m file editor. Similarly, > the lack of nice spacing in the typesetting of the code is a shame and > makes packages look uglier -- usually requiring extra whitespace (and > effort) to be readable. Finally, the editor doesn't like code that has comments inserted > mid-way through. For example, paste this into a file test.m: (* ::Package:: *) > code[hello, > (* ::Text:: *) > (*some explanation*) > there] Open it in Mathematica, then select all, cut, and paste (this procedure > emulates you typing in those lines manually). Close and reopen the file > and you'll see that Mathematica has inserted two blank lines in the > code. Yuck. Furthermore, this sort of construction kills syntax colouring, which is > a big shame. > It also breaks the Run Package button, which tries to evaluate the > package cell by cell (instead, it should simply execute `< chunks of code when large packages deserve better comments than an > essay right before the Module with inline comments like (* we're doing > stuff here *). If those sorts of comments was the only way to document > the code then we may as well not even bother with cells, to be frank. *** To sum up: the .m file editor is pretty neat but two main additions > would make it much better: explicit support for breaking cells up with > comments whereever you like (including syntax checking and colouring > across cell breaks); and typesetting as in the the notebook editor > (including the extended symbols). In the very least, it shouldn't > interpret typeset symbols unless it intends to preserve them. The > typesetting doesn't affect anyone trying to edit the thing in plain > text and makes the whole thing much nicer to use. After all, without nice typesetting we may as well go back to notebooks > with initialisation cells, which have even less ability to be commented > nicely by splitting up cells partway through. Any comments from others also using the editor? Will Robertson The new .m file editor is useful when building large projects combining Mathematica with revision control software (like subversion). Instead of a .m and a .nb to keep track of, there is only the .m. Since the .m is in plaintext (let's not go into how a .nb is also plaintext), it is easier to run commands like unix's diff on the code tree to see what changed. In order for this to work right, the .m file must be indented in a way that promotes readability... In the past, using .m files had the disadvantage of non-interactivity (unless one was using emacs, et al.), but much of that is mitigated with the new .m file editor. Not that I am really an active Mathematica user anymore... === Subject: Re: problem accessing notebooks try AppendTo[$Path,C:Dokumente und EinstellungenrosenthalEigene what you do with SetDirectory[] is irrelevant for the package search. > dear forum, > BeginPackage[Symkin`,{ > GlobalKinematics`TopologicalStructure`, > GlobalKinematics`GlobalChains`, > SingleLoops`SolveSingleLoop`, > SingleLoops`GetSubstitutions`, > SingleLoops`GenerateConstraints`, > SingleLoops`BuildIPM`, > SingleLoops`ConstraintProjections`, > SingleLoops`GenerateVelocities`, > SingleLoops`GenerateAccelerations`, > SingleLoops`SolveLinearEquations`, > Graphs`LeafDetection`, > Graphs`KinematicalNetwork`, > Graphs`LoopBasis`, > Graphs`SpanningTree`, > Graphs`KinematicsToGraphs`, > Graphs`CycleBasis`, > Graphs`CycleBasis2`, > Graphs`CycleBasis3`, > Graphs`CycleBasis4`, > Graphs`CycleBasis6`, > Graphs`ShortestPath`, > Jacobians`GenerateJacobians`, > Jacobians`DeriveJacobians`, > Jacobians`Make6x1Vector`, > Transformations`Make4x4Matrix`, > Transformations`SimplifyChain`, > Transformations`NormalizeTransformations`, > Transformations`SwapAxes`, > Transformations`BasicTransformations`, > Transformations`PartitionChain`, > Algebra`Trigonometry`, > ImplicitSolutions`ImplicitSolutions`, > ImplicitSolutions`ExtractEdges`, > ImplicitSolutions`JointConstraints`, > ImplicitSolutions`JointConstraints`, > Dynamics`KinematicDifferentials`, > Help`ExtractReferenceSystems`, > Help`GenerateEquationSequence`, > Help`GenerateCORDICBlocks`, > Help`GenerateNumericValues`}] > I get the error message: > Get::noopen: Cannot open GlobalKinematics`TopologicalStructure` > (I added the first line of the code fragment to overcome this problem, and the package of name TopologicalStructure resides in the subdirectory GlobalKinematics). So, although the files seem to be in the right place, mathematica will not access them. Is there some other path-variable that I need to set, e.g. a variable containing the default-path for packages or something like that? Also, you might want to know that this package did run under earlier versions of mathematica, and, was designed for mathematica 4, I think. > Dietmar > === Subject: Re: problem accessing notebooks > dear forum, > BeginPackage[Symkin`,{ > GlobalKinematics`TopologicalStructure`, ... > Help`GenerateNumericValues`}] > I get the error message: > Get::noopen: Cannot open GlobalKinematics`TopologicalStructure` > (I added the first line of the code fragment to overcome this problem, and the package of name TopologicalStructure resides in the subdirectory GlobalKinematics). So, although the files seem to be in the right place, mathematica will not access them. Is there some other path-variable that I need to set, e.g. a variable containing the default-path for packages or something like that? Also, you might want to know that this package did run under earlier versions of mathematica, and, was designed for mathematica 4, I think. > Dietmar > Hello Dietmar, you should try 1.) SetDirectory instead of setDirectory 2.) C:Dokumente und Einstellungenrosenthal... instead of C:Dokumente und Einstellungenrosenthal... (see section 2.8.6 in The Mathematica Book) Hope, that helps, Peter === Subject: Re: Product command with matrices > I want to define a matrix valued function such as the following (in > LaTeX lingo): $$ > X(0)=Id, > X(n)=prod_{i=0}^{n-1} (Id + f[i] A) > $$ where A and f have already been defined and Id is the identity matrix > of appropriate size. I tried the following: Id=IdentityMatrix[2]; > Phi[0]:=Id; > Phi[n_]:= Product[Id + f[i] A,{i,0,n-1}] However, Phi[3] and (Id+f[2]A).(Id+f[1]A).(Id+f[0]A) do not agree. The following will do the recursion and correctly handle the *matrix* product (which Product[] does not do). Fold[(Id + f[#2] A).#1 &, Id + f[0] A, Range[n - 1]] Here is an example of a complete definition: Id = IdentityMatrix[2]; phi[0] := Id; phi[n_] := Fold[(Id + f[#2] A).#1 &, Id + f[0] A, Range[n - 1]] phi[3] % == (Id + f[2] A).(Id + f[1] A).(Id + f[0] A) // Simplify {{A (A (1 + A f[0]) f[1] + A f[0] (1 + A f[1])) f[ 2] + (A^2 f[0] f[1] + (1 + A f[0]) (1 + A f[1])) (1 + A f[2]), A (A^2 f[0] f[1] + (1 + A f[0]) (1 + A f[1])) f[ 2] + (A (1 + A f[0]) f[1] + A f[0] (1 + A f[1])) (1 + A f[2])}, {A (A^2 f[0] f[1] + (1 + A f[0]) (1 + A f[1])) f[ 2] + (A (1 + A f[0]) f[1] + A f[0] (1 + A f[1])) (1 + A f[2]), A (A (1 + A f[0]) f[1] + A f[0] (1 + A f[1])) f[ 2] + (A^2 f[0] f[1] + (1 + A f[0]) (1 + A f[1])) (1 + A f[2])}} True -- === Subject: Re: Product command with matrices > On Apr 18, 6:14 am, -Peer Kuska Times[] is not Dot[] and Product[] and no equivalent to use >> Dot[] instedad of Times[] and there is no (easy) way to >> tell Mathematica that f[1] is a matrix and what may be A >> a scalar ? a vector or a matrix too ? Even I can't find it out >> and Mathematica can't know it. >> You mean >> DotProduct[mtx_, {i_, i1_, in_}] := Dot @@ Table[mtx, {i, i1, in}] >> Phi[0] := Id; >> Phi[n_] := DotProduct[Id + f[i] ** A, {i, 0, n - 1}] >> and >> Phi[3] gives >> (Id + f[0] ** A).(Id + f[1] ** A).(Id + f[2] ** A) >> >> I want to define a matrix valued function such as the following (in >> LaTeX lingo): >> $$ >> X(0)=Id, >> X(n)=prod_{i=0}^{n-1} (Id + f[i] A) >> $$ >> where A and f have already been defined and Id is the identity matrix >> of appropriate size. >> I tried the following: >> Id=IdentityMatrix[2]; >> Phi[0]:=Id; >> Phi[n_]:= Product[Id + f[i] A,{i,0,n-1}] >> However, Phi[3] and (Id+f[2]A).(Id+f[1]A).(Id+f[0]A) do not agree. >> Any help around this would be appreciated. email. I thought I would share the following very efficient solution: Phi[n_]:=Apply[Dot,Table[Id + f[k]A,{k,0,n-1}]] There is a caveat to this approach. If your purpose is to do matrix-times-vector products (this is quite common, say in iterative linear solvers), then you'd want to avoid the explicit Dot expansion. That is, instead of the matrix-times-matrix you would only do matrix-times-vector. This will cut the run time by a factor approximating the dimension. Here is an example, using integers just to show equivalence (for numeric purposes, say, one would more likely have matrices of inexact numbers). f[j_] := 3*j^2 - j + 5 matfunc[m_, n_] := Table[IdentityMatrix[dim] + f[j]*m, {j, n}] In[82]:= dim = 25; n = 200; bnd = 5; mat = RandomInteger[{-bnd, bnd}, {dim, dim}]; vec = RandomInteger[{-bnd, bnd}, {dim}]; Now notice that creating the table is quick, and evaluating the matrix-times-vector is nearly dim times slower than expanding the matrix product explicitly followed by application to the vector (and they give the same result). In[87]:= Timing[mtable = matfunc[mat, n];] Timing[prod = Apply[Dot, mtable];] Timing[newvec = prod.vec;] Timing[newvec2 = Fold[Dot[#2, #1] &, vec, Reverse[mtable]];] Max[Abs[newvec - newvec2]] Out[87]= {0.02, Null} Out[88]= {3.785, Null} Out[89]= {0., Null} Out[90]= {0.171, Null} Out[91]= 0 Daniel Lichtblau Wolfram Research === Subject: Very Long Wait for the Kernel after Reboot I'm running v6.0.1 of Mathematica under Mac OS X v10.4.11 with 1 GB time I try to evaluate a Mathematica instruction after rebooting the computer, it takes a very long time to load the kernel (I once timed it at five minutes, and it seems to be getting longer, but I haven't timed it again so that might just be frustration). Subsequent sessions with Mathematica don't require nearly as long (though it still seems unreasonably long) to get the kernel up and running---as long as I haven't rebooted. Is this normal for my configuration? Does anyone have an explanation? --Lou Talman Department of Mathematical and Computer Sciences Metropolitan State College of Denver === Subject: Re: axis alignment of 3D plots with ListContourPlot3D Hello Jess, This will work, it is not efficient, but fairly straightforward to modify for you own purposes: data = Table[{Sin[RandomReal[{-x, x}]], Cos[RandomReal[{-x, x}]], Cos[ x]}, {x, 0, 1, .01}]; plot = ListPlot3D[data] Show[myplot, ViewPoint -> r {Cos[theta] Sin[phi], Sin[theta] Sin[phi], Cos[phi]}] (*here I use spherical coordinates, but the choice is yours) (* You can also program your own flight trajectory and speed *) > Can anyone tell me how I can manually the view angle of a > ListContourPlot3D? Mathematica seems to automatically set the view > angle according to the data distribution. I need to do this because I > am generating a series of 3D graphics with ListContourPlot3D, which I > then animate into a AVI movie using the export command. As the > distribution changes shape significantly in each image, Mathematica > automaitcally shifts the view angle substantially, which unfortunately > makes the resulting animation appear to shake as the view angle > changes. Jess -- W. Craig Carter === Subject: Re: axis alignment of 3D plots with ListContourPlot3D set the ViewAngle option in all you plots to the value you like ?? > Can anyone tell me how I can manually the view angle of a > ListContourPlot3D? Mathematica seems to automatically set the view > angle according to the data distribution. I need to do this because I > am generating a series of 3D graphics with ListContourPlot3D, which I > then animate into a AVI movie using the export command. As the > distribution changes shape significantly in each image, Mathematica > automaitcally shifts the view angle substantially, which unfortunately > makes the resulting animation appear to shake as the view angle > changes. Jess > === Subject: Re: axis alignment of 3D plots with ListContourPlot3D > Can anyone tell me how I can manually the view angle of a > ListContourPlot3D? Mathematica seems to automatically set the view > angle according to the data distribution. I need to do this because I > am generating a series of 3D graphics with ListContourPlot3D, which I > then animate into a AVI movie using the export command. As the > distribution changes shape significantly in each image, Mathematica > automaitcally shifts the view angle substantially, which unfortunately > makes the resulting animation appear to shake as the view angle > changes. Jess, The function *ListContourPlot3D[]* takes, in additions to its own specific options, the same options as *Graphics3D[]*. Doing animations, you may be especially interested by the SphericalRegion, ViewCenter, ViewAngle options. Options[ListContourPlot3D] {AlignmentPoint -> Center, AspectRatio -> Automatic, Axes -> True, AxesEdge -> Automatic, AxesLabel -> None, AxesStyle -> {}, Background -> None, BaselinePosition -> Automatic, BaseStyle -> {}, BoundaryStyle -> GrayLevel[0], Boxed -> True, BoxRatios -> {1, 1, 1}, BoxStyle -> {}, ColorFunction -> Automatic, ColorFunctionScaling -> True, ColorOutput -> Automatic, ContentSelectable -> Automatic, Contours -> 3, ContourStyle -> GrayLevel[1], ControllerLinking -> Automatic, ControllerMethod -> Automatic, ControllerPath -> Automatic, DataRange -> Automatic, DisplayFunction :> $DisplayFunction, Epilog -> {}, FaceGrids -> None, FaceGridsStyle -> {}, FormatType :> TraditionalForm, ImageMargins -> 0., ImagePadding -> All, ImageSize -> Automatic, LabelStyle -> {}, Lighting -> Automatic, MaxPlotPoints -> Automatic, Mesh -> Automatic, MeshFunctions -> {#1 &, #2 &, #3 &}, MeshShading -> None, MeshStyle -> Automatic, Method -> Automatic, PerformanceGoal :> $PerformanceGoal, PlotLabel -> None, PlotRange -> {Full, Full, Full, Automatic}, PlotRangePadding -> Automatic, PlotRegion -> Automatic, PreserveImageOptions -> Automatic, Prolog -> {}, RegionFunction -> (True &), RotationAction -> Fit, SphericalRegion -> False, Ticks -> Automatic, TicksStyle -> {}, ViewAngle -> Automatic, ViewCenter -> {1/2, 1/2, 1/2}, ViewMatrix -> Automatic, ViewPoint -> {1.3, -2.4, 2.}, ViewRange -> All, ViewVector -> Automatic, ViewVertical -> {0, 0, 1}} -- === Subject: Re: Mathematica syntax > An error is yielded with the below segment: l4**2*m1*phidd - l3**2*m2*psidd + > - l1**2*m1*thdd + l4**2*m1*thdd + l2**2*m2*thdd + > - l3**2*m2*thdd + (l1**2*mb*thdd)/3. - > - (l1*l2*mb*thdd)/3. + (l2**2*mb*thdd)/3. - > - l1*l4*m1*(phidd + 2*thdd)*Cos(phi) + I believe it may arise from, among other things, Cos(phi) where you probably mean Cos[phi]. Also, I don't think Mathematica recognizes the ** as exponentiation as I think you intend: n.b. 2^3 is 8 -- W. Craig Carter === Subject: Re: Mathematica syntax I'm shocked to see that your old version of Mathematica, I think v3 had used .eq. instead of == (Equal[]) and that is had used ** instead of ^ (Power[]). I use Mathematica since version 1.2 and it had never, *never* NEVER used .eq. or **. Or did you expect that Mathematica understand FORTRAN ? So the answer is simply translate it from FORTRAN to Mathematica. > An error is yielded with the below segment: l4**2*m1*phidd - l3**2*m2*psidd + > - l1**2*m1*thdd + l4**2*m1*thdd + l2**2*m2*thdd + > - l3**2*m2*thdd + (l1**2*mb*thdd)/3. - > - (l1*l2*mb*thdd)/3. + (l2**2*mb*thdd)/3. - > - l1*l4*m1*(phidd + 2*thdd)*Cos(phi) + > - l2*l3*m2*(psidd - 2*thdd)*Cos(psi) + > - l1*l4*m1*phid**2*Sin(phi) + > - 2*l1*l4*m1*phid*thd*Sin(phi) - > - l2*l3*m2*psid**2*Sin(psi) + > - 2*l2*l3*m2*psid*thd*Sin(psi) - > - g*l3*m2*Sin(psi - th) + g*l1*m1*Sin(th) - > - g*l2*m2*Sin(th) + (g*l1*mb*Sin(th))/2. - > - (g*l2*mb*Sin(th))/2. - g*l4*m1*Sin(phi + th).eq.0, > l4*m1*(l4*phidd + l4*thdd - l1*thdd*Cos(phi) - > - l1*thd**2*Sin(phi) - g*Sin(phi + th)).eq.0, > l3*m2*(l3*psidd - l3*thdd + l2*thdd*Cos(psi) - > - l2*thd**2*Sin(psi) + g*Sin(psi - th)).eq.0 (This is from a old version of Mathematica, I think v3) It gives a syntax error and (psi) and (phi) are invalid. What needs to be corrected? I'll post the whole notebook aftewards. === Subject: Re: Mathematica syntax > An error is yielded with the below segment: l4**2*m1*phidd - l3**2*m2*psidd + > - l1**2*m1*thdd + l4**2*m1*thdd + l2**2*m2*thdd + > - l3**2*m2*thdd + (l1**2*mb*thdd)/3. - > - (l1*l2*mb*thdd)/3. + (l2**2*mb*thdd)/3. - > - l1*l4*m1*(phidd + 2*thdd)*Cos(phi) + > - l2*l3*m2*(psidd - 2*thdd)*Cos(psi) + > - l1*l4*m1*phid**2*Sin(phi) + > - 2*l1*l4*m1*phid*thd*Sin(phi) - > - l2*l3*m2*psid**2*Sin(psi) + > - 2*l2*l3*m2*psid*thd*Sin(psi) - > - g*l3*m2*Sin(psi - th) + g*l1*m1*Sin(th) - > - g*l2*m2*Sin(th) + (g*l1*mb*Sin(th))/2. - > - (g*l2*mb*Sin(th))/2. - g*l4*m1*Sin(phi + th).eq.0, > l4*m1*(l4*phidd + l4*thdd - l1*thdd*Cos(phi) - > - l1*thd**2*Sin(phi) - g*Sin(phi + th)).eq.0, > l3*m2*(l3*psidd - l3*thdd + l2*thdd*Cos(psi) - > - l2*thd**2*Sin(psi) + g*Sin(psi - th)).eq.0 (This is from a old version of Mathematica, I think v3) It gives a syntax error and (psi) and (phi) are invalid. What needs to be corrected? I'll post the whole notebook aftewards. > This is not a Mathematica expression at all. It is Fortran. Mathematica does not seem to support parsin FortranForm, so the expression needs to be rewritten manually. === Subject: Re: Mathematica syntax > An error is yielded with the below segment: l4**2*m1*phidd - l3**2*m2*psidd + > - l1**2*m1*thdd + l4**2*m1*thdd + l2**2*m2*thdd + > - l3**2*m2*thdd + (l1**2*mb*thdd)/3. - > - (l1*l2*mb*thdd)/3. + (l2**2*mb*thdd)/3. - > - l1*l4*m1*(phidd + 2*thdd)*Cos(phi) + > - l2*l3*m2*(psidd - 2*thdd)*Cos(psi) + > - l1*l4*m1*phid**2*Sin(phi) + > - 2*l1*l4*m1*phid*thd*Sin(phi) - > - l2*l3*m2*psid**2*Sin(psi) + > - 2*l2*l3*m2*psid*thd*Sin(psi) - > - g*l3*m2*Sin(psi - th) + g*l1*m1*Sin(th) - > - g*l2*m2*Sin(th) + (g*l1*mb*Sin(th))/2. - > - (g*l2*mb*Sin(th))/2. - g*l4*m1*Sin(phi + th).eq.0, > l4*m1*(l4*phidd + l4*thdd - l1*thdd*Cos(phi) - > - l1*thd**2*Sin(phi) - g*Sin(phi + th)).eq.0, > l3*m2*(l3*psidd - l3*thdd + l2*thdd*Cos(psi) - > - l2*thd**2*Sin(psi) + g*Sin(psi - th)).eq.0 (This is from a old version of Mathematica, I think v3) It gives a syntax error and (psi) and (phi) are invalid. What needs to be corrected? I'll post the whole notebook aftewards. As far as I can tell, the extract of code you posted is incomplete (it is a list of equalities and the curly braces that must surround them are missing), the .eq. symbol (FORTRAN syntax?) must stand for Equal[] (also ==, double equal sign), and the expressions are imputed in TraditionalForm[]. Also, the code posted contains too many minus signs (perhaps a side effect of copying and pasting within your newsreader client?) and the double star sign ** means non-commutative multiplication. Is this really what you want? Non-commutative multiplication between scalars such as 14 and 2 is not really meaningful. However, some other programming languages , such as FORTRAN if I remember well, use ** to indicate exponentiation. So, you should fix the code by adding curly braces around lists of equations, discard the excessive minus sings, changing .eq. to ==, and be sure of the meaning of the ** (otherwise, replace them by a single * for regular multiplication or a ^ for exponentiation). Also, do not forger to tell Mathematica that this is TraditionalForm[] or use square brackets [] rather than parentheses () when passing arguments to a function. Finally, your code should more or less looks like {-(1/3) l1 l2 mb thdd - l1 l4 m1 (phidd + 2 thdd) Cos[phi] + l2 l3 m2 (psidd - 2 thdd) Cos[psi] + m1 thdd l1 ** 2 + 1/3 mb thdd l1 ** 2 + m2 thdd l2 ** 2 + 1/3 mb thdd l2 ** 2 - m2 psidd l3 ** 2 + m2 thdd l3 ** 2 + m1 phidd l4 ** 2 + m1 thdd l4 ** 2 + 2 l1 l4 m1 phid thd Sin[phi] + l1 l4 m1 phid ** 2 Sin[phi] + 2 l2 l3 m2 psid thd Sin[psi] - l2 l3 m2 psid ** 2 Sin[psi] - g l3 m2 Sin[psi - th] + g l1 m1 Sin[th] - g l2 m2 Sin[th] + 1/2 g l1 mb Sin[th] - 1/2 g l2 mb Sin[th] - g l4 m1 Sin[phi + th] == 0, l4 m1 (l4 phidd + l4 thdd - l1 thdd Cos[phi] - l1 thd ** 2 Sin[phi] - g Sin[phi + th]) == 0, l3 m2 (l3 psidd - l3 thdd + l2 thdd Cos[psi] - l2 thd ** 2 Sin[psi] + g Sin[psi - th]) == 0} HTH, -- === Subject: Re: Problems to find the local extrema of an InterpolatingFunction > does anyone know how to find all the local extrema of an InterpolatingFunction in a specified interval? The only The following might help (Note that NDSolve[] returns an InterplolatingFunction so most of the post is relevant) Minima -- === Subject: Re: Problems to find the local extrema of an InterpolatingFunction does anyone know how to find all the local extrema of an InterpolatingFunction in a specified interval? The only > I would feel uncomfortable using FindMinimum on InterpolatingFunction objects because (when constructed with Interpolation) the derivative of an InterpolatingFunction is usually not continuous. f = Interpolation[{1, 3, 7, 4, 2}] Plot[{f[x], f'[x]}, {x, 1, 5}] If the InterpolatingFunction was returned by NDSolve, or the values of the derivative were supplied to Interpolation, then the derivative will be usually continuous. If you have the raw data points, I would suggest working with them directly, or at least using them to find the two data points that surround the extremum, and using the FindMinimum[f, {x, x0, xmin, xmax}] syntax to search for the mimimum in a restricted region. Here's a tutorial on extracting data points from InterpolatingFunctions returned by NDSolve: tutorial/NDSolvePackages#120436095 http://reference.wolfram.com/mathematica/tutorial/NDSolvePackages.html And some simple ways for finding zero crossings or local minima in discrete data: data = Table[Sin[x], {x, 0, 5, .2}] Select[Partition[data, 2, 1], NonPositive[Times @@ #] &] minPoint[{a_, b_, c_}] := b <= a && b <= c Select[Partition[data, 3, 1], minPoint] Ways to construct numerical derivatives from discrete data: Differences[data] ListConvolve[{1, -1}, data] ListConvolve[{1, 0, -1}, data]/2 This should be enough to get you started. === Subject: Re: Problems to find the local extrema of an InterpolatingFunction My recommendation is to get Ted Ersek's RootSearch package: http://library.wolfram.com/infocenter/MathSource/4482/ , then use the derivative of your InterpolatingFunction: In[1]:= Needs[Ersek`RootSearch`] In[2]:= interpChirp = Interpolation[({#1, Cos[14*#1^2]} & ) /@ Range[-3, 3, 0.01]] Out[2]= InterpolatingFunction[] In[3]:= Information[RootSearch, LongForm -> False] RootSearch[lhs==rhs,{x,xmin,xmax}] tries to find all numerical solutions to the equation (lhs==rhs) with values of x between xmin and xmax. In[4]:= extremaChirpXCoords = x /. RootSearch[D[interpChirp[x], x] == 0, {x, -1.5, 3}] Out[4]= {-1.4980975190701675, -1.4210097731164544, -1.3399599968757765, -1.253270595111517, -1.1602567136610211, -1.0593077704612488, -0.9474492610932443, -0.8204437093590906, -0.6699513826802013, -0.47370362211238165, -0.004342581524651825, 0.00434258152465195, 0.47370362211238176, 0.6699513826802013, 0.8204437093590906, 0.9474492610932445, 1.0593077704612488, 1.160256713661021, 1.253270595111517, 1.3399599968757765, 1.4210097731164542, 1.4980975190701675, 1.5709720363954214, 1.6408167527739237, 1.7081100377259189, 1.77232629554058, 1.8346443273739474, 1.8948220414420387, 1.9530325395646555, 2.064834351176493, 2.1187158019428436, 2.170525249075549, 2.2216511458569324, 2.2715727275276505, 2.320364713016632, 2.3688300115369434, 2.4154912450988784, 2.4611399058587113, 2.5067974734662237, 2.550625271059587, 2.5945599123892618, 2.6377710949526834, 2.7208407543330613, 2.7618276779035154, 2.8021763434663263, 2.84189467724394, 2.8810163395212918, 2.958738929626501, 2.996047283696872} In[5]:= extremaChirpYCoords = interpChirp[extremaChirpXCoords] Out[5]= {0.9995783376727462, -0.9997913995697288, 0.9999851022756102, -0.9996907441468013, 0.9999722045939012, -0.9999572984982811, 0.9999164611721563, -0.9999891795306132, 0.9999994140183288, -0.9999936451427361, 1.0000005058258696, 1.0000005058258696, -0.999993645142736, 0.9999994140183288, -0.9999891795306133, 0.9999164611721564, -0.9999572984982811, 0.9999722045939011, -0.9996907441468013, 0.9999851022756102, -0.9997913995697286, 0.9995783376727462, -0.9996970548912986, 0.9996880319837047, -0.9992890387882577, 0.9990115892238276, -0.9984100861603418, 0.9981875824885136, -0.9982748925101684, -0.9974550471242827, 0.9987552561687699, -0.9992978970579964, 0.9981128527753262, -0.998012320054932, 0.9992740115186692, -0.998176511269883, 0.9953339150930023, -0.9978553098199383, 0.9952867875140399, -0.9984119813872546, 0.9937952104558903, -0.9954141530293343, -0.9974161404829311, 0.9951318944149817, -0.9941722992470973, 0.9944011576893499, -0.9962360609385842, -0.9951865800641378, 1.0138341847377665} In[6]:= Show[ ListPlot[Transpose[{extremaChirpXCoords, extremaChirpYCoords}]], Plot[interpChirp[x], {x, -3, 3}]] Hope that helps! C.O. does anyone know how to find all the local extrema of an > InterpolatingFunction in a specified interval? The only thing that seems to > work is Findroot, but it only finds a single root each time. Other -- Curtis Osterhoudt cfo@remove_this.lanl.and_this.gov PGP Key ID: 0x4DCA2A10 Please avoid sending me Word or PowerPoint attachments See http://www.gnu.org/philosophy/no-word-attachments.html === Subject: Re: Problems to find the local extrema of an InterpolatingFunction Hello Modeler, I beleive the best strategy for you is: plot your InterpolationFunction over its finite domain, visually look for the roots, and then find them with: FindRoot[InterpolatingFunction[x],{x,firstguess,leftlimit, rightlimit}] If you need to do this for many unknown Interpolating functions, then you will need to automate this a bit---for example by moving the search domain iteratively. But, if you only have one, graphically assisted root finding works well in my experience. Craig does anyone know how to find all the local extrema of an InterpolatingFunction in a specified interval? The only -- W. Craig Carter === Subject: Re: Possible bug in WAV export >> To demonstrate that this unbelievable thing really happens, here's an >> another example, together with the result. Note that the very same >> command returns different results in subsequent evaluations: >> In[1]:= >> Table[ >> Total[#[[1, 1, 1]]] &@ >> ImportString[ >> ExportString[ >> Play[Sum[Sin[2 Pi 440 k t], {k, 1, 4}], {t, 0, 1}, >> SampleRate -> 44100, SampleDepth -> 16], WAV], WAV], >> {20}] >> Out[1]= {0., 268.745, -0.752563, -0.756226, -0.756226, -2.99866, 0., >> 0., -2.98279, 0., 0.756226, 341.993, 0., -0.752563, 0., 268.017, >> -0.752563, 0., -2.2522, 0.} >> The small fluctuations could be explained by dithering, but any >> reasonably precise result cannot have a sum of 342! The sound >> function was constructed in such a way that the sum should be 0. A workaround is to use PlayRange -> All. > randomness, though. With PlayRange -> All, the sums are always 0., so it cannot be dithering. === Subject: Re: Changing TextStyle within Show no, you must add it to the individual Text[] objects because otherwise an individual change would not possible. > I have often used TextStyle as a global option in Show, for example TextStyle->{FontFamily->Times,FontSlant->Italic,FontSize->9} to render all text in a plot. Is there a way to use it as a > Graphics instruction so that font size, etc. is changed for subsequent > Text objects as the plot is processed? The Graphics documentation (I am looking at 5.2 on my laptop) says > yes, but gives no specific format or examples. I would expect a > function like Graphics[TextStyle[ arguments ]] to be available > but cant find a description. > === Subject: Re: Column Product of a Matrix of zeros and 1's Hello Bill, myM2 = { {1, 1, 0, 0, 0, 0, 1, 0, 0}, {1, 1, 0, 0, 0, 0, 1, 1, 0}, {1, 1, 1, 0, 0, 0, 1, 1, 0}, {1, 0, 1, 0, 0, 0, 1, 1, 1}, {1, 1, 0, 1, 0, 1, 0, 0, 0}, {1, 1, 1, 1, 0, 1, 0, 0, 0}, {1, 0, 1, 1, 1, 0, 0, 0, 0}, {1, 0, 1, 1, 0, 1, 0, 0, 0} }; I take the product of colomn 1 and 2 as an example: {1,1,1,0,1,1,0,0} (thisSet= {1,2}) The positions of the 1's are: {1,2,3,5,6} (with Flatten) I solved how to do this for thisSet etc. But I did not use the property that myGlobalMatrix (myM2)is 1's and 0's. with friendly greetings, P_ter === Subject: Re: installing Player Pro killed using Mathematica itself: BEWARE! > With an existing installation of Mathematica 6.0.2 under Windows, I just > installed Player Pro. The result: if I start Mathematica itself and > open a new notebook there, I am prohibited from typing any and all input. This sort of thing is intolerable! An utterly time-frittering aggravation. I suspect that the scenario involved here was not tested by WRI: My > mathpass for Mathematica itself is in the Licensing subdirectory of my > USERBASE directory, which is the same as my BASE directory (both set by > Windows environment variables MATHEMATICA_BASE and MATHEMATICA_USERBASE). This is hardly the first time I have run into trouble with multiple > passwords from multiple Wolfram Research products. It is something they > have just not yet gotten right. Beware! What I did as a temporary fix was to use my Windows backup program to > restore my pre-existing mathpass file. Now regular Mathematica works. > But of course Player Pro does not. > Murray, Maybe you could use both products on the same machine by changing the MATHEMATICA_BASE/MATHEMATICA_USERBASE environment variable when you switch from one to the other (and on initial installation). I do agree about your complaint though, mathpass files are obviously encrypted, but it would be nice if in all other ways their behaviour was transparent. David === Subject: Re: Converting Power terms to Times terms Hi and Daniel, Reza ----- Original Message ---- === Subject: Re: Converting Power terms to Times terms no, but you can redefine the output of Power[], so that it look like a*a*a, i.e. Unprotect[Power] Format[Power[a_, n_Integer], FortranForm] := (HoldForm @@ {Table[a, {n}]}) /. List -> Times Protect[Power] and FortranForm[a*b^4*Sin[w^2]] gives a*(b*b*b*b)*Sin(w*w) I am using Dolfin/FFC for solving finite element problems. I want to use Mathematica for generating the linear and bilinear terms of the weak equation. After computing the terms, I use the InputForm, and then give the results to FFC compiler. The problem is that FFC does not accept power function. Therefore, terms such as a^2 must be written as a*a. Because there are many terms in the weak form of my problem, manual conversion of power terms takes a long time (and probably is subject to errors). Is there any way to disable power function, or stop times function to be simplified in the power form? Any other solution? Reza === Subject: Re: installing Playe rPro killed using Mathematica itself: BEWARE! Yes, this is because of the overlapping use of MATHEMATICA_USERBASE. Anybody who does not set this variable will not see the problem. To work around this... * Take your current mathpass file and move it into Mathematica's installation directory in ConfigurationLicensing. * Start Player Pro and enter your password. * Take the newly generated mathpass file and move it into Player Pro's installation directory in ConfigurationLicensing. John Fultz jfultz@wolfram.com User Interface Group Wolfram Research, Inc. > With an existing installation of Mathematica 6.0.2 under Windows, I just > installed Player Pro. The result: if I start Mathematica itself and > open a new notebook there, I am prohibited from typing any and all input. This sort of thing is intolerable! An utterly time-frittering > aggravation. I suspect that the scenario involved here was not tested by WRI: My > mathpass for Mathematica itself is in the Licensing subdirectory of my > USERBASE directory, which is the same as my BASE directory (both set by > Windows environment variables MATHEMATICA_BASE and MATHEMATICA_USERBASE). This is hardly the first time I have run into trouble with multiple > passwords from multiple Wolfram Research products. It is something they > have just not yet gotten right. Beware! What I did as a temporary fix was to use my Windows backup program to > restore my pre-existing mathpass file. Now regular Mathematica works. > But of course Player Pro does not. === Subject: Re: installing Playe rPro killed using Mathematica itself: BEWARE! > Yes, this is because of the overlapping use of MATHEMATICA_USERBASE. Anybody > who does not set this variable will not see the problem. To work around this... * Take your current mathpass file and move it into Mathematica's installation > directory in ConfigurationLicensing. > * Start Player Pro and enter your password. > * Take the newly generated mathpass file and move it into Player Pro's > installation directory in ConfigurationLicensing. > John Fultz Wouldn't it be possible for each Wolfram product to be aware of all other products that might be present - together with the associated environment variables - and take data from every mathpass file it encountered. David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Re: matrix of vectors - super slow here is a more mathematica like implementation.You should test it well, because I did not have the time to do it thoroughly. Is it correct that for Pint and SInt only one element of the 2x2 matrix is used? What is the Norm[..] doing? Further, there is no need to create 128^2 equal copies in BeamIn. I only give the changes, the definitions that are unchanged are eliminated: BeamIn={{Sqrt[2]/2},{Sqrt[2]/2}}; x=Table[R ((2 i-n)-1),{i,n}]; y=Table[R ((2 i-m)-1),{i,m}]; PBeam=Outer[(r=Sqrt[#1^2+#2^2]; [Theta]=ArcTan[#2/#1]; PPol.LaserRod[r,[Theta],1*10^-3].QuarterWave[[Pi]/2].LaserRod[r,[Theta ],1*10^-3].PPol.BeamIn)&,x,y]; SBeam=Outer[(r=Sqrt[#1^2+#2^2]; [Theta]=ArcTan[#2/#1]; SPol.LaserRod[r,[Theta],1*10^-3].QuarterWave[[Pi]/2].LaserRod[r,[Theta ],1*10^-3].PPol.BeamIn)&,x,y]; PInt=Map[Norm[#[[1,1]]]^2&,PBeam,{2}]; SInt=Map[Norm[#[[2,1]]]^2&,SBeam,{2}]; hope this helps, Daniel > I have an matrix of vectors where each element has to go through > various transformations, that is each element has to be multiplied by > a few different matrices. Is there a more efficient way of doing that > from what I am currently doing? n = 128*1; > m = 128*1; > R = 1; > BeamIn = Table[( { > {Sqrt[2]/2}, > {Sqrt[2]/2} > } ), {i, n}, {j, m}]; > PBeam = Table[0, {i, n}, {j, m}]; > SBeam = Table[0, {i, n}, {j, m}]; > PInt = Table[0, {i, n}, {j, m}]; > SInt = Table[0, {i, n}, {j, m}]; HalfWave[[Theta]_] = ( { > {Cos[-[Theta]], Sin[-[Theta]]}, > {-Sin[-[Theta]], Cos[-[Theta]]} > } ).( { > {1, 0}, > {0, Exp[-I [Pi]]} > } ).( { > {Cos[[Theta]], Sin[[Theta]]}, > {-Sin[[Theta]], Cos[[Theta]]} > } ); > QuarterWave[[Theta]_] = ( { > {Cos[-[Theta]], Sin[-[Theta]]}, > {-Sin[-[Theta]], Cos[-[Theta]]} > } ).( { > {1, 0}, > {0, Exp[-I [Pi]/2]} > } ).( { > {Cos[[Theta]], Sin[[Theta]]}, > {-Sin[[Theta]], Cos[[Theta]]} > } ); > PPol = ( { > {1, 0}, > {0, 0} > } ); > SPol = ( { > {0, 0}, > {0, 1} > } ); > LaserRod[TT_, [Theta]_, Q_] = ( { > {Cos[-[Theta]], Sin[-[Theta]]}, > {-Sin[-[Theta]], Cos[-[Theta]]} > } ).( { > {Exp[-I *2.8 *TT^2*Q], 0}, > {0, Exp[I *0.4 *TT^2* Q]} > } ).( { > {Cos[[Theta]], Sin[[Theta]]}, > {-Sin[[Theta]], Cos[[Theta]]} > } ); For[i = 1, i <= n, i++, > For[j = 1, j <= m, j++, > x = R ((2 i - n) - 1); > y = R ((2 j - m) - 1); > r = Sqrt[x^2 + y^2]; > [Theta] = ArcTan[y/x]; > PBeam[[i, j]] = > PPol.LaserRod[r, [Theta], 1*10^-3].QuarterWave[[Pi]/ > 2].LaserRod[r, [Theta], 1*10^-3].PPol.BeamIn[[i, j]]; > SBeam[[i, j]] = > SPol.LaserRod[r, [Theta], 1*10^-3].QuarterWave[[Pi]/ > 2].LaserRod[r, [Theta], 1*10^-3].PPol.BeamIn[[i, j]]; > PInt[[i, j]] = Norm[PBeam[[i, j]][[1, 1]]]^2; > SInt[[i, j]] = Norm[SBeam[[i, j]][[2, 1]]]^2; > ]; > ]; > ListDensityPlot[PInt] > ListDensityPlot[SInt] === Subject: Re: matrix of vectors - super slow > I have an matrix of vectors where each element has to go through > various transformations, that is each element has to be multiplied by > a few different matrices. Is there a more efficient way of doing that > from what I am currently doing? n = 128*1; > m = 128*1; > R = 1; > BeamIn = Table[( { > {Sqrt[2]/2}, > {Sqrt[2]/2} > } ), {i, n}, {j, m}]; > PBeam = Table[0, {i, n}, {j, m}]; > SBeam = Table[0, {i, n}, {j, m}]; > PInt = Table[0, {i, n}, {j, m}]; > SInt = Table[0, {i, n}, {j, m}]; HalfWave[[Theta]_] = ( { > {Cos[-[Theta]], Sin[-[Theta]]}, > {-Sin[-[Theta]], Cos[-[Theta]]} > } ).( { > {1, 0}, > {0, Exp[-I [Pi]]} > } ).( { > {Cos[[Theta]], Sin[[Theta]]}, > {-Sin[[Theta]], Cos[[Theta]]} > } ); > QuarterWave[[Theta]_] = ( { > {Cos[-[Theta]], Sin[-[Theta]]}, > {-Sin[-[Theta]], Cos[-[Theta]]} > } ).( { > {1, 0}, > {0, Exp[-I [Pi]/2]} > } ).( { > {Cos[[Theta]], Sin[[Theta]]}, > {-Sin[[Theta]], Cos[[Theta]]} > } ); > PPol = ( { > {1, 0}, > {0, 0} > } ); > SPol = ( { > {0, 0}, > {0, 1} > } ); > LaserRod[TT_, [Theta]_, Q_] = ( { > {Cos[-[Theta]], Sin[-[Theta]]}, > {-Sin[-[Theta]], Cos[-[Theta]]} > } ).( { > {Exp[-I *2.8 *TT^2*Q], 0}, > {0, Exp[I *0.4 *TT^2* Q]} > } ).( { > {Cos[[Theta]], Sin[[Theta]]}, > {-Sin[[Theta]], Cos[[Theta]]} > } ); For[i = 1, i <= n, i++, > For[j = 1, j <= m, j++, > x = R ((2 i - n) - 1); > y = R ((2 j - m) - 1); > r = Sqrt[x^2 + y^2]; > [Theta] = ArcTan[y/x]; > PBeam[[i, j]] = > PPol.LaserRod[r, [Theta], 1*10^-3].QuarterWave[[Pi]/ > 2].LaserRod[r, [Theta], 1*10^-3].PPol.BeamIn[[i, j]]; > SBeam[[i, j]] = > SPol.LaserRod[r, [Theta], 1*10^-3].QuarterWave[[Pi]/ > 2].LaserRod[r, [Theta], 1*10^-3].PPol.BeamIn[[i, j]]; > PInt[[i, j]] = Norm[PBeam[[i, j]][[1, 1]]]^2; > SInt[[i, j]] = Norm[SBeam[[i, j]][[2, 1]]]^2; > ]; > ]; > ListDensityPlot[PInt] > ListDensityPlot[SInt] Make absolutely sure your matrices are composed of Real or Complex numbers by applying N[..] as necessary. Otherwise there is a danger of performing arithmetic on exact expressions composed of surds, fractions and factors of Pi. This can generate extremely complicated expressions which then collapse silently to real numbers as you plot them! David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Re: A Problem with Simplify > And even in the purely algebraic cases Reduce can easily take for > ever. Or consider this: Reduce[x^3 + Sin[x] == 0, x] During evaluation of In[34]:= Reduce::nsmet : This system cannot > be solved with the methods available to Reduce even though anyone can easily see that 0 is a solution (but Reduce is > not allowed to return an incomplete solution). > Adnrzej Kozlowski I was surprised a bit. It is sad that even if I specify the Real domain I may not give the only possible answer x=0: Reduce[x + Sin[x] == 0, x, Reals] Solve[x + Sin[x] == 0, x, Reals] Now I understand the depth of the problem. But speaking about Integrate, is it really necessarily to perform Reduce[] on each step? The problem is to find the singularities on the parameters of the argument function (I mean such values of the parameters those degenerate the argument function). After this we should keep track on arising new conditions on each step. It does not mean to use Reduce. We need only understand what we really do and know about limitations. As I think this is not so much complicated task and may be fully implemented in Mathematica (if it is not implemented already). On the final result we may need perform searching for the singularities again - but only for checking the result! But as I see first of all Wolfram Research should extend Reduce[] for working with trigonometric functions. This is that we should wait for nearest-future version of Mathematica. If we can not expect this - what for we should pay money? === Subject: Re: Wolfram User Interface Research? > This comment about APL is quite wrong: nothing compelled you to write > inscrutable single line programs (except maybe in the earliest days, > when one was sending single lines over a telephone line to a mainframe, > then waiting for your instruction's turn to get its slice of time and > have the result sent back and typed at your terminal). With APL then, and with IBM's APL2 now, you MAY, if you wish, write > overly condensed one-liners. And indeed some APL programmers aimed to > write as concise a program, all in one line, as they could possibly do. I'll totally concede your point here. But I don't think it makes my original comment quite wrong, or even wrong at all. And I'm not attacking APL at all -- a great (if arcane) intellectual achievement in computer science, and maybe a great (if still arcane) tool for certain types of computation. But nonetheless, the arcane symbolic notation used in APL tends to make even multi-line APL programs nearly as inscrutable for all but APL experts. > What's more, many of the combinations of symbols in APL were instantly > recongnizable to any APL programmer as so-called idioms. Again, happy to agree. But, there aren't really a lot of APL programmers around, right? -- and I'd bet that they tend to be programmers employed as such, rather than ordinary users from many other fields, who just want to be get some computational task done in the field where their skills primarily lie. Is the primary market for Mathematica supposed to be Mathematica programmers, skilled in the arcana of the more abstruse parts of Mathematica, or ordinary users whose primary interests and skills lie in many, many other fields -- and who want Mathematica to be (for them) just an easy to learn, easy to use, easy to remember tool? > The delight of APL was, and is, that many very complicated things can, > in fact, be expressed quite concisely, in a way that the suggestive > graphic symbols of APL help one understand. Yes, and that's absolutely fine. But is Mathematica supposed to be a $1000 gaming platform for most powerful but also most abstruse one-liner competitions? Or a useful tool that can be quickly and easily learned (and remembered between intermittent uses!) by ordinary _non-programmer_ users, who just want to get work done using it in _their_ field of expertise. > Mathematica programs can be MUCH more difficult to understand > than corresponding APL program -- because the Mathematica programs use > all those, often long, words, and because they force one to pay close > attention to order of precedence and to insert nested brackets. Have to more or less totally disagree here. The 1000 or more basic symbols in Mathematica have names like ToUpperCase[] and EllipticThetaPrime[] for a reason . . . a _good_ reason. > I cannot speak knowledgeably of the current situation with APL2, but for > many years APL programmers were incredibly productive compared with > those programming in just about all other standard computer languages. > It's not for no good reason that, for example, major financial analysis > systems and reservations systems were written in APL (and some still > are, or at least in offshoots from the APL trunk). I suspect that one large part of the good reasons for this situation (if not the primary reason) was that every type of computer resource --- cpu speeds, hard disk storage capacity, printer capabilities, display capabilities, compiler capabilities, communication link speeds --- was (or were) were all _immensely_ more limited and more expensive 20 years ago, when these programs were written, than what we enjoy today. === Subject: Re: Wolfram User Interface Research? >It's really all a matter of what one has learned, and how well, and how >accustomed one is to the language. As just one rather simple-minded >example, suppose you want to form the running cumulative sum of a list >(in APL-speak, a vector) of numbers. In APL, this is given by + vec But I suspect that most users of Mathematica are mathematicians (or physicists or engineers or the like) and so come from a background of standard mathematical notation. Whilst Mathematica does try hard to stick with this it doesn't always and special symbols (like #, @) and so on are not transparent to a new user and not something that you would ordinarily search on. I have the advantage of an old fashioned thing made of paper, with hard covers (called a book) for Mathematica 5 and can flick through, see a symbol I don't recognise and read about it and think there may be better ways of expressing things than the way I am used to. With an online help I don't know that you would ever go and just look up random symbols unless someone had pointed you in the right direction. Whilst this is also true for standard mathematical notation, it is just that - standard. Mathematica isn't, it differs in some notations from other similar software (yes they do exist) and for the casual user (such as myself) it is very hard to learn this. One thing that would help me enormously from this forum is that when someone posts a suggestion for how to encode a particular issue (and I find these posts extremely helpful)is a bit of explanation of some of the more obscure terminology. I realise this adds a little to the effort involved in posting but if the idea is to help users learn how better to use Mathematica rather than just provide one off solutions to problems then this would be a big benefit. === Subject: Re: Problem with RegionFunction any idea what is the problem with the output of this Manipulate? Manipulate[ > Plot3D[Sin[x]*Cos[y],{x,1,10},{y,2,10},RegionFunction->Function[{x,y}, > 45<=(y^x)]] > ,{dummy,{True,False}}] The error I get (in XP, 6.0.1) relates to the 0^0 in the RegionFunction specification. Try: Manipulate[ Plot3D[Sin[x]*Cos[y], {x, 1, 10}, {y, 2, 10}, RegionFunction -> Function[{x, y} , x >= 1 && y >= 2 && 45 <= (y^x) ]], {dummy, {True, False}}] Hth, Fred Klingener === Subject: Re: Problem with RegionFunction try Manipulate[ Plot3D[Sin[x]*Cos[y], {x, 1, 10}, {y, 2, 10}, RegionFunction -> Function[{x, y}, 45 <= (y^x)], Exclusions -> x == 0], {dummy, {True, False}}] because y^x for x==0 and y==0 is undefined. any idea what is the problem with the output of this Manipulate? Manipulate[ > Plot3D[Sin[x]*Cos[y],{x,1,10},{y,2,10},RegionFunction->Function[{x,y}, > 45<=(y^x)]] > ,{dummy,{True,False}}] Interestingly none of the following codes produces errors: Plot3D[Sin[x]*Cos[y], {x, 1, 10}, {y, 1, 10}, > RegionFunction -> Function[{x, y}, 45 <= (y^x)]] Manipulate[ > Plot3D[Sin[x]*Cos[y], {x, 1, 10}, {y, 1, 10}, > RegionFunction -> If[region, All, Function[{x, y}, 45 <= (y^x)]]] > , {region, {True, False}}] Any suggestion would be appreciated. > Istvan Zachar > === Subject: Re: Problem with RegionFunction any idea what is the problem with the output of this Manipulate? Manipulate[ > Plot3D[Sin[x]*Cos[y],{x,1,10},{y,2,10},RegionFunction->Function[{x,y}, > 45<=(y^x)]] > ,{dummy,{True,False}}] Interestingly none of the following codes produces errors: Plot3D[Sin[x]*Cos[y], {x, 1, 10}, {y, 1, 10}, > RegionFunction -> Function[{x, y}, 45 <= (y^x)]] Manipulate[ > Plot3D[Sin[x]*Cos[y], {x, 1, 10}, {y, 1, 10}, > RegionFunction -> If[region, All, Function[{x, y}, 45 <= (y^x)]]] > , {region, {True, False}}] Any suggestion would be appreciated. > Istvan Zachar However, this code does produce the error... Plot3D[Sin[x]*Cos[y], {x, 1, 10}, {y, 2, 10}, RegionFunction -> Function[{x, y}, 45 <= (y^x)], PerformanceGoal -> Speed] and this version of the Manipulate is error-free... Manipulate[ Plot3D[Sin[x]*Cos[y], {x, 1, 10}, {y, 2, 10}, RegionFunction -> Function[{x, y}, 45 <= (y^x)], PerformanceGoal -> Quality], {dummy, {True, False}}] Although the final image in Manipulate is produced with PerformanceGoal->Quality, intermediate images are produced with PerformanceGoal->Speed. It looks like the error-handling between the two is getting confused here. But, in your case, the problem is easy to work around, although the work-around will produce a slower Manipulate if your Manipulate requires forcibly regenerating this Plot3D. John Fultz jfultz@wolfram.com User Interface Group Wolfram Research, Inc. === Subject: Re: Player Pro and Packages > What I meant was that it is very difficult to protect and claim ownership > for clear text file formats, like the Mathematica notebook format or the PDF > format. This raises an interesting intellectual property (IP) question which I'm not qualified to answer, namely can one obtain some form of legally enforceable IP protection on a _format_? --- especially one which is expressed in such a simple and clear text form that it's easy to reverse engineer? If so, this format may not be protected by obscurity, but may still be protect-able against unlicensed use by taking legal action against unauthorized users. [My understanding is that Adobe retains some rights over modifications, extensions, variations on PDF, while allowing anyone to use it without a license (?); and Don Knuth certainly did this with TeX. Maybe it's only the _name_ of the format that is legally protected? --- If you modify the format itself in any way, you can't call or refer to the result as PDF or as TeX???] > Hopefully Wolfram finds some new business concept to make the money roll in. I would fully share this hope -- provided that it means that * The primary or core part of Mathematica itself remains primarily a very powerful _computational_ tool, and secondarily an adequately powerful _display_ tool for outputting or displaying the results of those computations. * And that this primary or core part is not further encumbered by adding separable additional tasks -- e.g., typesetting, more complex formatting capabilities, attempting to make it also a primary _publication_ tool -- and trying to embed them directly in the core. * With the reason for this being that the core, and its documentation, should remain as lean as possible, within the already large requirements of those two tasks --- which are, in reality, going to make this core, and its documentation, very large _just_ with those two primary tasks. * And with the further proviso that this Mathematica core uses, or requires, for its generalized file and data input and output functions _only_ open, widely used, widely available, preferably even ISO standardized formats. So, my 'Silicon-Valley-style' entrepreneurial vision for Mathematica would be that: * IF Wolfram can provide and maintain this kind of core tool --- repeat, a _core tool_ --- that is readily usable by ordinary users, and has good but simplified documentation for those users, but also has lots of much more sophisticated aspects for more sophisticated users and experts --- about what v6 provides today, or a bit trimmed back -- for a 'street price' of, let's say, not more than $300 (in current dollars) to all purchasers; and * IF they can build around this core various profitable product lines of specialized packages (or plug-ins?) for many specialized fields, and specialized data services at various levels and in various fields, and various types of Player products of varying cost and degree of sophistication (from free upward); and * IF they can maintain a little better backward capability and avoid the really destructive disruption of the v5 to v6 transition in the future; and * IF they can _greatly_ improve their 'ordinary user' documentation for their core product; then I think they'd have a quite good chance to build the kind of very widespread, world-wide, innumerable-fields-of-study-wide Mathematica ecosystem that someone referred to in another post --- and, hopefully, make a lot of money, and beat down their major competitors, in the process. But if they just continue making their base (core) product ever more complex, ever more confusing, ever more obese --- the v5 to v6 trajectory extrapolated --- well, I suspect that I, and a lot of other users, will sooner or later be gone --- even if I don't know where to. Over and out . . . AES === Subject: Hamiltonian System So I'm trying to solve the following Hamiltonian system using Mathematica. I posted this earlier, but I wanted to make sure it's not skipped over. solution = NDSolve[{x'[t] == 2p[t], x[0] == 2, p'[t] == I*(2 + 1/2)(I*x[t])^(1 + 1/2), p[0] == 1-2*I}, {x, p}, {t,0,10}, MaxSteps -> Infinity][[1]]; I'm letting E=1, so at all points t, it should be that (p[t]/.solution)^2-(I*x[t]/.solution)^(2+1/2)=1. That is the case until the function crosses a branch cut on the complex x-plane that runs from 0 to i*(Infinity). Once the function crosses the branch cut, the system no longer preserves E and the value changes to something around 1.3. How can I go about fixing this problem? I've already tried working with the precision and accuracy goals, and that didn't work. I also tried the SymplecticPartitionedRungeKutta method, but that didn't work either. I'm not sure what else to consider. Any help would be appreciated. Alex === Subject: Create array of data files Hi there, === Subject: Re: Create array of data files > Hi there, > perhaps something like: Do[ Print[ ToString[ PaddedForm[pictureCounter, 5, NumberPadding -> {0, 0}]] ]; , { pictureCounter, 10 }] Oliver Oliver Ruebenkoenig, === Subject: Re: Create array of data files no we don't know that even a For[] command exist and I have never used it, but mtx = Table[Random[], {10}, {10}]; MapIndexed[ Export[c:/temp/dta <> ToString[#2[[1]]] <> .txt, #1, Table] &, mtx] will do what you want, without a For[] or Do[] .. > Hi there, === Subject: Probably memory problem _ Question: Do anyone knows if using the palletes (Alebraic Manipulation, BasicMathInput, BasicTypesetting) in Mathematica 6 needs more stack memory that writing algebra in full form? __ Problem: I am interested in check an equality: Side 1= Side 2 of the form: 24*n*y*y=-4*b+2*v*z-v*v/k*e^z With y,b,v,z,k,n variables which all but n are veeeeeery long expressions of the form: y:= b:= etc... and to make them look shorter I defined other expressions, so that y, b, v, etc, need other expressions to be complete. I know that the equality is analitically true, but I get using TrueQ(side 1, side2), PossibleZeroQ, that the equality is False. Options: So, I think that the problem could be in: - Lack of memory, because Mathematica stops evaluating the notebook after the 16th definition, although I asked Mathematica about the memory used: MemoryInUse= 6,314,760 bites just before it stopped evaluating the notebook but I think Mathematica=B4s limit is about 19,654,528 bites. -Maybe I do not have enough computer memory, but -Maybe I did not write well the definitions. _ Any comments or suggestions will be very appreciated, :) thank you very much in advance, Alejandra Lozada === Subject: Re: Probably memory problem _ > Question: > Do anyone knows if using the palletes (Alebraic Manipulation, > BasicMathInput, > BasicTypesetting) in Mathematica 6 needs more stack memory that writing > algebra in full form? > __ > Problem: I am interested in check an equality: Side 1= Side 2 of the form: 24*n*y*y=-4*b+2*v*z-v*v/k*e^z With y,b,v,z,k,n variables which all but n > are veeeeeery long expressions of the form: > y:= > b:= > etc... > and to make them look shorter I defined other > expressions, so that y, b, v, etc, need > other expressions to be complete. I know that the equality is analitically true, but > I get using TrueQ(side 1, side2), PossibleZeroQ, > that the equality is False. First, you have to use correct syntax: Equality is ==, not = Did you mean E^z when where you've written e^z? Functions are written with square brackets, TrueQ[expr], not TrueQ(expr) TrueQ is a structural (not Mathematica operation). It will only return True is the input is explicitly True. Use Simplify/FullSimplify with appropriate assumptions to check whether the equality is true. > Options: > So, I think that the problem could be in: > - Lack of memory, because Mathematica stops evaluating > the notebook after the 16th definition, What do you mean when you say that Mathematica stops evaluating the notebook? This is very vague. Do you get an error message? Does the kernel quit? > although I asked Mathematica about the memory used: > MemoryInUse= 6,314,760 bites just before it stopped > evaluating the notebook but I think Mathematica=B4s limit > is about 19,654,528 bites. > -Maybe I do not have enough computer memory, but > -Maybe I did not write well the definitions. > _ > Any comments or suggestions will be very appreciated, :) > thank you very much in advance, Alejandra Lozada === Subject: Re: installing Playe rPro killed using Mathematica itself: Yes, this fixes the problem with the mathpass for Player Pro under my configuration effectively killing the mathpass for Mathematica itself. Of course the problem should have been avoidable by the installer program, or at least by installation directions, in the first place. > Yes, this is because of the overlapping use of MATHEMATICA_USERBASE. Anybody > who does not set this variable will not see the problem. To work around this... * Take your current mathpass file and move it into Mathematica's installation > directory in ConfigurationLicensing. > * Start Player Pro and enter your password. > * Take the newly generated mathpass file and move it into Player Pro's > installation directory in ConfigurationLicensing. > John Fultz > jfultz@wolfram.com > User Interface Group > Wolfram Research, Inc. > With an existing installation of Mathematica 6.0.2 under Windows, I just >> installed Player Pro. The result: if I start Mathematica itself and >> open a new notebook there, I am prohibited from typing any and all input. >> This sort of thing is intolerable! An utterly time-frittering >> aggravation. >> I suspect that the scenario involved here was not tested by WRI: My >> mathpass for Mathematica itself is in the Licensing subdirectory of my >> USERBASE directory, which is the same as my BASE directory (both set by >> Windows environment variables MATHEMATICA_BASE and MATHEMATICA_USERBASE). >> This is hardly the first time I have run into trouble with multiple >> passwords from multiple Wolfram Research products. It is something they >> have just not yet gotten right. Beware! >> What I did as a temporary fix was to use my Windows backup program to >> restore my pre-existing mathpass file. Now regular Mathematica works. >> But of course Player Pro does not. > -- Murray Eisenberg murray@math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305 === Subject: Re: Wolfram User Interface Research? Let's remember that Mathematica 1.0 was released in 1988ish. At that time my desktop NEC PC was 2 feet wide and 9 inches high, and I weighed 145lbs. The functionality was presumably limited by the ASCII character set. We have of course all gotten used to thinking of /@ as Map and /. as replace. I agree though that there are more intuitive symbols, but how would you represent them in a Package .m file? If Wolfram are to consider changing the Notebook Interface then I would like to see more flexibility in how the pages are laid out - by way of example, Excel for Windows vs. Numbers on a Mac. For that matter, I would like to see a spreadsheet control in Mathematica that allows you to create lists by typing into a 'Grid' -like control. I know you can do this using Grid and Dynamic, but its cumbersome. My understanding is that at least some vendors of larger software apps do a substantial amount of research into how users interact with their products -- e.g., they set up experiments in test rooms where they observe, record, and/or videotape how ordinary users perform various typical tasks using their products -- how they approach them, what mistakes they frequently make -- and try to interpret from these observations what mental constructs these users seem to be working under, why they make the mistakes they make and so on. A curiosity based question along this line for Wolfram: If one examined a bunch of notebooks generated by some representative set of users, I particularly wonder what would be the relative frequency of use for all of the numerous non-alphabetic operators in Mathematica? -- that is, all the innumerable codings like . . @ -> & @ @@ @@@ * << % and on. Which of these are frequently used, which are very seldom used, by different classes of users? (And which are most frequently misused or lead to errors when used?) One might of course ask the same thing about many of the alphabetically named computational and display commands in Mathematica (There are more than 1000 of these, is that not so?) Seems like data like this could not only improve the product but provide some really useful guidance for what to focus on in the development of manuals, tutorials, and other documentation for new or less experienced users (assuming, of course, that Wolfram will ever again have any interest in providing this kind of documentation) (sorry, couldn't resist that jab). Robert Prince-Wright Houston TX, 77006 USA === Subject: When Find finds something - - it sometimes highlights the thing and sometimes puts a little dotted box around it. What's the difference? It's very hard to see the dotted box sometimes and I have to Find it visually! Is there a way to change this found indicator to make it more conspicuous? Steve Gray === Subject: Re: waveform >I'm new to the audio functions of Mathematica, and I'd like to >create a waveform that is a sine wave of whose frequency increasing >linearly over time. Does anybody know a way to do this? Sin[a t^2] will do what you want. Size a for the desired start frequency. === Subject: Re: Print[Plot] vs Print[text,Plot]? My original post said: > I've just executed a test cell containing Print[Plot[---]]; > Print[Some textn, Plot[---]]; Result from first line is expected plot; result from second line is a > miniaturized plot about 1/4 the size of the first one. ****** This is sensible or useful? ****** In response to various replies: I realize full well that designing how a program is to work given various inputs always involves design choices and compromises between various objectives, including the goal of consistency (which itself may call for different choices depending on the level where the consistency is sought) and so on. Nonetheless, I still think the choice that leads to the behavior described above is a _bad_ design choice, in several ways: 1) First, displaying the plot in the 2nd input line above at full size can be a very useful, as well as simple, technique. I wanted, in fact, to put multiple instances of 3 plots plus some explanatory text into a single cell, using Print[Some textn, plot1, n, plot2, n, plot3]; and do this repeatedly multiple times in a Do loop, so that I could then examine how three linked aspects of a given problem changed with changed parameters, either by stepping sequentially through these multi-plot cells or by making them page sized and printing them to PDF slides. The first line above confirmed that the plot came out about the size I wanted it; adding text and doing three plots using the approach in the 2nd and 3rd lines above seemed a simple and natural extension. 2) What comparable useful purpose is served by throwing consistency out the window and shrinking the plot when the multi-plot Print[] form is used? What arguments lead to choosing the default amount by which it's shrunk? 3) and, hey, if I do instead Print[text, some_TableFormed_Table], does the Table get similarly shrunk? Why? Or, why not? Any consistency here? 4) OK, the damn plot evidently gets shrunk in the second approach. Now, it was created (and displayed in the first Print statement) using some default value of ImageSize, which turned out to be just about what I wanted, without my having to bother inserting an ImageSize value in the plot. So, if I now _explicitly_ insert that default image size into the Plot command, will the plot again be shrunk in the second case? Or will that default image size now stick? Or do I have to blow up the plot, using a larger ImageSize, in order to get it shrunk back down to what I want? Who wants to guess on this???? 5) In any case, instead of going with the default image size, as I did in the first case (with totally satisfactory results), I'm now going to have to dig one level deeper in the (large) set of options for Plot, or Print[], or maybe both. This is useful? 6) And did anyone notice that the majority of the alternative approaches suggested in most replies (Column[], etc) were things that are new in 6.0? Must everyone take a week off from their real life to trudge (tediously) thru What's New in 6.0, on screen? 7) And also, that the widely used older approach that I might have used to get my desired 3-plots-in-one=cell result, namely GraphicsArray[ {{plot1}, {plot2}, {plot3}}] is now gone? Bottom line: I doubt very much that coding Print[text,plot1] to shrink the plot compared to Print[plot1] was a _necessary_ behavior, imposed by some inherent characteristics of Print or Plot. I suspect it was instead a _design choice_, and one that required some coding to implement -- and it was a poor design choice IMHO. === Subject: Fourier transform in arbitrary dimension? I would like to calculate a Fourier transform in arbitrary dimension , say D, of the function 1/q^2, where q denotes the absolute value of a D dimensional spatial vector. The integral I have to perform is int frac{d^Dq}{(2pi)^D}exp(-iQcdot x)frac{1}{q^2} where |Q| = q. But I can't find a way to tell Mathematica to calculate this integral of dimension D. PS. The answer is proportional to Gamma(D/2 - 1)(x^2/4)^{1-D/2} Any ideas would be appreciated. === Subject: Re: Fourier transform in arbitrary dimension? integrateDimD[f_, dim_Integer] := Module[{var}, var = Table[{Unique[x], -Infinity, Infinity}, {dim}]; Integrate @@ {f @@ (First /@ var), Sequence @@ var} ] and integrateDimD[f, 3] gives Integrate[f[x$12006, x$12007, x$12008], {x$12006, -Infinity, Infinity}, {x$12007, -Infinity, Infinity}, {x$12008, -Infinity, Infinity}] I would like to calculate a Fourier transform in arbitrary dimension > , say D, of the function 1/q^2, where q denotes the absolute value > of a D dimensional spatial vector. > The integral I have to perform is int frac{d^Dq}{(2pi)^D}exp(-iQcdot x)frac{1}{q^2} where |Q| = q. > But I can't find a way to tell Mathematica to calculate this integral > of dimension D. > PS. The answer is proportional to Gamma(D/2 - 1)(x^2/4)^{1-D/2} Any ideas would be appreciated. > === Subject: Re: Dynamic: feature? > I have a cell containing this: Dynamic[f[a, b]] Then I do this: a /: f[a, b] = 12 and the dynamic cell updates to 12, as I would expect. When I do this: b /: f[a, b] = 45 The dynamic cell does *not* update for some reason. > It seems as though it does not realize an update has occurred when it > is associated with b. Does anyone know why this is? Chris Weird. I witness the same behavior if the cells are evaluated in the given order. However, ff one change the order of the assignments (i.e. b first, then a) Dynamic[] works as expected. Evaluating the following expressions in that order, Dynamic[f[a, b]] (* The first output cell is: f[a, b] *) b /: f[a, b] = 45 (* The first output cell is now: 45 *) a /: f[a, b] = 12 (* The first output cell is now: 12 *) $Version => 6.0 for Mac OS X x86 (64-bit) (February 7, 2008) I have also recorded the sessions in a PDF file. See http://homepages.nyu.edu/~jmg336/mathematica/weirddynamic.pdf -- === Subject: Re: Dynamic: feature? Hi Chris, if you assigne 2 rules for f, Mathematica takes the first one it finds. And as it searche in alphabetic order, a wins over b. hope this helps, Daniel > I have a cell containing this: Dynamic[f[a, b]] Then I do this: a /: f[a, b] = 12 and the dynamic cell updates to 12, as I would expect. When I do this: b /: f[a, b] = 45 The dynamic cell does *not* update for some reason. > It seems as though it does not realize an update has occurred when it > is associated with b. Does anyone know why this is? Chris === Subject: Re: waveform Hello Jack, I believe this may work or easily modified for your purposes Scream[m_] := Play[Sin[440 2 Pi t (1 + m t)], {t, 0, 1}] Scream[1.2] > I'm new to the audio functions of Mathematica, and I'd like > to create a waveform that is a sine wave of whose frequency > increasing linearly over time. Does anybody know a way > to do this? Jack > -- W. Craig Carter === Subject: Re: waveform Hi jack, try: Play[Sin[500t (1+t^3)],{t,0,1.5}] //Sound Daniel > I'm new to the audio functions of Mathematica, and I'd like > to create a waveform that is a sine wave of whose frequency > increasing linearly over time. Does anybody know a way > to do this? Jack === Subject: Re: waveform > I'm new to the audio functions of Mathematica, and I'd like > to create a waveform that is a sine wave of whose frequency > increasing linearly over time. Does anybody know a way > to do this? Jack Play[Sin[(1500 + 100 t) t], {t, 0, 3}] (adjust parameters to taste), and press the play button in the notebook. Alternatively, if you would like the sound to be generated immediately, try: Play[Sin[(1500 + 100 t) t], {t, 0, 3}] //EmitSound David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Re: waveform > I'm new to the audio functions of Mathematica, and I'd like > to create a waveform that is a sine wave of whose frequency > increasing linearly over time. Does anybody know a way > to do this? This goes linearly from 200 Hz to 1000 Hz in 2 sec: Play[Sin[2 [Pi] (200 t + 200 t^2)], {t, 0, 2}] === Subject: Re: Changing TextStyle within Show Hello Carlos, I don't have a 5.2 in front off me, but I can give you a 6.0 suggestion, and perhaps you can backtrack and change it for 5.2. I often put such things into my init.m SetOptions[Plot, BaseStyle -> {FontFamily -> Helvetica, FontSlant -> Italic, FontSize -> 24} ] Plot[Nest[Sin, x, 128], {x, 0, 4 Pi}, PlotLabel -> Wiggly, AxesLabel -> {Uncle, Grandpa}] > I have often used TextStyle as a global option in Show, for example TextStyle->{FontFamily->Times,FontSlant->Italic,FontSize->9} to render all text in a plot. Is there a way to use it as a > Graphics instruction so that font size, etc. is changed for subsequent > Text objects as the plot is processed? The Graphics documentation (I am looking at 5.2 on my laptop) says > yes, but gives no specific format or examples. I would expect a > function like Graphics[TextStyle[ arguments ]] to be available > but cant find a description. -- W. Craig Carter === Subject: Re: Changing TextStyle within Show Show[Graphics[Table[ Text[ FontColor -> Hue[n/26]], {n/26, n/26}], {n, 26}]]] Bob Hanlon > I have often used TextStyle as a global option in Show, for example TextStyle->{FontFamily->Times,FontSlant->Italic,FontSize->9} to render all text in a plot. Is there a way to use it as a > Graphics instruction so that font size, etc. is changed for subsequent > Text objects as the plot is processed? The Graphics documentation (I am looking at 5.2 on my laptop) says > yes, but gives no specific format or examples. I would expect a > function like Graphics[TextStyle[ arguments ]] to be available > but cant find a description. > === Subject: Re: Timing Hi Artur, most time is spent in calculating ((3 + 2 Sqrt[2])^(2^(n - 1) - 1) and (3 - 2 Sqrt[2])^(2^(n - 1) - 1). We may speed this up by calculating it recursively and using functions that remember their values. You may even precalculating p1 and p2 by p1[nmax]; and p2[nmax];. Do not make nmax too big,the numbers increase astronomically, otherwise your memory will overflow. The subsequent calculations are then very fast. Here is an example: p1[n_]:=p1[n]=p1[n-1]^(2)(3+2Sqrt[2])//Expand; p1[1]=1; p2[n_]:=p2[n]=p2[n-1]^(2)(3-2Sqrt[2])//Expand; p2[1]=1; p1[27; p2[27]; Timing[Do[If[IntegerQ[t= (p1[n]-p2[n])/(4 Sqrt[2] (-1+2^n))//Expand],Print[{n}]],{n,1,27,2}]] hope this helps, Daniel > Who know how change bellow procedure to received reasonable timing? Part: > Expand[((3 + 2 Sqrt[2])^(2^(n - 1) - 1) - (3 - 2 Sqrt[2])^(2^(n - 1) - > 1))/(4 Sqrt[2])]/(2^n - 1) > is every time integer >> Timing[Do[ If[IntegerQ[Expand[((3 + 2 Sqrt[2])^(2^(n - 1) - 1) - (3 - >> 2 Sqrt[2])^(2^(n - 1) - 1))/(4 Sqrt[2])]/(2^n - 1)]