Wolfram Mathematica

Welcome! This is the main Mathematica chat room for mathematic...
Jun 11, 2021 20:47
@Szabolcs Makes sense to me (if a bit weird way to do it). As plotpoints goes up, resolution of hypotenuse increases as an aside. In any case, the evaluations for the plot produce a sequence that when fed to ListPlot generates the same result, though obviously with no concept of the "region" and concomitant filling...
May 20, 2021 23:09
Given a (simple but large number of terms) polynomial in a few dozen variables, is Replace[poly, Power[x_, _] -> x, {2}] the quickest way to set all exponents to one, or is there something faster (i.e., an internal function or some such means)?
May 17, 2021 23:53
@VitaliyKaurov Version 1 on Apple. Probably still have it laying around in my old software boxes.
Oct 14, 2020 05:12
<Soapbox On> I am seriously getting tired of the "do my work for me", zero effort, photograph/image of a textbook exercise questions.<Soapbox Off>
Mar 20, 2020 15:25
@rcollyer Cool. It's even worse - that example, after opening and checking CPU use in task manager, doing some scrolling, etc. then just hangs. I have to kill Mathematica to get out...
Mar 20, 2020 15:24
@rcollyer Sent an example.
Mar 20, 2020 15:04
@rcollyer Might be impractical to supply notebook I'm currently working on, but give me an hour or so and I'll try to simplify it and/or find example elsewhere.
Mar 20, 2020 14:49
@rcollyer Yes, just the FE. Scrolling gets pretty chunky too when this is going on.
Mar 20, 2020 14:46
@rcollyer Windows 10
Mar 20, 2020 14:28
Ugh. Wolfram might consider adding the ability to have version-specific front end preferences include the subversion: I'm already getting tired of having to switch magnification when I open something on 12.0 that I worked on in 12.1, where a different magnification setting is more comfortable in each.

That, and why must 12.1 seem to chew up ~20% cpu just sitting there doing "nothing" if there are graphics in the notebook?
Mar 16, 2020 21:04
@Silvia And on the other side of that coin, a buddy was in Arizona for spring training, which was cancelled. His kids implored him not to fly back. So he rented a car. It only cost him $15 a day - they had so many car cancellations they just wanted to move them.
Mar 16, 2020 20:57
Add to that questionable hygiene for situations like this (kissy-face greetings, lowest hand-washing rate in developed countries of Europe other than Netherlands) and Italy was ripe for this outcome. At least they are being quite serious about enforcing social distancing.

Here in San Francisco bay area, they just announced mandatory "Shelter in place" order, meaning non-essential businesses closed and individuals to stay home other than for necessities shopping / medical care.
May 8, 2017 05:53
@halirutan Sorry for tardy reply - seems I did not get notification of your response. In any case - the long pauses resolved themselves after a few complete exit/start of MMA - beats me what was going on. Thanks again for taking the time to reply...
Mar 30, 2017 00:37
I have been suffering with long pauses/hangs when entering lines in the frontend. There was a question in the past year related to this, thought I'd bookmarked it, had not, searched to no avail. Had to do with deleting a system file (IIRC a history of commands used, for completion/hinting), which I'd done before and it fixed the issue. Anyone recall the question and/or file name?
Sep 20, 2016 04:03
@SjoerdC.deVries Not a word in English - but used to mean something that performs (i.e. efficient)
Aug 11, 2016 23:33
@J.M. Oh, of course - I've done so on occasion for specific cases, but to have such things as built-ins (and a wider range of statistical tests) would be sweet - MMA already has breadth/depth (at least in probability) beyond any product I'm aware of. I held off going to 10 , then surprised to see significant performance improvements in some probability functionality (and close to speed of work-arounds I'd posted) that was completely undocumented in release notes...
Aug 11, 2016 03:58
The day a new version of MMA is touted, and instead of boasting of things like "...two man-years of effort resulting in significantly improved image recognition for dog collars..." there's "...built-in functionality for Edgeworth and saddle-point approximations for probability distributions..." I'll probably have a coronary from surprise and delight...
6
Jun 20, 2016 09:07
@Kuba some patch on the part of the globe where it's below the horizon gets paint, and the patch where the cone exits the globe toward moon gets paint. Imagine pointing a flashlight that has a beam that expands to size of moon at the moon (and magically passes through earth) - you'd light up some ground (small patch) where moon's not visible, bigger patch where beam exits globe. My guess is rotation of Earth + orbit of Moon over time results in pinched band around globe.
Jun 20, 2016 02:42
@J.M. - Perhaps, I loath "do this for me" questions, but the whole geospatial aspect is way out of my field, so a question there might precipitate a "oh, that's easy, look here..." answer, so I'll probably do so.
Jun 19, 2016 20:12
Any 3D Geospatial plot wizards: I'd like to make an animation of the globe, rotating, but with a certain shading done first - I want to pick a point on the Earth, use it as the peak of a cone, the large end of the cone being the Moon's disk. Anywhere that cone intersects the surface over some selected time period, shade. I'd imagine over a long time span, it's a wide band. I've done nothing with the Geo/Astro features of MMA, will be learn-as-go. Is this going to be simple with MMA features?
Jun 8, 2016 22:40
@E.Doroskevic What are you expecting? The returned object is the representation, which you can then operate on, e.g. with Volume, etc.
May 20, 2016 09:34
@Szabolcs: I use SparseArray[Unitize[Subtract[arr, Max@arr]], Automatic, 1]["NonzeroPositions"] for multi-dimensional cases, pretty quick...
May 18, 2016 21:46
@Szabolcs Pick[Range@Length@#, #, Max@#] &@list ?
2
May 10, 2016 05:20
@AliHashmi: Ping him at his personal blog - listed in his profile...
May 8, 2016 04:46
Is it me, or has the number of "I want this, do it for me and make sure you fully explain/comment the code" questions gone way up in the past half year or so?
Sep 13, 2015 21:54
@OleksandrR. Agreed, seems to be a trend over last year - Raspberry Pi/ University courses I suppose...
Aug 29, 2015 06:26
@belisarius Ah, sorry I missed you - just popped in to scan for interesting code snippets...
Aug 2, 2015 12:16
@Guesswhoitis. Of course - and the interesting generalizations by Kupin and Pudwell. I don't have to tell you (if you've viewed their implementations), they're mathematicians, not coders :-) , so was just checking if anyone had seen an mma implementation before I start on one.
Aug 2, 2015 07:12
On another note, is anyone aware of a MMA implementation of the Goulden-Jackson clustering method for pattern-avoiding words? I'd rather grab an existing package vs reinvent the wheel...
Aug 2, 2015 07:11
@OleksandrR. Disagree with site getting "downvote happy" - ref'd question is one of several by same that seem to show little if any effort in utilizing and understanding documentation. Myself, I will downvote many "be my automated documentation source" questions.
 
Jul 12, 2017 18:25
Considering the cost of license and extensions to have dozens of subkernels licensed, you must have support from Wolfram, yes? This is clearly a question better directed there, particularly so if it's a licensing issue.
 
Aug 29, 2015 20:33
Anyway, semi-interesting problem, but pretty clear large cases / performance does not matter to OP , since accepted answer gets agonizingly slow for such things compared to other simpler answers posted. Thanks for interchange!
Aug 29, 2015 20:31
Since the subsets rapidly grow to non-single elements, this avoids traversing the list sequentially, and a quick cobbled-up test showed it much faster for large cases...
Aug 29, 2015 20:30
Negatives are a non-issue - simply lift the list into non-negative domain. In any case, the outline is:set last subset tot to 0
set cur min to 0

Until done :
Find first ele in accum > min (bin srch)
mark/sow/whatever
min = double found ele & subtract last subset tot
set last subset tot to ele
Repeat
Aug 29, 2015 20:29
@LeonidShifrin: Shall I spoil the ending, or do you want the "ah-ha!" yourself? Hint: Look at the pattern of positions in the accumulation of the target list vs where the subset breaks happen...
Aug 29, 2015 20:29
@LeonidShifrin: Fair enough (depends on the what definition of "is" is, eh? ;-} ) - btw -cool way to do this for large lists is via bin search - quite fast...
Aug 29, 2015 20:29
@LeonidShifrin: Range[-3,3] trivial example - s/b 7 distinct sets, but output is just the range...
Aug 29, 2015 20:29
Neat, but fails when negatives present. +1 though. Interestingly, dramatic slowdown with reals.
 
