plotting – Which function should I use to spherically 3D plot an interpolation function of two variables

I have a dataset in the form:

valuesfitC12 = {{{-180, 0}, 21.14`}, {{-180, 5}, 21.29`}, {{-180, 10},
     21.44`}, {{-180, 20}, 21.74`}, {{-180, 30}, 21.84`}, {{-170, 0}, 
    21.14`}, {{-170, 5}, 21.34`}, {{-170, 10}, 21.44`}, {{-170, 20}, 
    21.69`}, {{-170, 30}, 21.79`}, {{-160, 0}, 21.14`}, {{-160, 5}, 
    21.34`}, {{-160, 10}, 21.39`}, {{-160, 20}, 21.74`}, {{-160, 30}, 
    21.84`}, {{-150, 0}, 21.14`}, {{-150, 5}, 21.34`}, {{-150, 10}, 
    21.44`}, {{-150, 20}, 21.69`}, {{-150, 30}, 21.79`}, {{-140, 0}, 
    21.14`}, {{-140, 5}, 21.29`}, {{-140, 10}, 21.49`}, {{-140, 20}, 
    21.69`}, {{-140, 30}, 21.69`}, {{-130, 0}, 21.14`}, {{-130, 5}, 
    21.34`}, {{-130, 10}, 21.39`}, {{-130, 20}, 21.74`}, {{-130, 30}, 
    21.84`}, {{-120, 0}, 21.14`}, {{-120, 5}, 21.29`}, {{-120, 10}, 
    21.44`}, {{-120, 20}, 21.74`}, {{-120, 30}, 21.84`}, {{-110, 0}, 
    21.14`}, {{-110, 5}, 21.34`}, {{-110, 10}, 21.44`}, {{-110, 20}, 
    21.69`}, {{-110, 30}, 21.79`}, {{-100, 0}, 21.14`}, {{-100, 5}, 
    21.34`}, {{-100, 10}, 21.39`}, {{-100, 20}, 21.74`}, {{-100, 30}, 
    21.84`}, {{-90, 0}, 21.14`}, {{-90, 5}, 21.34`}, {{-90, 10}, 
    21.44`}, {{-90, 20}, 21.69`}, {{-90, 30}, 21.79`}, {{-80, 0}, 
    21.14`}, {{-80, 5}, 21.29`}, {{-80, 10}, 21.49`}, {{-80, 20}, 
    21.69`}, {{-80, 30}, 21.69`}, {{-70, 0}, 21.14`}, {{-70, 5}, 
    21.34`}, {{-70, 10}, 21.39`}, {{-70, 20}, 21.74`}, {{-70, 30}, 
    21.84`}, {{-60, 0}, 21.14`}, {{-60, 5}, 21.29`}, {{-60, 10}, 
    21.44`}, {{-60, 20}, 21.74`}, {{-60, 30}, 21.84`}, {{-50, 0}, 
    21.14`}, {{-50, 5}, 21.34`}, {{-50, 10}, 21.44`}, {{-50, 20}, 
    21.69`}, {{-50, 30}, 21.79`}, {{-40, 0}, 21.14`}, {{-40, 5}, 
    21.34`}, {{-40, 10}, 21.39`}, {{-40, 20}, 21.74`}, {{-40, 30}, 
    21.84`}, {{-30, 0}, 21.14`}, {{-30, 5}, 21.34`}, {{-30, 10}, 
    21.44`}, {{-30, 20}, 21.69`}, {{-30, 30}, 21.79`}, {{-20, 0}, 
    21.14`}, {{-20, 5}, 21.29`}, {{-20, 10}, 21.49`}, {{-20, 20}, 
    21.69`}, {{-20, 30}, 21.69`}, {{-10, 0}, 21.14`}, {{-10, 5}, 
    21.34`}, {{-10, 10}, 21.39`}, {{-10, 20}, 21.74`}, {{-10, 30}, 
    21.84`}, {{0, 0}, 21.14`}, {{0, 5}, 21.29`}, {{0, 10}, 
    21.44`}, {{0, 20}, 21.74`}, {{0, 30}, 21.84`}, {{10, 0}, 
    21.14`}, {{10, 5}, 21.34`}, {{10, 10}, 21.44`}, {{10, 20}, 
    21.69`}, {{10, 30}, 21.79`}, {{20, 0}, 21.14`}, {{20, 5}, 
    21.34`}, {{20, 10}, 21.39`}, {{20, 20}, 21.74`}, {{20, 30}, 
    21.84`}, {{30, 0}, 21.14`}, {{30, 5}, 21.34`}, {{30, 10}, 
    21.44`}, {{30, 20}, 21.69`}, {{30, 30}, 21.79`}, {{40, 0}, 
    21.14`}, {{40, 5}, 21.29`}, {{40, 10}, 21.49`}, {{40, 20}, 
    21.69`}, {{40, 30}, 21.69`}, {{50, 0}, 21.14`}, {{50, 5}, 
    21.34`}, {{50, 10}, 21.39`}, {{50, 20}, 21.74`}, {{50, 30}, 
    21.84`}, {{60, 0}, 21.14`}, {{60, 5}, 21.29`}, {{60, 10}, 
    21.44`}, {{60, 20}, 21.74`}, {{60, 30}, 21.84`}, {{70, 0}, 
    21.14`}, {{70, 5}, 21.34`}, {{70, 10}, 21.44`}, {{70, 20}, 
    21.69`}, {{70, 30}, 21.79`}, {{80, 0}, 21.14`}, {{80, 5}, 
    21.34`}, {{80, 10}, 21.39`}, {{80, 20}, 21.74`}, {{80, 30}, 
    21.84`}, {{90, 0}, 21.14`}, {{90, 5}, 21.34`}, {{90, 10}, 
    21.44`}, {{90, 20}, 21.69`}, {{90, 30}, 21.79`}, {{100, 0}, 
    21.14`}, {{100, 5}, 21.29`}, {{100, 10}, 21.49`}, {{100, 20}, 
    21.69`}, {{100, 30}, 21.69`}, {{110, 0}, 21.14`}, {{110, 5}, 
    21.34`}, {{110, 10}, 21.39`}, {{110, 20}, 21.74`}, {{110, 30}, 
    21.84`}, {{120, 0}, 21.14`}, {{120, 5}, 21.29`}, {{120, 10}, 
    21.44`}, {{120, 20}, 21.74`}, {{120, 30}, 21.84`}, {{130, 0}, 
    21.14`}, {{130, 5}, 21.34`}, {{130, 10}, 21.44`}, {{130, 20}, 
    21.69`}, {{130, 30}, 21.79`}, {{140, 0}, 21.14`}, {{140, 5}, 
    21.34`}, {{140, 10}, 21.39`}, {{140, 20}, 21.74`}, {{140, 30}, 
    21.84`}, {{150, 0}, 21.14`}, {{150, 5}, 21.34`}, {{150, 10}, 
    21.44`}, {{150, 20}, 21.69`}, {{150, 30}, 21.79`}, {{160, 0}, 
    21.14`}, {{160, 5}, 21.29`}, {{160, 10}, 21.49`}, {{160, 20}, 
    21.69`}, {{160, 30}, 21.69`}, {{170, 0}, 21.14`}, {{170, 5}, 
    21.34`}, {{170, 10}, 21.39`}, {{170, 20}, 21.74`}, {{170, 30}, 
    21.84`}, {{180, 0}, 21.14`}, {{180, 5}, 21.29`}, {{180, 10}, 
    21.44`}, {{180, 20}, 21.74`}, {{180, 30}, 21.84`}}; 

… and I’m creating a interpolation function the following way:

newvalfit = 
 Partition(
  Riffle(Reverse(valuesfitC12((All, 1))*Pi/180, 2), 
   valuesfitC12((All, 2))), 2); (*convert to radian*)
f =  Interpolation(newvalfit)

… which gives me an interpolation function of form f(theta,phi).

I can’t seem to find a way how get a spherical plot by limiting theta=(0,Pi/6) and phi(-Pi,Pi) since every other value of the function is extrapolated and I can’t use. I’ve tried this but the ranges are totally off, even though I explicitly set them:

SphericalPlot3D(f(theta, phi), {theta, 0, Pi/6}, {phi, -Pi, Pi}, 
 BoxRatios -> {1, 1, 0.5})

spherical plot3d of interpolation function

Also my function values should only lie between {21.14 , 21.84} but that doesn’t seem to be the case. Is there another way to plot it? What am I doing wrong? Many thanks in advance!

G sheet How to jump over no value cells with SUMIF function

I would to get the sum of the duration of the column B

+---+----------+
| A | 14:45:00 |
+---+----------+
| A | #Value!  |
+---+----------+
| A | 13:34:50 |
+---+----------+
| B | 23:41:00 |
+---+----------+
| B | 43:46:00 |
+---+----------+

I’m using these functions :

=SUMIF( A1:A5 ; "B" ;B1:B5 ) this one gives me the sum of time

=SUMIF( A1:A5 ; "A" ;B1:B5 ) This one doesn’t work because I’ve an Error with #Value! in B2.

How to jump over the “#Value! Error” cells with SUMIF ?

How to make DSolve express constants in terms of the unknown function

If I do

DSolve[y'[x] == y[x], y[x], x]

Mathematica returns

{{y[x] -> E^x C[1]}}

Is there a way to have it return this instead?

{{y[x] -> E^x y[0]}}

use of an uninitialized value in a function in c++

I’m studying the code for a calculator from here: https://github.com/dlasalle/wx-calc

 bool m_decimal;

 template<int NUM>
 void WxCalcWindow::onNumButton( wxCommandEvent&)
   {
      m_entryMode = true;

       // accumulate number
   if (!m_decimal) {
    m_preDecimal += std::to_string(NUM);
   } else { 
     m_postDecimal += std::to_string(NUM);
   }

As far as I know, m_decimal is undefined, ie contains garbage. Why didn’t the author initialize it in the first place?

Thank you very much.

list manipulation – Using sequence to complete arguments to a function

I have a function of, say 4 arguments f[a,b,{c,e},d] where some of the arguments are lists. Given a list of triplets that are possible last-three-arguments to f I’d like to paste them as arguments to f as in

Map[f[2, # /. List -> Sequence] &, {{1, {2, -2}, 3}, {0, {2, -2}, 4}, {3, {5, -5}, 7}}]

but this gives me

{f[2, 1, 2, -2, 3], f[2, 0, 2, -2, 4], f[2, 3, 5, -5, 7]}

whereas I wanted

{f[2, 1, {2, -2}, 3], f[2, 0, {2, -2}, 4], f[2, 3, {5, -5}, 7]}

How can I get the result I want?

worksheet function – How to write an Excel Formula that takes a total across multiple repeating rows

I’m working with payroll data in a spreadsheet. What I’m looking to find is a total across different rows of employees with different roles. For example, how could I write a forumla for the “Total Hours” column below?

╔═══════╦══════════╦═══════════╦═══════╦═════════════╗
║ Emp # ║ Employee ║   Role    ║ Hours ║ Total Hours ║
╠═══════╬══════════╬═══════════╬═══════╬═════════════╣
║     1 ║ Jim      ║ Role 1    ║     5 ║           7 ║
║     1 ║ Jim      ║ Role 2    ║     2 ║             ║
║     2 ║ Bob      ║ Only Role ║    10 ║          10 ║
║     3 ║ Jane     ║ Role 1    ║    10 ║          15 ║
║     3 ║ Jane     ║ Role 2    ║     2 ║             ║
║     3 ║ Jane     ║ Role 3    ║     3 ║             ║
╚═══════╩══════════╩═══════════╩═══════╩═════════════╝

apache – mod_headers check for existence of multiple cookies and perform a function only on those cookies

I have a requirement on Apache 2.4 wherein I’d like to check for specific cookies and set the HTTPOnly plus Secure flags only on those Cookies and ignore other Cookies.

E.g. On browser I have the following Cookies for the same web domain i.e. CookieA, CookieB, CookieC, CookieD, CookieE, CookieF.

However in Apache (mod_headers), I’d like to match using CookieName only CookieB and CookieC; then update the settings for HTTPOnly and Secure Flags only for CookieB and CookieC.

PseudoLogic :

If getAllCookies contains CookieB
then update only CookieB (Header edit Set-Cookie (CookieB) “$1; HTTPOnly; Secure”
elseIf getAllCookies contains CookieC
then update only CookieC (Header edit Set-Cookie (CookieC) “$1; HTTPOnly; Secure”
endIf

Any help would be appreciated.

Thank You

plugins – How to remove Database Table in WordPress via Function file?

I recently installed Rankmath, I am using different Page Builder, Where the content not readable by the Plugin. So I disabled SEO Analysis from Setting. Now I wonder if we can remove this Table from Daba via functions.php. I think removing this table will improve load time.

enter image description here

Table Name : “wpbr_rank_math_sc_analytics”

numerical integration – Integrate over one variable of a 2D interpolating function returned from NDEigensystem

I’m trying to implement the answer for “Integrate only one variable of a 2D interpolating function” (https://mathematica.stackexchange.com/a/161962/73672) but for interpolating functions returned from NDEigenSystem it isn’t working.

First I solved for my required eigenfunctions and stored them as “funs”:

    A = 0.0025; Subscript(V, 0) = 1 ; d = 2; 
schröd = -A*d^2 (Pi)*D((Psi)(n, (CurlyPhi)), {(CurlyPhi), 2}) + 
   A/(4 (Pi)) ((CurlyPhi)*(CurlyPhi)*(Psi)(n, (CurlyPhi)) + 
      2 I*D((Psi)(n, (CurlyPhi)), {n, 1}) - 
      D((Psi)(n, (CurlyPhi)), {n, 2})) - 
   Subscript(V, 
    0) ((Cos(2 (Pi)*d*n)) + Cos((CurlyPhi)) - 20) (Psi)(
     n, (CurlyPhi));

 Subscript(n, min) = -1/2; Subscript(n, max) = 1/2; Subscript( (CurlyPhi), min) = -(Pi); Subscript((CurlyPhi), max) = (Pi); 

{vals, funs} = NDEigensystem({schröd,
    PeriodicBoundaryCondition((Psi)(n, (CurlyPhi)), 
     Subscript((CurlyPhi), min) <= (CurlyPhi) <= 
       Subscript((CurlyPhi), max) && n == Subscript(n, max) , 
     FindGeometricTransform({{Subscript(n, min), 
         Subscript((CurlyPhi), min)}, {Subscript(n, min), 
         Subscript((CurlyPhi), max)}}, {{Subscript(n, max), 
         Subscript((CurlyPhi), min)}, {Subscript(n, max), 
         Subscript((CurlyPhi), max)}})((2))), 
    PeriodicBoundaryCondition(Exp(I 2 (Pi) n)*(Psi)(n, (CurlyPhi)),
      Subscript(n, min) <= n <= Subscript(n, max) && (CurlyPhi) == 
       Subscript((CurlyPhi), max), 
     FindGeometricTransform({{Subscript(n, min), 
         Subscript((CurlyPhi), min)}, {Subscript(n, max), 
         Subscript((CurlyPhi), min)}}, {{Subscript(n, min), 
         Subscript((CurlyPhi), max)}, {Subscript(n, max), 
         Subscript((CurlyPhi), max)}})((2)))}, (Psi)(
    n, (CurlyPhi))   , {n, (CurlyPhi)} (Element) 
    Rectangle({Subscript(n, min), Subscript((CurlyPhi), 
      min)}, {Subscript(n, max), Subscript((CurlyPhi), max)}), 8);

The answer to the other question was as follows:

    da = Flatten(
       Table({t, tau, N@Sin(2 (t + 3 tau)) Exp(-2 t - tau)}, {t, 0, 2, 
         2/100}, {tau, 0, 5, 5/100}), 1);
    f = Interpolation@da;
    {{x1, x2}, {y1, y2}} = f("Domain");
    intx = Integrate(f(x, y), x) /. x -> x2;
    
    nintx(y_?NumericQ) := Module({x}, NIntegrate(f(x, y), {x, x1, x2}));
    
    Plot(nintx(y), {y, y1, y2}, PlotRange -> All)

However, trying to implement this myself gives an error after the third line, I believe because it reads n2 as 0.5:


    f = funs((1));
        {{n1, n2}, {(CurlyPhi)1, (CurlyPhi)2}} = f("Domain");
        
        intn = Integrate(f(n, (CurlyPhi)), n) /. n -> n2;

General::ivar: 0.5 is not a valid variable.

Integrate::ilim: Invalid integration variable or limit(s) in 0.5.

Thank you so much in advance for your help!

worksheet function – Plotting combined column charts in Excel

I have data like as shown below in csv file for 3 terms such as A, B, C.

I am trying to plot them using a column chart.

enter image description here

Basically what my data indicates (ex: Terms A) is out of 200 items, 150 belongs to the MP category and 50 belongs to the UMP category.

So orange and grey should be within a blue color. It shouldn’t be stacked one on top of another.

So, my graph should only have two colors because Total (200) should be overwritten by MP (150) and UMP (50)