Solve Differential Equation with Boundary Conditions (lengthy equation)

I have a lengthy equation to be substitute into a differential equation. I used DSolve to generate the output. However, it took me more than 3 hours and it still running. The DE is the convective-diffusion equation which is

1/r del /del r (r del f1s/ del r) - a1 = 0

and the boundary condition is r=k when del f1s/ del r =0

so the input is:

a1 = -(810165067720210957064125/25546163167349695028752149) -       0.00395833 (-0.5 + r) (1.02817 +          3.98107/(5.36839*10^11/r - 1.*10^12 r)^(1/20) +          2./((1.27718 - 0.666667 r - 0.333333 r^2)/(1. + r))^(1/20) +          3./((3.05377 - 0.888889 r - 0.111111 r^2)/(4. + r))^(1/20) +          3.01772/(-((1. (-0.675531 + 0.125 r + r^2))/(0.0625 + r)))^(         1/20) + 3.03794/(-((1. (-0.867019 + 0.285714 r + r^2))/(           0.142857 + r)))^(1/20) +          2.04096/(-((1. (-1.14539 + 0.5 r + r^2))/(0.25 + r)))^(1/20) +          3.08948/(-((1. (-1.57936 + 0.8 r + r^2))/(0.4 + r)))^(1/20) +          3.12414/(-((1. (-2.32712 + 1.25 r + r^2))/(0.625 + r)))^(1/20) +          3.23431/(-((1. (-7.80849 + 3.5 r + r^2))/(1.75 + r)))^(1/20)) +       0.125 (-0.5 + r) (0.196614 +          1.32702*10^-12 (5.36839*10^11/r - 1.*10^12 r)^(19/20) +          0.666667 ((1.27718 - 0.666667 r - 0.333333 r^2)/(1. + r))^(          19/20) + ((3.05377 - 0.888889 r - 0.111111 r^2)/(4. + r))^(         19/20) +          0.894139 (-((1. (-0.675531 + 0.125 r + r^2))/(0.0625 + r)))^(          19/20) +          0.787613 (-((1. (-0.867019 + 0.285714 r + r^2))/(0.142857 + r)))^(          19/20) +          0.453547 (-((1. (-1.14539 + 0.5 r + r^2))/(0.25 + r)))^(19/20) +          0.572125 (-((1. (-1.57936 + 0.8 r + r^2))/(0.4 + r)))^(19/20) +          0.462835 (-((1. (-2.32712 + 1.25 r + r^2))/(0.625 + r)))^(          19/20) +          0.239579 (-((1. (-7.80849 + 3.5 r + r^2))/(1.75 + r)))^(19/20))   TRY = DSolve[{1/r D[r f1s'[r], r] - a1 == 0, f1s'[k] == 0}, f1s, r, GeneratedParameters -> S] 

I’m stuck and I don’t know what else should I do. I tried to do manually by integrating the equation but it’s kinda haywire. Could anyone help me out with this coding. Really appreciate it 🙂

What conditions must be met in order to upload .zip file to a multisite WordPress installation?

I cannot upload .zip files to my WordPress network, despite making IMHO everything that is needed. I am still hit by this irritating error.

enter image description here


  1. I am a super-admin in my network.
  2. The ALLOW_UNFILTERED_UPLOADS flag is set to true
  3. Custom hook of $ existing_mimes['zip'] = 'application/zip'; is added
  4. Uploading .zip files is allowed in my network:

enter image description here

Here is entire code of my hook:

function so_387865_custom_upload_mimes ( $  existing_mimes ) {     $  existing_mimes['epub'] = 'application/epub+zip';     $  existing_mimes['mobi'] = 'application/x-mobipocket-ebook';     $  existing_mimes['zip'] = 'application/zip';       return $  existing_mimes; }   add_filter('upload_mimes', 'so_387865_custom_upload_mimes'); 

I thought that maybe there’s something wrong with the hook, so I have installed the Enhanced Media Library extension (as suggested in here). All for nothing, as it clearly shows that this MIME type is added:

enter image description here

What else should I do in order to be able to upload .zip files? I am seriously lost!

Ndsolve of random (periodic) initial conditions via BSplineFunction

Suppose we want to solve the heat equation for a random initial temperature field T(t,x,y). Therefore I define the initial conditions with the BSplineFunction which nicely incorporates periodic boundary conditions and try to solve it with NDSolve:

Clear["Global`*"] Lx = 1; Ly = 1; eq = D[T[t, x, y], t] == Laplacian[T[t, x, y], {x, y}]; pbc1 = T[t, x, 0] == T[t, x, Ly]; pbc2 = T[t, 0, y] == T[t, Lx, y]; T0[x_, y_] =   BSplineFunction[RandomReal[1, {30, 30, 1}], SplineClosed -> True][x,    y] Plot3D[T0[x, y], {x, 0, Lx}, {y, 0, Ly}, PlotRange -> All,   AxesLabel -> {"x", "y", "T"}, ColorFunction -> "DarkRainbow",   Mesh -> All, MeshStyle -> Opacity[.2]] T0[0, 0] ic = T[0, x, y] == T0[x, y] ic2 = T[0, x, y] == 0.5*Exp[-4 ((x - Lx/2)^2 + (y - Ly/2)^2)]; Monitor[AbsoluteTiming[   sol = NDSolve[{eq, pbc1, pbc2, ic},      T, {t, 0, 1}, {x, 0, Lx}, {y, 0, Ly},      Method -> {"MethodOfLines",        "SpatialDiscretization" -> {"TensorProductGrid",          "MaxPoints" -> 25}},      EvaluationMonitor :> (currentTime =         Row[{"t = ", CForm[t]}])]], currentTime] 

The code unfortunately throws an error "Data … is not a rectangular tensor with dimensions …". I assume this results from the fact that T0 evaluated e.g. at grid point [0,0] returns a list {} and NDSolve probably needs just the float value.

I tried T0[0,0][[1]] which yields the expected value. But this does not work for the definition of the initial condition: ic = T[0, x, y] == T0[x, y][[1]], where x,y are not set yet. This returns just x, in reality it should first put in the values of x,y and only after that take list element 1 (if I am not mistaken).

Apart from that the code works fine which can be verified if you simply use ic2 instead of ic as initial condition in NDSolve.

Can someone help to get this running?

A flag (indicator) that shows for each row which conditions was used to select it

Suppose I have the table foo. I want to filter the rows of this table using different conditions (cond_1, cond_2, …, cond_nthe order is important) combined in a disjunction, i.e.:

SELECT * FROM foo WHERE cond_1 OR cond_2 OR ... OR cond_n; 
  1. Is it possible (in PostgreSQL 13) to distinguish for each row which condition cond_i was used to select it? Since I stated that the order is important the question may be reformulated as – I want to know the first cond_i that selected the row, for each row.

Now consider that I have in foo a column for this purpose, e.g. selected_by.

  1. Is it possible to distinguish for each row which condition cond_i was used to select it and store it in selected_by? (the same as 1st question but for an UPDATE statement)

Two things are important: the order of conditions (as it was highlighted earlier); performance (i.e. table foo may have many rows, the number of conditions is small, up to 5-10).

Evocation Wizard’s Sculpt Spell Ability with spells that persist over time – under what conditions is protection maintained?

One of my current players has the first Wizard Evoker for whom I have GMed.

His PC’s Sculpt Spells ability was easy to interpret at lower levels, when his evocation spells, like thunderwave and fireball, were instantaneous.

As he advances, however, he may obtain spells that have longer durations, such as Storm Sphere, Wall of Ice, or Whirlwind. I am realizing that I do not know how to adjudicate Sculpt Spell with spells that persist, especially when the initial conditions of the Sculpt Spell ability no longer apply.

Sculpt Spells says:

Beginning at 2nd level, you can create pockets of relative safety within the effects of your evocation spells. When you cast an evocation spell that affects other creatures that you can see, you can choose a number of them equal to 1 + the spell’s level. The chosen creatures automatically succeed on their saving throws against the spell, and they take no damage if they would normally take half damage on a successful save.

Storm Sphere, for example, has a a duration of Concentration (up to 1 minute) and says in part:

Each creature in the sphere when it appears or that ends its turn there must succeed on a Strength saving throw or take 2d6 bludgeoning damage.

To use the Sculpt Spell ability, the Evoker must see the creatures he is designating as being protected at the time he casts the Storm Sphere, and they must be in the area of the sphere at the time he casts it. It is clear that designating the protected creatures happens "when you cast".

What is not clear to me is whether the protection is for just the first round ("when you cast") or is meant to persist and provide protection on subsequent rounds.

If the protection normally persists, can it be lost if the creatures no longer meet the conditions that were required for them to be designated as protected?

What would happen to a protected creature if it was to exit the area of the Sphere and later re-enter?

Does the Evoker need to maintain them in his sight to maintain their protection? If they were originally protected when the spell was cast, but later became invisible, would it end their protection if the Evoker could no longer see them?

It is possible that reviewers may mark this as asking multiple questions. To be clear, I see all of these as examples of one question – Under what conditions does the protection afforded by Sculpt Spell persist or not persist over time?

Under what conditions does a Martial Spellcaster need the Warcaster feat to comfortably cast spells?

I had a player recently come to me about playing an Eldritch Knight character, and they had questions about their ability to cast spells while holding a weapon (or two), and were debating taking the Warcaster feat (PHB, 170) to mitigate specifically those issues. At my table, I try to take the somatic/material component requirements of spells seriously, so I want to make sure I have a grasp of what can or cannot be done when a spellcaster holding weapons tries to cast a spell, or return to attacking after having cast a spell.

One thing I’m especially interested in is the degree to which the character can "comfortably" do the actions listed. "Comfortably" in this context means that the character isn’t taking certain actions which might be technically legal according to the rules of the game, but which might inconvenience them under common circumstances. A common example is a Two Weapon Fighting character who drops a weapon to the ground to grab their spellcasting focus for casting; if they have to move, they risk leaving their weapon behind on the ground, so from my perspective, this wouldn’t qualify as a "comfortable" maneuver.

So, for the following builds, under what conditions is the character able to cast spells, and to what degree does the Warcaster feat improve their ability to do so?

  • Holding a one-handed weapon
  • Holding two one-handed weapons
  • Holding a one-handed weapon and Shield (neither Cleric nor Paladin)
  • Holding a one-handed weapon and Shield (Cleric or Paladin)
    • I’m separating these two out because Clerics and Paladins both get the ability to affix a Holy Symbol to their shield and therefore use their Shield as they would a Material Component. So I think the answer to this question is necessarily different depending on whether the spellcaster is a paladin or an Eldritch Knight, for example.
  • Holding a two-handed weapon

Under what conditions can a ghost attune to a magic item?

A ghost can possess people (‘humanoids’). It can also go onto the Border Etherial, phasing between two planes of existence. This means its interaction with physical objects varies based on where it has gone plane-wise and who it is ‘inside’, person-wise.

Attunement requires a very specific process:

Attuning to an item requires a creature to spend a Short Rest focused on only that item while being in physical contact with it (this can’t be the same short rest used to learn the item’s properties). This focus can take the form of weapon practice (for a weapon), meditation (for a wondrous item), or some other appropriate activity. If the Short Rest is interrupted, the attunement attempt fails. Otherwise, at the end of the Short Rest, the creature gains an intuitive understanding of how to activate any magical properties of the item, including any necessary Command words.

It is not clear who is touching things while one is doing Possession. The ghost is using the person ‘as a puppet’. By holding a magic knife with a puppet one is NOT touching the knife at all. Yet, if arrested, pointing out ‘the magic knife is attuned to the puppet!!’ does not help much. After all possession is 9/10ths of the law.

Question repeat: Can a ghost attune to a magic item? If so, under what conditions?

MySQL – multiple counts on relations based on conditions – JOIN VS. SUBQUERY

I don’t want to share my exact DB structure, so let’s assume this analogy :

--categories-- id name  --products-- id name cat_id 

I then have SQL like this :

SELECT categories.*, count(CASE WHEN products.column1=something1 and products.column2=something2 THEN 1 END) as count1, count(CASE WHEN products.column3=something3) as count2  FROM categories LEFT JOIN products ON GROUP BY 

The problem here is that the GROUP BY is taking too long, it’s a difference between 0.2s query and 2.5s query.