Steady state solution (1D) of nonlinear dispersal equation

Now I’m interested in the equation $ $ \frac{\partial }{\partial x}\Bigl(\text{sgn}(x) u \Big) +\frac{\partial}{\partial x} \Bigl[ u^2 \frac{\partial u}{\partial x} \Bigr] =0$ $ with boundary conditions $ u(-5)=u(5)=0$

Since $ \text{sgn}(x)$ is not differentiable at $ x=0$ , I expectd ND solve to have some problems. I tried

sol = NDSolveValue[{   0 == D[Sign[x]*u[x],x] + D[u[x]^2 D[u[x], x], x],    u[-6] == 0, u[6] == 0}   , u, {x, -7, 7}] 

but I can’t even plot it and I think that I’m writing it in the wrong way. Could someone confirm I wrote the right snippet and show the plot I should obtain?

  • I asked a related question three days ago, where the equation was the PDE $ \partial_t u = \partial_x (\text{sign}(x) u) + \partial_x (u^2\partial_x u)$ . The one I have above it’s the steady state solution, and I want to compute it directly, instead of integrating in time.

Offline bin-packaging problem: probability of a non-optimal solution for the first-fit-decreasing algorithm

For the offline bin packaging problem (non-bounded number of bins, where each bin has a fixed size, and a input with known size that can be sorted beforehand), the first-fit-decreasing algorithm (FFD) gives a solution whose number of bins is, at most, $ \frac{11}{9}\times S_{opt} + \frac{6}{9}$ , or, for the sake of simplification, around $ 23\%$ bigger than the optimal number of bins ($ S_{opt}$ ).

Has the probability of getting a non-optimal solution using FFD been ever calculated? Or, in other words, what is the probability of getting a solution whose exact size is $ S_{opt}$ ? Or do we have no other choice than assuming that the solution size is evenly distributed in the interval $ [S_{opt}, \frac{11}{9}\times S_{opt} + \frac{6}{9}]$ ? Or, as another alternative I can think of right now, is the solution size so dependant on the input that making this question has no sense at all?

And, as a related question, is there any research about what is the NP-hard or NP-complete problem that has an approximation algorithm (of polynomial asymptotic order) with the highest probability of providing an optimal solution?

What should players roll to “deduce” a solution?

Say my players are in a dungeon of many keys and many doors, where if a wrong key is used in the wrong door, they will be electrocuted, ambushed, etc. This makes the players wary to just try every key in every door. The players have found a key that I describe as "a simple key, made of copper stained green with age." Our session ends, and next week the players find a locked door. A perception check has them see the lock as "relatively simple, made of aged copper, turning green." Due to my players lack of note taking and poor memory over a week, they do not associate the key with the lock. In this scenario the players may have forgotten, but the characters likely wouldn’t have, but I do not want to just hand the players the answer.

After a few minutes of them unsuccessfully trying to get through the door that was never intended to be difficult puzzle, I want them to roll to recognize the similarities between the lock and the key they previously found.
An investigation check doesn’t seem appropriate, as they are not investigating anything for this, just thinking about it. A perception check doesn’t seem fitting either, as they have already seen the lock and key, they just need to recognize the similarities between them.

How should I have my players roll to deduce an answer to a simple question?

File analysis solution

I scrolled through SA and didn’t find a better site. If there’s a better place to ask please let me know.

We’re in need of a file analysis solution. We need a way to analyze and assess files with unknown contents that in some cases may have confidential information within them. Due to this risk of confidential information we either need a reputable cloud based company with a strong privacy policy and security measures, or an on-prem solution, with on-prem being preferred.

Anyone here have any suggestions? We’re open to either static-analysis or dynamic-analysis in our situation.

Improving mesh and NDSolve solution convergence

