Community RSS Feed
https://community.wolfram.com
RSS Feed for Wolfram Community showing any discussions from all groups sorted by activeChanging free variable for a Function that results from NDsolve
https://community.wolfram.com/groups/-/m/t/2055573
Hi There
I'm trying to use Inverse function result from NDSolve, the inverse works, but when i'm trying to re-define the free variable as function of another variable(time) in order to solve a new ODE, and im' getting some errors.
im not sure i change variable the right way
Thx
EzraEzra Kohavi2020-08-11T17:10:58Z[WSG20] Calculus Daily Study Group begins August 3 (Free!)
https://community.wolfram.com/groups/-/m/t/2041687
The latest [Wolfram Daily Study Group][1] features one of our favorite math instructors, [Devendra Kapadia][at1], and focuses on building fundamental concepts in calculus. This is a great opportunity for students to refresh their knowledge or get a head start on the subject. Sign up: https://wolfr.am/od7nlnga
[1]: https://www.wolfram.com/wolfram-u/special-event/study-groups/
[at0]: https://community.wolfram.com/web/dkapadia
[at1]: https://community.wolfram.com/web/dkapadiaJamie Peterson2020-07-21T15:27:37ZReflection and Anamorphism in a Hanging Conical Mirror
https://community.wolfram.com/groups/-/m/t/2053926
![enter image description here][1]
I took the chrome plated conical mirror used in my [previous Wolfram Community contribution][2], suspended it upside down, and asked myself the (anamorphism) question : what should a (deformed) image look like to be reflected in this mirror as the (undeformed) original? We can use Mathematica to solve this problem!
![enter image description here][3]
**1. Geometry of reflection in a hanging conical mirror**
![enter image description here][4]
An observer looking from a viewpoint at V in the direction of the cone, will see the point S reflected as the point I. Q is the intersection point of the view line VI with the cone. This function computes this intersection:
viewlineConeIntersection[{yi_, zi_}, {xv_, zv_}, h0_, h_] :=
Module[{t1, t2},
t1 = Sqrt[-h^2 xv^2 yi^2 + h0^2 (xv^2 + yi^2) + xv^2 zi^2 +
yi^2 zv^2 - 2 h0 (xv^2 zi + yi^2 zv)];
t2 = 1/(h^2 (xv^2 + yi^2) - (zi - zv)^2);
{t2 xv ((h0 - zi) (zi - zv) + h (h yi^2 + t1)),
t2 yi (h^2 xv^2 + (h0 - zv) (-zi + zv) - h t1),
t2 (-h0 (zi - zv)^2 + h^2 (xv^2 zi + yi^2 zv) + h (-zi + zv) t1)}]
With the help of viewlineConeIntersection, the following function computes the intersection of the reflection line IQ with the x-y plane. This intersection is the anamorphic map of I.
hangingConeAnamorphicMap[{yi_, zi_}, {xv_, zv_}, h0_, h_] :=
Quiet[Module[{mirror, ptI, ptV, imageTriangle, vwLine, xq, yq, zq,
ptQ, xn, yn, zn, ptVr},
mirror = Cone[{{0, 0, h0 + h}, {0, 0, h0}}, 1]; ptI = {0, yi, zi};
ptV = {xv, 0, zv};
imageTriangle =
Triangle[{{0, 0, h0}, {0, -1, h + h0 - .001}, {0, 1,
h + h0 - .001}}];
If[! RegionMember[imageTriangle, {0, yi, zi}], {yi, zi} =
Rest[RegionNearest[imageTriangle, {0, yi, zi}]], {yi, zi}];
vwLine = Line[{ptI, ptV}]; {xq, yq, zq} =
viewlineConeIntersection[{yi, zi}, {xv, zv}, h0, h];
ptQ = {xq, yq, zq}; {xn, yn} = Normalize[{xq, yq}];
zn = -Sin[ArcTan[1/h]];
ptVr = ReflectionTransform[{xn, yn, zn}, ptQ][ptV];
Solve[{{x, y, z} \[Element] HalfLine[{ptVr, ptQ}] && z == 0}, {x,
y, z}][[1, All, -1]]]]
This is the function in action as the pointS follows the anamorphic map of a reflected circle:
![enter image description here][5]
**2. Preparing the images**
It is clear that the points I all will have to belong to the triangular region Triangle[{{-1,51.98/30},{1,51.98/30},{0,0}}]. The following code computes the function range staring from its triangular domain.
Module[{xv = 5., zv = 3., r = 1, h = 51.98/30, h0 = .5, triangle,
circlePts, anaCirclePts, trianglePts, anaTrianglePts},
triangle = Triangle[{{-h0 - .02, 0}, {-h0 - h, 1}, {-h0 - h, -1}}];
trianglePts =
DeleteDuplicates[
RegionNearest[triangle,
CirclePoints[{0, (h0 + h)/2}, 4, 1000]] /. {x_?NumericQ,
y_} :> {y, -x}];
anaTrianglePts =
DeleteCases[
ParallelMap[Most[hangingConeAnamorphicMap[#1, {xv, zv}, h0, h]] &,
trianglePts], {}];
Grid[{Style[#, Bold, 14] & /@ {"Domain", "Range"}, {Rotate[
Graphics[{HatchFilling[], FaceForm[LightGray],
EdgeForm[AbsoluteThickness[1.5]], triangle},
PlotRange -> {{-4, 2}, {-2, 2}}, Axes -> True,
TicksStyle -> Small, ImageSize -> 400], -Pi/2],
Rotate[Graphics[{HatchFilling[], FaceForm[LightGray],
EdgeForm[AbsoluteThickness[1.5]], FaceForm[Lighter[Gray, .85]],
Polygon[anaTrianglePts]},
PlotRange -> {{-4, 2.5}, {-4.5, 4.5}}, Axes -> True,
TicksStyle -> Small, ImageSize -> 300], -Pi/2]}}]]
![enter image description here][6]
The reflection appearing in the inverted cone will maximum be triangular in shape or at least fit inside a triangle. In our case (we suspend the cone with its tip at .5 above the x-y plane), this is the triangle Triangle[{{-1,51.98/30},{1,51.98/30},{0,0}}]:
Graphics[{EdgeForm[Black], HatchFilling[], FaceForm[LightGray],
Triangle[{{-1, 51.98/30}, {1, 51.98/30}, {0, 0}}] /. {x_?NumericQ,
y_} :> {x, y + 0.5}}, Axes -> True, AxesOrigin -> {0, 0}]
![enter image description here][7]
In order to fit an image inside this triangle, we need a function that convert the image to a set of colored polygons that fit into the triangle (or other) region.
Module[{mandrill, irc},
mandrill = ImageResize[ExampleData[{"TestImage", "Mandrill"}], 100];
irc = imageRegionCrop[mandrill,
Region@Triangle[{{-.99, 1}, {.97, 1}, {-.01, -.97}}]];
Graphics[{irc /. {x_?NumericQ, y_} :> {x, y + 1.5}, FaceForm[],
EdgeForm[Black],
Triangle[{{-.99, 1}, {.97, 1}, {-.01, -.97}}] /. {x_?NumericQ,
y_} :> {x, y + 1.5}}, Axes -> True,
AxesOrigin -> {0, 0} Axes -> True, AxesOrigin -> {0, 0}]]
![enter image description here][8]
**3. 3D simulation in Mathematica**
Now, we convert the triangular set of colored polygons into its anamorphic map with our function hangingConeAnamorphicMap. With Graphics3D, we can see a simulation of how the anamorphic image will look reflected in the hanging cone:
Module[{r = 1., h = 51.98/30, h0 = .5, xv = 5, zv = 3.5, mirrorCone,
ptV, imageTriangle, img, splitLogo, pixelPolys, anaPolys},
mirrorCone = Cone[{{0, 0, h0 + h}, {0, 0, h0}}, r];
ptV = {xv, 0, zv};
imageTriangle =
Triangle[{{0, 0, h0}, {0, -r, h + h0}, {0, r, h + h0}}];
img = ImageResize[ExampleData[{"TestImage", "Mandrill"}], 200];
splitLogo =
imageRegionCrop[img,
Triangle[{{-1, 51.98/30/2.}, {1,
51.98/30/2.}, {0, -51.98/30/2.}}]];
pixelPolys = splitLogo /. {x_?NumericQ, y_} :> {x, y + 1.5};
anaPolys =
DeleteCases[
MapAt[hangingConeAnamorphicMap[#, {5, 1.367}, .5, 51.98/30] &,
pixelPolys, {All, -1, All, All}] /. {x_?NumericQ, y_, z_} :> {x,
y}, {z == 0}, \[Infinity]];
Graphics3D[{{LightGray,
InfinitePlane[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}}]},
{Opacity[.35], LightGray, Specularity[1, 2],
mirrorCone}, {AbsoluteThickness[2],
Line[{{0, 0, h + h0 + 2}, {0, 0, h + h0}}], AbsolutePointSize[3],
Point[{0, 0, h + h0 + 22}]},
{FaceForm[], EdgeForm[{Blue, AbsoluteThickness[.5]}],
imageTriangle},
pixelPolys /. {y_, z_} :> {0, y, z},
anaPolys /. {x_?NumericQ, y_} :> {x, y, 0.001}}]]
![enter image description here][9]
**5. Real world testing**
To test this in a real world setting, we need a printout of the anamorphic image...
Graphics[{{Thin, Circle[]}, anaPolys}]
![enter image description here][10]
...locate the printout under our hanging conical mirror....
![enter image description here][11]
...and see the result reflected as the original and undeformed image!
![enter image description here][12]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=mandrillsetupintro.jpg&userId=68637
[2]: https://community.wolfram.com/groups/-/m/t/2050345?p_p_auth=DRO9ZQfD
[3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=chromecone.jpg&userId=68637
[4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=6150geometryhangingcone.png&userId=68637
[5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=hangingcone.gif&userId=68637
[6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=7783domainandrange.png&userId=68637
[7]: https://community.wolfram.com//c/portal/getImageAttachment?filename=triangle.png&userId=68637
[8]: https://community.wolfram.com//c/portal/getImageAttachment?filename=9702mandriltriangle.png&userId=68637
[9]: https://community.wolfram.com//c/portal/getImageAttachment?filename=mandrill3D.png&userId=68637
[10]: https://community.wolfram.com//c/portal/getImageAttachment?filename=6839mandrill.jpg&userId=68637
[11]: https://community.wolfram.com//c/portal/getImageAttachment?filename=8974mandrillsetup.jpg&userId=68637
[12]: https://community.wolfram.com//c/portal/getImageAttachment?filename=mandrillresult-2.jpg&userId=68637Erik Mahieu2020-08-08T11:58:47ZProblem with importing Dataset
https://community.wolfram.com/groups/-/m/t/2055189
I'm trying to import the dataset "Genetic Sequences for the SARS-CoV-2 Coronavirus". However, the function ResourceData doesn't work (actually it is not working for any dataset).
It shows this message: Cannot open ResourceSystemClientLoader`
Can anyone help me to understand what is going on?Vitor Marquioni Monteiro2020-08-11T05:34:10ZMatrix multiplication T2*T1, i am not getting the output
https://community.wolfram.com/groups/-/m/t/2055888
a = \[Alpha]*(r + s)/2 /. {r -> 0.00037, s -> 0.0013};
b = \[Alpha]*(\[Alpha]*r*s - 1) /. {r -> 0.00037, s -> 0.0013};
Subscript[\[Beta], 1] = Sqrt[Sqrt[a^2 - b] - a];
Subscript[\[Beta], 2] = Sqrt[Sqrt[a^2 - b] + a];
Subscript[m,
1] = (\[Alpha]*s + Subscript[\[Beta], 1]^2)/Subscript[\[Beta], 1];
Subscript[m,
2] = (\[Alpha]*s - Subscript[\[Beta], 2]^2)/Subscript[\[Beta], 2];
T1 = {{1, 0, 1, 0}, {Subscript[m, 1]*Subscript[\[Beta], 1], 0,
Subscript[m, 2]*Subscript[\[Beta], 2],
0}, {0, (Subscript[\[Beta], 1] - Subscript[m, 1]),
0, (Subscript[\[Beta], 2] + Subscript[m, 2])}, {-Subscript[m, 1]*
Subscript[\[Beta], 1]*t, Subscript[\[Beta],
1], -Subscript[m, 2]*Subscript[\[Beta], 2]*t, Subscript[\[Beta],
2]}} /. {t -> 0.2154};
T2 = Inverse[{{Cosh[Subscript[\[Beta], 1]/2],
Sinh[Subscript[\[Beta], 1]/2], Cos[Subscript[\[Beta], 2]/2],
Sin[Subscript[\[Beta], 2]/2]}, {Subscript[m, 1]*Subscript[\[Beta],
1]*Cosh[Subscript[\[Beta], 1]/2],
Subscript[m, 1]*Subscript[\[Beta], 1]*
Sinh[Subscript[\[Beta], 1]/2],
Subscript[m, 2]*Subscript[\[Beta], 2]*
Cos[Subscript[\[Beta], 2]/2],
Subscript[m, 2]*Subscript[\[Beta], 2]*
Sin[Subscript[\[Beta], 2]/2]}, {(Subscript[\[Beta], 1] -
Subscript[m, 1])*
Sinh[Subscript[\[Beta], 1]/2], (Subscript[\[Beta], 1] -
Subscript[m, 1])*
Cosh[Subscript[\[Beta], 1]/
2], -(Subscript[\[Beta], 2] + Subscript[m, 2])*
Sin[Subscript[\[Beta], 2]/2], (Subscript[\[Beta], 2] + Subscript[
m, 2])*Cos[Subscript[\[Beta], 2]/2]}, {Subscript[\[Beta], 1]*
Sinh[Subscript[\[Beta], 1]/2],
Subscript[\[Beta], 1]*
Cosh[Subscript[\[Beta], 1]/2], -Subscript[\[Beta], 2]*
Sin[Subscript[\[Beta], 2]
/2], Subscript[\[Beta], 2]*Cos[Subscript[\[Beta], 2]/2]}}]Kumar Arpit2020-08-11T18:34:02ZBest way to produce interactive 3d images of tangles/knots?
https://community.wolfram.com/groups/-/m/t/2053300
On my html5 website on physics, I would like to add 3d computer graphics of tangles. (Tangles are cousins of knots.) The tangles would be similar to the one in the following photograph. I would like to allow users to rotate the image of such a tangle and thus allow them to view the tangle from all sides.
Question1 : How can I generate such a tangle most easily in Mathematica?
Question 2: What is the best 3d format to export it, and what is the best/easiest way to embed the 3d image in a html5 page, so that viewers can rotate the image with their mouse or with sliders?
(P.S. Tubular ropes are completely sufficient, without any substructure.
P.P.S. Apart from Mathematica, I also own KnotPlot.)
![A tangle photograph][1]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=DAVN3.jpg&userId=2053250Chris S2020-08-07T12:02:35ZChanging Input when I use == or >
https://community.wolfram.com/groups/-/m/t/2055820
I am using Mathematica 12.1.1.0 and am having a really annoying issue that when I type an equal sign = it changes the input type in line so that I can't enter == to use in Solve or Reduce. Similarly, any time I use a greater than symbol, >, it converts to Python input. This is making working very very frustrating and tedious.
I have already re-downloaded and re-installed the most up-to-date version from my User Portal. Does anyone know what to do??Ian Turner2020-08-11T16:21:54ZHow to rotate a 3D plot along its perpendicular axis?
https://community.wolfram.com/groups/-/m/t/2055533
I'm trying to rotate a 3D plot for a complex polynomial along its perpendicular axis but its giving me an error. I'm using the inbuilt function RevolutionPlot3D. Please advise me the correction.Rahul Chakrabory2020-08-11T13:40:57ZAvoiding the welcome screen in Mathematica 12.1 at startup om windows
https://community.wolfram.com/groups/-/m/t/2054809
I would like to be able to avoid the welcome screen.
I have tried to uncheck to box Show at Startup and tried to change the frontend init.m file - and tried to use the option inspector.Kurt Boge2020-08-09T20:00:02Z[WSS20] Implementing Mutual Information
https://community.wolfram.com/groups/-/m/t/2030629
![Karman vortex street and an estimation of mutual information][1]
&[Wolfram Notebook][2]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=animationkarman.gif&userId=1894013
[2]: https://www.wolframcloud.com/obj/luigi.brancati93/Published/WSS20-Project-Notebook-final.nbLuigi Brancati2020-07-14T18:12:42ZInteractiveTradingChart not working on my installation, is it broken?
https://community.wolfram.com/groups/-/m/t/2055429
Hi there guys,
I'm on Mathematica 12.1.1 on linux, trying to work with InteractiveTradingChart, sadly i can't make any of the examples work. All i get is a red box and a bunch of errors..
![enter image description here][1]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=wmtc.png&userId=1998036
I need help in trying to debug this feature. I'd like to understand if the problem is because of bad data provided to the function or the function itself is kind of deprecated.
EDIT:
The code i used in this test is the first (at the moment) example in the doc page about InteractiveTradingChart, i am copying it here for completeness:
InteractiveTradingChart[{"GOOGL", {{2009, 1, 1}, {2009, 12, 31}}}]Francesco Lasco2020-08-10T18:29:42ZSolving equation by radical expression
https://community.wolfram.com/groups/-/m/t/2055313
This gives square and cubic radical expressions, but of complex numbers:
ToRadicals[RootReduce[ReIm[x /. Solve[x^7 == 1]]]]Gianluca Gorni2020-08-10T15:34:44ZExplore how the double slit experiment derives from branchial space.
https://community.wolfram.com/groups/-/m/t/2046930
Imagine a quantum mechanical structure of many possible branchings. Imagine this structure’s graph has a one way event horizon. But as computation unfolds/progresses, another graph creates a connection to it so it is no longer a one way event horizon. This “other’ graph would be the observer. The connection would be caused by the observation. The observer derives information and thus causes it to no longer be one way. The observing/measuring creates information in the observer ‘graph’ thus causing a connection. [Appreciate readers bearing with any incorrect uses of terminology, and considering the idea.] Note: Inspired by Stephen Wolfram’s Virtual ICM Seminar.Kevin Willis2020-07-28T20:33:26ZAnalysis of the Change in Phillips Curve After COVID-19 with Regression
https://community.wolfram.com/groups/-/m/t/2055704
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/603a80fb-9cab-4224-83df-8118c1ded5b7Seojin Yoon2020-08-11T09:09:47ZHow to convert into fraction form
https://community.wolfram.com/groups/-/m/t/2055494
I would like to convert symbolic fraction form into standard fraction form like Matlab as PDF.Sheng Dai2020-08-11T07:16:16ZDefinition of derivatives using Limit : D[f[x]=Limit(( f{x+h) - f(x) )/h ]
https://community.wolfram.com/groups/-/m/t/2053448
Definition of derivatives using Limit :
D[f[x]=Limit(( f{x+h) - f(x) )/h ] as h approaches zero.
Given f[x_]:=PieceWise[{{x^3,-4<==x<==1}},{3x,x>1}];
Show using the definition of Limit that that D[f[x],x] is not defined at x = 1Abraham Gadalla2020-08-07T14:53:16ZI could not plot the 3D PDE equation,
https://community.wolfram.com/groups/-/m/t/2009272
I am trying to solve this homogeneous 3D PDE, but I could not. Could you please find the problem?M al2020-06-21T07:39:37ZSolve Function on a Specific Interval
https://community.wolfram.com/groups/-/m/t/2053841
In order to get the exact answer using the Solve[] function, it would be useful to enter the specific interval. For example in calculating the values of x in the Solve function
Solve[2 Sin[x]^2 - Sin[x] - 1 == 0, x, Reals]
I would like the answer on the interval from 0 to 2 Pi.
Without the ability to enter the desired interval, I get the answer of:
{{x -> ConditionalExpression[-(\[Pi]/6) + 2 \[Pi] C[1],
C[1] \[Element] Integers]}, {x ->
ConditionalExpression[\[Pi]/2 + 2 \[Pi] C[1],
C[1] \[Element] Integers]}, {x ->
ConditionalExpression[(7 \[Pi])/6 + 2 \[Pi] C[1],
C[1] \[Element] Integers]}}
Which is not exactly correct since answer #1 is less than 0 and the answer for 2 pi (11pi/6) is not listed.
Thanks,
Mitch SandlinMitchell Sandlin2020-08-07T19:44:50ZGraphics out of "Manipulate" function : habitable zone around a star
https://community.wolfram.com/groups/-/m/t/2054443
Dear sirs,
my skills with Wolfram Language are still quite basic.
I have created a very simple calculation of the boundaries of a star's goldilocks zone (rough calculation that doesn't take into account the complexity of greenhouse effects and geothermal energies).
I used the function 'Manipulate' , but then (for the sake of learning) I wish to create a graphic visualization of the results, maybe a 3D disk, where the habitable zone is just a coloured ring around a star (the star should be placed at the center of the disk, and its colour should vary, depending on the chosen luminosity.
This task is far too difficult for me, at this stage.
Anybody would like to help me?
please find the relevant notebook, our task refers to the last calculation, at the bottom of the file.
Thank you in advance
Cpt Mauro B. Mistretta
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/corsaire.mbm/Published/Goldilocks%20Zone.nbMauro Benjamin Mistretta2020-08-09T09:23:04ZAssigning a name to variables depending on the thread number.
https://community.wolfram.com/groups/-/m/t/2055205
Hello,
I would like to name the variables dynamically, e.g. so that their names depend on the number of the thread being executed. Something like below:
n = 3;(*numer wątku*)
ParallelDo[
Subscript[t, i] = Table[Random[], {10}], {i, n}];
t = Table[0, {10}];
Do[t += Subscript[t, i], {i, n}];
t
Unfortunately, table t has all zeros.
I tried to sum in a loop, I tried to use the $KernelID variable. Unfortunately, it didn't help.
The program "sees" the results because it can write them out:
n = 3;(*numer wątku*)
ParallelDo[
Subscript[t, i] = Table[Random[], {10}];
Print[Subscript[t, i]], {i, n}]
I am asking for a hint (it is certainly not very simple).
If "n" is greater than the number of threads, will the program (after the prompt) also work?
Best regards,
DMD M2020-08-10T13:58:13ZColebrook equation
https://community.wolfram.com/groups/-/m/t/2054486
Hello
I´m programming someting about pumps
I have the flow vector (from the pump chart) (Caudal in spanish)
Cau={0.0001,.025,.05,.076,.101,.126,.151}
I find the Reynolds number vector :
Rei={212.207,53051.6,106103.,161277.,214329.,267380.,320432.}
I can find the friction factor, applying individually the colebrook equation to any Reynols number
Rei1=Part[Rei,1];
Solve[1/f1^(1/2) ==-2* Log10[(\[Alpha])/3.7+2.51/(Rei1*f1^(1/2))], f1]
Rei2=Part[Rei,2];
Solve[1/f2^(1/2) ==-2* Log10[(\[Alpha])/3.7+2.51/(Rei2*f2^(1/2))],f2] ..... etc....
I obtain in each case:
{{f1->0.117072}}
{{f12->0.0206185}} ........etc ......
After that I recopilate manually the friction factor values in the vector "f"
f={0.117072,0.0206185, .......... etc ....,}
The questions are :
- Can I solve the Colebrook equation for the Reynolds number vector ?
- Can I recopilate automatically the values and build the vector "f".LUIS ARBOLEDA2020-08-09T23:03:28ZExcluding the input value say j=0 from the input values {j, -30, 30, 10}
https://community.wolfram.com/groups/-/m/t/2053978
lat = Table[j Pi/180., {j, -30, 30, 10}]; Show[Graphics3D[Sphere[]],
ParametricPlot3D[{Cos[x] Sin[Pi/2 - #], Sin[x] Sin[Pi/2 - #],
Cos[Pi/2 - #]}, {x, 0, 2 Pi}] & /@ lat, Boxed -> False]
Is it possible to exclude an input value say j=0 from the input values {{j, -30, 30, 10} for the function Table[j Pi/180., {{j, -30, 30, 10}] in the above Mathematica code just so the middle latitude which happens to be the equator will not be drawn
The Mathematica code happens to be a code I want to adopt from the reply of Hans Dolhaine, retired in the community post "How to display latitude and longitude lines on the sphere?" contributed by Qiu Mianp, SOHOYaw Antoa Onyina2020-08-08T22:21:03ZSave as pdf
https://community.wolfram.com/groups/-/m/t/2054599
Who can help me?
When I save a notebook in pdf, the pdf file is corrupt, it cannot be opened.
I tried online at library.wolfram.com/Explore/Publishing/NBtoPDF.jsp, but it doesn't work.
Thank you.Ion Ganea2020-08-09T19:18:47ZEstimation of energy yield of 2020 Beirut port explosion
https://community.wolfram.com/groups/-/m/t/2051264
Probably most of you heard the sad news that there was a giant explosion in the port of Beirut today August 3rd 2020. Several videos were released on which we can do analysis. Note that the method I will use was also famously used by G.I. Taylor to find the energy of the Trinity nuclear bomb test, and he found the right amount to within 10%! We will not be so lucky as the video quality was relatively poor as compared to the high-speed imaging done back then.
I extracted several frames from one of the videos:
![enter image description here][1]
SetDirectory[NotebookDirectory[]];
v1 = Import["1.mp4"];
fra = VideoExtractFrames[v1, Interval[{11, 12}]]
fra = ImageRotate[#, Right] & /@ fra;
For each of the frames I identified the explosion by clicking 3 point on the circle:
data={
{7,{{157.15625,365.20703125000006`},{233.83984375,379.76562500000006`},{272.015625,312.91015625000006`}}},
{8,{{318.16796874999994`,322.81640625000006`},{228.7890625,462.8515625},{103.61328125,393.38281250000006`}}},
{9,{{341.03515625000006`,311.34765625},{308.27734375,478.125},{93.86328125,420.34375}}},
{10,{{359.08984375,315.546875},{351.48828125,478.63671875000006`},{86.55078125,454.5078125}}},
{11,{{375.62109375,325.64453125},{330.05859375,535.3984375},{62.0390625,434.51171875}}},
{12,{{376.0390625,326.765625},{337.94140625,539.9257812499999},{46.4140625,462.55859375}}}
};
The first is the index of the frames, the last elements are points of the circle:
circs = CircleThrough /@ data[[;; 6, 2]];
r = circs[[All, 2]];
Here is the visualization:
Table[HighlightImage[fra[[data[[i, 1]]]], circs[[i]], "Boundary"], {i, Length[data]}]
![enter image description here][2]
Notice that I tracked the orange 'glow', not the shockwave or the smoke that was there partially before the main explosion (so on the conservative side and underestimating the energy release).
From Google earth I estimated the size of the face of the building on the left (a grain elevator) and found that every pixel corresponds to 0.59 m roughly (~22 meters corresponding to ~37 pixels).
cali = 0.5888486673789164`;
realr = r cali
The timestamps can be found from the video framerate.
Information[Import["video.mp4"]].
And so the timestamps are created and the dataset is created:
t = (Range[0, Length[realr] - 1]) 1/29.97;
tr = Transpose[{t, realr}]
Since the explosion started between two frames we include that in the fit (the t0):
fit = FindFit[
tr, { a (x + t0)^0.4, 0 < t0 < 1/30}, {{a, 200}, {t0, 1/60}}, x]
realfit = a (x + t0)^0.4 /. fit
tzero = t0 /. fit
realfitshifted = a (x)^0.4 /. fit
prefactor = a /. fit
The fit can be found [here][3] and is based on dimensional analysis with the variable E (energy), r (radius of the explosion), t (time), and ρ (density). This also explains the exponent 0.4 used for fitting.
We plot the data and the fit:
Show[{ListPlot[Transpose[{t + tzero, realr}]],
Plot[realfitshifted, {x, 0, 0.2}]},
PlotRange -> {{0, 0.2}, {0, 120}}, Frame -> True,
FrameLabel -> {"t", "r [m]"}]
![enter image description here][4]
Which is a pretty good fit.
We can now calculate the energy back from the explosion:
ClearAll[r, e, t, \[Rho]]
r == (e t^2/\[Rho])^(1/5)
Refine[DivideSides[%, t^(2/5)], t > 0]
%[[2]] == Quantity[prefactor, "Meters"/"Seconds"^(2/5)]
% /. \[Rho] -> Quantity[1, "Kilograms"/"Meters"^3]
energy = e /. Solve[%, e][[1]]
Yielding:
Quantity[4.2808721214488837`*^11, "Joules"]
and we can convert it to kiloton of TNT:
UnitConvert[energy, "KilotonsOfTNT"]
yielding:
Quantity[0.102315, "KilotonsOfTNT"]
This number is comparable to the 2015 Tianjin explosion (0.3 kilo tonnes of TNT).
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2020-08-04at21.44.20.png&userId=73716
[2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2020-08-05at12.00.12.png&userId=73716
[3]: https://en.wikipedia.org/wiki/Nuclear_weapon_yield#Calculating_yields_and_controversy
[4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2020-08-04at21.53.18.png&userId=73716Sander Huisman2020-08-04T19:57:48ZSharing your work with non-Mathematica users
https://community.wolfram.com/groups/-/m/t/2054137
Dear sirs,
I appreciate that this topic might have been already covered in the past.
However, I could not find any valuable solution to the problem.
Suppose I wanted to show my work to a fellow student or my professor (who are NOT Mathematica users) , which is the best option / line of action available?
As far as I understand PDFs are not an option, since they would lose the 'manipulated' content of my calculations.
Thank you
Cpt Mauro B. MistrettaMauro Benjamin Mistretta2020-08-08T11:33:55ZEntropy in the Wolfram model
https://community.wolfram.com/groups/-/m/t/2006331
Is there a way to think of entropy in the spatial hypergraph? Or does it correspond to the fact that branches are branching in the multiway graph? I expect there should be a relation between time passing and entropy rising in the model.
Once we have this, I am wondering if there would then be a way to represent life in the model if it can be defined as the thing in the universe which feeds off negative entropy or free energy as Schrödinger claimed.Brady Doyle2020-06-17T18:03:51ZWhat does the Wolfram Model say about the heat death of the universe?
https://community.wolfram.com/groups/-/m/t/2008340
I'm asking this question to spur a discussion that might lead somewhere interesting.David Barksdale2020-06-19T20:32:25ZIs this a bug with GraphicsGrid?
https://community.wolfram.com/groups/-/m/t/2054288
Hi!
I am trying to reproduce a GraphicsGrid to visualize data as follows:
ofdata = ExampleData[{"Statistics", "OldFaithful"}];
GraphicsGrid[{
{ListPlot[ofdata], DensityHistogram[ofdata, 20, "PDF"]},
{Histogram3D[ofdata, 20, "PDF"], SmoothHistogram3D[ofdata]}
}, ImageSize -> 400]
But the result was not the expected since the first ListPlot graphic was not shown (see figure below)
![enter image description here][1]
If I make the ListPlot isolated I success
ListPlot[ofdata]
![enter image description here][2]
I have Mathematica Version 12.1.1. I don't know why this happens, is this a bug?.
Thanks for your comments!
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Capture.PNG&userId=391135
[2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Capture2.PNG&userId=391135Diego Ramos2020-08-08T20:57:39ZWhy am I getting unexpected results in 2D plot?
https://community.wolfram.com/groups/-/m/t/2054259
Dear all,
I have a code for 2D plot of a complex polynomial. In Plot 1 and in Plot 3 its exactly same code with all values exactly same. When I run the code, comparing the Plot 1 and Plot 3 I can find that its giving me two different plots. Kindly advise me as how to rectify the code.Rahul Chakrabory2020-08-08T17:46:25ZVigenère cipher/Cryptanalysis
https://community.wolfram.com/groups/-/m/t/557226
Trying to understand more of the functions in Mathematica related to operations on text, I am trying to solve the following, I have obtained from :
[Vigenère cipher/Cryptanalysis][1]
This is what I have done in an attempt to resolve this problem:
text = "MOMUD EKAPV TQEFM OEVHP AJMII CDCTI FGYAG JSPXY ALUYM NSMYH
VUXJE LEPXJ FXGCM JHKDZ RYICU HYPUS PGIGM OIYHF WHTCQ KMLRD
ITLXZ LJFVQ GHOLW CUHLO MDSOE KTALU VYLNZ RFGBX PHVGA LWQIS
FGRPH JOOFW GUBYI LAPLA LCAFA AMKLG CETDW VOELJ IKGJB XPHVG
ALWQC SNWBU BYHCU HKOCE XJEYK BQKVY KIIEH GRLGH XEOLW AWFOJ
ILOVV RHPKD WIHKN ATUHN VRYAQ DIVHX FHRZV QWMWV LGSHN NLVZS
JLAKI FHXUF XJLXM TBLQV RXXHR FZXGV LRAJI EXPRV OSMNP KEPDT
LPRWM JAZPK LQUZA ALGZX GVLKL GJTUI ITDSU REZXJ ERXZS HMPST
MTEOE PAPJH SMFNB YVQUZ AALGA YDNMP AQOWT UHDBV TSMUE UIMVH
QGVRW AEFSP EMPVE PKXZY WLKJA GWALT VYYOB YIXOK IHPDS EVLEV
RVSGB JOGYW FHKBL GLXYA MVKIS KIEHY IMAPX UOISK PVAGN MZHPW
TTZPV XFCCD TUHJH WLAPF YULTB UXJLN SIJVV YOVDJ SOLXG TGRVO
SFRII CTMKO JFCQF KTINQ BWVHG TENLH HOGCS PSFPV GJOKM SIFPR
ZPAAS ATPTZ FTPPD PORRF TAXZP KALQA WMIUD BWNCT LEFKO ZQDLX
BUXJL ASIMR PNMBF ZCYLV WAPVF QRHZV ZGZEF KBYIO OFXYE VOWGB
BXVCB XBAWG LQKCM ICRRX MACUO IKHQU AJEGL OIJHH XPVZW JEWBA
FWAML ZZRXJ EKAHV FASMU LVVUT TGK";
We erased the spaces of the variable txt
junto = StringJoin[StringSplit[text]];
largo = StringLength[junto];
freq = Table[
StringCount[junto, StringTake[junto, {i, i + 2}]], {i, 1, 826}];
Tally[DeleteCases[freq, 1]]
I have done so we are looking for the position of the trigrams used within the text,
StringTake[junto, {#, # + 2}] & /@ Flatten[Position[freq, 4]]
DeleteDuplicates[
StringTake[junto, {#, # + 2}] & /@ Flatten[Position[freq, 3]]]
Calcualte prb for use later
prb = StringPosition[junto, #] & /@ {"UXJ", "CUH", "BYI", "TUH",
"XJL"}
for example we calculate the differences of prb, to know the distances between each repetition of a Trigrama.
DeleteDuplicates[Flatten[Differences[#, {1, 0}] & /@ prb]]
Here decompose each number into its prime factors to try to find the possible differente in the key of the cipher text is clearly seen that the numbers that most times are repeated are the 2 and 7, i thought that the key could be 7,but i have not received anything in particular
Tally[Flatten[#[[;; , 1]] & /@
FactorInteger[{524, 126, 42, 98, 322, 252, 168, 266}]]]
Perhaps a different approach can help me
Any help is welcome, thaks in advance.
[1]: http://rosettacode.org/wiki/Vigen%C3%A8re_cipher/CryptanalysisLuis Ledesma2015-08-31T23:51:54ZA Chronological Approach to the Wolfram Physics Project
https://community.wolfram.com/groups/-/m/t/2054240
The goal of the Wolfram Physics Project is to find a rule that generates our Universe, as it was envisioned in the section [Ultimate Models for the Universe][1] of the chapter *Fundamental Physics* of S. Wolfram's book *A New Kind of Science*. The main obstacle is that the evolution of our Universe may be [computationally irreducible][2]. If this is the case, the emergent properties generated by the rules from the candidates of the Wolfram Model of our Universe can only be obtained by means of extremely slow simulations.
One way to overcome the problem of computational irreducibility is to construct the Wolfram Model of our Universe in a time-reversal way, using the forms of matter from the previous epochs of the Universe as black boxes. In the [chronology][3] of our Universe, we have the following epochs (in chronological order):
- Planck epoch
- Grand unification epoch
- Inflationary epoch
- Electroweak epoch
- Quark epoch
- Hadron epoch
- Neutrino decoupling
- Lepton epoch
- Big Bang nucleosynthesis
- Photon epoch
- Recombination
- Dark Ages
- Star and galaxy formation and evolution
- Reionization
- Present time
One way to progress in the Wolfram Physics Project is to develop a Wolfram Model in order to explain the transition from any cosmological epoch to the next one. For example, we could imagine papers with titles like "A Wolfram Model for the transition from the Quark epoch to the Hadron epoch". Finally, after recreating the history of our Universe by means of Wolfram Models of transitions between two consecutive epochs, the next challenge will be to write a paper with the title "A Wolfram Model for the time before the Planck epoch".
[1]: https://www.wolframscience.com/nks/p465--ultimate-models-for-the-universe/
[2]: https://www.wolframscience.com/nks/p737--computational-irreducibility/
[3]: https://en.wikipedia.org/wiki/Chronology_of_the_universe#Tabular_summaryJosé Manuel Rodríguez Caballero2020-08-08T15:27:18ZNew member asks: where do I look for responses to my published notebook?
https://community.wolfram.com/groups/-/m/t/2053418
This is my first post. I just published one of my notebooks (about organic chemistry reactions in the Wolfram language). Since I am new here, I adjust starting to understand how to navigate within the Wolfram community. I have the URL for my published notebook, but how do I access any responses that it might generate? (Should I create a post about it to get a discussion started?).
Also, I apparently forgot to name the notebook -- I would like to remedy that.
Lastly, I tried to add my notebook to this post, but was unsuccessful. Instead I received the error message "To post a notebook, you must be logged in to the Wolfram Cloud with your Community account." I am logged in to the Wolfram Cloud, so maybe there is a distinction between my "personal account" versus "my Community account"?Leonardo Cabana2020-08-07T12:30:04ZAnother inequality to solve
https://community.wolfram.com/groups/-/m/t/2051895
Hi everyone, I'm trying to solve an equation that is similar to my previous post, but I don't get how it could be different and doesn't end running again. Do I forgot something?
I'm putting the file with the code to be more practical. Thanks in advance for any help or leads!
![enter image description here][1]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=4712Example2.PNG&userId=2050303Xavier Koch2020-08-05T11:41:41Z[WSS20] Cellular Automata (CA) on 3D Lattices
https://community.wolfram.com/groups/-/m/t/2027803
![Examples of 3D Lattices and CA on them][1]
&[Wolfram Notebook][2]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=imgleading.jpg&userId=1971688
[2]: https://www.wolframcloud.com/obj/radhikap0/Published/caon3dlattice.nbRadhika Prasad2020-07-14T11:43:23Z[WSS20] Towards Universal Robotics
https://community.wolfram.com/groups/-/m/t/2028734
![enter image description here][1]
&[Wolfram Notebook][2]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=foldim.png&userId=2028347
[2]: https://www.wolframcloud.com/obj/douwmarx/Published/D_Marx_Community_Post6.nbDouw Marx2020-07-14T15:47:46Z[WSS20] Computable Grammar of Architectural Forms
https://community.wolfram.com/groups/-/m/t/2030176
![ ][1]
&[Wolfram Notebook][2]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=picture.jpg&userId=2027104
[2]: https://www.wolframcloud.com/obj/m.anna.czarnecka/Published/Maria%20Czarnecka3.nbMaria Czarnecka2020-07-14T17:28:18Z|x| as the absolute value of x?
https://community.wolfram.com/groups/-/m/t/2052795
I'm sure I'm not the first to ask this, but I couldn't find another thread talking about this.
I was wondering why `|x|` isn't defined to be an abbreviation for `Abs[x]`?
Sure `||` is defined to be `Or[...]`, but I think it's possible to distinguish between those two meanings:
- If there is only one `|` you could look for the next `|` and put the symbols in between inside `Abs[...]`
- The problem starts when there are two of them side by side. You wouldn't know it's for a nested absolute value like `Abs[Abs[...]]` or if it's the `Or[...]`
So my proposal is:
- `||` would still mean `Or[...]`
- `| |x|-y |` would mean `Abs[Abs[x]-y]`
So if there is a space between the vertical lines it means the nesting of `Abs[...]`
I think it wouldn't break any existing code because spaces aren't allowed between the vertical lines yet.
Really the only possible problem I see is that spaces aren't as clearly readable.
And reading a line with double `|` could become a bit confusing, because you could only tell the meaning of it by understanding the context or trying to see if there is a space in between the lines or not.
What do you think about it? And what are the reasons against this feature?
Edit: I think even better would be to use `Norm[...]`. If I'm not mistaken this would be the same for single numbers, but would include dealing with lists.Nico G2020-08-06T20:07:05ZTimelinePlot in Dataset
https://community.wolfram.com/groups/-/m/t/2052622
Members,
different visualization of TimelinePlot[] in Dataset[]. For code please see the Notebook attached. Mathematica Version is 12.1. Is this a bug?
Thank you very much for your assistance.
Best regards
KMSKlaus-Martin Simonic2020-08-06T09:05:02ZWhy is Wolfram Language free to use, but Mathematica is not?
https://community.wolfram.com/groups/-/m/t/2052512
Question:
---------
The differences of Mathematica and Wolfram Engine/Wolfram Language are discussed at other places.
Like:
- [FAQ for Wolfram Engine][1]
- [FAQ for Wolfram Language][2]
- [Can Wolfram Engine do more than Mathematica?][3]
- [Is Mathematica an Implementation of the Wolfram Language?][4]
- Others...
Even though I still can't grasp concretely what the differences are.
My Question here is why there are different payment models for Mathematica, WolframCloud and WolframEngine?
It seems like you gain practically very little by paying for Mathematica. (Mostly interface-wise)
I would think of Mathematica to be kind of like an IDE.
But nobody would pay hundreds of dollars just for an IDE.
So what am I missing about Mathematica that makes it reasonable to pay for it?
Why didn't the new business model for distributing Wolfram Language change the business model of Mathematica?
And why isn't Mathematica free to use?
My Background:
--------------
I heard of Mathematica ever since I started studying physics 2 years ago and I was always kind of sad that it is so expensive.
I used WolframAlpha for many calculations while studying, but I always found it quite rigid.
Often it just wasn't enough to solve a problem I had.
So I searched for alternatives and since I love Python I started to learn more about SageMath.
But quickly I figured it just isn't as well designed as I'd like it to be.
So I searched for alternatives again and stumbled upon WolframCloud and Wolfram Engine.
I've been using it for a few days now and it's just what I imagined Mathematica to be. (and more)
And I feel like I won't ever have to pay for Mathematica, because I could just use Wolfram Language for free.
[1]: https://www.wolfram.com/engine/faq/
[2]: https://www.wolfram.com/language/faq/
[3]: https://community.wolfram.com/groups/-/m/t/1697210
[4]: https://mathematica.stackexchange.com/questions/37557/is-mathematica-an-implementation-of-the-wolfram-languageNico G2020-08-05T20:48:25ZTesting duckweed as a fertilizer using the Wolfram Language
https://community.wolfram.com/groups/-/m/t/2050612
![enter image description here][1]
**Summary:**
Using the Wolfram Language we were able to rapidly and accurately quantify plant health, allowing us to test a promising novel fertilizer.
**Background:**
About half of the human population is currently supported by synthetic fertilizers, but at best only half of the nutrients deposited by these fertilizers actually make it into the plant, with the rest being lost to the environment (Savci, 2012).
![human population supported by nitrogen fertilizers][2]
While critical for supporting the human population, the high usage rate and low nutrient uptake of chemical fertilizers leads to global pollution. On top of the environmental degradation, the manufacturing process is expensive and energy intensive. Emerging alternatives are organic fertilizers: they are cheap, natural products (generally waste material) that release their nutrients slowly as they decompose, reducing the risk of overfertilization. However, their nutrient content is not as dense, or as consistent, as the synthetic fertilizers. Still, they have the potential to carry a wider range of nutrients. The pros and cons are summarized below:
![pros and cons of synthetic and organic fertilizers][3]
**The solution:**
Duckweeds are a family of small aquatic plants found all over the world, and could be a promising fertilizer.
![duckweed][4]
Found in almost any temperate, stagnant pond, duckweeds have a very high protein content (higher than soy), leading to a high nitrogen content. Nitrogen is the key ingredient in all modern fertilizers, and is usually the critical factor in determining plant growth. These incredible plants are already being farmed on an industrial scale, for example by [Parabel foods][5] in Florida as a protein supplement. Duckweeds also carry other macro- and micro-nutrients critical for fertilizers, such as phosphorus, potassium, magnesium, iron, and copper. Duckweeds grow incredibly quickly, some doubling in biomass every 16 hours. With these three traits, duckweeds could have the nutrient density of synthetic fertilizers while retaining the natural qualities of organic fertilizers, combining the benefits of both while minimizing their drawbacks. Referring to the previous graphic, it's all green.
**Testing:**
The question was now how to test this potential fertilizer – most modern procedures assessing the performance of fertilizers can be subjective (measuring stem height or leaf width), destructive (taking leaf sampling), or can only happen once (removing the plant from the soil and measuring change in biomass). Wolfram language provides an alternative solution through NDVI analysis, also known as Normalized Difference in Vegetation Index. When plants undergo photosynthesis, they absorb red light and reflect near-infrared light. This was used by [NASA][6] in the 70’s to measure plant health over large areas by subtracting near infrared from red light, and normalizing that by the total amount of red and infrared light to get a ratio that can quantitatively describe plant health.
![NDVI][7]
Zhamilya Bilayova introduced me to NDVI at the Wolfram Summer Camp (2019). She had developed a function that could take in near-infrared and red filtered images, and generate a heatmap based on the calculated NDVI values for each pixel. You can see her community post [here][8].
I was able to add onto her code so that it can efficiently take in large data sets of images, useful for my research application. I then created a function that returned an average numerical NDVI value for a given image, and finally one function that wraps it all together, taking in a large data set of images and spitting out a text file receipt with the average values of each image. These modifications made the system a practical and easy to use tool that could return quantitative results to researchers very quickly.
The first piece of code is the NDVI function that will be applied to each pixel:
NDVIformula[pixel1_,pixel2_]:= (((pixel1-pixel2)/(pixel1+pixel2))+1) /2;
This is a slightly modified formula that has the values scaled from 0 to 1 instead of -1 to 1, to avoid any negative pixel values when coloring the heatmap.
Then, I made a function that outputted a single, average NDVI value for each picture processed:
NDVIsingle[image_] :=
(
Clear[mean, i];
mean = {0, 0, 0};
ImageScan[mean += # &,
i = ImageApply[NDVIformula,
ColorSeparate[
ImageTake[
image, {cropconstant,
ImageDimensions[image][[2]] - cropconstant}, {cropconstant,
ImageDimensions[image][[1]] - cropconstant}], {"B", "R"}]]
];
mean[[1]] /= Times @@ ImageDimensions[i]
)
The "crop constant" variable set to 100 pixels, for unknown reasons both in mine and Zhamilya's code this was required to process images without errors. I then added the functionality to import large sets of images, and to print out receipts of the average values:
NDVIFunction[user_, month_, date_] :=
(
Clear[files, dataList, cuts, datres];
files =
FileNames["*.jpg",
StringJoin["C:\\Users\\", ToString@user,
"\\USER FILE LOCATION\\", ToString@month, "-", ToString@date]];
dataList = Import[#] & /@ files;
cuts = Table[
StringDrop[FileNames[files][[n]], 104], {n, 1, Length@dataList}];
datres =
AbsoluteTiming[
Table[NDVIsingle[dataList[[n]]], {n, 1, Length@dataList}]];
{Export[StringJoin[ToString@month, "-", ToString@date, ".txt"],
Riffle[cuts, datres[[2]]]], Print[datres]}
)
Along with the code, I turned a basic consumer camera into an NDVI sensor by removing the infrared filter and applying my own red filter from Public Lab’s [Infragram][9]. This would then make infrared light show up in the “red” channel of a color separated image, as well as having red light show up in the “blue” channel. Using the camera and the code, I then compared the change in plant health over time for cabbage applied with synthetic fertilizer, organic fertilizer, duckweed fertilizer, and a control without fertilizer.
![sensor][10]
My experiment was set up in a research greenhouse, with 16 late flat Dutch cabbage plants. The synthetic fertilizer was a water-soluble cocktail of salts and minerals, the duckweed fertilizer was a solution of high-quality powdered duckweed from Parabel Foods, and the organic fertilizer was a kelp emulsion. The duckweed and synthetic fertilizers were applied at the same concentration of nitrogen, and the organic fertilizer was applied by the bottles instructions to avoid over-fertilization or improper usage. I selected this variety of cabbage because it had a high nitrogen requirement (250 Kg N/Ha), while also growing quickly – this would make it a good indicator of a fertilizer’s ability to deposit nutrients over a shorter period.
This is what it looked like in the research greenhouse:
![Greenhouse][11]
I took pictures every alternating day when the greenhouse was open. The first trial ran for about 2 months till COVID-19 forced me to stop this trial, and another trial that just started a week prior. Once I took my pictures, I cropped them to cover the same consistent image, then let my code crunch through them. In total I collected about 400 images. With each pixel as a unique value, I collected about 3 billion data points.
Here is a colorized GIF of one portion of the plots over time:
![colorized gif][12]
These are the results of the average NDVI of each plot:
![Full Data][13]
At first glance, you may notice that the dip at the beginning and the fair amount of day to day variation. I was still ironing out kinks in my data collection procedure, and on that day the light in the greenhouse was inconsistent from what it usually was. With better photography and lighting I was able to smooth out some of these issues over time. However, the day to day the relative positions of the different variables remains fairly constant – synthetic with the highest NDVI value/plant health, closely followed by duckweed, then with organic and control on the bottom. You may also notice in the middle portion the duckweed lags behind the synthetic – this is because duckweed is a slow release fertilizer, so it took a while to it to release as many nutrients to get the same NDVI as the synthetic. These results are best summarized in this box plot:
![boxplot][14]
You can see how the duckweed and synthetic fertilizers trend closely together, while organic and the control are in a different tier. A statistical test (ANOVA) supports this claim - the duckweed fertilizer's performance was found to be not significantly different from the synthetic fertilizer, while significantly different from the organic and synthetic fertilizers.
While more trials and more robust analyses were cut short with the premature end of the academic year, the results are nonetheless an exciting proof of concept. In a head to head competition, the duckweed can keep up with a gold standard synthetic fertilizer. At the same time, it is still a cheaply farmed natural product that breaks down slowly, mitigating the risk of overfertilization. By using the natural and efficient growth of duckweed to build up a sophisticated fertilizer instead of a chemical plant, we also have a more sustainable manufacturing process. This work opens the door to looking at duckweed as a cleaner, cheaper, equally effective alternative to the fertilizers that support half the human population.
**References**
> Savci, S. (2012). Investigation of Effect of Chemical Fertilizers on
> Environment. APCBEE Procedia,1, 287-292. doi:10.1016/j.apcbee.2012.03.047
> https://doi.org/10.1016/j.apcbee.2012.03.047
> https://www.sciencedirect.com/science/article/pii/S2212670812000486
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=dsagf45ywyhnfsbds.jpeg&userId=20103
[2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=world-population-supported-by-synthetic-nitrogen-fertilizers.png&userId=1725442
[3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=chart.PNG&userId=1725442
[4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=81njTxJFreL._SL1500_adf03405-2c59-481e-84aa-577bd276a915_1024x1024.jpg&userId=1725442
[5]: https://www.parabel.com/ "Parabel Foods"
[6]: https://earthdata.nasa.gov/earth-observation-data/near-real-time/hazards-and-disasters/vegetation "NASA"
[7]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ndvi-example.jpg&userId=1725442
[8]: https://community.wolfram.com/groups/-/m/t/1663138 "here"
[9]: https://publiclab.org/wiki/infragram "Infragram"
[10]: https://community.wolfram.com//c/portal/getImageAttachment?filename=sensor.PNG&userId=1725442
[11]: https://community.wolfram.com//c/portal/getImageAttachment?filename=IMG_20200218_125344021.jpg&userId=1725442
[12]: https://community.wolfram.com//c/portal/getImageAttachment?filename=duckweed.gif&userId=1725442
[13]: https://community.wolfram.com//c/portal/getImageAttachment?filename=fulldata.PNG&userId=1725442
[14]: https://community.wolfram.com//c/portal/getImageAttachment?filename=boxplot.PNG&userId=1725442Arian Patel2020-08-04T03:01:28Z[WSS18] A New Kind of Chess
https://community.wolfram.com/groups/-/m/t/1380041
![enter image description here][1]
# Summary & Objectives
The rules of chess have been perfected for more than a millennia to ensure an exciting game every time. These relatively simple rules are capable of producing very interesting and complex dynamics that deserve to be studied in their own rights, not just merely for competition purposes. This project aims at laying down the formalism to capture the game of chess as well as many other board and card games. In accordance with this formalism, a Mathematica chess package has been developed which creates, displays, and evolves a ChessState object using ChessState, ChessPlot, and ChessEvolve functions.
ChessPlot enables the user to provide options such as setting board color set, displaying coordinates, rotating point of view, or extracting MatrixForm of a ChessState.
![enter image description here][2]
In addition, a list of rule functions is provided which take in a ChessState and output all the possible moves in accordance with the rule they represent.
With this setup, the user is able to setup any ChessEvaluate function and explore the chess space. This open-ended chess design also enables the user to modify the rules with ease so they can explore chess variations such as antichess, atomic chess, and others (see LiChess.org for more examples).
## ChessState
Many board/card games may be represented using an association where coordinates in the game are associated with states.
Specifically for chess, we can write:
![enter image description here][3]
Which can be encapsulated in a wrapper for aesthetic reasons as well as additional functionalities that help the user to extract the state of a coordinate using different notations (e.g. "e1", {rank, file} = {1, 5}).
![enter image description here][4]
In order to avoid referring to previous states of the game, auxiliary (as in not part of the board) has been added. For instance, if a pawn may be captured via En passant, it's coordinate will be mentioned. As another example, if the rooks or the king move, the opportunity of castling will be revoked. White and black cemeteries are there to keep track of captured pieces. Turn switches between White and Black after each move. The game ends when the Result is set to "1/2-1/2", "1-0", or "0-1".
## A Move $=$ A Set of Actions
A move is a list of actions. For instance, the move of a white pawn at a7 capturing a rook at b8 and becoming a queen may be represented as {a7 &rarr; &#9812; , &#9820;
&rarr; BlackCemetery, b8 &rarr; &#9813;
}.
## Mathematical Formulation of Chess Rules
If we want to develop a chess algorithm, we should list all the rules pseudo-mathematically as such:
![enter image description here][5]
(Forgive me for mistakes and for using an image instead of typing it. I will try to write this up more clearly at a later time)
## Game Rules $=$ Exhaustive Move Generators
I have used the rules expressed above to create functions that intake a ChessState and output all the possible moves in accordance with the rules. For instance, an exhaustive move generator for knights in Mathematica would look like this:
![enter image description here][6]
Be aware that not all rules might have been implemented as of the time you are reading this post.
## Code on GitHub
You can find my code on GitHub. You can either import chess.m as a package or use Notebook01.nb for code, documentation, and demonstrations. The following is the link to GitHub but be aware that I am planning to move this to a new GitHub location (before Jan 2019). If that happens, I'll update this link.
[https://github.com/Miladiouss/Summer2018Starter/tree/master/ChessPackage][7]
[1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=6152chess.gif&userId=1188265
[2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=chess01.png&userId=1188265
[3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=state01.png&userId=1188265
[4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=chessStateImage.png&userId=1188265
[5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=cheesRules.png&userId=1188265
[6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=KnightMoves.png&userId=1188265
[7]: https://github.com/Miladiouss/Summer2018Starter/tree/master/ChessPackageMilad Pourrahmani2018-07-11T21:30:48ZOptions AspectRatio and ImageSize within DateListPlot or DateListLogPlot
https://community.wolfram.com/groups/-/m/t/2051827
Hello Community
Why do the Options AspectRatio and ImageSize not work when defined in SetOptions[DateListPlot ... ] ? They work well when defined within DateListPlot or DateListLogPlot.
Options[DateListPlot] list them as an option.
I always get the default plot ratio and size.
With kind regards
PeterPeter Anliker2020-08-05T08:38:00ZA formula for the number of updates per second that occur in our Universe
https://community.wolfram.com/groups/-/m/t/2052706
Assume that our Universe is described by a Wolfram Model. We want to estimate the number of updates per second. In order to do that, we propose the following experiment.
Assume that we can observe an aperiodic physical system involving elementary particles (in a lab or via astronomical methods) such that we can *estimate* its descriptive complexity at any given time (a periodic system with a *sufficiently large* period can also be used for this experiment). Suppose that during a time interval of dt seconds the system increased its descriptive complexity in dK bits (in general, the exact value is uncomputable, but we only want an estimation). Then, using the theorem from my previous post [logarithm of time = complexity][1], we can express the number of updates per second as the quotient
updates per second = 2^(dK) / dt.
Notice that, in a time interval dt, our aperiodic system increases its descriptive complexity the same amount as the whole Universe. This claim follows from the fact that in both cases, the only information needed in order to reconstruct their states at time dt after the initial conditions is precisely the descriptive complexity of the product of dt times the number of updates per second. Therefore, the formula above also provides an estimation of the number of updates per second of the Universe.
Before ending this post, I would like to point out that the method described here is not for an exact calculation, even if the premises are verified. This method is for *estimation* and it is not clear what is the bound of the error of measurement using the approach that we proposed.
I subject related to the present discussion, but that is not exactly the same, is the physical limit of computation. In this direction, I recommend Seth Lloyd's paper [Ultimate physical limits to computation][2].
[1]: https://community.wolfram.com/groups/-/m/t/2047389?p_p_auth=ymzGZe8D
[2]: https://cds.cern.ch/record/396654/files/9908043.pdfJosé Manuel Rodríguez Caballero2020-08-06T13:26:36ZIncorrect solution, how to control such behaviour of the Solve function?
https://community.wolfram.com/groups/-/m/t/2051959
Here is a simple system of algebraic equations. It is clear that two first equations determine x1 and x2 and the third one determines x3. But something goes wrong...
sys = {1 + x1^2,
-3 + x2^2 + 4 x2*x1,
-3 + x3 + x2*x1}
sol = Solve[sys == 0]
sys /. sol
Please look at the result here: [notebook with this system][1].
We see that there are 4 branch solutions and one of them is found with an error.
The question is about Solve, not about this particular system which, of course, can be solved after some manipulations (for instance, with help of Groebner, although it seems redundant in such a simple situation). In principle, Solve is able to correctly find solutions of much more complicated systems. What is wrong with this one and how to make control of such type of mistakes?
[1]: https://www.wolframcloud.com/obj/a.g.lebedev/Published/error.nbAlbert Lebedev2020-08-05T10:25:32ZRecover .nb file
https://community.wolfram.com/groups/-/m/t/2050509
Is there any way recover an .nb file? I tried to export to .pdf and all the content was lost.
Here's the error: $ Failed. 6 line of corrupt data deleted.
I executed these two instructions in a new notebook:
Needs["AuthorTools`"]
NotebookRestore[]
but I got the error above.Ion Ganea2020-08-03T19:14:17ZCompare/contrast Wolfram|One, Development Platform, Mathematica Online, etc
https://community.wolfram.com/groups/-/m/t/1096129
Can somebody give a succinct comparison of the features of the various products: Mathematica, Mathematica Online, Wolfram|One, Wolfram Development Platform, Wolfram Cloud, Wolfram Data Drop.
I find differentiating so many similar products &mdash; especially those manifestly cloud-based &mdash; rather confusing.Murray Eisenberg2017-05-16T18:35:44ZPlotting Voronoi diagram for a country
https://community.wolfram.com/groups/-/m/t/1975264
Dear all,
I have geographical coordinates and rainfall values for 151 points (stations) over Turkey.
How do I plot the Voronoi diagram over this country with Mathematica?
Sations = {"ADANABOLGE", "ADIYAMAN", "AFYONKARAHİSARBÖLGE", "AĞRI",
"AHLAT", "AKÇAABAT", "AKÇAKOCA", "AKSARAY", "AKŞEHİR", "AMASRA",
"AMASYA", "ANKARABÖLGE", "ARDAHAN", "ARTVİN", "AYVALIK", "BAFRA",
"BALIKESİRGÖNEN", "BANDIRMA", "BARTIN", "BAŞKALE", "BAYBURT",
"BERGAMA", "BEYPAZARI", "BEYŞEHİR", "BİLECİK", "BİNGÖL",
"BOĞAZLIYAN", "BOLU", "BOLVADİN", "BOZÜYÜK", "BURDUR", "BURSA",
"ÇANAKKALE", "ÇANKIRI", "ÇEMİŞGEZEK", "CEYHAN", "CİHANBEYLİ",
"ÇORLU", "ÇORUM", "DENİZLİ", "DEVELİ", "DİNAR", "DİVRİĞİ",
"DİYARBAKIRHAVALİMANI", "DÖRTYOL", "DURSUNBEY", "DÜZCE", "EDİRNE",
"EĞİRDİR", "ELAZIĞBÖLGE", "ELMALI", "EMİRDAĞ", "ERCİŞ", "ERDEMLİ",
"EREĞLİ", "ERZİNCAN", "ERZURUMHAVALİMANI", "FLORYA", "GAZİANTEP",
"GEMEREK", "GEYVE", "GİRESUN", "GÖKÇEADA", "GÖKSUN", "GÜMÜŞHANE",
"GÜNEY", "HADİM", "HINIS", "HOPA", "HORASAN", "IĞDIR", "ILGIN",
"İNEBOLU", "İSKENDERUN", "ISPARTA", "İSPİR", "İZMİRBÖLGE",
"KAHRAMANMARAŞ", "KARAİSALI", "KARAMAN", "KARAPINAR", "KARS",
"KASTAMONU", "KASTAMONUBOZKURT", "KAYSERİBÖLGE", "KEBAN", "KELES",
"KİLİS", "KIRKLARELİ", "KIRŞEHİR", "KIZILCAHAMAM", "KOCAELİ",
"KONYAHAVALİMANI", "KORKUTELİ", "KOZAN", "KULU", "KÜTAHYA",
"MALATYA", "MALAZGİRT", "MANAVGAT", "MERZİFON", "MUĞLA", "MUŞ",
"NALLIHAN", "NEVŞEHİR", "NİĞDE", "ORDU", "ÖZALP", "PALU",
"POLATLI", "RİZE", "RİZEPAZAR", "SAKARYA", "SALİHLİ", "SAMANDAĞ",
"SAMSUNBÖLGE", "SARIKAMIŞ", "SARIYER", "SARIYERKUMKÖYKİLYOS",
"SARIZ", "ŞEBİNKARAHİSAR", "SENİRKENT", "SEYDİŞEHİR", "SİİRT",
"ŞİLE", "SİMAV", "SİNOP", "SİVAS", "SIVRIHISAR", "SOLHAN",
"TAVŞANLI", "TEFENNİ", "TEKİRDAĞ", "TERCAN", "TOKAT", "TORTUM",
"TOSYA", "TUNCELİ", "ULUBORLU", "ULUDAĞ", "UŞAK", "UZUNKÖPRÜ",
"VANBÖLGE", "YALOVA", "YATAĞAN", "YOZGAT", "YUMURTALIK", "YUNAK",
"ZARA", "ZİLE", "ZONGULDAK"};
lat = {37.`, 37.75`, 38.75`, 39.72`, 38.77`, 41.02`, 41.08`, 38.38`,
38.35`, 41.75`, 40.65`, 39.95`, 41.12`, 41.18`, 39.32`, 41.57`,
40.1`, 40.35`, 41.63`, 38.05`, 40.25`, 39.12`, 40.17`, 37.68`,
40.15`, 38.88`, 39.2`, 40.73`, 38.72`, 39.92`, 37.72`, 40.18`,
40.15`, 40.6`, 39.07`, 37.03`, 38.65`, 41.17`, 40.55`, 37.78`,
38.38`, 38.07`, 39.37`, 37.9`, 36.85`, 39.58`, 40.83`, 41.67`,
37.87`, 38.67`, 36.75`, 39.02`, 39.03`, 36.62`, 37.5`, 39.75`,
39.92`, 40.98`, 37.07`, 39.18`, 40.52`, 40.92`, 40.2`, 38.02`,
40.47`, 38.15`, 36.98`, 39.37`, 41.4`, 40.05`, 39.92`, 38.28`,
41.98`, 36.58`, 37.77`, 40.48`, 38.43`, 37.6`, 37.27`, 37.18`,
37.72`, 40.62`, 41.37`, 41.95`, 38.73`, 38.8`, 39.92`, 36.72`,
41.73`, 39.15`, 40.47`, 40.78`, 37.87`, 36.75`, 37.45`, 39.1`,
39.42`, 38.35`, 39.15`, 36.78`, 40.87`, 37.22`, 38.73`, 40.18`,
38.58`, 37.97`, 40.98`, 38.67`, 38.72`, 39.58`, 41.03`, 41.18`,
40.78`, 38.48`, 36.08`, 41.28`, 40.33`, 41.17, 41.25`, 38.48`,
40.3`, 38.1`, 37.42`, 37.92`, 41.18`, 39.08`, 42.02`, 39.75`,
39.45`, 38.97`, 39.55`, 37.32`, 40.98`, 39.78`, 40.3`, 40.3`,
41.02`, 39.12`, 38.08`, 40.13`, 38.68`, 41.27`, 38.5`, 40.65`,
37.35`, 39.82`, 36.77`, 38.82`, 39.9`, 40.3`, 41.45`};
lon = {35.33`, 38.28`, 30.53`, 43.05`, 42.5`, 39.58`, 31.13`, 34.08`,
31.42`, 32.38`, 35.83`, 32.88`, 42.72`, 41.82`, 26.7`, 35.92`,
27.65`, 27.97`, 32.33`, 44.02`, 40.23`, 27.18`, 31.92`, 31.72`,
29.98`, 40.48`, 35.25`, 31.52`, 31.05`, 30.03`, 30.28`, 29.07`,
26.42`, 33.62`, 38.92`, 35.82`, 32.93`, 27.8`, 34.95`, 29.08`,
35.5`, 30.17`, 38.12`, 40.23`, 36.22`, 28.63`, 31.17`, 26.57`,
30.83`, 39.23`, 29.92`, 31.15`, 43.35`, 34.3`, 34.05`, 39.5`,
41.27`, 28.75`, 37.38`, 36.07`, 30.3`, 38.4`, 25.9`, 36.5`, 39.47`,
29.07`, 32.47`, 41.7`, 41.43`, 42.17`, 44.05`, 31.92`, 33.77`,
36.17`, 30.55`, 41.`, 27.17`, 36.93`, 35.07`, 33.22`, 33.55`,
43.1`, 33.78`, 34.02`, 35.48`, 38.75`, 29.07`, 37.12`, 27.23`,
34.17`, 32.65`, 29.93`, 32.48`, 30.2`, 35.82`, 33.`, 29.97`,
38.32`, 42.53`, 31.43`, 35.33`, 28.37`, 41.48`, 31.35`, 34.67`,
34.68`, 37.9`, 43.98`, 39.97`, 32.15`, 40.52`, 40.88`, 30.42`,
28.13`, 35.97`, 36.3`, 42.57`, 29.05, 29.03`, 36.5`, 38.42`,
30.55`, 31.83`, 41.95`, 29.61`, 28.98`, 35.17`, 37.02`, 31.53`,
41.07`, 29.5`, 29.77`, 27.55`, 40.38`, 36.57`, 41.55`, 34.03`,
39.55`, 30.45`, 29.08`, 29.4`, 26.68`, 43.38`, 29.27`, 28.13`,
34.8`, 35.78`, 31.73`, 37.75`, 35.75`, 31.8`};
rain = {65.10364583333333`, 69.24427083333333`, 35.316875`,
44.31385416666667`, 48.824375`, 60.07927083333334`,
90.26499999999999`, 30.4459375`, 47.152499999999996`,
84.07041666666667`, 39.665104166666666`, 33.730937499999996`,
46.18989583333334`, 59.59437500000001`, 65.39645833333333`,
66.26520833333333`, 56.8996875`, 60.803437499999994`,
86.75604166666668`, 37.60124999999999`, 37.283229166666665`,
62.348958333333336`, 34.07760416666667`, 42.45520833333334`,
37.88489583333333`, 83.88291666666665`, 33.40291666666666`,
46.26270833333333`, 33.0103125`, 40.45520833333333`,
35.920833333333334`, 59.19114583333333`, 54.93541666666667`,
33.924166666666665`, 54.429999999999986`, 68.190625`,
28.725729166666664`, 48.099687499999995`, 38.19916666666666`,
50.333125`, 33.5215625`, 38.09729166666667`, 33.66562499999999`,
47.78999999999999`, 80.06635416666668`, 47.6740625`, 68.9203125`,
49.01083333333332`, 70.82197916666667`, 36.59572916666666`,
42.33979166666666`, 34.72958333333332`, 37.396875`,
61.012187499999996`, 27.422604166666662`, 31.66`, 34.3028125`,
54.60708333333333`, 59.14447916666666`, 36.41260416666667`,
53.246249999999996`, 104.93041666666666`, 64.91343749999999`,
54.14729166666666`, 38.96833333333334`, 48.09666666666667`,
58.42135416666667`, 50.02572916666667`, 186.38958333333332`,
34.09375`, 21.917500000000004`, 36.49583333333333`,
84.91864583333333`, 63.12968749999999`, 43.601875`,
39.66906250000001`, 74.27645833333334`, 75.86124999999998`,
78.48114583333333`, 30.548333333333332`, 27.080729166666668`,
40.853541666666665`, 41.176770833333336`, 102.25729166666665`,
34.189791666666665`, 33.369791666666664`, 62.652604166666656`,
53.38614583333333`, 46.46583333333333`, 33.14489583333333`,
47.733333333333334`, 68.51447916666666`, 27.64041666666667`,
33.63822916666667`, 72.35229166666667`, 33.57364583333333`,
45.55354166666667`, 34.13260416666666`, 39.54677083333333`,
129.77604166666666`, 37.36052083333333`, 109.60208333333331`,
67.33604166666666`, 28.4934375`, 36.56010416666666`,
28.66677083333333`, 86.56166666666665`, 41.82364583333333`,
50.02427083333333`, 30.500416666666666`, 186.503125`,
170.72708333333335`, 70.54874999999998`, 46.05270833333334`,
89.77739583333333`, 57.81166666666666`, 51.84885416666666`,
70.90697916666667`, 70.74885416666667`, 46.635833333333345`,
50.375104166666674`, 56.90666666666666`, 63.61427083333333`,
65.45572916666667`, 73.02739583333334`, 69.20229166666667`,
56.49010416666667`, 38.18552083333333`, 33.69833333333334`,
59.517916666666665`, 40.5925`, 39.89760416666666`, 49.4359375`,
37.839166666666664`, 37.82166666666667`, 40.09354166666666`,
39.73760416666667`, 75.17218749999999`, 52.24187499999999`,
123.11343749999999`, 47.08375`, 55.36291666666667`,
34.23145833333333`, 62.806562500000005`, 62.40125`, 52.1103125`,
80.3328125`, 38.78125`, 45.807291666666664`, 39.19291666666667`,
102.12302083333334`};
latLngs = Transpose[{lat, lon}];
toMercator[{lat_, lng_}] := {lng,
Log[Abs[Sec[lat*Degree] + Tan[lat*Degree]]]/Degree};
mercPoints = toMercator /@ latLngs;
Show[CountryData["Turkey", {"Shape", "Mercator"}], Frame -> True,
Epilog -> {PointSize[0.01], Red, Point[mercPoints]}]
![enter image description here][1]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=4089Untitled.png&userId=943918M.A. Ghorbani2020-05-15T07:30:13ZA three-dimensional vertex model to simulate biological tissues
https://community.wolfram.com/groups/-/m/t/2051277
Vertex model is a special class of numerical simulations that is pervasively used in many areas of physics such as soft matter physics, engineering design, and more recently in developmental biology. For instance, classically in the soft matter community foams (Figure 1a) have usually been
modeled by employing vertex model. Following a similar pursuit, biological tissues (Figure 1b) have also been simulated via vertex model. However, before I overwhelm the reader with the usage of the term, I would like to elucidate what exactly are vertex models?
![enter image description here][1]
Figure 1 (a) dry foam (b) drosophila (fruitfly) epithelium
The tissues in our body are a collection of specialized cells that communicate with each other mechanically because cells are mechanically linked with each other. These cellular communities form a living system that perform work day and night by actively burning energy and preventing themselves from dying - or reaching thermodynamic equilibrium. If you are ever fortunate enough to observe a small slice of a tissue under an optical microscope, the membranes of the cells are constantly moving, flailing about in space and changing their length. As a result of coupled dynamic events cells can alter their morphology and configuration - oftentimes to perform specific functions e.g. think of the heart muscles that are perpetually relaxing and getting tensed in every beat.
Two dimensional and three-dimensional vertex models can be used to capture some of the dynamics of these active systems. In a two-dimensional setting, a foam or a biological tissue can be abstracted by a set of connected polygons (Figure 2). An edge of the polygon represents the edge of a bubble or a cell. It is through these network of edges(interfaces) that a bubble connects to its neighbouring bubble and likewise, the biological cells. Moreover, the ends of the edges constitute the vertices/junctions where more than two polygons meet. The movement of the vertices and consequently the edges can capture - in an abstract manner - the motion of the cell membranes and the dynamic behaviour of the cellular communities. Broadly we can take advantage of the vertex model to simulate a monolayer of cells (epithelia) or even an agglomerate of cells (e.g. a multilayered tissue).
![enter image description here][2]
Figure 2: cells represented as polygons with shared edges (lines) and vertices (dots)
Simply putting the vertices are assumed to obey the following physical equation:
η dr/dt=-∇U
where η is the resistive coefficient, U is potential energy and r is the position vector associated with the vertex.
The vertices are displaced by virtue of the forces acting on them, with the forces generated as a result of the gradient of potential energy at that point. The potential energy can be a sum or contributions of multiple terms, with the more notable being the spring energy terms associated with changes in cell area, perimeter etc... Keeping the above equation in view, the vertices will move down the gradient in a deterministic fashion to minimize the total potential energy of the system. The relative motion of the vertices in space will eventually lead to newer topologies - topologies that are energetically more feasible. In a naïve manner we assume that this holds for biological cells where the relative or collective movement of cells in the community establish new tissue architectures that are also energetically favourable states. Moreover, we can infer a lot about the dynamics
governing morphogenesis and animal development by looking at the forces, by extension the stresses, acting on the cells by utilizing vertex models. Additionally, one can also implement procedures in vertex model to emulate neighbourhood exchanges whereby a cell can switch its immediate neighbours.
In a three dimensional context each polygon is replaced by a polyhedron whilst the governing equations remain unaltered. The cells in 3D not only share edges but faces as well (Figure 3). In this post, I am releasing the first versions of my notebooks. For notebooks please visit the github repository [3D-Vertex-Model][3]. I will discuss how the fascinating new capabilities of Mathematica 12.1 especially for computational geometry can allow us to construct the more complex 3D vertex models. Though I must admit that the implementation of the 3D vertex model was a somewhat long and dauting task. The implementation is based of the approach presented in *"Reversible network reconnection model for simulating large deformation in dynamic tissue morphogenesis", (Biomechanics and modeling in Mechanobiology 2013)*. As is mostly the case the authors have not released the code to the public. I do not know why this is the case when all the code should be released on both scientific and ethical grounds. But that is entirely a different rant.
![enter image description here][4]
Figure 3: in three dimensions cells share edges and faces with their neighbours
I started constructing the 3D vertex model in version 12.0 however along the way 12.1 came and I tweaked the code a bit to take advantage of the additional capabilities of version 12.1. For the purpose of this post my aim is to model an infinite sheet (epithelium) of cells. The infinite aspect is established by ensuring periodic boundary conditions at the edges of the simulation domain. Nevertheless, the code can be conveniently tweaked to model a multilayered system such as a cluster of cells. The quintessential ingredients of the vertex model includes a geometric mesh and a choice of a numerical solver to propagate the vertices. A polyhedra sheet is established by the following recipe. The vertices for the polygons are setup spatially as a two dimensional curved sheet which are mirrored in the z direction. The two layers of polygons are connected laterally to create the third dimension. Thereafter a `Polyhedron` function is applied to a single cell to create a hexahedral prism (below) and their collection forms the prism lattice.
![enter image description here][5]
The cells at the edges of the simulation domain are stitched together to ensure periodic boundary conditions. The vertices are displaced slightly from their initial configuration by sampling noise from a normal distribution. Yet again, a periodic boundary condition is ensured at the edges of the mesh. The noise can be thought of as a perturbation from the stable hexahedral prism lattice configuration and infuses the mesh with higher energy. "infinite-sheet".nb and "infinite sheet - noise addition".nb
make extensive use of built-in Mathematica functionality and custom routines to generate the curved hexahedral prism lattice and add noise to the vertices in the mesh respectively. The geometric mesh prior to and with the addition of noise are depicted below.
![enter image description here][6]
Once the mesh is created we now require a numerical procedure to solve for the vertex displacement. I have implemented a Runge-Kutta 5th order numerical integration scheme which allows me to use a relatively larger timestep without a loss in numerical accuracy when compared to say Heun's integrator. The potential energies considered in the study can be decomposed into two parts; a part associated with surfaces (between cells and those between cells and the outside, where the outside can be some liquid) and a second contribution owing to the volumetric elasticity of the cells away from an equilibrium value. The gradient of the potential energy term is determined by taking the gradient of the surface energy and the volumetric energy terms. And this is where Mathematica 12.1 shines ! The new computational geometry features coupled with a lot of custom
(`CompiledC`, and `Listable`) routines from discrete differential geometry allow me to evaluate these terms quite conveniently.
Additionally we can include some kind of transformation rules that instruct the cells when and how to exchange their neighbours. The neighbour exchanges in this model can take place by considering two types of transitions: a shared edge between two cells - smaller than a defined threshold-
is replaced by a trigonal face, and the process is reversible. Consider a set of four polyhedrons (Figure 4); a network transformation rule (I-to-∆, see the journal article) allows the polyhedrons to swap neighbours by eliminating an edge and establishing a new trigonal face
between cells. Another transformation rule (not shown here) takes a small trigonal face between cells and establishes a new edge in lieu of a face.
![enter image description here][7]
Figure 4: a type of network transformation that changes the cell neighbourhood
The numerical integration scheme and the topological transition rules (neighbourhood exchanges) are included in "vertex model 3D".nb. The mesh created from the earlier notebooks is imported into it. Some polyhedral cells in the mesh are labelled as "growing" (with active increase in size)
whereas the majority of the cells are non-growing (no active increase in volume). The mesh is then integrated over time. The result for the current mesh (400 cells) after a few integration steps is shown below.
![enter image description here][8]
The initial state (prior to iterations) and the final states (post iterations) of a few cells can be superimposed to note for the changes.
![enter image description here][9]
Although I have not had the time to run it as of yet, I have computed that it will take approximately a month to generate the results that the authors have presented in their study. I will do that soon. Well 30 days is quite less in the span of a human lifetime and provided there is an extra computer to spare. Also while I am at it I will remember the proverb "a watched pot never boils" and stick to it :)
I hope that my post shows that computational geometry is not just relevant for experts working with Graphics and Finite Elements, but also for people like me who are trying to understand biological phenomena using physical principles.
The entire code is a bit too elaborate to paste here directly and I do not intend to overwhelm anyone reading the post as I want to keep it bare-bones. Nevertheless, I have utilized nearly all programming paradigms that Mathematica has to offer; a mix of rule-based substitutions,
functional and procedural programming are all applied wherever their specific need arose. Yet there are a couple of code excerpts that I will paste here as they prove to be quite important:
I particularly love this portion mainly because of the simplicity: this is **how I created polyhedra from two curved surfaces**
initFace = {{1, 2, 3, 4, 5, 6}, {7, 12, 11, 10, 9, 8},
Sequence @@ NestList[# + 1 &, {1, 7, 8, 2}, 4], {6, 12, 7, 1}};
faceListInd = NestList[# + 12 &, initFace, (cellNumX*cellNumX) - 1];
faceListCoords = MapAt[Lookup[indToPtsAssoc, #] &, faceListInd, {All, All, All}];
you can **view say the first polyhedron** that has triangulated faces as:
firstPolyhedra = First@faceListCoords;
Graphics3D[{Directive[Blue, Opacity[0.25*1/GoldenRatio]],Polyhedron@Flatten[triangulateFaces[firstPolyhedra], 1]
the `triangulateFaces` function is as follows:
**Triangulation of faces of polyhedra**
Clear[triangulateFaces];
triangulateFaces::Information = "the f(x) takes in cell faces and triangulates them";
triangulateFaces[faces_] := Block[{edgelen, ls, mean},
(If[Length[#] ≠ 3,
ls = Partition[#, 2, 1, 1];
edgelen = Norm[SetPrecision[First[#] - Last[#], 8]] & /@ ls;
mean = Total[edgelen * (Midpoint /@ ls)] / Total[edgelen];
mean = mean~SetPrecision~8;
Map[Append[#, mean] &, ls],
{#}
]) & /@ faces];
to find local neighbourhood of a vertex or an edge I have devised the following rules and functions. They also work for vertices at the edge of the simulation domain as I ensure periodic boundary conditions:
**rules to find neighbourhood given periodic boundary conditions**
periodicRules::Information =
"shift the points outside the simulation domain to inside the domain";
transformRules::Information =
"vector that shifts the point outside the simulation domain back inside";
With[{xlim1 = xLim[[1]], xlim2 = xLim[[2]], ylim1 = yLim[[1]],
ylim2 = yLim[[2]]},
periodicRules = Dispatch[{
{x_ /; x >= xlim2, y_ /; y <= ylim1, z_} :> SetPrecision[{x - xlim2, y + ylim2, z}, 8],
{x_ /; x >= xlim2, y_ /; ylim1 < y < ylim2, z_} :> SetPrecision[{x - xlim2, y, z}, 8],
{x_ /; xlim1 < x < xlim2, y_ /; y <= ylim1, z_} :> SetPrecision[{x, y + ylim2, z}, 8],
{x_ /; x < 0., y_ /; y <= ylim1, z_} :> SetPrecision[{x + xlim2, y + ylim2, z}, 8],
{x_ /; x < 0., y_ /; ylim1 < y < ylim2, z_} :> SetPrecision[{x + xlim2, y, z}, 8],
{x_ /; x < 0., y_ /; y > ylim2, z_} :> SetPrecision[{x + xlim2, y - ylim2, z}, 8],
{x_ /; 0. < x < xlim2, y_ /; y > ylim2, z_} :> SetPrecision[{x, y - ylim2, z}, 8],
{x_ /; x > xlim2, y_ /; y >= ylim2, z_} :> SetPrecision[{x - xlim2, y - ylim2, z}, 8]}];
transformRules = Dispatch[{
{x_ /; x >= xlim2, y_ /; y <= ylim1, _} :> SetPrecision[{-xlim2, ylim2, 0}, 8],
{x_ /; x >= xlim2, y_ /; ylim1 < y < ylim2, _} :> SetPrecision[{-xlim2, 0, 0}, 8],
{x_ /; xlim1 < x < xlim2, y_ /; y <= ylim1, _} :> SetPrecision[{0, ylim2, 0}, 8],
{x_ /; x < 0, y_ /; y <= ylim1, _} :> SetPrecision[{xlim2, ylim2, 0}, 8],
{x_ /; x < 0, y_ /; ylim1 < y < ylim2, _} :> SetPrecision[{xlim2, 0, 0}, 8],
{x_ /; x < 0, y_ /; y > ylim2, _} :> SetPrecision[{xlim2, -ylim2, 0}, 8],
{x_ /; 0 < x < xlim2, y_ /; y > ylim2, _} :> SetPrecision[{0, -ylim2, 0}, 8],
{x_ /; x > xlim2, y_ /; y >= ylim2, _} :> SetPrecision[{-xlim2, -ylim2, 0}, 8],
{___Real} :> SetPrecision[{0, 0, 0}, 8]}];
];
(*wrappedMat =
AssociationThread[
Keys[cellVertexGrouping] ->
Map[Lookup[indToPtsAssoc, #] /. periodicRules &,
Lookup[cellVertexGrouping, Keys[cellVertexGrouping]], {2}]];*)
and one can find local topology by `getLocalTopology`
getLocalTopology::Information = "given a vertex or a vertex-pair the function yields the local cell
topology";
getLocalTopology[ptsToIndAssoc_, indToPtsAssoc_, vertexToCell_,
cellVertexGrouping_, wrappedMat_, faceListCoords_][vertices_] :=
Module[{localtopology = <||>, wrappedcellList = {}, vertcellconns,
localcellunion, vertInBounds, v, wrappedcellpos, vertcs = vertices,
transVector, wrappedcellCoords, wrappedcells, vertOutofBounds, shiftedPt,
transvecList = {}, $faceListCoords = Values@faceListCoords,vertexQ},
vertexQ = MatchQ[vertices, {__?NumberQ}];
If[vertexQ,
vertcellconns =
AssociationThread[{#} , {vertexToCell[ptsToIndAssoc[#]]}] &@vertices;
vertcs = {vertices};
localcellunion = Flatten[Values@vertcellconns],
(* this will yield vertex \[Rule] cell indices connected in the local mesh *)
vertcellconns =
AssociationThread[# ,
Lookup[vertexToCell, Lookup[ptsToIndAssoc, #]]] &@vertices;
localcellunion = Union@Flatten[Values@vertcellconns];
];
(* condition to be an internal edge:
both vertices should have 3 or more neighbours *)
(*Print["All topology known"];*)
(* the cells in the local mesh define the entire network topology \
\[Rule] no wrapping required *)
(* else cells need to be wrapped because other cells are connected \
to the vertices \[Rule] periodic boundary conditions *)
With[{vert = #},
If[((\[ScriptCapitalD]~RegionMember~
Most[vert]) && ! (vert[[1]] == xLim[[2]] ||
vert[[2]] == yLim[[2]])),
(*
the vertex has less than 3 neighbouring cells but the vertex is within bounds *)
(*Print["vertex inside bounds with fewer than 3 cells"];*)
v = vertInBounds = vert;
(* find cell indices that are attached to the vertex in wrappedMat *)
wrappedcellpos = DeleteDuplicatesBy[
Cases[Position[wrappedMat, x_ /; SameQ[x, v], {3}],
{Key[
p : Except[
Alternatives @@
Join[localcellunion, Flatten@wrappedcellList]]],
y__} :> {p, y}],
First];
(*wrappedcellpos = wrappedcellpos/.{Alternatives@@Flatten[
wrappedcellList],__} \[RuleDelayed] Sequence[];*)
(* if a wrapped cell has not been considered earlier (i.e. is new)
then we translate it to the position of the vertex *)
If[wrappedcellpos != {},
If[vertexQ,
transVector =
SetPrecision[(v -
Extract[$faceListCoords,
Replace[#, {p_, q__} :> {Key[p], q}, {1}]]) & /@
wrappedcellpos, 8],
(*the main function is enquiring an edge and not a vertex*)
transVector =
SetPrecision[(v - Extract[$faceListCoords, #]) & /@
wrappedcellpos, 8]
];
wrappedcellCoords =
MapThread[#1 ->
Map[Function[x,
SetPrecision[x + #2, 8]], $faceListCoords[[#1]], {2}] &,
{First /@ wrappedcellpos, transVector}];
wrappedcells = Keys@wrappedcellCoords;
AppendTo[wrappedcellList, Flatten@wrappedcells];
AppendTo[transvecList, transVector];
AppendTo[localtopology, wrappedcellCoords]; (*local topology here only has wrapped cell *)
],
(*Print["vertex out of bounds"];*)
(* else vertex is out of bounds *)
vertOutofBounds = vert;
(* translate the vertex back into mesh *)
transVector = vertOutofBounds /. transformRules;
shiftedPt = SetPrecision[vertOutofBounds + transVector, 8];
(* find which cells the vertex is a part of in the wrapped matrix *)
wrappedcells = Complement[
Union@Cases[
Position[wrappedMat, x_ /; SameQ[x, shiftedPt], {3}],
x_Key :> Sequence @@ x, {2}] /.
Alternatives @@ localcellunion -> Sequence[],
Flatten@wrappedcellList];
(*forming local topology now that we know the wrapped cells *)
If[wrappedcells != {},
AppendTo[wrappedcellList, Flatten@wrappedcells];
wrappedcellCoords = AssociationThread[wrappedcells,
Map[Lookup[indToPtsAssoc, #] &,
cellVertexGrouping[#] & /@ wrappedcells, {2}]
];
With[{opt = (vertOutofBounds /. periodicRules)},
Block[{pos, vertref, transvec},
Do[
With[{cellcoords = wrappedcellCoords[cell]},
pos = FirstPosition[cellcoords /. periodicRules, opt];
vertref = Extract[cellcoords, pos];
transvec = SetPrecision[vertOutofBounds - vertref, 8];
AppendTo[transvecList, transvec];
AppendTo[localtopology,
cell -> Map[SetPrecision[# + transvec, 8] &, cellcoords, {2}]];
], {cell, wrappedcells}]
];
];
];
];
] & /@ vertcs;
If[localcellunion != {},
AppendTo[localtopology,
Thread[localcellunion -> Map[Lookup[indToPtsAssoc, #] &,
cellVertexGrouping /@ localcellunion, {2}]]
]
];
transvecList = Which[
MatchQ[transvecList, {{{__?NumberQ}}}], First[transvecList],
MatchQ[transvecList, {{__?NumberQ} ..}], transvecList,
True,
transvecList //. {x___, {p : {__?NumberQ} ..}, y___} :> {x, p, y}
];
{localtopology, Flatten@wrappedcellList, transvecList}
];
The small excerpts from the code for the computation of surface gradient and volumetric gradient are as follows:
**SurfaceGradient**
ClearAll@surfaceGrad;
surfaceGrad::Information =
"surfaceGrad takes in arguments and computes the surface gradient about a point";
With[{epcc = ϵcc, epco = ϵco},
surfaceGrad = Compile[{{point, _Real, 1}, {opentr, _Real, 3},
{normalO, _Real, 2}, {closedtr, _Real, 3}, {normalC, _Real, 2}},
Block[{ptTri, source = point, normal, target, facept, cross,
openS = {0., 0., 0.}, closedS = {0., 0., 0.}},
Do[
ptTri = opentr[[i]];
normal = normalO[[i]];
cross = If[Chop[ptTri[[1]] - source, 10^-8] ⩵ {0., 0., 0.},
{target, facept} = {ptTri[[2]], ptTri[[-1]]};
Cross[normal, facept - target],
{target, facept} = {ptTri[[1]], ptTri[[-1]]};
Cross[normal, target - facept]
];
openS += (0.5 * cross), {i, Length@normalO}];
Do[
ptTri = closedtr[[j]];
normal = normalC[[j]];
cross = If[Chop[ptTri[[1]] - source, 10^-8] ⩵ {0., 0., 0.},
{target, facept} = {ptTri[[2]], ptTri[[-1]]};
Cross[normal, facept - target],
{target, facept} = {ptTri[[1]], ptTri[[-1]]};
Cross[normal, target - facept]
];
closedS += (0.5 * cross), {j, Length@normalC}];
epcc * closedS + epco * openS], CompilationTarget → "C", RuntimeOptions → "Speed",
CompilationOptions →
{"ExpressionOptimization" → True, "InlineExternalDefinitions" → True}]
**VolumeGradient**
Clear@volumeGrad;
volumeGrad::Information = "volumeGrad computes the volume gradient about a point";
volumeGrad[normalsAssoc_, cellids_, assocTri_, polyhedVols_, growingCellIds_] :=
Block[{celltopology, gradV, vol, growindkeys},
gradV = With[{nA = normalsAssoc, aT = assocTri},
Table[
celltopology = aT[cell];
(1. / 3.) Total[(areaTriFn[#] × nA[#]) & /@ celltopology], {cell, cellids}]
];
vol = AssociationThread[cellids → ConstantArray[Vo, Length@cellids]];
growindkeys =
Replace[Intersection[cellids, growingCellIds], k_Integer ⧴ {Key[k]}, {1}];
vol = Values@If[growindkeys ≠ {}, MapAt[(1 + Vgrowth time) # &, vol, growindkeys], vol];
kcv Total[((polyhedVols/vol) - 1) gradV]
];
Overall I am quite impressed by the latest versions of Mathematica. Something of this sort in my opinion was not possible before version 12. And so the computational geometry features are a welcome addition to the already extensive capabilities of Mathematica. I hope people at Wolfram
keep adding more and more features for computational geometry in the upcoming versions for Mathematica.
Note 1: In "vertex model 3D".nb I have tried to incorporate some simple schemes to detect and prevent collision of polyhedral cells. Theoretically, the polyhedrons can possibly intersect each other but in reality we know that cells are not ghosts. I hope that in the future release of Mathematica
some built-in fast functions for computational geometry can be incorporated to determine if two or more polyhedral objects are colliding or intersecting.
Note 2: The topological transition rule relies on a check - `SubIsomorphicQ` function from Szabolcs Horvat's brilliant IGraphM package.
Note 3: I have plans to expand the functionality in future by incorporating divisions and removal of polyhedrons in the mesh, in a manner mimicking biological cell division and death. Plus other functionalities will hopefully follow. If you have any interest in talking to me or wanting to contribute or optimise the code, please feel free to contact me.
References for figures:
Figure 1a:
https://www.researchgate.net/figure/Photograph-of-a-typical-dry-foam-a-close-packing-of-bubbles-of-a-wide-distribution-of_fig1_265117106
Figure 1b:
https://www.researchgate.net/figure/a-left-Confocal-microscope-image-of-a-developing-Drosophila-wing-E-cadherin-labelled_fig1_47809672
Figure 2: https://www.sciencedirect.com/science/article/pii/S0079610713000989
Figure 3: https://royalsocietypublishing.org/doi/pdf/10.1098/rstb.2015.0520
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=figure1.png&userId=942204
[2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=figure2.png&userId=942204
[3]: https://github.com/alihashmiii/3D-Vertex-Model
[4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=figure3.png&userId=942204
[5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=3399singlehexahedralprism2.PNG&userId=942204
[6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=meshwithandwithoutnoise.png&userId=942204
[7]: https://community.wolfram.com//c/portal/getImageAttachment?filename=transf.png&userId=942204
[8]: https://community.wolfram.com//c/portal/getImageAttachment?filename=finalmesh.png&userId=942204
[9]: https://community.wolfram.com//c/portal/getImageAttachment?filename=cellstatessuperimposed.png&userId=942204Ali Hashmi2020-08-04T20:36:12ZSolve[] not giving ConditionalExpression?
https://community.wolfram.com/groups/-/m/t/2052030
The following solution is finite only if `c` is not zero:
Solve[x * c == 1, x]
{{x -> 1/c}}
however, `Solve[]` does not return a `ConditionalExpression`. How could I enforce that? Thanks.Thomas Tse2020-08-05T13:07:31Z[Info] Office 365 Update v2007: SVG seems to work at last.
https://community.wolfram.com/groups/-/m/t/2051685
You can finally just copy / paste a graphic from Mathematica into PPT, save the PPT file and be reasonably confident that when you re-open the document, axes ticks and labels will still be in place.Mark Moores2020-08-05T16:46:00Z