Search Results

Search found 129 results on 6 pages for 'mathematica'.

Page 2/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • plot of multiple line segments on 2D plot in Mathematica

    - by Bruce
    Hi, I would like to plot multiple, perhaps thousands of line segments on a single 2D plot in Mathematica. These line segments would be determined from an algorithm that would detected and save each segments endpoints. Once the algorithm has determined all the line segments within a finite 2D plot domain and range (e.g., x = 0,4 and y=0,0.5), I would like to plot them all on a single plot. Thanks for any suggestions.

    Read the article

  • Mathematica, PDF Curves and Shading

    - by Venerable Garbage Collector
    I need to plot a normal distribution and then shade some specific region of it. Right now I'm doing this by creating a plot of the distribution and overlaying it with a RegionPlot. This is pretty convoluted and I'm certain there must be a more elegant way of doing it. I Googled, looked at the docs, found nothing. Help me SO! I guess Mathematica counts as programming? :D

    Read the article

  • No more memory available in Mathematica, Fit the parameters of system of differential equation

    - by user1058051
    I encountered a memory problem in Mathematica, when I tried to process my experimental data. It's a system of two differential equations and I need to find most suitable parameters. Unfortunately I am not a Pro in Mathematica, so the program used a lot of memory, when the parameter epsilon is more than 0.4. When it less than 0.4, the program work properly. The command 'historylength = 0' and attempts to reduce the Accuracy Goal and WorkingPrecision didn`t help. I can't use ' clear Cache ', because there isnt a circle. I'm trying to understand what mistakes I made, and how I may limit the memory usage. I have already bought extra-RAM, now its 4GB, and now I haven't free memory-slots in motherboard Remove["Global`*"]; T=13200; L = 0.085; e = 0.41; v = 0.000557197; q = 0.1618; C0 = 0.0256; R = 0.00075; data = {{L,600,0.141124587},{L,1200,0.254134509},{L,1800,0.342888644}, {L,2400,0.424476295},{L,3600,0.562844542},{L,4800,0.657111356}, {L,6000,0.75137817},{L,7200,0.815876516},{L,8430,0.879823594}, {L,9000,0.900771775},{L,13200,1}}; model[(De_)?NumberQ, (Kf_)?NumberQ, (Y_)?NumberQ] := model[De, Kf, Y] = yeld /.Last[Last[ NDSolve[{ v (Ci^(1,0))[z,t]+(Ci^(0,1))[z,t]== -((3 (1-e) Kf (Ci[z,t]-C0))/ (R e (1-(R Kf (1-R/r[z,t]))/De))), (r^(0,1))[z,t]== (R^2 Kf (Ci[z,t]-C0))/ (q r[z,t]^2 (1-(R Kf (1-R/r[z,t]))/De)), (yeld^(0,1))[z,t]== Y*(v e Ci[z,t])/(L q (1-e)), r[z,0]==R, Ci[z,0]==0, Ci[0,t]==0, yeld[z,0]==0}, {r[z,t],Ci[z,t],yeld},{z,0,L},{t,0,T}]]] fit = FindFit[data, {model[De, Kf, Y][z, t], {Y > 0.97, Y < 1.03, Kf > 10^-6, Kf < 10^-4, De > 10^-13, De < 10^-9}}, {{De,7*10^-13}, {Kf, 10^-5}, {Y, 1}}, {z, t}, Method -> NMinimize] data = {{600,0.141124587},{1200,0.254134509},{1800,0.342888644}, {2400,0.424476295},{3600,0.562844542},{4800,0.657111356}, {6000,0.75137817},{7200,0.815876516},{8430,0.879823594}, {9000,0.900771775},{13200,1}}; YYY = model[ De /. fit[[1]], Kf /. fit[[2]], Y /. fit[[3]]]; Show[Plot[Evaluate[YYY[L,t]],{t,0,T},PlotRange->All], ListPlot[data,PlotStyle->Directive[PointSize[Medium],Red]]] the link on the .nb file http://www.4shared.com/folder/249TSjlz/_online.html

    Read the article

  • Mathematica + GraphPlot + GraphicsGrid with EdgeLabels

    - by Paxinum
    I had some very strange problems with GraphicsGrid. The individual PraphPlot:s looks nice and ok, but the code GraphicsGrid[{{GraphPlot[{{a -> b, "ab"}, {a -> c, "7"}}]}, {GraphPlot[{{a -> b, "5"}, {a -> c, "2"}}]}}] just produces 2 big clots of garbage. If I remove the edge labels, everything works as expected. I am using Mathematica 7.0.0.

    Read the article

  • Splitting a list based on another list values in Mathematica

    - by Max
    In Mathematica I have a list of point coordinates size = 50; points = Table[{RandomInteger[{0, size}], RandomInteger[{0, size}]}, {i, 1, n}]; and a list of cluster indices these points belong to clusterIndices = {1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1}; what is the easiest way to split the points into two separate lists based on the clusterIndices values?

    Read the article

  • scaling axes in Mathematica

    - by lak3rs
    I'm sure this is an incredibly simple question but I've recently started using Mathematica so it's all new to me. How do you scale the y axis? I try the following but it won't compile. Plot[y = {Exp[-(x^2+3x+2)]}, {x, 0, 5}, {y, 0, 1}]

    Read the article

  • Find Waldo with Mathematica

    - by Jason Fitzpatrick
    If you’re looking for a geeky (and speedy) way to find Waldo, of the Where’s Waldo? fame, this series of Mathematica scripts makes it a snap. Over at Stack Overflow, programmer Arnoud Buzing shares a clever bit of Mathematica-based coding that analyzes a Where’s Waldo? drawing and finds the elusive Waldo. Hit up the link below to see the distinct steps of analysis with accompanying photos. How Do I Find Waldo with Mathematica? [via Make] How To Properly Scan a Photograph (And Get An Even Better Image) The HTG Guide to Hiding Your Data in a TrueCrypt Hidden Volume Make Your Own Windows 8 Start Button with Zero Memory Usage

    Read the article

  • Show duplicates in Mathematica

    - by Martin Janiczek
    In Mathematica I have a list: x = {1,2,3,3,4,5,5,6} How will I make a list with the duplicates? Like: {3,5} I have been looking at Lists as Sets, if there is something like Except[] for lists, so I could do: unique = Union[x] duplicates = MyExcept[x,unique] (Of course, if the x would have more than two duplicates - say, {1,2,2,2,3,4,4}, there the output would be {2,2,4}, but additional Union[] would solve this.) But there wasn't anything like that (if I did understand all the functions there well). So, how to do that?

    Read the article

  • misleading plot issue in mathematica

    - by Qiang Li
    I want to study some "strange" functions by plotting them out in mathematica. One example is the following: mod2[x_] := Which[Mod[x, 2] >= 1, -2 + Mod[x, 2], True, Mod[x, 2]]; f[x_] := Which[-1 <= x <= 1, Abs[x], True, Abs[mod2[x]]]; fn[x_, n_] := Sum[(3/4)^i*f[4^n*x], {i, 0, n}] Plot[{fn[x, 0], fn[x, 1], fn[x, 2], fn[x, 5]}, {x, -2, 2}] However, the plot I got from mma is misleading, in the sense that the maxima and minima of fn[x, 5] should be on the same two levels. But due to high oscillation of the function, and the fact that clearly mma only takes limited number of points to draw the function, you see the plot exhibit strange behavior. Is there any option in plot to remedy for this? Many thanks.

    Read the article

  • Take positive square root in Mathematica

    - by Sagekilla
    Hi all, I'm currently doing some normalization along the lines of: J = Integrate[Psi[x, 0]^2, {x, 0, a}] sol = Solve[J == 1, A] A /. sol For this type of normalization, the negative square root is extraneous. My results are: In[49]:= J = Integrate[Psi[x, 0]^2, {x, 0, a}] Out[49]= 2 A^2 In[68]:= sol = Solve[J == 1, A] Out[68]= {{A -> -(1/Sqrt[2])}, {A -> 1/Sqrt[2]}} Even if I try giving it an Assuming[...] or Simplify[...], it still gives me the same results: In[69]:= sol = Assuming[A > 0, Solve[J == 1, A]] Out[69]= {{A -> -(1/Sqrt[2])}, {A -> 1/Sqrt[2]}} In[70]:= sol = FullSimplify[Solve[J == 1, A], A > 0] Out[70]= {{A -> -(1/Sqrt[2])}, {A -> 1/Sqrt[2]}} Can anyone tell me what I'm doing wrong here? I'd much appreciate it! If it helps any, I'm running Mathematica 7 on Windows 7 64-bit.

    Read the article

  • Permutations distinct under given symmetry (Mathematica 8 group theory)

    - by Yaroslav Bulatov
    Given a list of integers like {2,1,1,0} I'd like to list all permutations of that list that are not equivalent under given group. For instance, using symmetry of the square, the result would be {{2, 1, 1, 0}, {2, 1, 0, 1}}. Approach below (Mathematica 8) generates all permutations, then weeds out the equivalent ones. I can't use it because I can't afford to generate all permutations, is there a more efficient way? Update: actually, the bottleneck is in DeleteCases. The following list {2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 0, 0, 0} has about a million permutations and takes 0.1 seconds to compute. Apparently there are supposed to be 1292 orderings after removing symmetries, but my approach doesn't finish in 10 minutes removeEquivalent[{}] := {}; removeEquivalent[list_] := ( Sow[First[list]]; equivalents = Permute[First[list], #] & /@ GroupElements[group]; DeleteCases[list, Alternatives @@ equivalents] ); nonequivalentPermutations[list_] := ( reaped = Reap@FixedPoint[removeEquivalent, Permutations@list]; reaped[[2, 1]] ); group = DihedralGroup[4]; nonequivalentPermutations[{2, 1, 1, 0}]

    Read the article

  • How to extract a Date from an SQLDateTime object in Mathematica

    - by andrews
    I am trying to do a plot of a time series with DateListPlot. I want to feed it a time series I obtain from an SQL database. When I retrieve the time series the list is composed of SQLDateTime entries that DateListPlot doesn't understand. In[24]:= t=SQLExecute[conn, "select timestamp,value from timeseries order by timestamp asc"] Out[24]={{SQLDateTime[{2010,1,1}],12.3},{SQLDateTime[{2010,1,2}],12.51}} Doesn't work: In[25]:= DateListPlot[t] DateListPlot requires a Date tuple and doesn't understand SQLDateTime. What can I do?

    Read the article

  • Weird behavior of substitution in Mathematica.

    - by Ilya
    My question is: why doesn't the following work, and how do I fix it? Plot[f[t], {t, 0, 2*Pi}] /. {{f -> Sin}, {f -> Cos}} The result is two blank graphs. By comparison, DummyFunction[f[t], {t, 0, 2*Pi}] /. {{f -> Sin}, {f -> Cos}} gives {DummyFunction[Sin[t], {t, 0, 2 *Pi}], DummyFunction[Cos[t], {t, 0, 2 * Pi}]} as desired. This is a simplified version of what I was actually doing. I was very annoyed that, even after figuring out the annoying "right way" of putting the curly brackets nothing works. In the end, I did the following, which works: p[f_] := Plot[f[t], {t, 0, 2*Pi}] p[Sin] p[Cos]

    Read the article

  • how to use units along function parameter values in Mathematica

    - by niko
    I would like to pass the parameter values in meters or kilometers (both possible) and get the result in meters/second. I've tried to do this in the following example: u = 3.986*10^14 Meter^3/Second^2; v[r_, a_] := Sqrt[u (2/r - 1/a)]; Convert[r, Meter]; Convert[a, Meter]; If I try to use the defined function and conversion: a = 24503 Kilo Meter; s = 10198.5 Meter/Second; r = 6620 Kilo Meter; Solve[v[r, x] == s, x] The function returns the following: {x -> (3310. Kilo Meter^3)/(Meter^2 - 0.000863701 Kilo Meter^2)} which is not the user-friendly format. Anyway I would like to define a and r in meters or kilometers and get the result s in meters/second (Meter/Second). I would be very thankful if anyone of you could correct the given function definition and other statements in order to get the wanted result.

    Read the article

  • Mathematica ListcontourPlot3D

    - by Alejandro
    I have data in the form { {x,y,z,f}...} I am using ListContourPlot3D but all I get is an empty box with dimensions -1,1 in each direction. Here is my code: ListContourPlot3D[data5, PlotRange - All, AxesLabel - {"[Beta]", "[Omega]", "Vo"}, Contours - {1500}]. These are the first 5 points of my data:( the whole set has 55 points) {{200, 20000 10^(1/3), 2000, 1226}, {200, 20000 10^(1/3), 2600, 1422}, {200, 20000 10^(1/3), 3200, 1581}, {200, 20000 10^(1/3), 3800, 1761}, {200, 20000 10^(1/3), 4400, 1872}} Dimensions[data5] returns {55,4} If I do IntegerPart[data5] it does it correctly so it must recognize the numbers in my data. I appreciate any ideas. Thank you.

    Read the article

  • String quotation marks when exporting a Mathematica Grid as vector graphics

    - by Janus
    Running the following agrid = Grid[{{Style["hello", Bold]}}] ImportString[ExportString[agrid, "PNG"], "PNG"] ImportString[ExportString[agrid, "EPS"], "EPS"] spits out hello hello "hello" That is, the EPS exporter included the quotation marks in the output. Same for PDF. Without the Grid, all exporters leave out the quotation marks. What magic do I need to get rid of the quotation marks in the PDF?

    Read the article

  • Import and Export for CSV are both broken in Mathematica

    - by dreeves
    Consider the following 2 by 2 array: x = {{"a b c", "1,2,3"}, {"i \"comma-heart\" you", "i \",heart\" u, too"}} If we Export that to CSV and then Import it again we don't get the same thing back: Import[Export["tmp.csv", d]] Looking at tmp.csv it's clear that the Export didn't work, since the quotes are not escaped properly. According to the RFC which I presume is summarized correctly on Wikipedia's entry on CSV, the right way to export the above array is as follows: a b c, "1,2,3" "i ""heart"" you", "i "",heart"" u, too" Importing the above does not yield the original array either. So Import is broken as well. I've reported these bugs to [email protected] but I'm wondering if others have workarounds in the meantime. One workaround is to just use TSV instead of CSV. I tested the above with TSV and it seems to work (even with tabs embedded in the entries of the array).

    Read the article

  • Named arguments in Mathematica.

    - by dreeves
    What's the best/canonical way to define a function with optional named arguments? To make it concrete, let's create a function foo with named arguments a, b, and c, which default to 1, 2, and 3, respectively. For comparison, here's a version of foo with positional arguments: foo[a_:1, b_:2, c_:3] := bar[a,b,c] Here is sample input and output for the named-arguments version of foo: foo[] --> bar[1,2,3] foo[b->7] --> bar[1,7,3] foo[a->6, b->7, c->8] --> bar[6,7,8] It should of course also be easy to have positional arguments before the named arguments.

    Read the article

  • Combining graphs in Mathematica

    - by pizziaolo
    Any idea how I can overlay the following two functions to compare them? ln[1]:= p1 = Plot[(E^((Pi/6)^(1/3)/x) (Pi/6)^(2/3))/((-1 + E^((Pi/6)^(1/3)/x))^2 x^2), {x, -2.2, 2.2}] ln[2]:= p2 = Plot[(E^((Pi/6)^(1/3)/t) (Pi/6)^(2/3))/((-1 + E^((Pi/6)^(1/3)/t))^2 t^2), {t, 0, 2.0}] When I try Show[p1,p2] it doesn't work

    Read the article

  • ForEach loop in Mathematica.

    - by dreeves
    I'd like something like this: ForEach[i_, {1,2,3}, Print[i] ] Or, more generally, to destructure arbitrary stuff in the list you're looping over, like: ForEach[{i_, j_}, {{1,10}, {2,20}, {3,30}}, Print[i*j] ] (Meta-question: is that a good way to call a ForEach loop, with the first argument a pattern like that?) ADDED: Some answerers have rightly pointed out that usually you want to use Map or other purely functional constructs and eschew a non-functional programming style where you use side effects. I agree! But here's an example where I think this ForEach construct is supremely useful: Say I have a list of options (rules) that pair symbols with expressions, like attrVals = {a -> 7, b -> 8, c -> 9} Now I want to make a hash table where I do the obvious mapping of those symbols to those numbers. I don't think there's a cleaner way to do that than ForEach[a_ -> v_, attrVals, h[a] = v] ADDED: I just realized that to do ForEach properly, it should support Break[] and Continue[]. I'm not sure how to implement that. Perhaps it will need to somehow be implemented in terms of For, While, or Do since those are the only loop constructs that support Break[] and Continue[]. If anyone interested in this wants to ask about that as a separate question, please do!

    Read the article

  • How to solve recursion relations in mathematica efficiently?

    - by Qiang Li
    I have a recursion to solve for. f(m,n)=Sum[f[m - 1, n - 1 - i] + f[m - 3, n - 5 - i], {i, 2, n - 2*m + 2}] + f[m - 1, n - 3] + f[m - 3, n - 7] f(0,n)=1, f(1,n)=n However, the following mma code is very inefficient f[m_, n_] := Module[{}, If[m < 0, Return[0];]; If[m == 0, Return[1];]; If[m == 1, Return[n];]; Return[Sum[f[m - 1, n - 1 - i] + f[m - 3, n - 5 - i], {i, 2, n - 2*m + 2}] + f[m - 1, n - 3] + f[m - 3, n - 7]];] It takes unbearably long to compute f[40,20]. Could anyone please suggest an efficient way of doing this? Many thanks!

    Read the article

  • how to use sort function the same way as max or min in mathematica

    - by Qiang Li
    Please take a look at the following code: Sort[{1, y, x}, Greater] Max[{1, x, y}] x = 1 y = 2 Sort[{1, y, x}, Greater] Max[{1, x, y}] It is interesting to note that the first Sort always produce a definite result while the first Max does not, even when Greater is specified. Note I have not given any numerical values for x and y. Why is this and how can I have a Sort function behave the same way as the Max (or Min) function? Thanks!

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >