I'm new to Mathematica and need some hints on how to derive (or > estimate) a function from a given set of discrete x/y values. > I know Mathematica can do this but I don't know how. > For example, I tried to create a table of x/y values, then assign the > approximated funcion to 'newfunction' and test it by calling it with > 2.3 as argument, but it failed as follows (I couldn't even figure out > how to build the table): Table = [{0, 0}, {1, 2}, {2, 4}, {3, 8}, {4, 16}, {5, 32}] > newfunction = Interpolation[%] > newfunction[2.3] In[4]:= f=Interpolation[{{0, 0}, {1, 2}, {2, 4}, {3, 8}, {4, 16}, {5, 32}}] Out[4]= InterpolatingFunction[{{0,5}},<>] In[7]:= f[3.4] Out[7]= 10.496 In[6]:= f'[3.4] Out[6]= 7.25333 Salut -- < Jean Pellegri > fortitudo mea in rota F - 93100 Montreuil I - 54023 Filattiera ==== Ingolf, I experienced the same problem when I first installed Mathematica 5.0 on Windows 98 many months ago. There was one other similar complaint on MathGroup at the time. After running Mathematica for some time, fonts would go bad. Sometimes in Mathematica notebooks and even more often in Windows. For example, the icons would change size. After restarting the computer the problem would go away, but then come back after running Mathematica. At the time, Wolfram support was saying that there were too many fonts installed on the Windows system and to remove some. But that was not the cause of the solution. at WRI and he replied that they had found the problem. He provided a site where I could download a new version of the front end. That solved the problem. I was under the impression that support provided the new front end to everybody that had the problem, which I believe was only on certain Windows systems, and that they had instituted a permanent fix. So it is strange that this is coming up again. Is it associated with the David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ >Sent: Friday, January 02, 2004 16:47 >To: 'Ingolf Dahl'; mathgroup@smc.vnet.net >Distortion could be, just could be, due to how your notebook's native >1024x768 resolution fixed grid transistors, on screen redraw, automatically >reinterporlate pixels. Just for the heck of it, can you try >connecting your >notebook to an external monitor, then try all screen adaptor modes >to see if >fonts still look like cooties? Sylvia Hobbs >Boston -----Original Message----- >Sent: Friday, January 02, 2004 4:24 AM >To: mathgroup@smc.vnet.net I have seen exactly the same behaviour on my computer (Windows Me), nothing >to add or to subtract from your description. >Please keep me informed if you find a work-around. Ingolf Dahl >Sweden >-----Original Message----- >To: mathgroup@smc.vnet.net >>Sent: Thursday, January 01, 2004 11:55 >>To: mathgroup@smc.vnet.net >>I have a problem with Mathematica 5 and Windows ME. After running for a >>while the fonts in the notebooks displayed on screen become >>garbled. A while >>later various other screen fonts (e.g. icon labels, etc) become garbled. >>This problem does NOT occur with Mathematica 4.2.1. I have tried various >>settings for the display (i.e. screen resolutions and colour depths) but >>nothing seems to help. Has anyone else had this problem? Even better, has anyone got any >>suggestions how to work around it. I would rather not go through >the hassle >>of upgrading to Windows XP. -- >>Steve Luttrell >>West Malvern, UK ==== I'm trying to learn some basic Bayesian statistics with Mathematica but I'm having trouble building up the probability formulae that I need. I tried to define depPr[x_,y_] := (Pr[x] depPr[y,x]) / Pr[y] but I don't even get an Out result (I thought it would have at least redisplayed it with numerator over denominator) (I assumed by the way that I needed a different name for the function Pr{x | y} vs the simple Pr{x}) If I replace the ':=' with '=', then I just get a recursion error. I've looked around on the web but there doesn't seem to be very much out there on doing probability with Mathematica Once I get this working, then I want to extend it (symbolically) so that I can work with sequences of events, i.e. Pr{Xi | Y} = Pr{Xi}*Pr{Y|Xi} ---- Sigma(Pr{Xi}*Pr{Y|Xi}, 1, n) and then create lists of items to run through it. Bit difficult when I can't even get the basics running. Any suggestions would be appreciated, Jen B. -- _______ ==== I enter the following: -------- - dat = {{1, 3}, {2, 12}, {3, 22}, {4, 35}, {5, 70}, {6, 95}, {7, 119}}; p = ListPlot[dat, PlotStyle -> PointSize[0.02]] a = Fit[dat, x, x] b = Fit[dat, {1, x, x^2}, x] pl = Plot[a, {x, -2, 9}] p2 = Plot[b, {x, -2, 9}] Show[p,p1,p2] -------- - Fit finds the requested things, Listplot and the 2 Plot draw the plots, BUT Show[p,p1,p2] don't show anything. Well actually it shows the error message: Show::gcomb: An error was encountered in combining the graphics objects in Show[p1, .Graphics]. More... Why Show[p,p1,p2] don't show p,p1,p2? ==== I usually Ungroup the entire graphic and you can use Shift+ObjectSelect in Illustrator to select common graphics objects within the main graphic. Alternately, you can use Prolog and Epilog to render graphics in order, in Mathematica, which should convert to EPS accordinly. But I have only tried this once or twice and I think I came to the conclusion that it was more a hassle than anything. Yas > use Adobe Illustrator to edit the EPS files. Here's my problem: I > plot y = x^2 and open the EPS file in Illustrator, but when I click on > the curve, Illustrator only highlights (selects) a piece of the > parabola (and not the entire parabola). Sometimes it even selects a > piece of the curve and a piece of an axis, but I cannot select just > the curve, or just an axis. I've posted a similar question on the > Adobe Forums, but with little success. Any suggestions? I appreciate any help that's out there. R > ==== > I'm afraid that's something you'll just have to live with. However, by > clicking and dragging, you can usually select many segments at once. > Once you've got them all selected, you can them group them. > Why this is so, can be easily understood, since the M's plot > constitutes from final line segments. To see this, pick out > the Out Graphics argument and look into it with FullForm command. First paragraph may be correct -- but (I suspect) only because, for whatever reason, that's the way Mathematica does it. I'm skeptical that Mathematica *has* to do it that way -- that is, has to break a single curve into some number of smaller sub-segments -- for any major technical reason; and it would be nicer if it didn't do it that way. Are there technical reasons (maximum number of points per Line[], or something like that) why Mathematica has to do it this way? Also, if you Select first segment A, then segment B, of a segmented curve of this type after transferring it from Mathematica to Illustrator, the curve appears continuous. Does this mean that the final point of segment A and the initial point of segment B are the same? -- or just very close to each other? Or does the EPS file somehow contain enough data that Illustrastor knows how to fill in the gap between last A and first B points? ==== > First paragraph may be correct -- but (I suspect) only because, for > whatever reason, that's the way Mathematica does it. I'm skeptical > that Mathematica *has* to do it that way -- that is, has to break a > single curve into some number of smaller sub-segments -- for any major > technical reason; and it would be nicer if it didn't do it that way. I don't see any other, better way, how Mathematica would handle this in EPS. Borut ==== > I have a problem with Mathematica 5 and Windows ME. After running for a > while the fonts in the notebooks displayed on screen become garbled. A > while > later various other screen fonts (e.g. icon labels, etc) become garbled. > This problem does NOT occur with Mathematica 4.2.1. I have tried various > settings for the display (i.e. screen resolutions and colour depths) but > nothing seems to help. Has anyone else had this problem? Even better, has anyone got any > suggestions how to work around it. I would rather not go through the > hassle > of upgrading to Windows XP. -- > Steve Luttrell > West Malvern, UK This is a known issue in Mathematica 5.0.0 for Windows. Wolfram tech support is aware of the issue and can provide an update to fix the problem. Anybody experiencing this problem should contact them at support@wolfram.com. Don't forget to include your license number. Sincerely, John Fultz jfultz@wolfram.com User Interface Group Wolfram Research, Inc. ==== George, The problem is that you confused the letter l with the number 1. Fix that and it works. This could all probably be drawn more conveniently with dat = {{1, 3}, {2, 12}, {3, 22}, {4, 35}, {5, 70}, {6, 95}, {7, 119}}; a = Fit[dat, x, x] b = Fit[dat, {1, x, x^2}, x] Needs[Graphics`Colors`] Plot[{a, b}, {x, -2, 9}, PlotStyle -> {Blue, Black}, Epilog -> {PointSize[0.02], Point /@ dat}, Frame -> True]; It is often easier to map Point onto a data list than to use ListPlot. If you want to use ListPlot and, say, plot the two curves over different domains you could try the DrawGraphics package at my web site below. Needs[DrawGraphics`DrawingMaster`] Draw2D[ {PointSize[0.02], ListDraw[dat], Draw[b, {x, 1, 7}], Blue, Draw[a, {x, -2, 9}]}, Frame -> True]; ListDraw and Draw work just like ListPlot and Plot except that they extract the primitive graphics and don't produce side plots. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ Show[p,p1,p2] -------- - Fit finds the requested things, Listplot and the 2 Plot draw the plots, BUT Show[p,p1,p2] don't show anything. Well actually it shows the error message: Show::gcomb: An error was encountered in combining the graphics objects in Show[p1, .Graphics]. More... Why Show[p,p1,p2] don't show p,p1,p2? ==== HI, I need to solve a large number of ordinary differential equations (5000). I encounter some memory issues using Mathematica because it deals with interpolating functions. I only need to know the value of the functions I integrate at the final time, and therefore do not need all the information contained in the interpolating function. Is there any ways I can overcome this difficulty? Vincent ==== Yas, I have often wondered about programs that would take Mathematica plot output and allow improvements to be made on the plots. What programs are available, what will they do for you and roughly how much do they cost? How well do they work with 3D graphics? Are they worth it? One of the things I don't like about Mathematica 3D graphics is the poor rendering. There are often extra lines and spots that shouldn't appear in the graphics. Do programs like Illustrator solve these problems? When I look at some of the sample 3D plots on the WRI web site, they look as if they had been run through an auxiliary program. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ > use Adobe Illustrator to edit the EPS files. Here's my problem: I > plot y = x^2 and open the EPS file in Illustrator, but when I click on > the curve, Illustrator only highlights (selects) a piece of the > parabola (and not the entire parabola). Sometimes it even selects a > piece of the curve and a piece of an axis, but I cannot select just > the curve, or just an axis. I've posted a similar question on the > Adobe Forums, but with little success. Any suggestions? I appreciate any help that's out there. R > ==== Re Mathematica 5.0 running under WinXP Home. Am using... z = Regress[...RegressionReport->CovarianceMatrix]; X = CovarianceMatrix /. z; ...to extract the given matrix. However, when I use X[[k,k]] to access the k'th diagonal element, I get a row instead! The culprit is that MatrixForm is the X-head (as FullForm reveals). How can I strip away this head and make X a list of lists? Bruce ==== Change pl = Plot[a, {x, -2, 9}] to p1 = Plot[a, {x, -2, 9}] (i.e. ell to one). The error message point to it directly. > I enter the following: > --- > ------ > dat = {{1, 3}, {2, 12}, {3, 22}, {4, 35}, {5, 70}, {6, 95}, {7, 119}}; p = ListPlot[dat, PlotStyle -> PointSize[0.02]] a = Fit[dat, x, x] > b = Fit[dat, {1, x, x^2}, x] pl = Plot[a, {x, -2, 9}] > p2 = Plot[b, {x, -2, 9}] Show[p,p1,p2] > --- > ------ > Fit finds the requested things, Listplot and the 2 Plot draw the plots, > BUT Show[p,p1,p2] don't show anything. Well actually it shows the > error message: Show::gcomb: An error was encountered in combining the graphics objects > in Show[p1, .Graphics]. More... > Why Show[p,p1,p2] don't show p,p1,p2? > ==== You typed pl = Plot[a, {x, -2, 9}] with the letter l in pl instead of the number 1. Correct and try again. Tomas Garza Mexico City Original Message: p2 = Plot[b, {x, -2, 9}] Show[p,p1,p2] -------- - Fit finds the requested things, Listplot and the 2 Plot draw the plots, BUT Show[p,p1,p2] don't show anything. Well actually it shows the error message: Show::gcomb: An error was encountered in combining the graphics objects in Show[p1, .Graphics]. More... Why Show[p,p1,p2] don't show p,p1,p2? ==== Compare In[1]:= Do[ f[k] = k, {k, 1., 17.} ] f[1.`20] Clear[f] Out[2]= 1. and In[1]:= Do[ f[k] = k, {k, 1., 18.} ] f[1.`20] Clear[f] Out[2]= f[1.0000000000000000000] -- and the user's best bet to figure out how it'll work is probably to flip a coin. The reason is probably just that the hashing mechanism breaks down, because the result returned by Mathematica changes after it re-sorts some internal table of DownValues for f (the 'boundary value' 17 is for version 5.0 on my machine; if 17. and 18. don't work, try 2. and 100.). But in general, my opinion is that it is only to be expected -- when we don't even know for sure how the definitions for f can be reordered. Maxim Rytin