Jun 29, 2015 13:10
@juror: That really added nothing - I can get the equation(s) from the code - that does not answer the fundamental question: WHAT does this conglomeration represent? You have not even specified the possible values for the parameters. My interest in code-tuning drops A.S. to zero if it's just code with no meaning. Nonetheless, simply changing the b[n, b0, t] term in f to bv, and surrounding the function body with With[{bv = b[n, b0, t]},...] nets a big boost... And I'll repeat - if you know characteristics of roots, using FindRoot will net several orders of magnitude improvement.
Jun 29, 2015 13:10
@juror: As in, what is this calculating? Is it some made-up distribution, or does the underlying problem have some realization that might lend itself to intrinsic MMA functionality (like, "I'm tying to calculate the distribution of Pokemons blown by a plasma beam at 2^8 km/sec..." or something. What do the parameters to your function represent, etc. In any case, barring that, if you can use FindRoot etc. (given you can roughly guess some position for the minimal root) you'll get orders of magnitude speed-up in the time-consuming part of your example.
Jun 29, 2015 13:10
With the wonderfully descriptive variable names (BTW, don't use uppercase initials for your own symbols, bad idea), how is one supposed to figure out what this does? Nor should one have to - why not add what precisely the goal is (as in the probabilistic arena this is playing in)?
 

 Chat with Rasher and Martin

Discussion re: coefficient generation
Feb 28, 2015 06:14
@martin: One more query - does N imply the number of variables in each term? That is, does your goal of 20 mean 20 variables? (Sorry, I've not taken much time at reversing your code to figure that part out). If so, you're going to run into problems where number of permutations needed for calculations could be huge/blow memory limits, else they need to be done "iteratively" with a huge performance hit. Let me know...
Feb 27, 2015 23:52
So, assuming I can come up with a reasonably efficient step 2 (I think I can), this could be good. But, if you're "done", will relegate to spare-spare-time thinking. Let me know...
Feb 27, 2015 23:50
a nine term set with internal powers ranging from 1 to 9 and external powers ranging from 1 to 10 with a few duplicates thrown in. Using CoefficientRules took nearly five minutes on the netbook. New step took... 0 seconds (below timer resolution). I gave up trying bigger tests to get timings, CR just takes too long.
Feb 27, 2015 23:47
@martin: However, I've made the "a-ha!" on the earlier truncated products idea. The basic idea is to get coeffs. for each of the terms (where each (a^x+b^x...)^z is a "term"), and then use those to get the ultimate result. Now, even though CoefficientRules is fairly fast on individual simple terms like that (it probably has some magic sauce internally), I tested step 1 of this idea (getting those coeff. sets) on...
Feb 27, 2015 23:44
@martin: Are you still on this, or is the current state of solution "good enough"? Here's where I'm at: Method of "flash" mentioned earlier is a mixed bag. Sometimes blindingly fast (as in handily beats CoefficientRules for getting all distinct), sometimes a dog, slower than current getCoeff. I kind of expected that from the method, but... bummer.
Feb 25, 2015 22:10
Glad to here it. Had a flash as I fell to sleep last night that might be a fast way to gen valid exp sets... will ponder today and update you.
Feb 23, 2015 23:41
Working on some ideas today ... stay tuned.
Feb 20, 2015 21:34
. If I can get it to work (right now most coeff. are fine, some are < than actual from truncation, so need to figure out correction) this c/b quite fast.
Feb 20, 2015 21:34
@martin Whoa! That's a lotta code ;-) I'll be lounging later, will ponder this, my gut tells me there's an efficient way of doing this, though I'm not sure so efficient that getting all for all valid sets will be nearly as fast as the earlier simpler case. I'm also playing with "truncating" results - that is, doing one poly multiplication, pulling distinct terms, multiplying by next, pulling distinct... rinse and repeat