Community RSS Feed
https://community.wolfram.com
RSS Feed for Wolfram Community showing any discussions in tag Wolfram Language sorted by activeMathematica and ML – TensorFlow visualisation
https://community.wolfram.com/groups/-/m/t/2823852
I am currently studying a specialization on Coursera in Machine Learning and am investigating various tools to help me out with the maths and with visualisations and so on.
Although I have many decades experience of development and am very handsome, I haven't done any formal maths study since my early 20s. So I want to take the edge off.
As a first excursion, I would like to be able to plot the results of predictions on my TensorFlow models against the training data, in a similar way `tfvis` library that comes along with `tensorflow.js`; but perhaps allowing me to tweak the layers, units and so on of my regressor model and see the effect in real time.
Am I dreaming here? Can Mathematica help me with that? If not, can anyone suggest an alternative?Mark Norgate2023-02-04T16:58:06ZCan I create a custom HolidayCalendar
https://community.wolfram.com/groups/-/m/t/2713860
Hello,
I was exploring the accuracy of Mathematica's **TimeSeriesResample[ ]** function trying to transform 15 min financial time series into daily "BusinessDay" data time series.
Dealing with french stock data, I use this command :
tsr = TimeSeriesResample[ts, "BusinessDay", HolidayCalendar -> "France"]
Sadly, it seems that the french HolidayCalendar used by Mathematica may not be accurate.
Indeed, Euronext official Calendar of business days 2022 (https://www.euronext.com/en/trade/trading-hours-holidays) gives Friday 15 April 2022 and Monday 18 April 2022 as closed trading days. As such, my 15 min source time series "ts" doesn't contain any values nor timestamps for those dates, iterating from 14 April 2022 straight to 19 April 2022.
But "tsr" has those dates, creating interpolated values.
Is this behaviour normal ? Isn't the whole point of using "BusinessDay" specification to suppress datapoints from time series when market is closed ?
Going forward, I did read the official documentation for HolidayCalendar (https://reference.wolfram.com/language/ref/HolidayCalendar.html) which says that we can define a *custom holiday schedule* under the Scope section.
Does that mean that I can use a list of closed market dates of my creation and feed that list as argument in TimeSeriesResample function ? I did read the documentation's examples, but couldn't find a way to make it work at all.
Thank you in advance for any help you can give me.
Cheers.Clarisse Wagner2022-12-01T20:30:57ZPlacing checkboxes in popup window
https://community.wolfram.com/groups/-/m/t/2824138
I've attached a working example file containing some controls functioning in a manipulate structure. The code produces a varying number of checkboxes. I'm looking for a way to place these checkboxes into a popup menu to save space. The ability to check more than one checkbox in the popup menu is required. I've attached the working file. Please advise, or direct me to something in the reference material. Much Thanks. G
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/c0f6eee1-a2ee-4e0b-b34f-1b7b2da75502Gerald Proteau2023-02-05T14:34:09Z[WSG23] Daily Study Group: Wolfram Language Basics
https://community.wolfram.com/groups/-/m/t/2774101
A Wolfram U daily study group covering the implementation of Wolfram Language for tasks ranging from basic programming to video analysis begins on January 17, 2023 and runs through February 3. This study group will run on weekdays from 11:00AM–12:00PM Central US time.
This study group is an incredible way either to start learning Wolfram Language or to explore new functionality you haven't yet used. We will cover a very broad variety of topics, including but not limited to image and sound analysis, symbolics and numerics, function visualization and even cloud computation and deployment. We will even cover useful tips and tricks to help you work efficiently with notebooks!
![enter image description here][1]
**No prior Wolfram Language experience is necessary.** As usual, we will have questions, study materials, quizzes along the way to help you master the subject matter.
You can [**REGISTER HERE**][2]. I hope to see you there!
![enter image description here][3]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=meechstogram.png&userId=1711324
[2]: https://www.bigmarker.com/series/daily-study-group-wolfram-language-basics-wsg34/series_details?utm_bmcr_source=community
[3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=WolframUBanner%281%29%281%29.jpeg&userId=1711324Arben Kalziqi2023-01-11T04:29:36ZFor loop translation from Matlab to Mathematica?
https://community.wolfram.com/groups/-/m/t/2823888
Hello,
I want to implement this code written in Matlab in Mathematica:
![enter image description here][1]
![enter image description here][2]
![enter image description here][3]
![enter image description here][4]
![enter image description here][5]
How can I do this?
Wolfram Mathematica 12 Notebook file attached.
Thank you.
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=3308Capture.JPG&userId=2803344
[2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Capture1.JPG&userId=2803344
[3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=9754Capture2.JPG&userId=2803344
[4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Capture3.JPG&userId=2803344
[5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=3114Capture.JPG&userId=2803344Cornel B.2023-02-05T09:39:41ZAdding a best fit surface
https://community.wolfram.com/groups/-/m/t/2821876
A very elementary presentation question for a new user - I have a 3D point plot to which I am attempting to add a "best-fit" surface. Tediously I cannot seem to get even the simplest of trials to work (i.e. I can generate the plot easily enough (trivial sample attached) but adding this surface is beyond me. I'm undertaking to learn Wolfram Language as a senior citizen, but better late than never I say.
![enter image description here][1]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Additionofabestfitsurface.jpg&userId=2431543Geoff Booth2023-02-02T05:02:29Z[WSS22] Quantum Ethernet
https://community.wolfram.com/groups/-/m/t/2575423
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/85892081-4109-4443-b89c-4ee0dbc3b106Paul Borrill2022-07-19T22:15:43ZWorking with Units in Wolfram Mathematica
https://community.wolfram.com/groups/-/m/t/2823597
Hello,
How can I do this in Wolfram Mathematica?
How can I work with units of measurement in Wolfram Mathematica?
![enter image description here][1]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Capture4.JPG&userId=2803344
Thank you.Cornel B.2023-02-04T20:42:25ZUsing vector variables and changing variables in ODEs
https://community.wolfram.com/groups/-/m/t/2823806
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/ea736d97-ac0b-42f9-b87d-bc5902508edaPeter Burbery2023-02-04T15:36:19ZCryptocurrencies: correlations, clustering and data analysis
https://community.wolfram.com/groups/-/m/t/2295861
*MODERATOR NOTE: Also see [blockchain integration][1] in the Wolfram Language, a part of [Wolfram Blockchain Labs][2].*
[1]: https://reference.wolfram.com/language/guide/Blockchain.html
[2]: https://www.wolframblockchainlabs.com
----------
![enter image description here][3]
&[Wolfram Notebook][4]
[DONT DELETE: Original Notebook]: https://www.wolframcloud.com/obj/ed6de398-4875-4040-b3cd-d36d285d9c59
[3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=sdfq34fdasdfas34.jpeg&userId=20103
[4]: https://www.wolframcloud.com/obj/409f97e4-1aff-4160-9131-b7cc38d76ebfAnton Antonov2021-06-22T17:48:33ZGreat rhombic triacontahedron explaoned
https://community.wolfram.com/groups/-/m/t/2823046
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/037b0049-c7c1-4ba4-92fa-1f00fa713279Sandor Kabai2023-02-03T17:49:46Z[WSG23] Daily Study Group: Introduction to Probability
https://community.wolfram.com/groups/-/m/t/2823625
A Wolfram U Daily Study Group on Introduction to Probability begins on February 27th 2023.
Join me and a group of fellow learners to learn about the world of probability and statistics using the Wolfram Language. Our topics for the study group include the characterisation of randomness, random variable design and analysis, important random distributions and their applications, probability-based data science and advanced probability distributions.
The idea behind this study group is to rapidly develop an intuitive understanding of probability for a college student, professional or interested hobbyist. A basic working knowledge of the Wolfram Language is recommended but not necessary. We are happy to help beginners get up to speed with Wolfram Language using resources already available on Wolfram U.
Please feel free to use this thread to collaborate and share ideas, materials and links to other resources with fellow learners.
[**REGISTER HERE**][1]
![Wolfram U Banner][2]
[1]: https://www.bigmarker.com/series/daily-study-group-probability-wsg36/series_details
[2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=banner.jpg&userId=2823613Marc Vicuna2023-02-03T23:08:52ZConverting MoveNet for Wolfram Language
https://community.wolfram.com/groups/-/m/t/2822251
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/410bf6e9-3bda-4f23-918d-c10be3c02156Kotaro Okazaki2023-02-02T13:44:46ZDifference map generative art
https://community.wolfram.com/groups/-/m/t/2823307
![enter image description here][1]
&[Wolfram Notebook][2]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=smith-tiles_obama30x30_rrr05_optimized.gif&userId=20103
[2]: https://www.wolframcloud.com/obj/d33cd2bb-69fb-4f0c-bd08-b9d2d613f911George Varnavides2023-02-03T20:00:10ZWhich[] calling Main Evaluate - can this be avoided?
https://community.wolfram.com/groups/-/m/t/2823162
Would not seem that Which[] would be a problem in compiling functions, but it's doing a call to Main Evaluate - its obviously on the list of compiled functions and pretty basic. Running the simple code below illustrates it (in v13.1). Its does not happen with If[] as one would expect. Really like to use Which[], but can a call to Main Evaluate be avoided?
Thanks in advance.
<< CompiledFunctionTools`;
fun = Compile[{{k, _Integer}, {u, _Real}},
Which[k == 1, u + 1, k == 2, u + 4]];
funIf = Compile[{{k, _Integer}, {u, _Real}}, If[k == 1, u + 1, u + 4]];
fun[1, 2]
funIf[1, 2]
CompilePrint[funIf]
CompilePrint[fun]
For Which [] the result without the header is
I0 = A1
R0 = A2
Result = R1
R1=MainEvaluate[Function[{k,u},Which[k==1,u+1,k==2,u+4]][I0,R0]]
Return
and for IF the result without the header is
I0 = A1
R0 = A2
I2 = 4
I1 = 1
Result = R1
B0=I0==I1
2 if[!B0] goto 7
3 R1=I1
4 R2=R0+R1
5 R1=R2
6 goto 10
7 R1=I2
8 R3=R0+R1
9 R1=R3
10 ReturnNeal Maroney2023-02-03T19:44:02ZCompiled Wolfram language functions list?
https://community.wolfram.com/groups/-/m/t/2818526
I am not clear on which Wolfram language functions are actually 'compiled'. It would be nice if a list of 'Compile-compatible' functions was available as it would allow determining, a priori, whether to invest the time in rewriting the code (in a form suitable to Compile). Such a list existed long time ago, but I am not able to find it any longer.
On the same topic, I seem to remember that there is a way to take an existing piece of code and process it without modifications. Am I mistaken? If not, how does that work?Fulvio Spagna2023-01-28T00:00:09Z[R&DL] Wolfram R&D LIVE: PDE Modeling
https://community.wolfram.com/groups/-/m/t/2823264
*MODERATOR NOTE: This is the notebook used in the livestream "PDE Modeling" on Wednesday, February 1 -- a part of Wolfram R&D livestream series announced and scheduled here: https://wolfr.am/RDlive For questions about this livestream, please leave a comment below.*
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/943ffa36-f707-4096-96e4-b0aae266f05aModeration Team2023-02-03T19:05:42ZUse Replace and Part at the same time?
https://community.wolfram.com/groups/-/m/t/2822890
Hello,
a = {6, 5, 4, 3, 2,
1}; {{1, 2, 3}, {4, 5, 6}} /. {d_, b_, c_} -> {a[[d]], a[[b]], a[[c]]}
would get errors:
> Part::pkspec1: The expression d cannot be used as a part specification.
> Part::pkspec1: The expression b cannot be used as a part specification.
> Part::pkspec1: The expression c cannot be used as a part specification.
> General::stop: Further output of Part::pkspec1 will be suppressed during this calculation.
Is there a way to use them at the same time?
Thanks.Zhenyu Zeng2023-02-03T15:47:02ZI would like to identify if a polygon is open then close it
https://community.wolfram.com/groups/-/m/t/2821400
Hi All,
I'm still very much a beginner in Mathematica and have struggled with this one.
I would like to load an image, identify polygons, then if any polygons are open, close them with a line or a curve, then save the new image.
I have no idea even how to approach this.
Any advice would be appreciated.S G2023-02-01T09:41:38Z[FSWS23]Diagrammatic & computational study of Abrikosov vortex interactions
https://community.wolfram.com/groups/-/m/t/2774996
![enter image description here][1]
&[Wolfram Notebook][2]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=school.bmp&userId=2146427
[2]: https://www.wolframcloud.com/obj/489968c8-c2b4-4184-8c4e-36e954b7958eGianni Tallarita2023-01-11T18:59:41Z⭐ [R&DL] Wolfram R&D Developers on LIVE Stream
https://community.wolfram.com/groups/-/m/t/2593151
**Join us for the unique Wolfram R&D livestreams on [Twitch][1] and [YouTube][2] led by our developers! Share this with your friends and colleagues:** https://wolfr.am/RDlive
You will see **LIVE** stream indicators on these channels on the dates listed below. The live streams provide tutorials and behind the scenes look at Mathematica and the Wolfram Language directly from developers.
Join our livestreams every Wednesday at 11 AM CST and interact with developers who work on data science, machine learning, image processing, visualization, geometry, and other areas.
----------
⭕ **UPCOMING** EVENTS
- Feb 8 - Dive into Video Processing by [Carlo Giacometti][33]
- Feb 15 - Everything to know about Mellin-Barnes Integrals - Part I by [Oleg Marichev][34]
- Feb 22 - Latest features in System Modeler by [Jan Brugard][35]
----------
✅ **PAST** EVENTS
- Feb 1st -- [PDE Modeling][36]
- Jan. 25th -- [Ask Integration Questions to Oleg Marichev][31]
- Jan. 18th -- [My Developer Tools][30]
- Jan. 11th -- [Principles of Dynamic Interfaces][29]
- Dec. 14th -- [Wolfram Resource System: Repositories & Archives][28]
- Dec. 7th -- [Inner Workings of ImageStitch: Image Registration, Projection and Blending][27]
- Nov. 30th -- [Q&A for Calculus and Algebra][26]
- Nov. 23rd -- [xAct: Efficient Tensor Computer Algebra][7]
- Nov. 16th -- [Latest in Machine Learning][8]
- Nov. 9th -- [Computational Geology][9]
- Nov. 2nd -- [Behind the Scenes at the Wolfram Technology Conference 2022][10]
- Oct 26th -- [Group Theory Package (GTPack) and Symmetry Principles in Condensed Matter][11]
- Oct 12th -- [Tree Representation for XML, JSON and Symbolic Expressions][12]
- Oct. 5th -- [A Computational Exploration of Alcoholic Beverages][13]
- Sept. 28th -- [Q&A with Visualization & Graphics Developers][14]
- Sept. 14th -- [Paclet Development][15]
- Sept. 7th -- [Overview of Chemistry][16]
- Aug. 24th -- [Dive into Visualization][17]
- Aug. 17th -- [Latest in Graphics & Shaders][18]
- Aug. 10th -- [What's new in Calculus & Algebra][19]
> **What are your interests? Leave a comment here on this post to share your favorite topic suggestions for our livestreams.**
Follow us on out live broadcasting channels [Twitch][20] and [YouTube][21] and for the up-to-date announcements on our social media: [Facebook][22] and [Twitter][23].
[![enter image description here][24]][25]
[1]: https://www.twitch.tv/wolfram
[2]: https://www.youtube.com/channel/UCJekgf6k62CQHdENWf2NgAQ
[3]: https://community.wolfram.com/web/markusa
[4]: https://community.wolfram.com/web/bobs
[5]: https://community.wolfram.com/web/lou
[6]: https://community.wolfram.com/web/brettc
[7]: https://community.wolfram.com/groups/-/m/t/2713818
[8]: https://community.wolfram.com/groups/-/m/t/2705779
[9]: https://community.wolfram.com/groups/-/m/t/2701172
[10]: https://youtu.be/UrM-OBu3H9o
[11]: https://community.wolfram.com/groups/-/m/t/2678940
[12]: https://community.wolfram.com/groups/-/m/t/2649407
[13]: https://community.wolfram.com/groups/-/m/t/2635049
[14]: https://community.wolfram.com/groups/-/m/t/2618033
[15]: https://community.wolfram.com/groups/-/m/t/2616863
[16]: https://community.wolfram.com/groups/-/m/t/2613617
[17]: https://community.wolfram.com/groups/-/m/t/2605432
[18]: https://community.wolfram.com/groups/-/m/t/2600997
[19]: https://community.wolfram.com/groups/-/m/t/2596451
[20]: https://www.twitch.tv/wolfram
[21]: https://www.youtube.com/channel/UCJekgf6k62CQHdENWf2NgAQ
[22]: https://www.facebook.com/wolframresearch
[23]: https://twitter.com/WolframResearch
[24]: https://community.wolfram.com//c/portal/getImageAttachment?filename=RDAnno_image.png&userId=20103
[25]: https://www.wolfram.com/mathematica/core-areas/
[26]: https://youtu.be/r7Hjdr_D7c4
[27]: https://youtu.be/pYHAz-NatXI
[28]: https://youtu.be/roCkXVkDuLA
[29]: https://community.wolfram.com/groups/-/m/t/2777853
[30]: https://youtu.be/istKGqpDUsw
[31]: https://community.wolfram.com/groups/-/m/t/2821053
[33]: https://community.wolfram.com/web/carlogico
[34]: https://community.wolfram.com/web/oleg1
[35]: https://community.wolfram.com/web/janb
[36]: https://community.wolfram.com/groups/-/m/t/2823264Charles Pooh2022-08-05T21:37:19ZShrinking faces of polahedra
https://community.wolfram.com/groups/-/m/t/2822693
![enter image description here][1]
&[Wolfram Notebook][2]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Shrinkingfacesofpolahedra.png&userId=20103
[2]: https://www.wolframcloud.com/obj/75cb1a9c-53eb-4a0f-a3f7-18344672edaaSandor Kabai2023-02-03T11:24:33ZDetermine solution of an underdetermined linear equation system
https://community.wolfram.com/groups/-/m/t/2820912
How can I get the same (i.e., a plane equation as) solution set of the linear system of equations in Mathematica as in Maple on the attached PDF (from a friend)?
Thanks in advanceNina Teller2023-01-31T16:42:11ZAdditional colorbar for a plot? UPD
https://community.wolfram.com/groups/-/m/t/2821866
Hello!
Assume I have a 2D function `Vel[x, z]` (say, velocity distribution in the geological medium) and a set of points `Xi = {x1, x1, ...}`, `Zi = {z1, z1, ...}` with some scalar measurements `Fi = {f[x1, z1], f[x2, z2], ...}` for each of them. I would like to visualize the spatial distribution of the measurements as a scatter plot with the velocity model as a background. Unfortunately, there's no function like `ScatterPlot` in the WL, but I managed to do what I want and obtained the following plot: ![enter image description here][1]
Here high values of `Fi` correspond to red points whereas low values correspond to white points.
**My question is: how can I add an additional colorbar for the "white-red" colorscale?** Thank you in advance!
**UPD: a code sample generating the image above:**
&[Wolfram Notebook][2]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=7208Plot.png&userId=1761135
[2]: https://www.wolframcloud.com/obj/6e023bd6-28cb-4866-b3d2-0b314a5e974fNikolay Shilov2023-02-02T04:09:57ZWhat does Interpolation take into account as an argument?
https://community.wolfram.com/groups/-/m/t/2821523
I am trying to convert a code from Mathemtica to Python and I am trying to understand what the following expression does:
I have df.txt that has the following structure:
{0.01, 0.01, 0.} 1.00000000002e-10
{0.01, 0.01, 0.05} 2.6020872669e-10
{0.01, 0.01, 0.1} 6.2612393705e-10
{0.01, 0.01, 0.15} 1.40324498972e-9
Clear[df, iJDP]
df = ToExpression[Import[NotebookDirectory[] <> "df.txt", "TSV"]];
iJDP = Interpolation[Map[{#[[1]], #[[2]]} &, df],
InterpolationOrder -> {1, 1, 1}, Method -> "Spline"];
I don't understand if 1 and 2 correspond to the first cluster and the second value, or something else.
Furthermore I have this step
x,y,z are the columns of the df dataset
a = If[rho < 1,
z /. FindRoot[iJDP[x, y, z] == rhs, {R2, 0.5, 0, 1}], 1];
In this case what is looking for iJDP?
ThanksDaniela Tortora2023-02-01T12:25:15ZTilings and constraint programming
https://community.wolfram.com/groups/-/m/t/2135869
Introduction
------------
The goal of this post is to start from images like this example one :
![Girl3][1]
and generate pictures like:
![Girl3Gray][2]
or
![Girl3Color][3]
Mathematica at least 12.1 will be required since Mixed Integer programming is used.
Explanation
-----------
Let's take the first image (black and white) as an example.
Let's assume we have a collection of 16 tiles:
![GrayTiles][4]
The problem to solve is how to place the tiles on the picture so that the gray content of a tile is close to the gray content of the picture below it and at the same time the topological constraints are satisfied.
By topological constraints, I mean that the tiles must be compatible.
This is allowed:
![Allowed][5]
This is forbidden because the dark horizontal band is continuing as a white horizontal band.
![Forbidden][6]
We are going to translate this problem into a set of equations on integer variables and with a linear cost function to optimize. The final problem will be solved with the LinearOptimization function from Mathematica 12.1.
Each pixel of the image is encoded by a vector ![eq1][7] because there are 16 different tiles in this example. The components of the vector can be either 0 or 1.
This is expressed as:
VectorLessEqual[{0, v}], VectorLessEqual[{v, 1}], v \[Element] Vectors[nbTiles, Integers]
For each pixel, only one tile can be used. We cannot put several tiles on a pixel but only choose one and only one.
If we use the constraint:
![eq2][8]
then we express that only one tile can be used. Indeed, since the component are integers and equal to 0 or 1, then the only way to satisfy this equation is that one of the components, and only one, is equal to one.
Expressing the topological constraints is similar.
We have equations like:
![eq3][9]
This equation is describing a relationship between pixel (x,y) and pixel (x+1,y).
The values on left and right side can either be 0 or 1 (at same time). When zero it means : none of the tiles is used. When one, it means one of the tile is used. So, the translation of the equation is:
If the tile 0,3 or 5 are used at pixel (x,y) then the tiles 3,6,9 or 11 must be used at pixel (x+1,y).
(I have not checked if it makes sense with the set of tiles I am using as example. The constraints for those tiles are probably different.).
To describe the topological constraint of the tiles, we have functions like:
rightSide[tileA[{a_,b_,c_}]] :={b,c};
This is giving a key describing the right side of the tile. Those keys are then used in associations to build the topological constraints. The key can be anything so if you want to add new tiles, you can just use the key you want to describe the sides of your tiles.
The generic function rightSide must be extended with new cases when new tiles are added.
Then, we need to express how good the tiles are approximating the original picture.
For this, an error function is created. It is a sum of terms:
![eq4][10]
It means that if the tile i is selected for pixel (x,y) then the approximation error is `Subscript[f, k]`
The function averageColor must be extended with new tiles. It returns the color content of a tile : a RGBColor. The code is using a color distance to compute the errors.
That's why the input picture is always converted to RGB and the alpha channel removed.
So, finally we have translated our problem into a set of integer constraints and with a linear cost function to optimize. It is a mixed integer programming problem which can be solved with LinearOptimization.
The tiles must be displayed. It is done by the function tileDraw and the tile is drawn in a square from (0,0) to (1,1) corners.
The code is rasterizing those graphics into 50x50 pixel images.
I have had lots of problems with those pictures due to rounding errors ... probably due to the very old GPU on my very old computer.
So I tuned the vector code assuming the final tile image is 50x50 pixels. Now the pictures are well aligned, there is no more one row or one column of wrong pixels on the boundary of the tiles.
But this may cause a problem on your configuration. So, if the tile pictures are not rendering correctly on your side, you'll need to tune my vector graphic code again.
If the picture is too big, solving the full mixed integer programming problem may take too long. But we can solve a sub-optimal problem. We divide the picture into sub-pictures and solve the problem on each sub-picture then we recombine the solutions. For it to work : we must add new constraints to express compatibility between the pictures.
For instance, the left side of a picture at (row,col) must be compatible with the right side of the picture at (row,col-1). So, the problem must be solved in a given order so that the constraints can be propagated from one sub-picture to the other.
For some tiles, the sub-optimal solution can be very good from an artistic point of view (the dark tiles below are working well). For other tiles (the smith tiles in the notebook) either the sub-optimal problem cannot always be solved (because the constraints coming from the previous pictures can't be satisfied) or the sub-optimal problem will look bad from time to time.
So this idea of using sub-picture is really dependent on the kind of tiles used. You need to experiment. But it is art after all.
Example of use
--------------
First, we get an example picture:
srcImage = ImageCrop[ExampleData[{"TestImage", "Girl3"}], {190, 270}]
The picture is resized, converted to RGB and any alpha channel removed.
imgToAnalyze =
ImageResize[
ImageAdjust[
RemoveAlphaChannel[ColorConvert[srcImage, "RGB"], Black]], {50,
Automatic}]
For the dark tiles (knots), we decide to only use gray levels. First color is the background of the tiles. Other colors are for the circles and vertical and horizontal bands.
tileData =
mkDarkTiles[RGBColor[
0.5, 0.5, 0.5], {RGBColor[0., 0., 0.], RGBColor[1., 1., 1.]}];
It gives a total of 16 tiles. The more tiles, the more difficult it is to solve the problem. 16 is ok on my old computer.
tileData["allTilesImg"] // Length
The problem is solved on 15x15 sub pictures.
solution = partitionSolve[tileData, imgToAnalyze, 15];
The final picture is generated from the tiles and the solution.
img = createPict[tileData, solution];
And you'll get:
![Girl3Gray][2]
Have fun ! I hope the vectorial code will not have to be tuned to generate the tile pictures (rounding errors).
The notebook is attached to the post.
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Girl3.png&userId=89693
[2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Girl3Gray.png&userId=89693
[3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Girl3Color.png&userId=89693
[4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Tiles.png&userId=89693
[5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Allowed.png&userId=89693
[6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Forbidden.png&userId=89693
[7]: https://community.wolfram.com//c/portal/getImageAttachment?filename=eq1.png&userId=89693
[8]: https://community.wolfram.com//c/portal/getImageAttachment?filename=eq2.png&userId=89693
[9]: https://community.wolfram.com//c/portal/getImageAttachment?filename=eq3.png&userId=89693
[10]: https://community.wolfram.com//c/portal/getImageAttachment?filename=eq4.png&userId=89693
[11]: https://community.wolfram.com//c/portal/getImageAttachment?filename=LenaGray.png&userId=89693Christophe Favergeon2020-12-11T16:08:18ZModeling an impossible chair
https://community.wolfram.com/groups/-/m/t/2822374
![enter image description here][1]
I was inspired by the "[Impossible Cube][2]" and wanted to apply similar ideas to a chair model I had previously been working on. This resulted in the tentative making of an "Impossible Chair."
chair = {
(*seat*){{{-1, 1, 2}, {-1, -1, 2}}, {{-1, -1, 2}, {1, -1,
2}}, {{1, -1, 2}, {1, 1, 2}}, {{1, 1, 2}, {-1, 1, 2}}},
(*sides*){{{-1, 1, 0}, {-1, 1, 2}}, {{-1, -1, 0}, {-1, -1,
2}}, {{1, -1, 0}, {1, -1, 2}}, {{1, 1, 0}, {1, 1, 2}}},
(*back*){{{-1, 1, 4}, {1, 1, 4}}, {{-1, 1, 3}, {1, 1, 3}}, {{-1, 1,
4}, {-1, 1, 2}}, {{1, 1, 4}, {1, 1, 2}}}};
Graphics3D[Map[Tube[#, .1] &, chair], Axes -> True,
AxesOrigin -> {0, 0, 0}, ImageSize -> 250]
![enter image description here][3]
I modified the spline curve to allow it to span various points along the side of the chair creating some type of armrest. Additionally, I linked the radius of the spline curve tube to its y-coordinates, making it proportionate to the view distance.
![enter image description here][4]
This Manipulate allows for experimentation with the armrest's control points, rotation, and other dimensions. 3 bookmarks demonstrate a few of the many possibilities.
Manipulate[Module[{m = 32, curvePnts, curvePntYs, tubeRadii},
curvePnts =
RotationTransform[-phi, {0, 0, 1}, {1, 1, 0}] /@ {{1, 1, x1}, {1,
1 - h2, x2}, {1, 1 - h3, x3}, {1, 1, x4}};
tubeRadii = (# (rt - rm)/4 + (rt + rm)/2) & /@ curvePnts[[All, 2]];
Graphics3D[{{Opacity[.35], Cylinder[{{0, 0, 0}, {0, 0, -.01}}, 3.5]},
Rotate[{
(*seat*){Brown,
Polygon[{{-1, -1, 2}, {-1, 1, 2}, {1, 1, 2}, {1, -1, 2}}]},
(*chair*){LightBrown, Specularity[White, 20],
Tube[BSplineCurve[curvePnts, tubeRadii]],
Map[Tube[#, rt] &, chair]}}, alpha, {0, 0, 1}]},
ViewPoint -> {2, -2, .75}, ViewAngle -> .33,
Lighting -> {DirectionalLight[Orange, {{5, 5, 4}, {5, -10, 0}}],
DirectionalLight[Orange, {{5, 5, 4}, {5, 5, 0}}],
DirectionalLight[Orange, {{5, 5, 4}, {5, 50, 0}}]},
Boxed -> False]],
"control points armarest BSplineCurve",
{{x1, 0}, None}, {{x2, 1.125}, -2, 4, .001}, {{h2, 2.38}, 0,
6, .001}, {{x3, 3.18}, 0, 4, .001}, {{h3, 4.08}, 0, 6, .001},
{{x4, 2}, 1,
4, .1}, {{rt, .11, "tube radius"}, .075, .25, .001}, {{rm, .09,
"min radius"}, .0, rt, .001}, {{alpha, 1.02, "chair angle"}, -.5,
1.5, .01}, {{phi, 0.26, "armrest angle"}, 0, 1., .001},
Bookmarks -> {"chair-low" :> {h2 = 2.38`, h3 = 4.08`, m = 35,
rm = 0.09, rt = 0.11, x1 = 0, x2 = 1.125`, x3 = 3.18`, x4 = 2,
alpha = 1.02, phi = 0.26},
"chair-mid" :> {h2 = 2.38`, h3 = 3.886`, m = 35, rm = 0.09,
rt = 0.11, x1 = 0, x2 = 1.69`, x3 = 2.368`, x4 = 3, alpha = 1.21,
phi = 0.436`},
"chair-high" :> {h2 = 2.38`, h3 = 6.`, m = 35, rm = 0.09,
rt = 0.11, x1 = 0, x2 = 1.69`, x3 = 2.368`, x4 = 4.`,
alpha = 1.18, phi = 0.411}}]
![enter image description here][5]
This video shows a rotating chair with the settings of bookmark "chair-mid".
![enter image description here][6]
![enter image description here][7]
The images above showcase three examples of the armrest spanning various distances. Perhaps a member of the community can build further and improve upon these ideas. Have fun experimenting...
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=chair.gif&userId=20103
[2]: https://community.wolfram.com/groups/-/m/t/875044
[3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=7479chairinGraphices3D.png&userId=68637
[4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=9047BSplineCurve.png&userId=68637
[5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=8166manipulate.png&userId=68637
[6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=chair.gif&userId=68637
[7]: https://community.wolfram.com//c/portal/getImageAttachment?filename=48613chairsinrow.png&userId=68637Erik Mahieu2023-02-02T17:43:59ZAssignments don't apply in scoping constructs
https://community.wolfram.com/groups/-/m/t/2822140
Hello guys
I created the procedure below assigning values to variables a, b and c, so that they are protected. When I apply WU, the values assigned to variables a,b and c are not applied. Within the WU procedure, I used the With and Block functions, but to no avail.
WU[ex_] := Module[{a, b, c, ex1, sk},
a = x + y;
b = x - y;
c = x*y;
ex1 = ex;
sk[t_] := Sin[t];
Return[sk[ex1]]]
{WU[a*b/c], WU[a - b - c]}
{Sin[(a b)/c], Sin[a - b - c]}
I'm grateful if anyone can help.
Regards,
Sinvalsinval santos2023-02-02T11:42:54ZA curious mass ratio
https://community.wolfram.com/groups/-/m/t/2822172
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/f83d34f0-3d28-4e78-a806-4fead9e7eed1Paul Abbott2023-02-02T16:55:09ZImporting ods file fails
https://community.wolfram.com/groups/-/m/t/2822290
Hi everyone,
I tried to import a specific sheet of an ods file by using Import["File_Name",{"Sheet","Name"}] but it does not work. Mathematica stops working after 10/15 min. Is there a way to import such a file without modifying the original one?
Thanks for your help.Dani O2023-02-02T15:08:21Z[WSG23] Daily Study Group: Quantum Computation Framework (Oct 24, 2022)
https://community.wolfram.com/groups/-/m/t/2619353
A new [WolframU][1] study group devoted to [Quantum Computation Framework][2] begins **Monday, October 24th!** A list of daily topics can be found on our Daily Study Groups page. This group will be led by me and [@Nikolay Murzin][at0], from Wolfram Quantum Team. We will meet daily, Monday to Friday. Study group sessions include time for exercises, discussion and Q&A. This study group will help you acquire an intro knowledge of quantum computation and learn how to implement quantum algorithms in the [Wolfram Quantum Computation Framework][3]. Feel free to explore our framework.
> [**REGISTER HERE**][4]
![enter image description here][5]
![enter image description here][6]
[at0]: https://community.wolfram.com/web/murzinnikolay
[1]: https://www.wolfram.com/wolfram-u/
[2]: http://wolfr.am/wolfram-quantum
[3]: http://wolfr.am/wolfram-quantum
[4]: https://www.bigmarker.com/series/dsg-wolfram-quantum-framework/series_details?utm_bmcr_source=events
[5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=WolframUbanner.jpg&userId=20103
[6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=circuit.png&userId=1539902Mads Bahrami2022-09-19T18:43:04ZExponential Quaternions not working
https://community.wolfram.com/groups/-/m/t/2798643
I can successfully add and multiply quaternions, but I can't figure out how to raise to the power of a quaternion? Advice?
In my case, this works:
Needs["Quaternions`"]
Needs["Quaternions`"]
NumberForm[
N[(Quaternion[0, 0, 0, 1] +
Quaternion[0, 0, 0, -1/(n + t)])^(n + t), 5]
But this does not work:
Needs["Quaternions`"]
NumberForm[
N[(Quaternion[0, 0, 0, 1] +
Quaternion[0, 0, 0, -1/(n + t)])^(Quaternion[0, 0, 0, 1]**(n + t)), 5]
Suggestions?John Henke2023-01-21T03:25:56ZLagrangian mechanics of 2D rolling body
https://community.wolfram.com/groups/-/m/t/2820980
![rolling GIF][1]
&[Wolfram Notebook][2]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=rolling_2D_seed.gif&userId=1705502
[2]: https://www.wolframcloud.com/obj/ae7933a0-e9da-4d70-b2b5-9c03332784f3Emmy Blumenthal2023-01-31T21:22:06ZEquation of the angle of inclination for plate girders (Wagner Beam)
https://community.wolfram.com/groups/-/m/t/2821855
Hello all,
I'm having trouble deriving Wagner's equation for the angle of inclination of plate girders. The angle is derived by applying the principle of least internal work. The work expression as well as the final form of the equation are:
----------
&[Wolfram Notebook][1]
----------
Where the variable (V, h, B etc..) are material properties and can be considered as constants. The equation of the angle of inclination is derived by setting the derivative of the work expression w.r.t alpha to 0 and solving. I'm interested in the steps required to derive the final equation. I'm fairly new to Mathematica so on a separate notebook I found the derivative of the work expression and solved for 0. Obviously this returned the roots of the equation however I am not interested in that. Is there a command or a method to solve the equation in terms of other constants?
Any help is greatly appreciated, been stuck on this problem for a while now. I can provide any extra info if needed. Thanks!
&[Wolfram Notebook][2]
[1]: https://www.wolframcloud.com/obj/0b6ac83e-0ae0-44d6-bbe5-20332ca4fbb8
[2]: https://www.wolframcloud.com/obj/a9f50341-c3d9-4f38-80f3-6b05df735233Ghaith Alshamsi2023-02-01T23:58:13ZHow to make a text to image network, based on customer text input ?
https://community.wolfram.com/groups/-/m/t/2821200
Hello Everyone. I have a question about how to make a service that could turn customers text to images with wolfram machine learning?
I see beautiful services like midjourney.com that works through discord messenger and i am interesting how to make something like this but better. Because that platforms are generating many wrong looking images, with some defects. Does it possible to make such service based on wolfram technologies ?Sergey Scorin2023-02-01T17:10:17ZCan Wolfram Engine do more than Mathematica?
https://community.wolfram.com/groups/-/m/t/1697210
Is there anything that the new Wolfram Engine can do that Mathematica (including the WolframScript that comes with Mathematica) cannot do?
P.S. Once again, WRI has confused things with its multiplicity if products with their overlapping functionality and similar names! (See: https://community.wolfram.com/groups/-/m/t/1096129)Murray Eisenberg2019-05-31T15:57:31ZFunctional iteration for Divide-and-Conquer algorithms
https://community.wolfram.com/groups/-/m/t/2821210
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/56f4e3a6-630d-40b0-8a4b-f8be6fb19215Ian Ford2023-02-01T00:24:46Z[R&DL] Wolfram R&D LIVE: Ask Integration Questions to Oleg Marichev
https://community.wolfram.com/groups/-/m/t/2821053
*MODERATOR NOTE: This is the notebook used in the livestream "Ask Integration Questions to Oleg Marichev" on Wednesday, January 25 -- a part of Wolfram R&D livestream series announced and scheduled here: https://wolfr.am/RDlive For questions about this livestream, please leave a comment below.*
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/af9f9409-15e2-439a-b72a-803e2f8f503dOleg Marichev2023-01-31T21:13:37ZDynamical Gravastars
https://community.wolfram.com/groups/-/m/t/2820793
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/76616147-2b0d-475c-91d9-d82040ebd431Stephen Adler2023-01-31T18:38:10ZReplacement of SymmetricGroupIndex result with input in second program
https://community.wolfram.com/groups/-/m/t/2820364
I have Mathematica Home Edition 13.1 running on a Mac OS X Arm (64-bit) platform. The result of the first program appears in the denominator of the line in the second program beginning with "X[y_] = ". When I replace this denominator with the second input line of the first program, the program no longer works. I would like to combine these two programs into one, but apparently I don't have a good handle on the timing of the replacement. It seems to get deferred and then the program hangs.
In[1] = mc = 5;
SymmetricGroupIndex[mc, x] /. x[i_] -> If[i == 1, y, rp[i]]
Out[2] = y^5/120 + 1/12 y^3 rp[2] + 1/8 y rp[2]^2 + 1/6 y^2 rp[3] +
1/6 rp[2] rp[3] + 1/4 y rp[4] + rp[5]/5
In[3] = digits = 17; mc = 5; (* mc=maximum children *)m = 2 digits + 10;
b[n_, i_, t_, k_] := b[n, i, t, k] = If[i < 1, 0,
Sum[Binomial[b[i - 1, i - 1, k, k] + j - 1, j]*
b[n - i*j, i - 1, t - j, k], {j, 0, Min[t, n/i]}]];
b[0, i_, t_, k_] = 1;
gf = 1 + Sum[b[j - 1, j - 1, mc, mc] x^j, {j, 1, m + 1}];
g[r_] := Module[{rp, X, ym},
For[k = 2, k <= mc, k++, rp[k] = gf /. x -> r^k];
X[y_] = (y - 1)/(y^5/120 + 1/12 y^3 rp[2] + 1/8 y rp[2]^2 +
1/6 y^2 rp[3] + 1/6 rp[2] rp[3] + 1/4 y rp[4] + rp[5]/5);
ym = y /. FindRoot[X'[y] == 0, {y, 2},
WorkingPrecision -> digits + 5]; X[ym]];
rho = FixedPoint[g, 1/3, SameTest -> (Abs[#1 - #2] < 10^-digits &)];
RealDigits[rho, 10, digits] // First
Out[4] = {3, 4, 0, 0, 1, 7, 4, 6, 9, 1, 5, 1, 0, 6, 0, 0, 8}Robert Russell2023-01-31T18:27:20Z[WELP22] Fake News Detection on Twitter: A Bayesian Framework
https://community.wolfram.com/groups/-/m/t/2820782
![graph][1]
&[Wolfram Notebook][2]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=welp6.jpeg&userId=911151
[2]: https://www.wolframcloud.com/obj/199ce33b-e5b4-4544-b32c-4ba9164cea6dWolfram Emerging Leaders Program2023-01-31T16:32:30ZWhat is the preferred way to PolarPlot a complex function?
https://community.wolfram.com/groups/-/m/t/2820159
As a newcomer to Mathematica (V13.2 Home Edition), I encountered an issue that might be due to my misunderstanding of the use of the AbsArg function within the PolarPlot of a complex function. The notebook file shown below compares polar plots of Exp[I \[Omega]]. The first plot uses separate Abs and Arg functions, and produces the anticipated results. The second plot uses the AbsArg function, and is inconsistent with the first plot.
My understanding is that the AbsArg function separates abs and arg as elements of a list. Then why do the two plots differ?
Any insight into this behavior is greatly appreciated.
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/2410b20d-9a81-4e4e-8678-9cc4f3457e25Jack Mandelman2023-01-30T20:37:07ZStudying periodic functions in three different ways
https://community.wolfram.com/groups/-/m/t/2800636
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/fe7a91ce-c744-4713-867a-ff32f3ba1868Athanasios Paraskevopoulos2023-01-21T23:08:12Z