I have developed the code below to solve two PDEs; first mu[x,y] is solved for, then the results of mu are used to solve for phi[x,y]. The code works and converges on a solution as is, however, I would like to decrease the size of a, b, and d even further. To accurately represent the physical process I am trying to simulate, a, b, and d would need to be ~100-1000x smaller. If I make them smaller, I don’t believe the solution has actually converged because the values for phi along the right boundary change significantly with a change in mesh size (i.e. if I make them smaller and the code below produces a value of phi=-0.764 at the midpoint between y2 and y3 along the right boundary, a change in size1 to 10^-17 and size2 to 10^-15, changes that value of phi to -0.763, and a change in size2 to 10^-16 changes that value again to -0.860), but I cannot make the mesh size any smaller without Mathematica crashing.

Are there any better ways to create the mesh that would be less computationally taxing and allow it to be more refined in the regions of interest? Or are there any ways to make the code in general less computationally expensive so that I can further refine the mesh?

ClearAll["Global`*"] Needs["NDSolve`FEM`"] (* 1) Define Constants*) e = 1.60217662*10^-19; F = 96485; kb = 1.381*10^-23; sigi = 18; sigini = 0; sigeni = 2*10^6; T = 1000; n = -0.02; c = 1;  pH2 = 0.2; pH2O = 1 - pH2; pO2 = 1.52*^-19; l = 10*10^-6; a = 100*10^-7; b = 50*10^-7; d = 300*10^-7; y1 = 0.01; y2 = 0.5*y1; y3 = y2 + a; y4 = y3 + d; y5 = y4 + b; mu1 = 0; mu2 = -5.98392*^-19; phi1 = 0;  (* 2) Create mesh*) m = 0.1*l; size1 = 10^-16; size2 = 10^-15; size3 = 10^-7; mrf = With[{rmf =       RegionMember[       Region@RegionUnion[Disk[{l, y2}, m], Disk[{l, y3}, m],          Disk[{l, y4}, m], Disk[{l, y5}, m]]]},     Function[{vertices, area}, Block[{x, y}, {x, y} = Mean[vertices];      Which[rmf[{x, y}],        area > size1, (0 <= x <= l && y2 - l <= y <= y2 + l),        area > size2, (0 <= x <= l && y3 - l <= y <= y3 + l),        area > size2, (0 <= x <= l && y4 - l <= y <= y4 + l),        area > size2, (0 <= x <= l && y5 - l <= y <= y5 + l),        area > size2, True, area > size3]]]]; mesh = DiscretizeRegion[Rectangle[{0, 0}, {l, y1}],     MeshRefinementFunction -> mrf];  (* 3) Solve for mu*) bcmu = {DirichletCondition[mu[x, y] == mu1, (x == 0 && 0 < y < y1)],    DirichletCondition[     mu[x, y] ==       mu2, (x == l && y2 <=  y <=  y3) || (x == l && y4 <= y <= y5)]}; solmu = NDSolve[{Laplacian[mu[x, y], {x, y}] ==       0 + NeumannValue[0, y == 0 || y == y1 ||         (x == l && 0 <= y < y2) || (x == l &&            y3 < y < y4) || (x == l && y5 < y < y1)], bcmu},     mu, {x, y} \[Element] mesh, WorkingPrecision -> 50];  (* 4) Solve for electronic conductivity everywhere*) pO2data = Exp[(mu[x, y] /. solmu)/kb/T]; sige0 = 2.77*10^-7; sigedata = Piecewise[{{sige0*pO2data^(-1/4), 0 <= x <= l - m},     {sige0*pO2data^(-1/4), (l - m < x <= l && 0 <= y < y2)},     {(sigeni - sige0*(pO2data /. x -> l - m)^(-1/4))/m*(x - (l - m)) +        sige0*(pO2data /. x -> l - m)^(-1/4), (l - m < x <= l &&         y2 <=  y <= y3)},     {sige0*pO2data^(-1/4), (l - m < x <= l && y3 < y < y4)},     {(sigeni - sige0*(pO2data /. x -> l - m)^(-1/4))/m*(x - (l - m)) +        sige0*(pO2data /. x -> l - m)^(-1/4), (l - m < x <= l &&         y4 <= y <= y5)},     {sige0*pO2data^(-1/4), (l - m < x <= l && y5 < y <= y1)}}];  (* 5) Solve for phi*) Irxn = -(2*F)*(c*pO2^n ); A = (Irxn - sigi/(4*e)*(D[mu[x, y] /. solmu, x] /. x -> l))/(-sigi); B = sigi/(4*e)*(D[mu[x, y] /. solmu, x] /.        x -> l)/(sigi + sigedata /. x -> l - m); bcphi = DirichletCondition[phi[x, y] == phi1, (x == 0 && 0 < y < y1)]; solphi = NDSolve[{Laplacian[phi[x, y], {x, y}] ==       0 + NeumannValue[0,         y == 0 ||          y == y1 || (x == l && 0 <= y < y2) || (x == l &&            y3 < y < y4) || (x == l && y5 < y < y1)] +        NeumannValue[-A[[1]], (x == l && y2 <= y <= y3)] +        NeumannValue[-B[[1]], (x == l && y4 <= y <= y5)], bcphi},     phi, {x, y} \[Element] mesh, WorkingPrecision -> 50];  (* 6) Print values to check for convergence*) P[x_, y_] := phi[x, y] /. solphi; P[l, (y3 - y2)/2 + y2] P[l, (y5 - y4)/2 + y4] 

