mathematica-8

What is the minimal difference in RGB color values which Mathematica renders and exports as different colors?

笑着哭i 提交于 2020-02-02 03:57:05
问题 I was amazed when I found that Mathematica gives True for the following code (on 32 bit Windows XP with Mathematica 8.0.1): Rasterize[Graphics[{RGBColor[0, 0, 0], Disk[]}]] === Rasterize[Graphics[{RGBColor[0, 0, 1/257], Disk[]}]] What is the minimal difference in RGB color values which Mathematica renders and exports as different colors? Is it machine-dependent? 回答1: I believe this behaviour is machine dependent, but I do not know how exactly it depends on the OS. On my machine, it evaluates

Not cropping BarChart when using Frame instead of Axes

余生长醉 提交于 2020-01-15 06:32:10
问题 I just found out that a BarChart may get cropped when using Frame rather than Axes . Example: data = {.2, .4, .6, 0., 0., 0.} BarChart[data] BarChart[data, Frame -> True, Axes -> False] Is this a feature or a bug? If it is a feature, is there an easy way to prevent cropping? EDIT Screenshot, per request: 回答1: Well, It was not always like that: 回答2: How about using PlotRange ?... data = {.2, .4, .6, 0., 0., 0.} BarChart[data] BarChart[data, Frame -> True, Axes -> False, PlotRange -> {{.5, 6.5}

How to Label Graph Edges with their weights

試著忘記壹切 提交于 2020-01-12 05:30:10
问题 Warning! I posted the question when Mathematica v 8.0 was the coolest kid. The bug has been solved as of version 9.0.1 The help for EdgeLabels states: However: CompleteGraph[4, EdgeWeight -> Range@6, VertexShapeFunction -> "Name", EdgeLabels -> "EdgeWeight"] Results in: So, no Edge Labels ... I guess it is a bug. I used a nasty construct like: adj = {{\[Infinity], 1, 1, 1, 1}, {1, \[Infinity], 2, 2, 2}, {1, 2, \[Infinity], 2, 2}, {1, 2, 2, \[Infinity], 2}, {1, 2, 2, 2, \[Infinity]}};

Mathematica: Obtaining graphics primitives and directives

大兔子大兔子 提交于 2020-01-02 07:42:13
问题 How do you obtain graphic primitives and directives from a Graphics object? Leonid Shifrin showed how to remove them in the post Mathematica: Removing graphics primitives. I tried applying something similar but I can't get what I want. Consider this example: g1 = ListPlot3D[ {{0, -1, 0}, {0, 1, 0}, {-1, 0, 1}, {1, 0, 1}, {-1, 1, 1}}, Mesh -> {2, 2}, Boxed -> False, Axes -> False, ViewPoint -> {2, -2, 1}, ViewVertical -> {0, 0, 1}, MeshStyle -> RGBColor[0, 0.5, 0], BoundaryStyle -> RGBColor[1,

Function minimization with equality constraints in Mathematica 8

只愿长相守 提交于 2020-01-02 02:55:27
问题 When using constraints with simple equality in Mathematica 8, minimization doesn't work. E.g. FindMinimum[{x^2 + y^2, y == 1}, {x, y}] works ok in Mathematica 6, but gives errors in version 8. Can anyone else confirm (or explain) this? Looks like fixing one of the parameters with a constraint confuses version 8. Putting xy==1 is OK, also any inequality. Any simple workaround on this? I have tried changing the Method , no luck. I would like to keep all the parameters in the parameter list, but

Is there any efficient easy way to compare two lists with the same length with Mathematica?

元气小坏坏 提交于 2020-01-01 04:42:05
问题 Given two lists A={a1,a2,a3,...an} and B={b1,b2,b3,...bn} , I would say A>=B if and only if all ai>=bi . There is a built-in logical comparison of two lists, A==B , but no A>B . Do we need to compare each element like this And@@Table[A[[i]]>=B[[i]],{i,n}] Any better tricks to do this? EDIT: Great thanks for all of you. Here's a further question: How to find the Maximum list (if exist) among N lists? Any efficient easy way to find the maximum list among N lists with the same length using

Doing probabilistic calculations on a higher abstraction level

谁都会走 提交于 2019-12-31 08:32:25
问题 To the downvoters: this isn't a question about mathematics, it's a question about the programming language Mathematica . One of the prime characteristics of Mathematica is that it can deal with many things symbolically. But if you come to think about it, many of the symbolic features are actually only halfway symbolic. Take vectors for instance. We can have a symbolic vector like {x,y,z}, do a matrix multiplication with a matrix full of symbols and end up with a symbolic result and so we

Doing probabilistic calculations on a higher abstraction level

扶醉桌前 提交于 2019-12-31 08:31:47
问题 To the downvoters: this isn't a question about mathematics, it's a question about the programming language Mathematica . One of the prime characteristics of Mathematica is that it can deal with many things symbolically. But if you come to think about it, many of the symbolic features are actually only halfway symbolic. Take vectors for instance. We can have a symbolic vector like {x,y,z}, do a matrix multiplication with a matrix full of symbols and end up with a symbolic result and so we

Mathematica: Non-intersecting line segments

随声附和 提交于 2019-12-24 07:07:53
问题 How can we tell Mathematica to gives us a set of non-intersecting lines? In this case two lines intersect if they have a point (not an endpoint) in common. Consider this simple case: l1 = {{-1, 0}, {1, 0}}; l2 = {{0, -1}, {0, 1}}; lines = {l1, l2}; The idea is to create a function which, given a set a lines, returns a set of non-intersecting lines. If such function exists say split then the output of split[lines] would be { {{-1, 0}, {0,0}}, {{ 0, 0}, {1,0}}, {{ 0,-1}, {0,0}}, {{ 0, 0}, {0,1}

Subkernel memory control in Mathematica

[亡魂溺海] 提交于 2019-12-23 10:16:39
问题 I have a somewhat similar question as: Mathematica running out of memory I am interested in something like this: ParallelTable[F[i], {i, 0, 14.9, 0.001}] where F[i] is a complicated numerical integral (I haven't yet found an easy way to reproduce the problem without page filling definitions for an integral). My problem is that the subkernels blow up in memory and I have to stop evaluation if I won't let the machine swapping. But even if I have stopped evaluation the kernels won't give free