.1362
===
Subject: Total Derivative and Output Display Question
Hello Mathgroup,
I have been experimenting with the Dt[] function in Mathematica.
The reason for this is that as I review or work with new topics in
math, I try to see how the same results achieved by hand can or will be
realized in Mathematica. I recently needed to review the concept of
the total derivative, and as is my usual practice, to ensure I
understood what I was doing, I came up with an example that would be a
challenge, that is, a challenge for me.
Here's what I did on paper (the actual example was two levels deeper
than this, but this should suffice for the sake of argument):
z = f(x,y);
x = g(r,s);
y = h(r,s);
r = a(t,u);
s = b(t,u);
What is the total (partial) derivative of z with respect to 't'?
On paper, I worked this out to (all derivatives should be considered as
partial):
dz/dt = dz/dx(dx/dr dr/dt + dx/ds ds/dt) + dz/dy(dy/dr dr/dt + dy/ds
ds/dt).
As you can see, there are no f's, g's, h's, a's, or b's, because we all
understand that when we state something like z = f(x, y), we are
stating that z is the dependent variable and x and y are the
independent variables and 'f' is just part of the notation indicating
that z is a function of x and y.
I then wanted to see how I could achieve this same result in
Mathematica in a general way. I tackled the same problem, but I left r
and s as functions of only t. I won't attempt to get the results from
my Mathematica attempt in this message. Suffice it to say that I went
through many iterations in order to achieve my less than satisfactory
results.
Here is the Mathematica code (converted to InputForm):
Clear[a, b, f, g, h, r, resultOne, resultTwo, s, t, x, y, z,
ë.a6, ë.b2]
r = a[t];
s = b[t];
x = g[r, s];
y = h[r, s];
z = f[x, y];
resultOne = Dt[z, t]
resultOne /. {Replacement Rules}
Unfortunately, converting my replacement rules to InputForm didn't work
very well. I will post what I have done as a notebook. Here is the
direct link (please replace 'notvalid' with 'anonmous':
http://home.comcast.net/~notvalid/mathematica/TotalDerivativeQuestion.nb
As those of you who download it will see, there are numerous problems
with my approach. The first is that it appears overly burdensome to
convert from Mathematica's default output form, to the more
'traditional' mathematical form. Secondly, even after I convert, I end
up with the differential operators being in the wrong order, and I'm
not really sure about how to avoid that.
Matt
===
Subject: Re: optimization nested in root-finding
Hello Neely,
put a print statement Print[x] into function f2. You will see, that f2
is called with a non numerical argument x.
You may prevent this by declaring:
f2[x_Real]:=...
HOWEVER, this is strange because FindRoot has the attribute HoldAll
and should therefore replace the symbol x by a numerical value before
calling f2.
???? HAS ANYBODY AN EXPLANATION ????
It looks like a bug to me.
Daniel
> I want to find some zeros of a function f(x). The evaluation of
> f in turn requires finding a minimum. For a simple example.
> obj2[x_, y_] := (x - 2)^2 + (y - 3)^2
> f2[x_] :=
> Module[
> {y},
> FindMinimum[obj2[x, y], {y, 0}][[1]]
> ]
> Thus, f2[x] is the minimum value obj[x,y] can take for a
> given fixed x.
> Now, I can plot f2[x] and all is well. However, when
> I try to solve f2[x]==5, I have trouble.
> FindRoot[f2[x] == 5, {x, 1, 1.01}]
> complains and returns. I am sure I am doing something silly,
> but I am having a slow-brain day and would appreciate any help.
> Neely Atkinson
> Department of Biostatistics and Applied Mathematics
> M. D. Anderson Cancer Center
> eatkinso@mdanderson.org
===
Subject: webmathematica
hello,
i ask you very much to help me with a problem.
i want to write if/then/else instruction
in jsp code like next example:
if (a==1)
then
{
MSPFormat[ MSPToExpression[ToString[a-b]], TraditionalForm, JPEG]
MSPFormat[ MSPToExpression[ToString[a+b]], TraditionalForm, JPEG]
}
else
{
...................
...................
}
i use jsp files for webmathematica server.
thank you very much
===
Subject: Re: optimization nested in root-finding
obj2[x_,y_]:=(x-2)^2+(y-3)^2;
f2[x_?NumericQ]:=Module[{y},FindMinimum[obj2[x,y],{y,0}][[1]]];
FindRoot[f2[x]==5,{x,3,5}]
{x -> 4.23606797749979}
Bob Hanlon
===
> Subject: optimization nested in root-finding
> I want to find some zeros of a function f(x). The evaluation of
> f in turn requires finding a minimum. For a simple example.
> obj2[x_, y_] := (x - 2)^2 + (y - 3)^2
> f2[x_] :=
> Module[
> {y},
> FindMinimum[obj2[x, y], {y, 0}][[1]]
> ]
> Thus, f2[x] is the minimum value obj[x,y] can take for a
> given fixed x.
> Now, I can plot f2[x] and all is well. However, when
> I try to solve f2[x]==5, I have trouble.
> FindRoot[f2[x] == 5, {x, 1, 1.01}]
> complains and returns. I am sure I am doing something silly,
> but I am having a slow-brain day and would appreciate any help.
> Neely Atkinson
> Department of Biostatistics and Applied Mathematics
> M. D. Anderson Cancer Center
> eatkinso@mdanderson.org
===
Subject: Re: The D'Agostino Pearson k^2 test implemented in mathematica
/ variance of difference sign test
> I have two questions.
> 1. Are there any resources of .nb files available on the internet
> where I might find an implementation of the D'Agostino Pearson k^2 test
> for normal variates?
> 2. In the mathematica time series package (an add-on), the
> difference-sign test of residuals is mentioned (url:
>
http://documents.wolfram.com/applications/timeseries/UsersGuidetoTimeSeries/1
.6.2.html).
> It says that the variance of this test is (n+1) / 2. However, it
> would seem to me that a simple calculation gives a variance of (n-1)/4.
> It goes as follows:
> If the series is differenced once, then the number of positive and
> negative values in the difference should be approximately equal. If Xi
> denotes the sign of each value in the differenced series, then
> Mean(Xi) = 0.5(1) + 0.5(0) = 0.5
> Var(Xi) = Expectation( (Xi - Mean(Xi))^2 )
> = Expectation( Xi^2 -Xi + 0.25 )
> = 0.5 - 0.5 + 0.25
> = 0.25
> And assuming independence of each sign from the others, the total
> variance should be the sum of the individual variances, up to n-1 for n
> data points (since there are only n-1 changes in sign), thus
> Variance = (n-1) / 4
> There is an equivalent problem in Lemon's Stochastic Physics about
> coin flips, for which the answer is listed, without proof, as (n-1)/8.
> Because of these three conficting results I am wondering if I have made
> an error in my calculation, and if anyone can find one please let me
> know.
> -John Hawkin
>
I agree with your calculation. We assume an indicator variable that is 1
if the succeeding value is greater or zero if it is less than the
preceding one. Under the null hypothesis this is just a binomial
variable with p=.5 and n-1 trials. The mean and variance of the number
of successes must be proportional to n-1 and are in fact the values you
calculated.
I don't have Lemon's book, so I can't comment on the equivalence of the
problems. Perhaps the factor of 2 is due to the way the problem is
stated w.r.t heads and tails.
LP
===
Subject: Re: ????
I've seen this too, though it only happened on some files. I never could
find
a pattern for when this would happen. I was generating text data files from
multiple measurement devices (all working identically), and some (few and
far
between) wouldn't import properly. There were *no* clues in the text file
as
to why this was happening, even at a binary level.
The only trick that worked for my case was to recreate the text file with
the
same data. An effective way was to import the file as lines so that I got
each row as a string. I then used ImportString to convert the individual
strings into data. Finally, I used to Export the result as a Table so that
I
would create a file that Import could handle more easily. I could then use
this new file in my main notebook with no problem. I don't have access to
those notebooks anymore, but essentially the psuedo-code was something
like:
strdata = Import[filename, Lines];
data = ImportString[ #, Table ]& /@ strdata;
Export[newfilename, data, Table]
Note that this is a very slow method, but it was the only one that worked
and
that my data would allow me to use.
Now you may be able to avoid some of that work if your files are very clean.
In my files, there would be marker lines and the occassional corrupt line
that
would change my data types and number of elements on a line. This meant
that
I couldn't use something like ReadList, but perhaps that would be an easier
solution for you.
Good luck!
> I have a file consisting of a table of numbers, where the coloms are
> seperated by spaces and the rows by newlines.
> Lets say I have col colums and row rows in my file.
> If I use the commond Import[file,Table] I get in mathematica a list
> of lenght two. The first entety is a list of length col, the second of
> lenght
> (row-1)*col.
> I would like to get a matrix of dimensions [col,row], how can I correct
> this.
> Maurits Haverkort
===
Subject: Re: Mathematica and Education
> I should like to say that as an educator of science students in a
> (predominantly) non-mathematical branch of science (earth sciences) I am
> very concerned about this approach.
However, is it reasonable to expect your students to gain the level of
mathematical expertise that you have (unless they are going to become
professional researchers also)? If not, what should they be taught?
> Sure Mathematica is a wonderful
> tool. As a professional researcher I use it all the time for doing
> tedious calculations to save time, or to check claculations where I may
> have got things wrong and so on and so on. If I didn't think Mathematica
> was useful I wouldn't have it and wouldn't subscribe to this list.
> But it is still a tool. IT can't know what calculations to do, what
> approximations to make and sometimes when there are mathematical choices
> to be made. For example there are times when Mathematica's choice of
> branch cut doesn't correspond to the one I want to make. Not a problem I
> can tell it what I really want. There are times when its choice of
> simplification doesn't suite my purpose. Again not a problem I can tell
> it what to do or simply carry on by hand if that's easier. But how do I
> know when the defaults don't suite my purpose, because I have spent many
> years doing things by hand and gaining that experience to know what I
> want.
A question remains though: how much of your accumulated expertise _can_
be automated. In some fields, e.g., summation, computer algebra can
automate nearly all operations of interest (see the books
generatingfunctionology
and A=B ).
> that I am not convinced that if I had done all my mathematics within
> Mathematica I would have gained the same experience. But I am open to
> discussion on this if anyone wants to put the counter case. However, I
> would need very strong convincing that it is good for students never to
> have to do old fashioned calculations on paper. In the same way I think
> it is important for children to learn multiplication rather than rely on
> a calculator or to learn to write rather than use a word processor.
Agreed. As I've previously posted on this newsgroup, I think that Bruno
Buchberger has got it right. See
http://www.risc.uni-linz.ac.at/people/buchberg/white_box.html
However, I think that the potential for discovery using computer
mathematics is underestimated -- and is only taught in very few
University courses.
Paul
_______________________________________________________________________
Paul Abbott Phone: 61 8 6488 2734
School of Physics, M013 Fax: +61 8 6488 1014
The University of Western Australia (CRICOS Provider No 00126G)
AUSTRALIA http://physics.uwa.edu.au/~paul
===
Subject: Re: Mathematica and Education
I've interspersed two comments below.
> .... But how do I
> know when the defaults don't suite my purpose, because I have spent many
> years doing things by hand and gaining that experience to know what I
> want. I am not convinced that if I had done all my mathematics within
> Mathematica I would have gained the same experience.
That's a very legitimate concern. to my mind it's the principal excuse
for still doing complicated paper-and-pencil calculations when learning.
(Simple paper-and-pencil calculations may be readily justified as
needed to understand what's happening.)
> In particular for practicing engineers they may be out in the field,
> away from a computer and be required to do a back of the envelope
> calculation by hand. If you have never done it before you will be stuck
> and I don't think you could consider yourself a real engineer.
But that seems to me to be essentially a red herring. It's the old
What will you do if you're on a desert island and don't have access to
a table of integrals? question. Surely many in the field engineers
now carry their laptops or tablet computers with them whenever they're
on the job. And we may be only a short time away from the day that
Mathematica will be available on a calculator/PDA-sized device that fits
into a shirt pocket.
--
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: first variation of the functional
>I Ramesh Gupta, PhD student of Aerospace Department,
>Indian Institute of Science,
>INDIA. our institute having licence version of
>mathematica.
>i would like to know how to get the first variation of
>the functional.
>As I came to know that command like EulerEquations
>can generate Differential
>equations, but i am expecting the boundry/natuaral
>conditions also, which are the by-products
>of first variation of the functional.
I think the package you are looking for is <please mail me as early as possible.
>ramesh
>
-----------------------------------------------------------------------------
----------------------
> B. Ramesh Gupta
> phD, Aerospace Department,
>IISc, Bngalore, INDIA.
>ph: 080-22932438 (Dept)
>cell: 09242844936
> Residence:
>#23/2, 3rd cross
>Subedharpalya
>Yeshwanthpura
>Bangalore. INDIA
>
>__________________________________________________________
>Yahoo! India Matrimony: Find your partner now. Go to
http://yahoo.shaadi.com
===
Subject: Re: Outputs of the Limit function
> When using the Limit function I got an output, BesselI(1,0)[5/2,s] ,
> where the bracket (1,0) was a superscript. Please, can anyone tell me
> the significance of the superscript bracket.
It means the partial derivative of BesselI[nu,s] with respect to nu,
evaluated at nu = 5/2. That is
Derivative[1, 0][BesselI][5/2, s]
If you enter
D[f[x,y],x] /. x -> 5/2
or
Derivative[1,0][f][5/2,y]
you will get a similar expression. Note that Mathematica can numerically
evaluate such expressions for numerical s. For example, enter
Derivative[1, 0][BesselI][5/2, 0.1]
See also http://functions.wolfram.com/03.02.20.0011.01.
Paul
_______________________________________________________________________
Paul Abbott Phone: 61 8 6488 2734
School of Physics, M013 Fax: +61 8 6488 1014
The University of Western Australia (CRICOS Provider No 00126G)
AUSTRALIA http://physics.uwa.edu.au/~paul
===
Subject: Re: Outputs of the Limit function
> When using the Limit function I got an output, BesselI(1,0)[5/2,s] ,
> where the bracket (1,0) was a superscript. Please, can anyone tell me
> the significance of the superscript bracket.
> Ben
First derivative with respect to first argument. I would imagine the
InputForm of the expression would make this more clear (if not, then
surely the FullForm...).
Daniel Lichtblau
Wolfram Research
===
Subject: Re: Outputs of the Limit function
When you cannot understand the notation, it is often useful to convert the
output cell to InputForm
D[BesselI[n, z], n] /. n -> 5/2
Derivative[1, 0][BesselI][5/2, z]
Bob Hanlon
===
> Subject: Outputs of the Limit function
> When using the Limit function I got an output, BesselI(1,0)[5/2,s] ,
> where the bracket (1,0) was a superscript. Please, can anyone tell me
> the significance of the superscript bracket.
> Ben
===
Subject: Bugs--Excessive Mathematica CPU usage on Sun running Solaris 10.
There is at least two of us who have noticed Mathematica (tested 5.1 and
5.2) using excessive CPU time on Solaris 10. If the GUI interface is used,
then attempting
In[1]:= 1+1
quickly returns the result 2, but the Kernel consumes loads of CPU time
*after* computing the result.
This only happens with the GUI. There was some discussion of this in the
Solaris newsgroup.
Can anyone else verify this? The two machines that has been seen on are
quite similar. One is a Sun Ultra 60, the other a Sun Ultra 80. These
particular Suns are very similar to each other - one is basically a quad
processor version of the other.
Link to the forum page for this post:
http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Speci
al:Forum_ViewTopic&pid=8905#p8905
===
Subject: TriangularSurfacePlot for quadrangles ??
is there any way to plot a 3D-surface in the same manner as
TriangularSurfacePlot but with quadrangle elements ??
thank you,
Pluton
===
Subject: Re: General--Making the DisplayFormula style in ArticleModern look
like Traditional
I just use arXiv stylesheet and palette to typeset my homeworks. It is
available at
http://www.wrel.co.uk/solutions/publishing/stylearxiv.html
The result looks very professional.
Note that there is a small bug in the stylesheet with numbered
formulas, you'll have to edit it to correct counter name (it was
discussed in the group in the past).
Alex
===
Subject: Re: General--Making the DisplayFormula style in ArticleModern look
like Traditional
> I doubt the need will ever vanish entirely as long as there are hard copy
texts.
But many hard copy texts are now available online. For example,
Abramowitz and Stegun is at
and Numerical Recipes in C is at
http://www.library.cornell.edu/nr/bookcpdf.html
Also, there is Google's project to digitize texts. For example,
A Treatise on the Theory of Bessel Functions by G Watson is at
It will not be that long before the mathematics in such online texts
will be stored in a portable fashion (via MathML, say), so that you can
paste mathematical expressions directly into Mathematica. As you would
be aware, you can already paste TeX expressions into the front end. They
are not always interpreted correctly as Mathematica input, which is not
suprising, but often the resulting expression can be re-formatted so as
to be useful.
Furthermore, MathWorld and the functions website (both with Mathematica
online supplements), and Wikipedia are demonstrating that online
references will supplant printed ones in the near future. As you are
probably aware, the fact that you can search the functions site using
Mathematica patterns makes it much more powerful than any existing
special functions reference book.
> If the journal were only distributed electronically, then
> there would be no issue. But since it is distributed via hard copy as well
> there will always be a few wanting to try the ideas presented who do not
have
> the electronic version.
How many, I wonder?
If you get the printed version from a library or from a colleague then
surely you can also get the electronic supplement. Also, in response to
questions about items in TMJ, I have always responded by sending
Notebooks, including columns in TMJ.
>Well, all Premier Service subscribers can read TMJ for free. See
>e.g.,
>http://www.wolfram.com/news/mathwire/mw-08-2005.html
>Universities with site-licenses may also have Premier Service (mine
>has).
> Surely, you aren't assuming all readers of the journal are also Premier
> Service subscribers or that they all have access to university provided
> tools?
I do not know how many readers of the journal are also Premier Service
subscribers. It would be interesting to know how many correspondents on
MathGroup are either subscribers to TMJ or have Premier Service. It
would also be interesting to know how many readers of TMJ cannot access
the electronic version.
> The choice of TraditionalForm versus StandardForm in the journal really
> as clear as possible to the widest possible audience, then TraditionalForm
is
> clearly the better choice. But if the goal is to elucidate how a
particular
> task can be done in Mathematica, StandardForm is the better choice as it
more
> clearly shows the underlying Mathematica code.
Like all language and programming issues, I think that your view on this
topic depends upon your background and experience with the different
formats.
Paul
_______________________________________________________________________
Paul Abbott Phone: 61 8 6488 2734
School of Physics, M013 Fax: +61 8 6488 1014
The University of Western Australia (CRICOS Provider No 00126G)
AUSTRALIA http://physics.uwa.edu.au/~paul
===
Subject: Re: Re: General--Making the DisplayFormula style in ArticleModern
look like Traditional
What is TraditionalForm? Is it what you find in math books and research
'Traditional form' is not at all the golden standard that is being claimed!
Mathematica StandardForm is an important step to simple, clear and
unambiguous notation - even if it doesn't look like what people are used
to.
David Park
djmp@earthlink.net
http://home.earthlink.net/~djmp/
The choice of TraditionalForm versus StandardForm in the journal really
as clear as possible to the widest possible audience, then TraditionalForm
is clearly the better choice. But if the goal is to elucidate how a
particular task can be done in Mathematica, StandardForm is the better
choice as it more clearly shows the underlying Mathematica code.
===
Subject: Importing Several sheets from one Excel file into Mathematica
Hi:
I have one excel file that contains three different worksheets. When I
import the data into Mathematica it only imports the data from the first
sheet, and it ignores the rest of the sheets. Is there a way to tell
Mathematica that there is more than one sheet in this Excel file or do I
have to create separate files? The procedure I use to import the data is
the following:
Since I have several files of data to analyze, I create an array with
the file names and I import each file with a Loop that assigns each file
to a matrix (see below). I have no problems importing the data to do the
calculations, with the exception for the above mentioned. Any
information that can be provided will be greatly appreciated.
Rosa.
(***assign files to array***)
data1={test1.xls,test2.xls,test3.xls};
(***Loop to Import data files into separate matrices, and arrange
matrices for calculations***)
Do[{
dat[k]=Import[data1[[k]]]; ...... ...
},{k,1,Length[data1]}];
===
Subject: How to get page breaks to work for printing
Can someone please tell me how to insert a page break for printing? I
inserted a PageBreakBelow statement, but it did not seem to relate to
the printed page.
I have a line of comment which I want to print above a plot. Without a
page break, the comment line prints on the previous page to the plot,
Diana M.
===
Subject: Re: Re: Problem with Import and/or J/Link
>Brian,
>example notebook for J/Link works. I believe this is an older
>implementation, before the functionality was included in Import.
>So, I'm still looking for an answer, if anyone has an idea. I have also
>asked Wolfram support who have made some suggestions but not solved the
>problem yet.
John,
This is a bug in Import. Import uses the Utilities`URLTools`FetchURL
function to download the content from the given URL. FetchURL tries to
choose an appropriate local file name for the URL content based on the URL
itself, and this code gets confused by the complex query string in that
URL. FetchURL also lets you pass in a filename to use, however, and that is
how Import should be calling it (after all, the file is deleted by Import
after it is read, so it's not important for it to have a meaningful name).
The solution is to call FetchURL directly, supplying the name of a
temporary file to use, so it doesn't have to try to come up with one based
on the URL. You also want to delete the file after it is read. Calling
Close[OpenTemporary[]] is a standard trick for getting the full path to a
temporary file:
HttpImport[url_String, format_String] :=
Module[{tempFile, result},
tempFile = Utilities`URLTools`FetchURL[url,
Close[OpenTemporary[]]];
result = Import[tempFile, format];
DeleteFile[tempFile];
result
]
This new function works on your complex URL:
HttpImport[http://ichart.finance.yahoo.com/table.csv?s=%5EDJI&a=09&b=1&c=2
000&d=01&e=9&f=2006&g=m&ignore=.csv,
CSV]
Todd Gayley
Wolfram Research
> John,
> I do not have a Window's machine available at this time. I did try
> Import with the URL (/http://ichart.finance.... on my Mac OS X4.5
> with V5.2 and it works.
> The error message suggests that there might be a character(s) in the
> URL that needs to be escaped on a Windows machine
> Try the simple version of your URL:
> Import[http://ichart.finance.yahoo.com/table.csv?s=%5EDJI, CSV]
> and see if that works. On my Mac I get
> {3-Mar-06, 11024.23, 11125.01, 10942.99, 11021.59, 2152950016,
> 11021.59},
> {2-Mar-06, 11052.57, 11090.91, 10951.71, 11025.51, 2494589952,
> 11025.51}}
> Brian
===
Subject: Re: Mathematica and Education
Peter,
I find your remarks very interesting and I think you state the principal
reasons for NOT making the maximum use of Mathematica in education. It
certainly helps to get the objections and perceived limitations on the
table. However, I would like to try, to the best of my ability, to make the
counter arguments.
If I may summarize the reasons you, and others, have put forward.
1) Mathematica allows a student to get an answer without truly
understanding
the underlying theory and reasons. Pencil and paper forces the student to
understand things more deeply and provides additional experience.
2) We have to preserve the old skills. In emergencies we may be forced to
fall back on them, such as in the field, in exams without computers and
after the next nuclear war. Good penmanship and mental arithmetic will save
us.
3) Mathematica will automatically make choices for us that we do not
understand. I would like to state this in a more general sense. Students
haven't mastered Mathematica well enough to use it as a reliable tool.
I have often argued here that students should be taught to think of
Mathematica as 'pencil and paper'. They should use it just like they would
use pencil and paper. Theodore Gray has provided us with the wonderful
notebook interface. You can have titles, sections, text cells, equations
and
diagrams. It's the style of textbooks, reports and research papers. It goes
back at least to Euclid. So, I don't understand specifically what advantage
real pencil and paper have over a Mathematica notebook, except perhaps that
it is far easier to get away with writing nonsense.
In fact, let's look at the advantages that a Mathematica notebook has over
real pencil and paper.
1) Neatness. And a student can correct and rewrite more easily.
2) An active document. The definitions students write can actively be used
in further derivations. In fact, the student is forced to make these
definitions and assumptions explicit.
3) Permanent record. Not only a permanent record but also a repository of
resources that the student may have developed.
4) Proofing. With a Mathematica notebook you can actually evaluate things
and verify that they work. One can't get away with sloppiness.
5) MORE and DEEPER experience. With a Mathematica notebook a student can
actually do many more, and more difficult, exercises and examples. Many
times, while working through textbooks, I have seen cases where the author
either skipped the demonstration or simplified the case for no other reason
than the difficulty of hand calculations.
6) A literate style. Conventional exercises and tests are usually skimpy
throw away documents. Mathematica notebooks provide a perfect opportunity
for 'essay' style work and develop the skills for technical communication.
Of course, we have to have teachers and students who know how to take
advantage of these features.
As for preserving old skills, I'm not too sympathetic. Are students to be
taught how to sharpen spears (no advanced bow and arrow technology
allowed!)
track animals and identify eatable grubs and berries, just in case we get
thrown back into a hunter-gatherer society? It wasn't that many generations
ago when almost all women knew how to weave or operate a spinning wheel.
Should these skills be preserved? Like it or not, we are dependent on
civilization and modern technology. Rather than teaching 'survival skills'
we should make sure that civilization is preserved and advanced. That's the
best chance. If worse comes to worst, some people will learn the
multiplication tables fast enough (and also how to sharpen spears).
The problem of using Mathematica intelligently, and not blindly, is
serious.
Most students are not well enough prepared with Mathematica to use it to
anywhere near its capability. Mathematica is not wide spread enough and
students do not learn it early enough. Any student interested in a
technical
career could do nothing better than start learning it in high school.
Furthermore, Mathematica is not optimized for students and researchers.
When
it comes to ease of use there are many gaps. I believe that Mathematica can
truly effect a revolution in technical education. But it is not as simple
as
just installing it on a departmental server. A lot of preparation is
needed.
Additional packages geared to student use are needed. Educators have to
learn how to take advantage of the resource. (For example how to shift from
quick calculations to essay type questions.)
David Park
djmp@earthlink.net
http://home.earthlink.net/~djmp/
I should like to say that as an educator of science students in a
(predominantly) non-mathematical branch of science (earth sciences) I am
very concerned about this approach. Sure Mathematica is a wonderful
tool. As a professional researcher I use it all the time for doing
tedious calculations to save time, or to check claculations where I may
have got things wrong and so on and so on. If I didn't think Mathematica
was useful I wouldn't have it and wouldn't subscribe to this list.
But it is still a tool. IT can't know what calculations to do, what
approximations to make and sometimes when there are mathematical choices
to be made. For example there are times when Mathematica's choice of
branch cut doesn't correspond to the one I want to make. Not a problem I
can tell it what I really want. There are times when its choice of
simplification doesn't suite my purpose. Again not a problem I can tell
it what to do or simply carry on by hand if that's easier. But how do I
know when the defaults don't suite my purpose, because I have spent many
years doing things by hand and gaining that experience to know what I
want. I am not convinced that if I had done all my mathematics within
Mathematica I would have gained the same experience. But I am open to
discussion on this if anyone wants to put the counter case. However, I
would need very strong convincing that it is good for students never to
have to do old fashioned calculations on paper. In the same way I think
it is important for children to learn multiplication rather than rely on
a calculator or to learn to write rather than use a word processor.
In particular for practicing engineers they may be out in the field,
away from a computer and be required to do a back of the envelope
calculation by hand. If you have never done it before you will be stuck
and I don't think you could consider yourself a real engineer.
So yes Mathematica is great. Yes students should be taught to use it and
use it properly. But please make sure you could have done your homework
by hand (it is often not as bad as you might think!). Perhaps I am a
dinosaur but I have been in meetings which required moderately difficult
numerical calculations which I could do by hand whereas other (younger)
people present were stuck without calculators.
I was once told a quote and I can't remember who it was from A fool
with a tool is still a fool
(Incidentally please don't take this personally. I don't know you and so
I have no reason to doubt that you are a perfectly good scientist I am
simply commenting on a current trend for people to run to software
rather than doing it by hand - which in some cases is actually easier).
Peter King
===
Subject: Plot3D
Hi there,
I just want to plot the very simple exp-function:
Plot3D[Exp[-10*(x*x + y*y)], {x, -1, 1}, {y, -1, 1}]
But the resulting plot is cut off at z(x,y)=0.2! So the result is simply not
an exponential!
I'd appreciate any help,
Franz
===
Subject: Graphics3D polygon face colors
If I display a polygon in 3 space with Graphics3D and the faces are
colored by the default light sources, does anyone know how to get the
rbg values for the face colors?
AJ Friend
===
Subject: Combining Matrices
Hello Everyone,
I'm trying to figure out how to combine an n x p matrix and an n x q
matrix to form an n x (p + q) matrix. I found one way, shown in the
second last line of the code below, but I have no idea why it works,
and I'm wondering whether there is a more direct way. The example
takes 3 x 4 matrix A and combines it with 3 x 2 matrix B to form 3 x
6 matrix X.
Any thoughts would be most appreciated.
Gregory
Clear[X]
n = 3; p = 4; q = 2;
A = Array[a, {n, p}];
B = Array[b, {n, q}];
(X = Transpose[Flatten[{{Transpose[A], Transpose[B]}}, 2]]) //
MatrixForm
Dimensions[X]
===
Subject: Re: The D'Agostino Pearson k^2 test implemented in mathematica /
variance of difference sign test
Here is an implementation of the D`Agostino Pearson K^2 test based on the
discussion in
R. B. D'Agostino and M. A. Stephens, editors. Goodness-of-Fit Techniques.
Marcel Dekker, Inc., 1986.
In[1]:= << Statistics`
(* This defines the SU standard normal approximation for sample skewness
given on page 377 of D`Agostino and Stephens. *)
In[2]:= susqrtb1[data_, len_] := Block[{y, beta2, wsq, delta, alpha},
y = Skewness[data] Sqrt[(len + 1) (len + 3)/(6 (len - 2))];
beta2 = 3 (len^2 + 27 len - 70) (len +
1) (len + 3)/((len - 2) (len + 5) (len + 7) (len + 9));
wsq = Sqrt[2 (beta2 - 1)] - 1;
delta = 1/Sqrt[Log[wsq]];
(* In the text, alpha is Sqrt[2/(wsq - 1)],
but that appears to be a typo. alpha = Sqrt[1/(wsq - 1)]
gives values consistent with a standard normal. *)
alpha = Sqrt[1/(wsq - 1)];
delta*Log[y/alpha + Sqrt[(y/alpha)^2 + 1]]]
(* This defines the Anscombe Glynn standard normal approximation for sample
kurtosis given on page 388 of D`Agostino and Stephens. *)
In[3]:= agb2[data_, len_] := Block[{b2, eb2, sdb2, xx, sqrtbeta1b2, aa},
b2 = Kurtosis[data];
eb2 = 3 (len - 1)/(len + 1);
sdb2 = Sqrt[24 len (len - 2) (len - 3)/((len + 1)^2 (len + 3)
(len + 5))];
xx = (b2 - eb2)/sdb2;
sqrtbeta1b2 =
6 (len^2 - 5 len + 2)/((len + 7) (len + 9))*
Sqrt[6 (len + 3) (len + 5)/(len (len - 2) (len - 3))];
aa = 6 + 8/sqrtbeta1b2 (2/sqrtbeta1b2 + Sqrt[1 +
4/sqrtbeta1b2^2]);
(1 - 2/(9 aa) - ((1 - 2/aa)/(1 + xx*Sqrt[2/(aa - 4)]))^(1/3))/
Sqrt[2/(9 aa)]]
(* The D`Agostino and Pearson K^2 test statistic is the sum of squares of
the
normal approximations to sample skewness and kurtosis. D`Agostino and
Stephens
states (on page 391) that K^2 is approximately distributed
ChiSquareDistribution[2] and that the chi square approximation presents no
problems
for n >= 100. *)
In[4]:= DAgostinoPearsonKSquareTest[data_] :=
Block[{len = Length[data], ksqrstat},
ksqrstat = susqrtb1[data, len]^2 + agb2[data, len]^2;
{KSquareStatistic -> ksqrstat,
PValue -> 1 - CDF[ChiSquareDistribution[2], ksqrstat]}]
(* Normally distributed data should tend to have pvalues that are not too
small. *)
In[5]:= DAgostinoPearsonKSquareTest[RandomArray[NormalDistribution[3, 1],
1000]]
Out[5]= {KSquareStatistic -> 2.29967, PValue -> 0.316688}
(* Data that are far from normal will have small pvalues. *)
In[6]:= DAgostinoPearsonKSquareTest[Table[Random[Real, {1, 10}], {1000}]]
Out[6]= {KSquareStatistic -> 582.761, PValue -> 0.}
For the variance quoted on the TimeSeries page, I initially thought the
same thing you did. Assuming the signs are independent and there are equal
probabilities of getting positive and negative signs (and 0 probability of
getting a 0 difference), the statistic would follow
BinomialDistribution[n-1, 1/2], which would have a variance of
(n-1)/4. Simulations give a variance that appears to be (n+1)/12 (which
would still indicate a typo in the TimeSeries documentation). I haven't
figured out why this should be the variance yet. My best guess is that the
assumption of independence is not valid given the differencing and as a
result the distribution is something other than BinomialDistribution[n-1,
1/2].
Darren Glosemeyer
Wolfram Research
>I have two questions.
>1. Are there any resources of .nb files available on the internet
>where I might find an implementation of the D'Agostino Pearson k^2 test
>for normal variates?
>2. In the mathematica time series package (an add-on), the
>difference-sign test of residuals is mentioned (url:
>http://documents.wolfram.com/applications/timeseries/UsersGuidetoTimeSeries
/1.6.2.html).
> It says that the variance of this test is (n+1) / 2. However, it
>would seem to me that a simple calculation gives a variance of (n-1)/4.
> It goes as follows:
>If the series is differenced once, then the number of positive and
>negative values in the difference should be approximately equal. If Xi
>denotes the sign of each value in the differenced series, then
>Mean(Xi) = 0.5(1) + 0.5(0) = 0.5
>Var(Xi) = Expectation( (Xi - Mean(Xi))^2 )
>= Expectation( Xi^2 -Xi + 0.25 )
>= 0.5 - 0.5 + 0.25
>= 0.25
>And assuming independence of each sign from the others, the total
>variance should be the sum of the individual variances, up to n-1 for n
>data points (since there are only n-1 changes in sign), thus
>Variance = (n-1) / 4
>There is an equivalent problem in Lemon's Stochastic Physics about
>coin flips, for which the answer is listed, without proof, as (n-1)/8.
>Because of these three conficting results I am wondering if I have made
>an error in my calculation, and if anyone can find one please let me
>know.
>-John Hawkin
===
Subject: how can I import my datas in excel to mathematica and then do
calculations on them?
my problem, First of all i'm a mathematic engineering student in
university and this is about my graduation project.
To summarize,
i have over 3650 datas in my excel files, they are datas of each day
past 10 years, i should import this to mathematica to do some
calculations, i 'll find increment or decrement percentage of each day
according to the next day, i almost need to have 3649 calculations,
can't do it without mathematica :) but i can't even import those datas
?
does any of you have any kind of idea, i'll gratefull if you help me.
===
Subject: Weird output?
Hi people,
some very not understandable output after some easy input:
http://ismi.math.uni-frankfurt.de/vanSchaik/Mathematica.gif
(5 kB pic). My question is not about the right answer but more for fun
and to ask if this kind of things occur more often?
- Kees
===
Subject: 3D-plot over a triangle
Hi there,
I want to plot the following function f = 4*s*t over a triangle defined
by s going from 0 to 1
and t from 0 to 1-s.
I tried Plot3D[4st, {s, 0, 1}, {t, 0, 1-s}]; but it does not work. Any
suggestion ?
Pluton