I am looking for suggestions for a permanency spell, weapon enchantment, and constructive critics for my homebrew solution [closed]

I’ve seen various questions on permanency, i am not an online guy(in fact i’m the older brother of this account owner, i have been DMing for more than 2 decades now, mainly in 2E,2.5E[combat and tactics] with my homebrew systems though)Just recently started DMing a 5e game(which is my 3rd experience with the system, systemwise i have no questions),some of players are 3 decade players, and our games are probably seen as technical freakshows to new players mostly(a naval engineer debating with his DM about his ship design, getting angry and actually building a perfect model and design of it irl, in order to prove it’s possible etc). So here is the question; how can i implement permanency spell/effect better into the game? Also these methods are my custom permanency methods, you can use them as you like.

(I must add we play only in Forgetten Realms, rarely other realms, and even such games start in FR and accesed through planescape/sigil etc, with most games focused on intrigue, economics and politics in detail which would annoy average gamers rather than hack and slash…and we are probably more canon freak than most people including Candlekeep bunch[most of them, not all])

My solution so far; making different permanency recipes(each permanency recipe is compatible with only one or rarely two spells, like bless, fire/cold shield or invisibility for example[not going to into advanced spellcraft recipes etc]) usually making some of them epic level thus causing divine intervention upon casting, eg: Mystra directly gets aware of it since it’s taboo/forbidden by her, and she might respond personally or through her chosens whatsoever. Combination; certain locations and certain dates in Harptos Calendar in which certain materials/spells are used at specific times on items explained in recipes, legendary/epic permanency effects/enchantments can take a year or more(total time spent is no more than week at most though waiting for right periods or reaching the locations and gathering the ingridients/reagents might take a long time) depending on circumstances. I use recipes for permanency rather than turning permanency itself into a spell, however some of these recipes might require rare quest items, materials, artifacts or even epic spells which are really scarce in 5th edition FR. Same ecnhantment(usually low levels) can be acquired through different recipes.

