wolfram-mathematica

A problem in Mathematica 8 with function declaration

你说的曾经没有我的故事 提交于 2019-12-04 05:18:19
This is a strange result with a function defined as "functionB" in this example. Can someone explain this? I want to plot functionB[x] and functionB[Sqrt[x]] , they must be different, but this code shows that functionB[x] = functionB[Sqrt[x]] , which is impossible. model = 4/Sqrt[3] - a1/(x + b1) - a2/(x + b2)^2 - a3/(x + b3)^4; fit = {a1 -> 0.27, a2 -> 0.335, a3 -> -0.347, b1 -> 4.29, b2 -> 0.435, b3 -> 0.712}; functionB[x_] := model /. fit Show[ ParametricPlot[{x, functionB[x]}, {x, 0, 1}], ParametricPlot[{x, functionB[Sqrt[x]]}, {x, 0, 1}] ] functionB[x] must different from functionB[Sqrt[x

How can I show % values on the y axis of a plot?

风格不统一 提交于 2019-12-04 04:58:50
In any Mathematica chart or plot how can I show % values on the y axis? I may have data like this: data = {{{2010, 8, 3}, 0.}, {{2010, 8, 31}, -0.052208}, {{2010, 9, 30}, 0.008221}, {{2010, 10, 29}, 0.133203}, {{2010, 11, 30}, 0.044557}, {{2010, 12, 31}, 0.164891}, {{2011, 1, 31}, 0.055141}, {{2011, 2, 28}, 0.114801}, {{2011, 3, 31}, 0.170501}, {{2011, 4, 29}, 0.347566}, {{2011, 5, 31}, 0.461358}, {{2011, 6, 30}, 0.244649}, {{2011, 7, 29}, 0.41939}, {{2011, 8, 31}, 0.589874}, {{2011, 9, 30}, 0.444151}, {{2011, 10, 31}, 0.549095}, {{2011, 11, 30}, 0.539669}}; DateListPlot@data I just want the y

Where is the location of MUnit in Wolfram Workbench 2.0 for the Mac?

你离开我真会死。 提交于 2019-12-04 04:54:30
I have Mathematica 8.0 and Wolfram Workbench 2.0 for the Mac. I want to use MUnit to unit test a package I am creating, but I am finding the lack of documentation on MUnit to be frustrating. The best resource so for has been Mathematic Cookbook by Sal Mangano . Section 19.11 covers "Integrating Wolfram Workbench’s MUnit Package into the Frontend". I figure once I expose MUnit to the frontend, I will be able to query the MUnit API with ? . Just one problem, I can't find the MUnit package. I tried to locate the MUnit directory as suggested in the book with: find / -name MUnit -print 2> /dev/null

NIntegrate fails to converge near a point that is not inside my definite integral?

ぃ、小莉子 提交于 2019-12-04 04:43:13
I am trying to calculate a definite integral. I write: NIntegrate[expression, {x, 0, 1}, WorkingPrecision -> 100] "expression" is described below. The WorkingPrecision was added in to help with another error. I get an error: "NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in x near {x} = {<<156>>}. NIntegrate obtained <<157>> and <<160>> for the integral and error estimates. >>" Why am I getting this error for near{x} = {<<156>>} when I am only looking at 0<x<1 ? And what do the double pointy brackets around the number mean? The expression

May I write {x,a,b}//Do[…,#]& instead of Do[…,{x,a,b}]?

半城伤御伤魂 提交于 2019-12-04 04:33:33
I'm in love with Ruby. In this language all core functions are actually methods. That's why I prefer postfix notation – when the data, which I want to process is placed left from the body of anonymous processing function, for example: array.map{...} . I believe, that it has advantages in how easy is this code to read. But Mathetica, being functional (yeah, it can be procedural if you want) dictates a style, where Function name is placed left from the data. As we can see in its manuals, // is used only when it's some simple Function, without arguments, like list // MatrixForm . When Function

What generates the In/Out CellLabels in Mathematica and how can I add automatic Timing to them?

♀尐吖头ヾ 提交于 2019-12-04 04:22:41
When Mathematica evaluates a cell, it gives the Input cell and Output cell the CellLabel s In[$Line]:= and Out[$Line]= where $Line is a counter that gets incremented on each evaluated input. If you input something like TraditionalForm[expr] or TeXForm[expr] (or any other *Form from $OutputForms ) then the name of the form also gets added to the Output cell's label. eg Out[1]//TraditionalForm= . I can't find any way of customising these labels. They can be disabled in the Preferences dialog. They don't seem to be in the StyleSheet options for Input and Output cells - although the options

Combinations with repetition

核能气质少年 提交于 2019-12-04 04:17:45
I'm using Mathematica 7 and with a combinatorica package function I can get all combinations of a certain number from a list of elements where the order doesn't matter and there is no repetition.e.g: in: KSubsets[{a, b, c, d}, 3] out: {{a, b, c}, {a, b, d}, {a, c, d}, {b, c, d}} I cannot find a function that will give me all combinations of a certain number from a list of elements where the order doesn't matter and there is repetition. i.e. the above example would include elements like {a,a,b},{a,a,a},{b,b,b}...etc in the output. It may require a custom function. If I can come up with one I

mathematica code in email and keeping formatting the same as notebook

我怕爱的太早我们不能终老 提交于 2019-12-04 04:03:35
As we all know, when one is to send email with some Mathematica code in it, the practice is to do the following Select the cell, Cell->ConvertTo -> INPUT FORM, then COPY AS TEXT Then paste the code into the email, or any other exchange media it is. The only problem with the above, is that when, on the other end, one copies the text from email and paste it back into a Mathematica notebook, the code will then no longer appear as it was in the original form (before the converting to INPUT FORM). Because when one inserts the text copied from the email to Mathematica notebook, it becomes a standard

The logic of Message internals

余生颓废 提交于 2019-12-04 03:59:47
问题 I am trying to figure out the logic of Message behavior. Consider evaluation of the following: On[] Sin[1,1] After evaluating the above you will get about 830 (!) Messages (in Mathematica 7). All these Messages have arisen during producing the one: Sin::argx: Sin called with 2 arguments; 1 argument is expected. >> (this is one but last Message ). The last Message Message::trace: Message[Sin::argx,Sin,2] --> Null. >> corresponds to finishing of the work of internal Mathematica 's Message

Avoid repeated calls to Interpolation

╄→гoц情女王★ 提交于 2019-12-04 03:47:10
I want to interpolate a function in mathematica. The function depends on a parameter a , in fact it is the inverse of a function F which also depends on a , so I build my approximation as follows, approx = Interpolation[Table[{F[0.1 n, a], 0.1 n}, {n, -100, 100}]] now I can simply call approx[x] to evaluate the inverse function at a point. Instead I would like to do something like this: Define a function which takes a parameter, G[x_,a_] = "construct the interpolating function, and return the value of the function at x" Then write G[x,a] to evaluate the function. Otherwise I would have to