Community RSS Feed
https://community.wolfram.com
RSS Feed for Wolfram Community showing any discussions in tag Wolfram Language sorted by activeHow to display a repeating decimal as a fraction in cloud?
https://community.wolfram.com/groups/-/m/t/2334939
I can't seem to see how to show a repeating decimal as a fraction in a cloud notebook:
Example:
0.183...
Sorry if this is obvious, can't seem to see it.Christopher Maughan2021-08-05T08:46:47Z[WSG21] Daily Study Group: programming tutorials
https://community.wolfram.com/groups/-/m/t/2330900
Daily Study Groups are back, now providing expertise on practical programming! After a short break, we're starting up with a series that picks up where Wolfram Language Basics sessions ended. This 3-week series will take you from basic programming concepts to package development.
Need tips on improving your code’s speed or functionality? Programming Tutorials offer a great opportunity to level-up your skills while interacting with software development professionals. See hands-on examples and get questions answered by Wolfram Language experts. Plus: participants who pass weekly quizzes are awarded a program completion certificate. Level 1 certification is available for those who pass manually graded exercises.
Join us any time between August 2 and August 20! Check out our [registration page][1] for more details.
[1]: https://wolfr.am/Study_Group15Wolfram U2021-07-30T15:24:02ZWhat is the best way to refactor code within a notebook?
https://community.wolfram.com/groups/-/m/t/2331999
Recently, I needed to rename some variables within a notebook. The only way I could find was to use search and replace. Although that worked, it was a bit error prone, and it made me think that there must be a better approach of which I was unaware.
Could someone enlighten me about the best way to refactor code within a notebook?
Cheers,
AndyAndrew Burnett2021-08-01T13:55:13ZHow to calculate probability density using observations?
https://community.wolfram.com/groups/-/m/t/2334559
Hi All
I am currently doing Master in data science. I came across the function PDF probability density function which is used to find cumulative probability(range) of a continuous random variable.
The PDF probability density function is plotted against probability density in y axis and Random variable in x axis.
I am not able to understand how to convert an experiments observation of continuous random variable into probability density function.
Kindly help me understand with a small example.
Thank you.naveen mani2021-08-05T08:06:36Z[WSS21] The 2-state cellular automaton with non-adjacent parent cells
https://community.wolfram.com/groups/-/m/t/2312836
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/2450f7ec-177c-4be6-aa73-8d6e49591368Alejandro Puga2021-07-13T18:46:34ZPlot the solution to a system of equations
https://community.wolfram.com/groups/-/m/t/2334480
What is the best way to plot the solution to a system of equations in 2D and 3D, where Mathematica does as much of the heavy lifting as possible?
I'd like to give Mathematica a system, say, x==y and y-x==0 and have Mathematica give me a 2D plot showing points (1,1) and (-1,-1). Or give Mathematica the system x^2+y^2+z^2==1 and x==y and get a 3D plot of a circle about the origin in the x=y plane.
I know how to produce the plots using ParametricPlot functions, but my hope is that Mathematica can give me a easier way to quickly visualize solutions to systems of equations more complicated than the examples above.
An even better visualization would be a manipulatable plot that toggles through the equations and their intersection.Jay Gourley2021-08-05T04:07:54Z[WSC19] Automated spot the difference
https://community.wolfram.com/groups/-/m/t/1732399
Description
-----------
I created a [website][1] that automatically makes a spot-the-difference challenge from various images. When given an image, I first find the specific items within the picture using ImageContents. I then remove or edit each of those contents and put the edited subimage back onto the original image, or in the case of removal, use InPaint to cover the gap.
When the user arrives at the site, they choose a difficulty level, whether they would like one image or all of the images in that difficulty range, and an image. They can click to the very right in order to reveal the correct solution.
General Image Functions
-----------------------
The heart of the functionality in my project is ImageContents, a function which uses machine learning to find and identify things in a given image. Though ImageContents uses the same idea as ImageIdentify, it can find items in subimages and not only the entire image. For example, lets take the ImageContents of this elephant image. It finds each elephant separately.
![enter image description here][2]
One of the first problems I ran into was that Inpaint will sometimes use parts of the original image which contain other objects: for example, Inpaint might successfully cover the large elephant, but catch the small elephant in its mask, covering the large elephant with an unsettling floating baby elephant head.
![enter image description here][3]
In order to solve this, I created my first function: `mask` which solves the issue of not being able to auto-generate masks based solely on their bounding boxes.
boundingboxes[image_]:=Quiet[Check[
List @@@ Flatten@
Values@Normal@ImageContents[image, All, "BoundingBox"], {}]]
The next function I created is called `expunge`, which utilizes `mask` to Inpaint the image contents.
mask[{{col1_, row1_}, {col2_, row2_}}, {nrows_, ncols_},
previous_: None] :=
Table[If[nrows - row2 < row <= nrows - row1 + 1 &&
col1 < col <= col2, 1,
If[previous === None, 0, previous[[row, col]]]], {row,
nrows}, {col, ncols}]
The next function I made is called ImageMapAt. ImageTrim trims the contents out of the image and applies the given function to the trimmed contents. ImageMapAt uses ImageCompose to shove the edited contents back into the original image, one at a time. Also, ImageMapAt uses the parameters {Left,Top} to align the edited contents correctly when pasting them back into the image, so it doesn't return outputs like this:
![enter image description here][4]
## Image Difference Functions ##
Once all my general functions were working, my next step was to create functions to be applied to the images to automate the differences. These functions were based on built-in functions in the Wolfram Language, but specified to visible yet not too obvious variations. These include `blurred`, which blurs an image by 2 units, `darker` which darkens dominant colors, `aquarecolor` which replaces a dominant color with part of the gradient Aquamarine, and various others.
## Displaying Image Differences ##
Once I had created differences, my next step was to display them. The idea is simple, merely subtract the original image from the one with differences. The difficult part was finding a way to display them nicely as the default had the differences placed on a black background making them hard to see and the ColorNegated version of it was too bright, so I used ImageAdjust. Here are some of the results.
![enter image description here][5]
## Image Distance Sorting ##
Now that I had created and displayed the differences, I sorted the images into the order of larger changes to smaller ones using ImageDistance, because the larger the distance is, the bigger the change. For example, compare these two distances. Wouldnt you agree the first one is roughly ten times easier than the second?
![enter image description here][6]
![enter image description here][7]
## Website Code ##
I then created LibraryAdd, a function that is used to add images into my curated image library. Lastly, I created my website. The basic idea is that next to the original (left) and the new image (right), there will be a blank/white image that I refer to as "blank." The user clicks on the "empty space" once they think they know the difference, and then the correct difference is shown. If it is clicked again, the image returns to its original blank state. The code is shown below.
CloudDeploy[
FormFunction[{"difficulty" -> {"easy" -> {0, 1/4},
"medium" -> {1/4, 1/2}, "hard" -> {1/2, 3/4},
"impossible" -> {3/4, 1}}, "selection" -> {"random", "all"},
"image" -> (CloudImport[First@# <> "/1.png"] -> First[#] & /@
Select[CloudObjects[
"gallery"], ! StringContainsQ[First@#, ".png"] &])},
With[{total = Length[CloudObjects[#image <> "/"]]/2,
original = #image <> "/1"},
Grid[With[{orderly =
Table[With[{new = #image <> "/" <> ToString[i]},
"<img height=\"200px\" src=\"" <> If[#2, blank, #] <> "\"" <>
If[#2,
" onclick=\"javascript:this.src=(this.src=='" <> # <>
"' ? '" <> blank <> "' : '" <> # <> "');\"", ""] <>
">" & @@@ {original <> ".png" -> False,
new <> ".png" -> False, new <> "a.png" -> True}],
{i, TakeQuantile[Range[2, total], #difficulty]}]},
If[#["selection"] === "random", {RandomChoice[orderly]},
orderly]]]] &,
AppearanceRules -> <|"Title" -> "Spot the Difference",
"Description" ->
"Choose a difficulty, whether you would like to see the \
solutions or not, and an image, then hit submit to try to spot the \
difference between the original image on the left and the edited one \
on the right. <i><a \
href=\"mailto:stella@maymin.com\">stella@maymin.com</a></i>"|>], \
"spot.me", Permissions -> "Public"]
## Future Work ##
In the future, as an extension of my website, I would like to find a way to create more of a game, perhaps by using dynamics. Another extension may be to create a timer counting in seconds how long it took the user to click the correct difference, or a counter of how many incorrect clicks on the Locator there were. Using those high scores, I think it might be possible to create a Leaderboard across all users. This would create a competition between users all over the world, so they can try to beat each others high scores in the race to the top. Lastly, a simpler extension is to create the option of allowing the user to upload their own images, which would be saved in my master library. This would let users play with images others have uploaded.
## Acknowledgements ##
I would like to thank my mentor, Rory Fougler, for helping me with my code every step of the way. It really made a huge difference. I would also like to thank Chip Hurst for providing various insights and helpful functions throughout my project. Lastly, I would like to thank Mads Bahrami, Kyle Keane, and Anna Musser for making this entire experience truly unforgettable. Overall, I am so grateful for my knowledge and capabilities now, thanks to my stay here at the Wolfram High School Summer Camp.
[1]: https://www.wolframcloud.com/obj/stella/spot.me
[2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ImageContentselephants.png&userId=1720407
[3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=OopsPost.png&userId=1720407
[4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=oopsididitagainpost.png&userId=1720407
[5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=orderlydiffs.png&userId=1720407
[6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ImageDistance01.PNG&userId=1720407
[7]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ImageDistance03.PNG&userId=1720407Stella Maymin2019-07-12T01:28:57ZPerform a regression analysis with a moderating variable?
https://community.wolfram.com/groups/-/m/t/2334397
Hi all! I'm quite new to Mathematica (and coming from SPSS) and now I feel a bit lost. I would like to run a regression analysis, with one moderator variable. My variables are qualitative (1-7 likert scale). If this is helpful, I also attached a sample file. If you could provide some guidance, or some initial steps to take, I would really appreciate it. Thanks a lotMaya Novak2021-08-04T18:18:30ZImplement a clock that can be used to synchronize another clock?
https://community.wolfram.com/groups/-/m/t/1176707
How can I implement a clock that can be used to synchronize another clock?Rodrigo Sambade2017-09-04T15:13:27ZDefinite integral over Owen's T function and exponential
https://community.wolfram.com/groups/-/m/t/2334735
I posted the question also here https://math.stackexchange.com/q/4217369/680634 . For some reason, the LaTeX does not compile here.
For my research, I must solve many integrals of the [Owen's T function][1]. As such, I am having struggles in calculating the integral
\begin{equation}
f(x, t) = \int_{0^{-}}^{t}d{s} \ e^{-(t+s)} \ \operatorname{T}\left(\frac{x}{\sqrt{2t}}, \sqrt{\frac{s}{2t-s}}\right).
\end{equation}
I asked a similar question in [[1][2]] for the integral
$$
\int_{0^{-}}^{t}d{s} \ \operatorname{T}\left(\frac{x}{\sqrt{2t}}, \sqrt{\frac{s}{2t-s}}\right),
$$
which was beautifully answered. Nevertheless, if one follows the same procedure the exponential complicates things. What I have done until know is following [[1][3]] which yields
![enter image description here][4]
where we performed the change of variable $s=tu$ and took $y=\frac{x}{2\sqrt{t}}$. Substituting the definition for Owen's T function and using Tonelli theorem gives
![enter image description here][5]
Taking the integral over u
$$
f(x,t)= \frac{1}{2\pi}t \int_{0}^{1} d{v} \ \frac{e^{-y^2(1+v^2)}}{1+v^2}\left(\frac{e^{\frac{2 t}{v^2+1}-3 t}}{t}-\frac{e^{-2 t}}{t}\right)
= -\frac{1}{2\pi} e^{-2 t}\int_{0}^{1} d{v} \ \frac{e^{-y^2(1+v^2)}}{1+v^2}+\frac{1}{2\pi} \int_{0}^{1} d{v} \ \frac{e^{-y^2(1+v^2)}}{1+v^2}e^{\frac{2 t}{v^2+1}-3 t}
$$
And using the definition of Owen T function gives
\begin{equation}
f(x, t)= -T\left(\tfrac{x}{\sqrt{2t}}, 1\right)e^{-2 t}+\frac{1}{2\pi} e^{-3t} \color{blue}{\int_{0}^{1} d{v} \frac{e^{-y^2(1+v^2)}}{1+v^2}e^{\frac{2 t}{v^2+1}}}
\end{equation}
The Owen T term, i.e. the first term, can be written in terms of Error function. However, I am struggling in solving the integral in the second term. I have tried integrate by part, but this just yield a more complicated expression. Someone who knows a way forward?
Also I checked above calculation numerically and it indeed holds up!
In[270]:= ClearAll["Global`*"];
int1[x_, t_]:=-OwenT[x/Sqrt[2t],1]*Exp[-2t]+1/(2\[Pi])*Exp[-3t]*NIntegrate[ Exp[-(x/(2Sqrt[t]))^2*(1+v^2)]/(1+v^2)*Exp[(2t)/(1+v^2)], {v,0,1},WorkingPrecision->7] ;
int2[x_, t_]:=NIntegrate[Exp[-(t+s)]*OwenT[x/Sqrt[2t],Sqrt[s/(2t-s)]], {s,0,t},WorkingPrecision->7] ;
{x,t}=RandomReal[{0,1},2,WorkingPrecision->50];
int1[x, t]
int2[x, t]
Out[274]= 0.01602865
Out[275]= 0.01603027
[1]: https://en.wikipedia.org/wiki/Owen%27s_T_function
[2]: https://math.stackexchange.com/q/4215629/680634
[3]: https://math.stackexchange.com/q/4215629/680634
[4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2021-08-05172136.jpg&userId=20103
[5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2021-08-05172348.jpg&userId=20103Orjan Ameye2021-08-05T13:43:29ZSimulating a real-time ticker
https://community.wolfram.com/groups/-/m/t/2084630
Hello all,
It seems that my previous inquiry was removed by the moderators as they wanted to see me invest time and effort in my problem. I have invested time and effort in the more "algorithmic" parts of my project, but now I need a bit of help in controlling the charting of stock data.
Here is my situation. For the past 20 years, as an Electrical Engineer with an interest in the recognition of stock trading patterns, I have worked with Technical Analysis. I have worked for startups and written software that can recognize trendlines, technical patterns, and Elliott Waves. I have done all of my previous work in C# and absolutely love the topic. It gives me something to do besides my day job as a university professor in the Department of Computer Science.
I have been enamoured with Mathematica since the mid 2000's. However, for some reason, I have found it difficult to learn, compared to all the previous (traditional and not so traditional) languages I have mastered (Basic, Forth, C, C++, C#). One of my problems is that I was always impatient to get the work done and I could do that with something like C++ with my favorite, C#. It could take me a couple of 100's of lines, but the process was rather simple.
But with Mathematica, it is a different mental approach. What I love with Mathematica, is that I can take those 100's of C# lines and compress them into 10 lines (or less) of Mathematica. The problem is that, while I can write those 100's of C# lines in an hour or so, it takes me a week for me to get my head around all the functions, tables, lists, etc,,, I use in Mathematica.
The final result in Mathematica is like a work of art. It is beautiful, it speaks to my mind. The work in C# produces a beautiful application, but I don't find the program itself that fascinating. It is a bit like pointillism. The pixels (the programs or lines of code), in themselves are not that interesting, but the overall effect (the application) can be quite stunning.
In Mathematica, you don't have pixels, but swaths of paint of different colors (List, Map, BlockMap, etc...) and combinations of a few swaths (a single line of Mathematica can be simply mesmerizing). However, it can take hours to design that swath or understand someone else's swath.
I thus decided to delve into Mathematica and I wanted an interesting project to do so. I chose to rewrite my Technical Analysis Suite in Mathematica. My C# version, displays stock data, indicators, patterns (like channels, triangles, pennants, flags, etc...) and now can analyze all the potential Elliott wave patterns present in a stock move from one time (minute, day, week or month) to another.
I plan on taking a large number of stocks over a certain period and generate all of the possible Elliott wave patterns that were created for each stock during that period. Then I will feed to patterns (and their subsequent result) into an AI algorithm to create an Algorithm that can then be used to determine if a particular stock should be bought or sold.
I have never been convinced that a single individual (Ralph Nelson Elliott) could, before the advent of computers, figure out how markets work. But, I figure that his theory of Elliott Waves could be tested.
The problem, from what I understand, is that, if you put five Elliotticians (as they are called) into a room and show them a stock chart, you will get 5 different interpretations, all of them acceptable!
My view is to take away the human element, find any and all potential waves, then feed them into an AI machine and see if our powerful modern-day algorithms can figure out which patterns have strong predictive powers.
As such, I have put in a lot of work in converting my C# code to Mathematica. I can't tell you how amazed I am in the power of Mathematica, taking thousands of lines of C# code and reducing them to about a dozen lines of Mathematica code!
Given a stock over a period of time, my code will determine ALL the potential Elliott Wave patterns that occurred for that stock during that period of time. At some point that information could have been used to make trading decisions.
However, my interest is in deciding, once and for all for me, whether or not the different patterns mentioned in the literature (things like the bat, the butterfly, the crab, the shark, etc... from "The Harmonic Trader" do occur and do have predictive power. I have found that they do occur, and often. As for the predictive power, I see anecdotal evidence, but would like to take the decisive step of simply feeding mathematically provable patterns (meaning that the patterns I feed are ALL the possible wave patterns in the chart) into an AI program and generating an algorithm (e.g. Neural Network) that could then tell us what its predictive power is.
We could also see if the Support/Resistance prices generated by the Elliott Waves are also validated.
In order to do so, I wanted to have the ability to display the stock on a chart. I have used Mathematica[s InteractiveTradingChart which offers a great way to display stock data. My problem is that InteractiveTradingChart shows the chart in one short. What I want to do is to show the chart incrementally. What I mean by that is that I want to show the first bar, and then, after a short period of time, show the next bar, and so on. I might want to show each new bar after a delay of 5 seconds (or any other time period) in order to simulate a ticker. Also, my algorithm works in an incremental fashion. You feed it a new bar and it figures out what new information or new Elliott Wave may have emerged from the new bar. All I've been able to do so far is ask the chart to redraw itself, with the new bar, But I do this by reloading the FinancialData (which takes a while) after having updated the last day of interest. This is not satisfying. I would like to read all the data in one short (reading weekly bars for instance, from Jan 1, 2020 to the current day) and then feeding the bars one at a time to the chart once every 5 seconds.
I don't know how to programatically control the display of the chart. There is a little window on the bottom which can be slid left or right or stretched to show more or less of the stock. One approach I an thinking of is to start the window on the first day of the stock data I have and every 5 seconds, change the change the right edge of the window to the next day. In this way, it would look like the chart is updating itself every 5 seconds.
Can anyone help with my problems?Henrick Jeanty2020-09-27T18:04:52ZModified Bessel function of the second kind
https://community.wolfram.com/groups/-/m/t/2334964
The modified Bessel functions of the second kind K_m can be represented by:
![enter image description here][1]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=K_m.png&userId=2334949
I tried to calculate this integral with Mathematica Version 12:
f[t_] := Exp[-x*Cosh[t]]*Cosh[m*t];
Integrate[f[t], {t, 0, Infinity}]
Unfortunately Mathematica does give no result by solving the integral above. Can someone explain me, how to solve this integral with Mathematica.
Thank you for your help in advance.
RuedigerGerd-Rüdiger Jaenisch2021-08-05T11:10:03ZWhy is there a grid pattern in Opacity+Rasters in 12.3?
https://community.wolfram.com/groups/-/m/t/2285567
Not sure why this is happening. I have used the same code for years but in 12.3 I see strange things happening. Can anybody reproduce this.
im1 = Rescale@Table[i, {i, 50}, {j, 50}];
im2 = Rescale@Table[j, {i, 50}, {j, 50}];
r1 = Raster[im1, ColorFunction -> ColorData["GrayTones"]];
r2 = Raster[im2, ColorFunction -> ColorData["SunsetColors"]];
GraphicsRow[{Graphics[r1], Graphics[r2],
Graphics[{r1, {Opacity[.3], r2}}]}]
![enter image description here][1]
When I rescale images the pattern changes.
![enter image description here][2]
Its also rendered when converting to images
GraphicsRow[
Image /@ {Graphics[r1], Graphics[r2], Graphics[{Opacity[.5], r2}],
Graphics[{r1, {Opacity[.3], r2}}]}]
![enter image description here][3]
![enter image description here][4]
And it also is there when exporting to jpeg or other image formats, but depends on the image resolution used.
Export["test-d.jpg", Graphics[{r1, {Opacity[.3], r2}}]];
Export["test-h.jpg", Graphics[{r1, {Opacity[.3], r2}}],
ImageResolution -> 1200];
default resolution
![enter image description here][5]
high resolution
![enter image description here][6]
That little piece of code is the backbone of my image viewer that I use on a daily basis so would love to have a solution.
![enter image description here][7]
![enter image description here][8]
And I noticed it's also there in the documentation of Raster (at least on my system).
![enter image description here][9]
It doesn't happen in Wolfram cloud
![enter image description here][10]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=7957im1.png&userId=1332602
[2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=1286im2.png&userId=1332602
[3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=9090im3.png&userId=1332602
[4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=im4.png&userId=1332602
[5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=test-d.jpg&userId=1332602
[6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=test-h.jpg&userId=1332602
[7]: https://community.wolfram.com//c/portal/getImageAttachment?filename=im5.png&userId=1332602
[8]: https://community.wolfram.com//c/portal/getImageAttachment?filename=im6.png&userId=1332602
[9]: https://community.wolfram.com//c/portal/getImageAttachment?filename=im7.png&userId=1332602
[10]: https://community.wolfram.com//c/portal/getImageAttachment?filename=cloud.png&userId=1332602Martijn Froeling2021-06-08T09:55:23ZSolving inequality in Wolfram|Alpha?
https://community.wolfram.com/groups/-/m/t/2334569
Hi everyone,
does anyone know why Mathematica does not understand this input?
![enter image description here][1]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=MathematicaPorblem2.PNG&userId=2331562
I want to solve this inequality such that I obtain a condition for j.
Thank you for the help!Marie Hasdenteufel2021-08-05T09:04:31ZMathematica v12.2 breaks the compatibility of Workbench (v10.1.822)
https://community.wolfram.com/groups/-/m/t/2167323
I had already raised the same issue in a separate discussion, but after a bit of research (digging), I decided to start a new one because I am now more confident that it is not a simple bug but a systematic compatibility issue.
It looks like WRI has gradually developed paclet tools (including documentation tools) for years. With Mathematica 12.2, the paclet tools seem to have become quite "mature". It has a complete new packages bundle PacletTools under SystemFiles/Components, and it includes DocumentationBuild. I guess it might enable us to build documentation files even without Workbench (for small-scale projects).
Two unfortunate things:
1. Obviously, the compatibility with the current public version of Workbench is broken. For example, when you try to build your documentation, Workbench tries to load DocumentationAssets, which is intended for WRI insiders (according to PacletTools, it should never happen). It is said that they have internally much advanced (and most likely compatible) version of Workbench inside WRI. I hope they release an updated public version which is compatible with 12.2.
2. The documentation of PacletTools (and included DocumentationBuild) is poor. You cannot apply those new tools to the documentation files generated with Workbench; many deprecated functions and so on. I could not yet figure out how to work around the problems.Masso Chailly2021-01-19T09:52:23ZClassifying stocks by their price volatility
https://community.wolfram.com/groups/-/m/t/2333494
![Percent Change over Time of Tesla, Amazon, and Ford][1]
&[Wolfram Notebook][2]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=StockVolatility.png&userId=2317066
[2]: https://www.wolframcloud.com/obj/0435cfb6-cd1d-495e-8419-76323ffdd81eArshaan Sayed2021-08-03T21:23:02ZDracula Theme for Wolfram Notebooks
https://community.wolfram.com/groups/-/m/t/2018326
![example-screenshot][2]
This theme is my go-to for dark mode, and I use it across several applications. So, I implemented the Dracula theme for Wolfram Notebooks!
If you're interested in using it, you can get it from two places:
## [GitHub repo](https://github.com/jldohmann/wolfram-notebooks)
### Get the files
If you are a git user, you can get the theme and keep up to date by cloning the repo:
$ git clone https://github.com/jldohmann/wolfram-notebooks.git
### Install the stylesheet
1. The stylesheet is titled "Dracula.nb". Move the stylesheet to folder where your Wolfram Desktop application is installed, and into SystemFiles. Run this code to open the folder:
SystemOpen[FileNameJoin[{$UserBaseDirectory, "SystemFiles", "FrontEnd", "StyleSheets"}]]
You may need to restart your application to see the changes take effect.
2. Open a new notebook, and from the menu go to Format > Stylesheet > Dracula to change the stylesheet to the Dracula theme.
Please feel free to file issues for suggestions or bugs!
## Function Repository
1. Get the [DraculaTheme Resource](https://resources.wolframcloud.com/FunctionRepository/resources/DraculaTheme)
2. Install the stylesheet system-wide with the following:
ResourceFunction["DraculaTheme"]["Install"]
[2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=screenshot.png&userId=515558Jesse Dohmann2020-07-03T01:01:57Z[WSS21] Expression difference
https://community.wolfram.com/groups/-/m/t/2312810
![ExpressionDifference][1]
&[Wolfram Notebook][2]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=diff.png&userId=2253909
[2]: https://www.wolframcloud.com/obj/3d68e9ac-8174-4528-8657-e8af79d6f98dAman Dewangan2021-07-13T17:59:20ZShowing two overlapped lines in a plot?
https://community.wolfram.com/groups/-/m/t/2333570
I'm plotting two expressions and their lines happen to be the same. However, I want to show that they are two different lines. On the diagram, only the second line is visible because it 'falls' on the first one. How can I show that there are two different lines that just happen to be equal?
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/d94ee615-4445-45c6-9917-d85307c62a54Tania Gerou2021-08-04T15:41:26ZPolling Entity and handling network errors
https://community.wolfram.com/groups/-/m/t/2333991
Hello, I use Entity["Isotope",...] to calculate radioactive decay chains. These calculations last up to several days. During this time, I get sometimes network errors because of timeouts:
… EntityValue::conopen: Using EntityValue requires internet connectivity. Please check your network connection. You may need to configure your firewall program or set a proxy in the Internet Connectivity tab of the Preferences dialog.
… EntityValue::nodat: Unable to download data. Some or all results may be missing.
The output result is:
Missing[RetrievalFailure]
My internet service provider (isp) does something, I cannot avoid. As a result I must restart the calculation. To avoid this I want to have some code, that ensures, that the Entity[…] request worked correct with no error. I think, that the following code shows what I am searching:
Without error handling I defined the function ssEntity (ss as first letter means stored):
ClearAll@ssEntity;
ssEntity[type$of$entity_String,isotope$name_String][propety_String]:=ssEntity[type$of$entity,isotope$name][propety]=Entity[type$of$entity,isotope$name][propety];
ssEntity["Isotope","Pu236"]["AtomicMass"]
gives the correct output
Quantity[236.046057964,"AtomicMassUnit"]
To manage network errors, I defined
ClearAll[sEntity];counted$polls=0;
sEntity[type$of$entity_String,isotope$name_String][propety_String]:=(*sEntity[type$of$entity,isotope$name][propety]=*)Block[{p,f},While[MissingQ@(f=Enclose[ConfirmQuiet[p=Entity[type$of$entity,isotope$name][propety]],Missing[]&]);(**);Pause[1];MissingQ@f,counted$polls++;Echo[{f,p,MissingQ@f,counted$polls}];f];p];
sEntity["Isotope","Pu244"]["AtomicMass"]
doesn’t do what I want with network connection ore without it.
Kind regards from Peter.Peter Klamser2021-08-04T16:07:48ZRiemann Zeta function on positive odd
https://community.wolfram.com/groups/-/m/t/2333783
Hello members,
I am interesting on Zeta Function, Riemann Hypothesis and, linear independence and formulas of zeta on positive odd. I demonstrated analytically the formula for Zeta[4n-1]; n=2,3,4, ...
Example:
Zeta_[4n-1]=For[n=2,n<=11,n++,Print[N[(1/(2n-1))Sum[Zeta[2p]*Zeta[4n-1-2p],{p,1,2n-2}],16]]]
I did the comparison between this formula with the value given by Mathematica, Zeta[4n-1]; the absolute and relative errors are small. Me, I was waiting to see that, very very small. Somebody can help me on this calculation and give me the commentaries.
L'erreur absolue;
In[18]:= For[n=2,n<=11,n++,Print[Abs[N[(1/(2n-1)) (Sum[Zeta[2p]*Zeta[4n-1-2p],{p,1,2n-2}])-Zeta[4n-1],16]]]]
L'erreur relative en pourcentage;
In[20]:= For[n=2,n<=11,n++,Print[100Abs[N[ (Sum[Zeta[2p]*Zeta[4n-1-2p],{p,1,2n-2}]/(2n-1)-Zeta[4n-1])/Zeta[4n-1],16]]]]
Sincerely your
Mundankulu KabongoMundankulu Kabongo2021-08-03T20:26:25Z[WSG21] Daily Study Group: Building and Applying Epidemic Models
https://community.wolfram.com/groups/-/m/t/2251812
A new study group for Building and Applying Epidemic Models with the Wolfram Language begins Monday, May 10, 2021!
Making progress in an online course can be daunting when you have to study all alone. Join a cohort of fellow Wolfram Language users for a two-week study group in which you will start in week one with the basics of implementing compartment-based epidemiological models in the Wolfram Language. In the second week, you will cover multi-group models–taking into account vital demographics (i.e. birth, death) and age groups–in addition to introducing control measures and ending with stochastic models.
**Sign up here**: https://wolfr.am/UZfPoLAqJeremy Stratton-Smith2021-04-23T20:17:17ZMoment of inertia of a (homogenous) triangle in R3
https://community.wolfram.com/groups/-/m/t/2333682
In a forgoing post
https://community.wolfram.com/groups/-/m/t/2332921
the moment of inertia of a triangle in R2 rotating around a point was calculated.
Here a method is given to do this in R3, the triangle rotating around an axis thru x4 and with direction b
(* square of distance of a point p to an axis thru x and direction b *)
Clear[dist]
dist2[p_, x_, b_] := Module[{aa, fL, vB},
aa = p - x;
fL = b.aa/(b.b);
vB = p - x - b fL;
vB.vB]
(* Moment of Inertia of a triangle given by x1, x2, x3 with respect to axis thru x4 and direction b *)
Clear[fMI]
fMI[x1_, x2_, x3_, x4_, b_] := Module[{d2, d3, fe},
d2 = x2 - x1;
d3 = x3 - x1;
fe = Cross[d2, d3];
fe = Sqrt[fe.fe]; (*surface-element of Triangle*)
Integrate[ fe dist2[x1 + u d2 + v d3, x4, b], {v, 0, 1}, {u, 0, 1 - v}]
]
Check with the result of forgoing post
fMI[{4, 1, 0}, {1, 3, 0}, {2, 7, 0}, {.5, 5, 9}, {0, 0, 3}]Hans Dolhaine2021-08-03T14:52:52ZSimulating brain tumor growth with diffusion-growth model
https://community.wolfram.com/groups/-/m/t/294122
![enter image description here][5]
When playing with Mathematica 10 I constructed this very simple example of an application of the NDSolve command, which I wanted to share. The objective is to model the growth of a special kind of brain tumour which affects mainly glial cells in a highly simplified way. I follow modelling ideas discussed in the excellent book ["Mathematical Biology" (Vol 2) by J.D. Murray][1]. It turns out that Gliomas, which are neoplasms of glial cells, i.e. neural calls capable of division, can be be modelled by a rather simple diffusion-growth model.
$$\frac{d c}{dt}=\nabla\left(D(x) \nabla c \right)+ \rho c$$
where c is the concentration of cancer cells and $D(x)$ is the diffusion coefficient, which depends on the coordinates; $\rho$ models the growth rate of the cells. The following boundary condition has to be observe (even though will be ignored in the model I use later on):
$${\bf n} \cdot D(x) \nabla c = 0 \qquad \text{for}\; x\; \text{on}\; \partial B.$$
In reality the diffusion coefficient will depend on the tissue type, i.e. gray matter vs white matter. I will use an image from a CT can to describe the different densities of the tissue instead.
![enter image description here][2]
In the book by Murray great care is taken to estimate the diffusion coefficient but I just want to show the principle here. I use the attached file "brain-crop.jpg" and import it:
img2=Import["~/Desktop/brain-crop.jpg"]
Then I sharpen it and convert it to gray-scale.
img3 = Sharpen[ColorConvert[img2, "Grayscale"]]
Then I use that image to determine the diffusion coefficient, locally:
diffcoeff = ListInterpolation[ImageData[img3], InterpolationOrder -> 3]
I should now determine the boundaries using something like EdgeDetect. As the background is black and allows no diffusion at all, we can simplify this by just setting a larger (rectangular) boundary box like so:
boundaries = {-y, y - 1, -x, x - 1};
\[CapitalOmega] =
ImplicitRegion[And @@ (# <= 0 & /@ boundaries), {x, y}];
Next we can solve the ODE on the domain:
sols = NDSolveValue[{{Div[1./500.*(diffcoeff[798.*x, 654*y])^4*Grad[u[t, x, y], {x, y}], {x, y}] - D[u[t, x, y], t] + 0.025*u[t, x, y] == NeumannValue[0., x >= 1. || x <= 0. || y <= 0. || y >= 1.]}, {u[0, x, y] == Exp[-1000. ((x - 0.6)^2 + (y - 0.6)^2)]}}, u, {x, y} \[Element] \[CapitalOmega], {t, 0, 20}, Method -> {"FiniteElement", "MeshOptions" -> {"BoundaryMeshGenerator" -> "Continuation", MaxCellMeasure -> 0.002}}]
Note that we start with an initially Gaussian distributed tumour and describe its growth from there. Also I took the fourth power of the diffcoeff function, which changes the relation between grayscale and diffusion rate. You can change the coefficient to get different patterns for the growth. Interestingly, this integration gives a warning about intersecting boundaries in MMA10, which it did not say in the Prerelease version; if someone can fix that, that would be great. For any time we can now overlay the resulting distribution onto the CT image:
ImageCompose[img3, {ContourPlot[
Max[sols[t, x, y], 0] /. t -> 2, {y, 0, 1}, {x, 0, 1},
PlotRange -> {{0, 1}, {0, 1}, {0.01, All}}, PlotPoints -> 100,
Contours -> 200, ContourLines -> False, AspectRatio -> 798./654.,
ColorFunction -> "Temperature"], 0.6}]
This should give something like this:
![enter image description here][3]
Using
frames = Table[
ImageCompose[
img3, {ContourPlot[
Max[sols[d, x, y], 0] /. d -> t, {y, 0, 1}, {x, 0, 1},
PlotRange -> {{0, 1}, {0, 1}, {0.01, All}}, PlotPoints -> 100,
Contours -> 200, ContourLines -> False,
AspectRatio -> 798./654., ColorFunction -> "Temperature"],
0.6}], {t, 0, 10, 0.5}];
we get a list of images,
![enter image description here][4]
which can be animated
ListAnimate[frames, DefaultDuration -> 20]
to give
![enter image description here][5]
This is only a very elementary demonstration, and certainly still far away from a "real" medical application, but it demonstrates the power of NDSolve and might, in a modified form, be useful as a case study for some introductory courses.
Cheers,
Marco
[1]: http://www.springer.com/new+&+forthcoming+titles+%28default%29/book/978-0-387-95228-4
[2]: /c/portal/getImageAttachment?filename=brain-crop.jpg&userId=48754
[3]: /c/portal/getImageAttachment?filename=BrainTumor-still.jpg&userId=48754
[4]: /c/portal/getImageAttachment?filename=1473BrainTumor-frames.jpg&userId=48754
[5]: /c/portal/getImageAttachment?filename=BrainTumor.gif&userId=48754Marco Thiel2014-07-14T13:54:54ZMoment of inertia of a triangle in R2 with respect to a point
https://community.wolfram.com/groups/-/m/t/2332921
A couple of hours ago someone asked how to calculate the moment of inertia of a (homogenous) triangle with respect to a point of rotation. I think it could be done like this
xx = {{4, 1}, {1, 3}, {2, 7}}; (*start*)
rr = {.5, 5}; (*point of rotation*)
a = .522; (* angle of rotation , to move the triangle around*)
(*rotated triangle*)
xx = # + rr & /@ ({{Cos[a], -Sin[a]}, {Sin[a], Cos[a]}}.(# - rr) & /@ xx);
(* point ( element R2 ) in triangle-cooridantes *)
\[Xi]1 = xx[[1]] + (xx[[2]] - xx[[1]]) u + (xx[[3]] - xx[[1]]) v;
(*cofactor for volume-element in triangle-coordinates*)
jj = Abs[Det[D[\[Xi]1, {{u, v}}]]]
(*moment of inertia of homogenous triangle with respect to rr *)
theta = Integrate[(\[Xi]1 - rr).(\[Xi]1 - rr) jj, {v, 0, 1}, {u, 0,1 - v}]
ParametricPlot[\[Xi]1, {v, 0, 1}, {u, 0, 1 - v}, AxesOrigin -> {0, 0},
Epilog -> {Red, PointSize[.025], Point /@ xx, Blue, Point[rr]}]Hans Dolhaine2021-08-02T17:41:28ZReproducing a generalization of the logistic map bifurcation diagram
https://community.wolfram.com/groups/-/m/t/2332065
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/385b0ba5-9e11-4f7a-98b1-9ed196a87010Christophe Favergeon2021-08-01T13:09:37ZSimplify 3rd order ODE to v''' + Z v = F a general formula
https://community.wolfram.com/groups/-/m/t/2332816
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/82028527-34c0-4dad-8b99-2de83055faa0Rauan Kaldybaev2021-08-02T13:26:57ZUsing the Gurobi Optimizer in the Wolfram Language
https://community.wolfram.com/groups/-/m/t/2333107
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/54323170-e51a-47ca-a4d4-3516daa04d8dArnoud Buzing2021-08-02T17:06:46ZInstalling & using Wolfram Engine on Windows and Mac through command line
https://community.wolfram.com/groups/-/m/t/2332560
&[Wolfram Notebook][1]
**Keywords:** Wolfram Language, Wolfram Engine, wolframscript, Command Line, CLI, Terminal
[1]: https://www.wolframcloud.com/obj/51f32d4b-2c1f-459b-88cc-f105e5a01162Alec Graves2021-08-02T14:55:37ZTraining a recurrent neural network (RNN) to generate piano music
https://community.wolfram.com/groups/-/m/t/2328597
> **GitHub Repository:** https://github.com/alecGraves/Howl
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/da6d3b76-7bbf-4a55-9fcd-058e7f1e17bfAlec Graves2021-07-27T14:09:12ZBrain haemorrhage diagnosis: using LeNet based deep learning model
https://community.wolfram.com/groups/-/m/t/2273879
Introduction
------------
Brain haemorrhage is a type of stroke. It's caused by an artery in the brain bursting and causing confined bleeding in the enclosing tissues. This bleeding kills brain cells.
The Greek root for blood is hemo. Haemorrhage means "blood bursting forth." Brain haemorrhages are also called cerebral haemorrhages, intracranial haemorrhages, or intracerebral haemorrhages.
Cerebral haemorrhage deems for about 13% of all strokes in the United States. It is the next foremost cause of stroke. (The principal cause of stroke is a blood clot – thrombus – in an artery in the brain, which blocks blood flow and cuts off required oxygen and nutrients to the brain.)
Importing Dataset
------------
I implied a data set of haemorrhage and non-haemorrhage brain from Kaggle. Each class placed in its corresponding variable.
infected=FileNames["*.png","E:\\COURSES\\Wolfram\\BrainTumorImagesDataset\\training_set\\hemmorhage_data"];
uninfected=FileNames["*.png","E:\\COURSES\\Wolfram\\BrainTumorImagesDataset\\training_set\\non_hemmorhage_data"];
Constructing File Objects for Images
------------
I wanted to match each brain image with a value of either true for Hemorrhage or false for no Hemorrhage. To improve the efficiency of the importation, I formulated separate file objects for each of the image variables. Each variable contained 70 images for parasitized and uninfected cells.
infectedIMG = File /@ infected;
uninfectedIMG = File /@ uninfected;
Then I created a record of 70 true and false values which would be used to be matched up with their respective images. I set these lists in variables and made another variable to connect the list of true and false values along with another variable that connected the infected and uninfected file objects.
Length[infectedIMG]
70
infectedvalues=Table[True,Length[infected]];Length[uninfected]
70
uninfectedvalues=Table[False,Length[uninfected]];
Finally, using the AssociationThread function, I associated the images with their values and divided the data into two groups, 75% for training and 25% for validation.
data=RandomSample[AssociationThread[infectedIMG->infectedvalues]];
traininglength=Length[data]*.75
52.5
trainingdata=data[[1;;52]];validationdata=data[[53;;]];
Creating the Neural Network
------------
I then started to work on the Neural Network, which used MNIST image classification. The network's goal is to classify uninfected and infected using true and false to describe whether the patient suffers Brain Haemorrhage or not. I built a NetChain function that had multiple layers. One striking layer is the Resize layer which changes the image dimensions of each image to 135 by 135. This changes the images to comply with the sensitivity of the neural network to the size of images. Further layers include the convolution layer, ramp, and pooling layer, which all work to narrow down pieces and create categories to classify each image to associate them.
dims={135,135}
{135,135}
lenet=NetChain[{ResizeLayer[dims],ConvolutionLayer[20,5],Ramp,(*Takesoutthethenotusefulfeatures*)PoolingLayer[2,2],(*Downsamples*)ConvolutionLayer[50,5],Ramp,(*Takesoutthethenotusefulfeatures*)PoolingLayer[2,2],(*Downsamples*)FlattenLayer[],500,(*Makesfeaturesintofeaturevector"*)Ramp,2,(*Takesoutthethenotusefulfeatures-Trueorfalse*)SoftmaxLayer[]},(*Turnsthevectorintoprobabilities*)"Output"NetDecoder[{"Class",{True,False}}],(*Tensorintotrueorfalse*)"Input"NetEncoder["Image"](*Turnsimageintonumbers*)]
Training the Neural Networks with NetTrain
------------
I trained the neural nets with 10 training rounds.
results=NetTrain[lenet,Normal[trainingdata],All,ValidationSet->Normal[validationdata],MaxTrainingRounds->10,TargetDevice->"CPU"]
![NetTrain Result][1]
Training the Neural Network with Augmented Layers
------------
Next I implemented an ImageAugmentationLayer, which randomly crops images to create new data sets to improve my neural network.
augment = ImageAugmentationLayer[{135, 135}, "Input" -> NetEncoder[{"Image", {139, 139}}], "Output" -> NetDecoder["Image"]]
I made the images 139 by 139 and allowed the augmentation layer to crop the images by 4 pixels at random within the constraints of the dimensions of 135 by 135.
dims2 = {139, 139}
lenet2 = NetChain[{ResizeLayer[dims2],
ImageAugmentationLayer[{135, 135}], ConvolutionLayer[20, 5], Ramp,
PoolingLayer[2, 2], ConvolutionLayer[50, 5], Ramp,
PoolingLayer[2, 2], FlattenLayer[], 500, Ramp, 2, SoftmaxLayer[]},
"Output" -> NetDecoder[{"Class", {True, False}}],
"Input" -> NetEncoder["Image"]]
I trained this data using the neural net, with only 7 layers on CPU.
results2 =
NetTrain[lenet2, Normal[trainingdata], All,
ValidationSet -> Normal[validationdata], MaxTrainingRounds -> 7]
![enter image description here][2]
Creating a Testing Set for Data
------------
![enter image description here][3]
Data Visualization
------------
Lastly, I made a ConfusionMatrixPlot using the Classifier Measurements function which compares the neural networks predicted class against the actual class result.
![enter image description here][4]
Conclusion
------------
I built a neural network that strongly diagnosed Brain Haemorrhage with an accuracy of about 99.000000078%. Furthermore, as displayed in the ConfusionMatrix, there were 18 examples of the neural network prediction matching with the actual results for true and 18 examples of the neural network and actual matching for true.
Future Improvements
------------
To additionally enhance this project, I could implement more augmented datasets to further train and enhance the neural net. Moreover, I could use various images from different datasets to prevent overfitting and improve efficiency. Lastly, I could execute a function that pinpoints Brain Haemorrhage by finding the edges of the Haemorrhage area and sensing the infected cells through the function, image distribution and colour detection.
&[Wolfram Notebook][5]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=1.png&userId=2253909
[2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=2.png&userId=2253909
[3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=3.png&userId=2253909
[4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=4.png&userId=2253909
[5]: https://www.wolframcloud.com/obj/f4d8f183-800b-4e6c-993f-6ee5d572e29aAman Dewangan2021-05-22T17:23:02ZPutting a differential equation into a certain form
https://community.wolfram.com/groups/-/m/t/2332609
Hi guys so I have this differential equation
DSolve[{M'[t] == 1/4500 (660 - M[t]) M[t] - 10, M[0] == 100}, M[t], t]
which gives me a result
(300 (4 + Sqrt[71] - 4 E^((Sqrt[71] t)/75) +
Sqrt[71] E^((Sqrt[71] t)/75)))/(23 + 3 Sqrt[71] -
23 E^((Sqrt[71] t)/75) + 3 Sqrt[71] E^((Sqrt[71] t)/75))
that I need to get into the form (150 (b + a E^((Sqrt[71] t)/75)))/(c + 55 E^((Sqrt[71] t)/75)) and I need to find a,b,c I have tried solve always but no luck is there any command that I can use to find a,b,c?&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/feeb5457-bf18-4e2b-a45c-0b8424e07dcbVedansh Malhan2021-08-02T02:39:19ZPartial differentiation in traditional form
https://community.wolfram.com/groups/-/m/t/2332209
I am trying to do partial differentiation using symbolic, but getting some error. Attaching herewith the work.
G[x_, y_] := x y
D[G[x, y], y]
(\[PartialD]G (x, y))/\[PartialD]y
want to use symbolic for better understanding. Kindly help.&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/c1bf5965-7c69-4c13-a6e5-cdd39784af8dvin Bha2021-08-01T16:10:18ZReflect the mesh points of 3D object model over a mirror?
https://community.wolfram.com/groups/-/m/t/2332523
I'm trying to find a way to turn the elephant inside out in a way. Imagine cutting an elephant in half from tail to trunk, stopping right before the trunk. You could flatten the elephant out and wrap it with the elephant's surface now being on the inside. I wonder if you can do this by reflecting the mesh points of the elephant circularly using shelled ellipse. Any suggestions and help are appreciated.
To clarify this is like reflecting each mesh point across the elliptical mirror but in an elliptical manner and not across a simple line or plane. So all the mesh points inside the mirror would now be outside. Here is the link to all the files.
[https://drive.google.com/drive/folders/1qB0PiJ6CA98JtgUw9DtszJVqLW_54saU?usp=sharing][1]
&[Wolfram Notebook][2]
[1]: https://drive.google.com/drive/folders/1qB0PiJ6CA98JtgUw9DtszJVqLW_54saU?usp=sharing
[2]: https://www.wolframcloud.com/obj/b99ca1a4-b944-4f13-99f9-f7e6f77b39b9Kevin Liang2021-08-02T01:53:17ZEstimation of water velocity in a video using Mathematica
https://community.wolfram.com/groups/-/m/t/2299892
Hi,
Today morning I measured the velocity of river flow by velocimeter and it was 1.15 m/s.
For studying the ability of the *Mathematica* in video file processing, I took a 60-second video from the water surface with a smartphone. I attached herewith the video file.
Is it possible to estimate this important parameter in this video using the *Mathematica*?
![enter image description here][1]
Although, two years ago, we did a study for estimating water suspended sediment in a laboratory flume, based on image processing (NOT VIDEO). We got the expected results and it was excellent.![enter image description here][2]
![enter image description here][3]
Thank you for your help.
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Untitled.jpg&userId=943918
[2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=1.png&userId=943918
[3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=2.png&userId=943918M.A. Ghorbani2021-06-27T19:24:10ZLimit keeps evaluating
https://community.wolfram.com/groups/-/m/t/2331984
Hello,
I'm trying to evaluate the limit of an expression when the variable goes to infinity and mathematica says: ''Running'' and doesn't evaluate it. Then I have to close the program and open it again in order for it to stop saying ''Running''.
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/3a5b6ba0-089c-4b3c-92d4-16e223f64e26Tania Gerou2021-08-01T12:09:31ZJuggling in space using Archimedean spirals and complex algebra
https://community.wolfram.com/groups/-/m/t/2331903
*SUPPLEMENTARY WOLFRAM MATERIALS for ARTICLE:*
> Adam Dipert, R. (2021).
> Choreographic techniques for human bodies in weightlessness
> Acta Astronautica. 182: 46-57. https://doi.org/10.1016/j.actaastro.2021.02.001
> [Full related videos playlist][1]
&[Wolfram Notebook][2]
[1]: https://youtube.com/playlist?list=PLKhOZ0nVFPlFm799hQMJv9ynBo3vsMxf3
[2]: https://www.wolframcloud.com/obj/7532ce3d-fe0e-4503-9ab3-fc2643e6dbd0R. Adam Dipert2021-07-31T15:41:17ZUnexpected behavior in ListLinePlot?
https://community.wolfram.com/groups/-/m/t/2329576
I create an array of images with ListLinePlots. All that the images are are set of sets of 4 points forming 3 lines. I tried to arrange for my lines to use the full range of the frame with an aspect ratio of 1x1.
I have it so that the X axis starts at the minimum value of the data and the Y axis starts at 0 while the top of the Frame is at the maximum Y.
I've attached as simple notebook so that you can see how the images comes up properly.
However, when I am plotting a number of such plots, most of them are printed correctly, spanning the range of [Ymin,Ymax] on the Y axis BUT some of them still show the chart with a lot of space below the Minimum Y and above the Maximum Y.
Please see the attached notebook for more information:&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/c8074437-5af2-4839-893f-b674112f19c2Henrick Jeanty2021-07-28T21:51:57ZIntegrating using one sided limits
https://community.wolfram.com/groups/-/m/t/2326876
I am finding my way around Mathematica but am stuck.
As part of the learning process I am using know functions and known outcomes. In this particular case calculating the Laplace transform of a Dirac Delta function from the integral formula.
Integrate[DiracDelta[t] E^(-s*t), {t, 0, \[Infinity]}]
what I actually want is the lower bound to be lim->0 from below. The above integral produces:
1 - HeavisideTheta[0]
rather than 1.
If I use LaplaceTransform I get 1.
Using Mathematica V10. I have tried using Lim as the lower bound for the integration, however, it returns the same result. Setting the value to something <0 yields 1.
How do I set the integration to the lim->0 to produce 1?Ted Bartlett2021-07-24T10:51:24ZPeaceful chess queen armies
https://community.wolfram.com/groups/-/m/t/2330564
![enter image description here][1]
I was solving the Rosetta problem [Peaceful chess queen armies][2] just now. The idea is to place q armies of queens, each m large, on a n-by-n chess board such that one army of queen can not capture any other queen. The task there ask us to place 2 armies of each 4 queens on a 5*5 board:
ClearAll[ValidSpots, VisibleByQueen, SolveQueen, GetSolution]
VisualizeState[state_] := Module[{q, cells, colors,},
colors = DeleteCases[Union[Flatten@state[[All, All, "q"]]], -1];
colors = Thread[colors -> (ColorData[106] /@ Range[Length[colors]])];
q = MapIndexed[
If[#["q"] == -1, {},
Text[Style[#["q"], 20, #["q"] /. colors], #2]] &, state, {2}];
cells =
MapIndexed[{If[OddQ[Total[#2]], FaceForm[],
FaceForm[GrayLevel[0.8]]], EdgeForm[Black],
Rectangle[#2 - 0.5, #2 + 0.5]} &, state, {2}];
Graphics[{cells, q}, ImageSize -> Length[First@state] 30]
]
ValidSpots[state_, tp_Integer] := Module[{vals},
vals =
Catenate@
MapIndexed[
If[#1["q"] == -1 \[And] DeleteCases[#1["v"], tp] == {}, #2,
Missing[]] &, state, {2}];
DeleteMissing[vals]
]
VisibleByQueen[{i_, j_}, {a_, b_}] :=
i == a \[Or] j == b \[Or] i + j == a + b \[Or] i - j == a - b
PlaceQueen[state_, pos : {i_Integer, j_Integer}, tp_Integer] :=
Module[{vals, out},
out = state;
out[[i, j]] = Association[out[[i, j]], "q" -> tp];
out = MapIndexed[
If[VisibleByQueen[{i, j}, #2], <|#1,
"v" -> Append[#1["v"], tp]|>, #1] &, out, {2}];
out
]
SolveQueen[state_, toplace_List] :=
Module[{len = Length[toplace], next, valid, newstate},
If[len == 0,
tmp = state;
Print[VisualizeState@state];
Abort[];
,
next = First[toplace];
valid = ValidSpots[state, next];
Do[
newstate = PlaceQueen[state, v, next];
SolveQueen[newstate, Rest[toplace]]
,
{v, valid}
]
]
]
GetSolution[n_Integer?Positive, m_Integer?Positive, numcol_ : 2] :=
Module[{state, tp},
state = ConstantArray[<|"q" -> -1, "v" -> {}|>, {n, n}];
tp = Flatten[Transpose[ConstantArray[#, m] & /@ Range[numcol]]];
SolveQueen[state, tp]
]
GetSolution[5, 4, 2]
![enter image description here][3]
Notice that no queen of army 1 can capture any queen of army 2 (and vice versa).
But we can go much beyond that, let;s check what can happen for a given chess board size how many we can place for the case of 2 armies:
GetSolution[3, 1]
GetSolution[4, 2]
GetSolution[5, 4]
GetSolution[6, 5]
GetSolution[7, 7]
![enter image description here][4]
We can also look at more than 2 armies, let's look at 3 armies:
![enter image description here][5]
There are many more things to explore: not only square chessboard but also rectangular chessboard, more colors, other chess pieces…
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=sadf34dfab.jpeg&userId=11733
[2]: http://www.rosettacode.org/wiki/Peaceful_chess_queen_armies "Peaceful chess queen armies"
[3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2021-07-29at23.38.49.png&userId=73716
[4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2021-07-30at00.09.00.png&userId=73716
[5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2021-07-30at00.34.00.png&userId=73716Sander Huisman2021-07-29T22:35:36ZAnimation on the cloud not working
https://community.wolfram.com/groups/-/m/t/2305551
I am trying to deploy a very simple animation on the cloud, but it does not show up.
[This is the deployment with the full code][1]
Does anybody know why this may be?
For context, the Mathematica file that I deployed simply has two lines (exactly as in the link above):
sol[t_]=theta[t]/.DSolve[{theta''[t]==-Sin[theta[t]], theta[0]==-1, theta'[0]==0.1}, theta,t][[1]];
Animate[Show[ListPlot[Re[{{Sin[sol[t]],-Cos[sol[t]]}}],PlotStyle->PointSize[0.02],PlotRange->{{-2,2},{-2,2}},AspectRatio->1],Graphics[Line[{{0,0},{Sin[sol[t]],-Cos[sol[t]]}}]]],{t,0,10}]
To deploy to the cloud I clicked File: Publish to cloud.
[1]: https://www.wolframcloud.com/obj/jon.shock/Published/animationtestJonathan Shock2021-07-05T18:39:56ZPlotting points from a 3d table
https://community.wolfram.com/groups/-/m/t/135429
Hi, I have a set of data in the table format
{{1,2,3,4},{10,2,5,6,5},{20,1,3,4,7},{30,3,1,6,9}}
where the first line is the x axis, but the y column is the first number of the following lines
TableForm[{{1, 2, 3, 4}, {10, 2, 5, 6, 5}, {20, 1, 3, 4, 7}, {30, 3, 1, 6, 9}}]
So x={1,2,3,4}, y={10,20,30} and f(x,y) are the remaining data.
How can I plot these data in a 3D like form?
Thanks.
SimoneS Mazzu2013-10-07T11:55:46ZAssigning three colors to a curve in ParametricPlot3D using PlotStyle?
https://community.wolfram.com/groups/-/m/t/2330541
Why does this not work?
ParametricPlot3D[{t, t, t}, {t, 0, 3}, PlotStyle -> {If[1 <= t <= 2, Red, Green]}]Mariano Gonzalez2021-07-29T22:03:15ZEpidemic simulation with a polygon container
https://community.wolfram.com/groups/-/m/t/1901002
*MODERATOR NOTE: coronavirus resources & updates:* https://wolfr.am/coronavirus
----------
![enter image description here][1]
&[WolframNotebook][2]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=3687ezgif.com-optimize.gif&userId=11733
[2]: https://www.wolframcloud.com/obj/c443430b-2f0e-461a-ad95-801016802147Francisco Rodríguez2020-03-18T01:05:06Z