(The following spell can only be cast after Forge of Spells in Wave Echo Cave becomes functional again, after a series of quests my adventurers, move a group of Ironstar Dwarves from distant city of Evereska, through lotsa politics, favors[they ressurect the 3rd dwarf Tharden Rockseeker, by carrying his corpse to Helm’s Hold with a cart after casting Gentle Repose on the corpse] and intrigue, they get full rights to Wave Echo Cave in LMoP, they eventually resurrect the guy eaten by the Notic as well, anyway, through their connections with certain individuals in Waterdeep they get in touch with these Dwarves, as the party’s sage discovers that Ironstar Clan still exists through vigorious research in libraries of Kryptgarden Scrolls(Daggerford) and family archives of scholarly Waterdeep nobles(Eltorchul, Estelmer, Thongolir, Wands etc) aftermath of the campaign, they get in touch with Ironstar Dwarves and give them mining/operating rights of the Cave(major share), they also manage to settle some Ironfist Dwarves from their stronghold and Crossroad Keep into Axeholm along with a dwarf royal[last of his line, they manage to convince him into marrying etc] they’ve met in Skullport, Gyudd, all in the name of their plan of finding a new cosmopolitan state in the future after they clean a certain fascist elven organization which nests in Neverwinter Wood(Eldreth Veluuthra)…Passing further details i’ve already written too much:P Just wanted to demonstrate what kind of game makes such recipes and permanency spells possible)

Darkfire Shield Enchantment: A scroll/recipe that can only be obtained from a specific dwarf[from Ironstar Clan] in Evreska in my campaign it can only be used on certain alloys, mostly on Darksteel another version of this recipe works on Mithral but it requires primordial fire in it’s enchantment process, which makes it a bit more tricky, and that recipe is harder to get anyway(the latter requires no diamond though).

In the middle of Flamerule(midsummer festival) sprinkle a thousand toal(2k gp) worth of ruby dust on a Darksteel Shield just before Tharsun turns to Eventide(around 17.00) at a certain shrine to TharmekhĂ»l infront of which lies a statue with an inscription written in Dethek(Dwarven Alphabet) with "Fire is the Cure" and cast this spell(fireshield), then at the last Highsun(twelve bells, midday/noon) of Tarsakh(Greengrass festival) repeat the spell on the Dumathoin shrine constructed within the Caves/Mines which houses "Forge of Spells" after sprinkling a thousand toal diamond, finalizing the procedure: infront of spell forge, by putting the item on the forge(using the forge like an altar to Moradin rather than using it for it’s original purpose in it’s lore) then blessing the item(preferably by a dwarf, even better a Moradin priest, if the latter, shield gives advantage to saving throws rolled against fire damage, eg:dragon breath, spells etc)

Cold version of the recipe works with same metals, different gems, a different shrine(In an old dwarven town built within Spine of the World Mountains/possibly Dorn’s Deep, second step is again Wave Echo Cave, recipe can be obtained from a smith in Mithral Hall after a questline)

I have similar, permanent enchantment recipes, some of them of Elven, Gnomish, Celestial or Abyssal Origin, how do you enchant equipment and locations in your game, do you have any alternative crafting methods that is compatible with game lore(like using alloys to get different effects, using mithral, darksteel and electrum items as base for magical crafting, crafting the hilt and the blade of a sword through very different methods/rituals and materials perhaps)? I would very much to learn your homebrew solutions, also if you are looking for custom recipes for certain spells or effects i can share my stuff.

Sorry for the long read(and possible errors in my spelling), thanks in advance for your constructive comments.

I can verify solutions to my problem in polynomial time, how would a non-deterministic algorithm arrive to a solution if it always takes $2^n$ bits?

Decision Problem: Given integers as inputs for $ K$ and $ M$ . Is the sum of $ 2^k$ + $ M$ a $ prime$ ?

Verifier

m = int(input('Enter integer for M: ')) sum_of_2**K+M=int(input('enter the sum of 2^k+m: '))  if AKS.sum_of_2**K+M == True:    # Powers of 2 can be verified in O(N) time   # make sure there is all 0-bits after the 1st ONE-bit      # Use difference to verify problem    if sum_of_2**K+M - (M) is a power_of_2:     OUTPUT Solution Verified 

The powers of 2 have approximately $ 2^n$ digits. Consider $ 2^k$ where $ K$ = 100000. Compare the amount of digits in $ K$ to the amount of digits in it’s solution! Also take note that the powers of 2 have $ 2^n$ bits as its 0-bit Unary essentially for the exponent $ n$ .

Question

How would a non-deterministic machine solve this problem in polynomial time?