Skip to main content

plotting - Smoothing a cusp in plotted data


Here are my data points:


59.51 -59.3642
58.9944 -58.8079
58.4836 -58.2471
57.9778 -57.6819
57.4769 -57.1122
56.981 -56.5383
56.4901 -55.96
56.0043 -55.3775

55.5236 -54.7907
55.048 -54.1998
54.5777 -53.6048
54.1125 -53.0056
53.6525 -52.4025
53.1979 -51.7953
52.7486 -51.1842
52.3046 -50.5692
51.866 -49.9503
51.4328 -49.3277

51.0051 -48.7013
50.5828 -48.0712
50.4206 -47.8259
50.0013 -48.2641
49.5782 -48.6986
49.1514 -49.1294
48.7208 -49.5564
48.2865 -49.9797
47.8485 -50.3992
47.4069 -50.8148

46.9616 -51.2266
46.5128 -51.6344
46.0604 -52.0384
45.6046 -52.4383
45.1452 -52.8343
44.6824 -53.2263
44.2163 -53.6141
43.7467 -53.998
43.2738 -54.3777
42.7977 -54.7532

42.3182 -55.1246
41.8356 -55.4918
41.3497 -55.8548
40.8607 -56.2135
40.3686 -56.5679
39.8734 -56.918
39.3752 -57.2638
38.874 -57.6053
38.3698 -57.9423
37.8627 -58.2749

37.3528 -58.6031
36.8399 -58.9269
36.3243 -59.2461
35.8059 -59.5608
35.2848 -59.871
34.761 -60.1767
34.2345 -60.4777
33.7055 -60.7741
33.1738 -61.066
32.6397 -61.3531

32.103 -61.6356
31.5639 -61.9134
31.0224 -62.1865
30.4786 -62.4549
29.9324 -62.7185
29.384 -62.9773
28.8333 -63.2313
28.2804 -63.4805
27.7253 -63.7249
27.1682 -63.9644

26.609 -64.1991
26.0477 -64.4288
25.4845 -64.6537
24.9193 -64.8736
24.3522 -65.0886
23.7833 -65.2986
23.2126 -65.5037
22.6401 -65.7037
22.0658 -65.8988
21.4899 -66.0889

20.9124 -66.2739
20.3333 -66.4538
19.7526 -66.6288
19.1704 -66.7986
18.5867 -66.9633
18.0017 -67.123
17.4152 -67.2775
16.8275 -67.4269
16.2384 -67.5712
15.6481 -67.7103

15.0567 -67.8443
14.464 -67.9731
13.8703 -68.0968
13.2755 -68.2152
12.6798 -68.3285
12.083 -68.4365
11.4853 -68.5393
10.8868 -68.637
10.2874 -68.7294
9.68725 -68.8165

9.08635 -68.8984
8.48476 -68.9751

I plotted these point in Mathematica.


enter image description here


The plot shows a cusp. I would like to modify the plot to round off the cusp.


enter image description here


How can I do this in Mathematica?




Comments

Popular posts from this blog

functions - Get leading series expansion term?

Given a function f[x] , I would like to have a function leadingSeries that returns just the leading term in the series around x=0 . For example: leadingSeries[(1/x + 2)/(4 + 1/x^2 + x)] x and leadingSeries[(1/x + 2 + (1 - 1/x^3)/4)/(4 + x)] -(1/(16 x^3)) Is there such a function in Mathematica? Or maybe one can implement it efficiently? EDIT I finally went with the following implementation, based on Carl Woll 's answer: lds[ex_,x_]:=( (ex/.x->(x+O[x]^2))/.SeriesData[U_,Z_,L_List,Mi_,Ma_,De_]:>SeriesData[U,Z,{L[[1]]},Mi,Mi+1,De]//Quiet//Normal) The advantage is, that this one also properly works with functions whose leading term is a constant: lds[Exp[x],x] 1 Answer Update 1 Updated to eliminate SeriesData and to not return additional terms Perhaps you could use: leadingSeries[expr_, x_] := Normal[expr /. x->(x+O[x]^2) /. a_List :> Take[a, 1]] Then for your examples: leadingSeries[(1/x + 2)/(4 + 1/x^2 + x), x] leadingSeries[Exp[x], x] leadingSeries[(1/x + 2 + (1 - 1/x...

mathematical optimization - Minimizing using indices, error: Part::pkspec1: The expression cannot be used as a part specification

I want to use Minimize where the variables to minimize are indices pointing into an array. Here a MWE that hopefully shows what my problem is. vars = u@# & /@ Range[3]; cons = Flatten@ { Table[(u[j] != #) & /@ vars[[j + 1 ;; -1]], {j, 1, 3 - 1}], 1 vec1 = {1, 2, 3}; vec2 = {1, 2, 3}; Minimize[{Total@((vec1[[#]] - vec2[[u[#]]])^2 & /@ Range[1, 3]), cons}, vars, Integers] The error I get: Part::pkspec1: The expression u[1] cannot be used as a part specification. >> Answer Ok, it seems that one can get around Mathematica trying to evaluate vec2[[u[1]]] too early by using the function Indexed[vec2,u[1]] . The working MWE would then look like the following: vars = u@# & /@ Range[3]; cons = Flatten@{ Table[(u[j] != #) & /@ vars[[j + 1 ;; -1]], {j, 1, 3 - 1}], 1 vec1 = {1, 2, 3}; vec2 = {1, 2, 3}; NMinimize[ {Total@((vec1[[#]] - Indexed[vec2, u[#]])^2 & /@ R...

plotting - Plot 4D data with color as 4th dimension

I have a list of 4D data (x position, y position, amplitude, wavelength). I want to plot x, y, and amplitude on a 3D plot and have the color of the points correspond to the wavelength. I have seen many examples using functions to define color but my wavelength cannot be expressed by an analytic function. Is there a simple way to do this? Answer Here a another possible way to visualize 4D data: data = Flatten[Table[{x, y, x^2 + y^2, Sin[x - y]}, {x, -Pi, Pi,Pi/10}, {y,-Pi,Pi, Pi/10}], 1]; You can use the function Point along with VertexColors . Now the points are places using the first three elements and the color is determined by the fourth. In this case I used Hue, but you can use whatever you prefer. Graphics3D[ Point[data[[All, 1 ;; 3]], VertexColors -> Hue /@ data[[All, 4]]], Axes -> True, BoxRatios -> {1, 1, 1/GoldenRatio}]