Wolfram Mathematica

Welcome! This is the main Mathematica chat room for mathematic...
Jan 8, 2022 20:38
@CarlLange Yeah, I had eventually figured out that to export Twitter friendly video in Blender I just need to reduce the export quality to medium to match their bit-rate limit, but this is faster.
Jan 8, 2022 15:26
Oh I like the VideoTranscode function. Just drop the video in and say Export["temp.mp4", VideoTranscode[#, "Twitter"]]&. Pretty easy.
Dec 25, 2021 17:23
It was on day 15 I saw that issue
Dec 25, 2021 17:21
I did find a bug to report, but not sure if this was before I switched to v13. I saw that weighted graph performance when inputting the weights via Annotation runs way, way slower than inputting the weights via the VertexWeights option.
Dec 25, 2021 17:20
I had two coworkers also participating this year who did about 2/3 of them.
Dec 25, 2021 17:20
I like to watch the speed contest they host at the Wolfram Conference because they utilize the variety of things WL can do better. But for number of people participating, algorithmic variety, and seeing how fast the best people in the world are across all languages, AoC is pretty cool.
Dec 25, 2021 17:18
I was pretty happy to make the top 100 on one problem. I might never again haha. The top guys are unbelievably fast. #1 ranked guy was International Math Olympiad winner.
Dec 25, 2021 17:17
@CarlLange AoC is a fun event. Like PE, you can use any language. Inputs randomized per person, just submit answer. Quirky story to loosely tie the problems together. It's impressive that one guy puts it all together each year and hundreds of thousands participate now. I did most of them last year the next day for completion, but this year I did them all, and tried at midnight release.
Dec 25, 2021 05:37
community.wolfram.com/groups/-/m/t/2432017?p_p_auth=hMHse2BJ Finished my Advent of Code solutions in WL this year. A couple of guys at work were participating with Python and Rust and had a pretty positive response to the conciseness of WL.
Dec 14, 2021 20:46
I've got 13 on my new Windows and Mac laptops now. Looking like they might have finally fixed the frequent 1-2 second freeze when the autocomplete popup appears on Windows, so that's good. Yeah default font size seems bigger. Trying with the online only docs for now. So far seems fine.
Dec 12, 2021 21:56
I hope they finally fix the slow Windows typing speed in v13. It's been a problem on all three recent Windows laptops I've used in the past couple of years. I figured I didn't need to report it because surely someone at Wolfram uses Windows. But I've gotten brand new very nice Windows and Mac laptops in the past month and sure enough the typing performance is way better on the Mac.
Dec 12, 2021 21:54
@Nasser I see. Thanks. So the general rule is to always list all the variables on the right that will be fixed/bound and not free/varied? It won't identify fixed/bound variables from the input.
Dec 12, 2021 21:42
I often find myself just as amazed at what Solve can't do as at what it can do. What am I missing here? Solve[a == 1 && b == a/2, b]
Aug 25, 2021 15:12
Haha yep
Aug 25, 2021 15:11
Yeah thankfully we officially aren't supporting IE
Aug 25, 2021 15:10
And oddly flatMap is used in some situations where I'd prefer to just use filter due to the way Typescript type inference works. But I think that is getting improved in the next release of Typescript.
Aug 25, 2021 15:09
Yes, flatMap too
Aug 25, 2021 15:02
But my favorite times are when I get to mix in little Mathematica influences like calling something *ExportString(...) haha. Lodash covers a good chunk of the utility functions.
Aug 25, 2021 14:59
Yes I definitely use refs from time to time. Mostly to manually adjust focus, scroll position, text selections, etc. And some libraries need refs passed in because they'll do things with them too.
Aug 25, 2021 14:50
We're using this fancy client document viewer library that does all sorts of stuff React doesn't approve of, but it's contained in a wrapper component.
Aug 25, 2021 14:47
Aug 25, 2021 14:47
Sure, although the DOM is back to how it was by the time the function returns and I haven't noticed any problems. This way components that use it don't need to do anything special.
Aug 25, 2021 14:36
Aug 25, 2021 14:36
I have pretty much the exact same snippet in my codebase lol
Aug 25, 2021 14:26
And I think for more complex scenarios, it's common for the library to provide a wrapper context component you put above both of the components we've been talking about that handles shared state and stuff. The drag and drop library I use does this.
Aug 25, 2021 14:24
That last example is the one described here: stackoverflow.com/a/45582558/3256171
Aug 25, 2021 14:23
Right, that example I would definitely just pass the value as a prop, and in the wrapper have a useEffect(() => nb.setDynamicModuleVariable({cellId, name, value}), [value]) statement. The value in square brackets at the end means that code only runs when value changes. But for the random image thing, I think the ref to call the funciton is fine, or passing in a prop that is just a counter, or having an initialization prop that let's the child pass functions back up. All seem fine to me.
Aug 25, 2021 14:06
Right I'm thinking through your random image one
Aug 25, 2021 14:04
@Kuba Well to use your specific example, there are lots of examples of reusable slider components. This is the one I use: material-ui.com/components/slider Conceptually it's like sliders in Mathematica. There is a value that is passed to the slider, and if you want to "reset" it, you just make a button to set that value back to 0 or 1/2 or whatever.
Aug 24, 2021 12:43
Or immediately update the cached value in some manner without even waiting on a network request to the endpoint, etc.
Aug 24, 2021 12:41
And the library includes nice features like caching results for initial render if you want, or auto refresh this endpoint when browser tab regains focus, etc.
Aug 24, 2021 12:39
It just says mutate(some endpoint) and the library sends one request for new data and knows which components are on screen and gives them the new data and they re-render. So even if it's a popup panel from a main menu that can be on top of any screen, it just says "user edited someone's name, so if any component on screen is using data that depends on the /users endpoint they should be updated".
Aug 24, 2021 12:37
@Kuba Ah, well that's fun. Haha, I guess just use whatever most closely matches how you think about it. The pattern I use a lot in React is to have components subscribe/listen to specific API endpoints they care about with a library like SWR or React Query. Then if some component updates some data, it doesn't need to worry about which other components are currently on screen.
Aug 24, 2021 01:15
If you give Wolfram Alpha the equation it ends up solving for the minimum, then it can list them all, including the one you want. wolframalpha.com/input/…
Aug 24, 2021 01:12
@NikeDattani Ah, thanks. Didn't see the hyperlink. I think in situations like that it is only giving the "first" value where the minimum occurs. Ordered real to imaginary, smallest to largest.
Aug 23, 2021 20:26
@NikeDattani What's the exact input you are giving? If I type "x^4 - x^2" into Wolfram Alpha it gives both minima as I'd expect.
Aug 23, 2021 14:35
@Kuba Cool. Yeah Carl's answer is the same one I saw. I haven't actually encountered that scenario in a year and a half of using React full time. They encourage you to be "declarative", so the only public interface to a component is the properties you give it when rendering it. Then it can add event handlers to listen to changes in those properties or other shared or global state and send network requests to get updated data or whatever else, which then trigger more declarative re-renders, etc.
Aug 22, 2021 02:54
So I'm not updating the existing component with new info, I'm creating a whole new copy of that component and removing the old one because it has a different key. React also uses key properties to optimize updates to lists of items.
Aug 22, 2021 02:52
It will reset the child component
Aug 22, 2021 02:52
@Kuba @CarlLange A normal way to re-initialize a child component in React is to change the special property called "key". So like if you have a details component with some initialization logic and you choose a new item in the list to show in the details component and you pass that new item into the details, it might update the details display but not re-run the initialization logic for the component. But if you have something like <Details key={selectedItem.id} item={selectedItem} />
May 23, 2021 13:58
One of my friends suggested Apple officially supporting a path to unlock iPhones for advanced users. Many people in the comments of articles at a minimum say Apple needs to get rid of the ban on apps mentioning that users can buy things on a website outside the app, etc. The "no steering" provision.
May 22, 2021 00:27
Yeah but that’s the thing. Historically once a software platform gets big enough a company is forced to open it up to increase innovation.
May 22, 2021 00:17
Seems easy to say Apple blocking so much competing software is stifling innovation too.
May 22, 2021 00:06
I’m pretty sure MS used all those same arguments to try and make IE the only windows browser to no avail.
May 21, 2021 23:46
And Microsoft doesn’t charge me $100 and even lets me upload my app from a non Microsoft device.
May 21, 2021 23:45
That’s pretty normal. Windows MacOS Linux all have conferences that lots of developers benefit from who don’t directly pay those companies.
May 21, 2021 23:21
Maybe. I agree they can have whatever weird monetization scheme they want if they aren’t being monopolistic anti competitive etc. To me sounds like they are making the same argument to prevent alternate store competition that Microsoft made to try to prevent other browsers besides IE on Windows. Which didn’t work. They didn’t want to burden their users with choice etc.
May 21, 2021 21:46
Seems like Epic is ending on a strong note. I like their argument that it's unfair Apple is using the gaming industry to subsidize everyone else. Epic has to pay hundreds of millions in fees while Wells Fargo pays nothing for the same service from Apple. And Cook's response was just "That's the monetization route we chose." Then the judge definitely pressed him at the end. If a warning sign is that a company can set prices instead of the market setting prices, it sounds like she thinks they do.
May 21, 2021 21:44
May 21, 2021 13:47
Speaking of the "Apple tax", Tim Cook will be in court today for the interesting Epic v Apple case.