How to use Reduce with inverse trigonometric functions?

Clear["`."]
rm = 1; al = Pi/6; csal = Cos[al];
DSolve[{rm ph'[s] == Sin[si[s]] Tan[si[s]]^2 csal, 
  rm si'[s] == -Sin[ph[s]] Sin[si[s]]^2}, {ph, si}, s]

How to reduce to obtain the solution within a reasonable time?

time series analysis – an algorithm for detecting whether noisy univariate data is constant or is the sum of step functions

In an explicit algorithm that I write, there is a certain step where I need to determine whether or not certain noisy univariate data are constant or are the sum of the step functions.

For example, define foo as the algorithm I'm after (write in python):
affirm foo ((0) * 20) == False
affirm foo ((0) * 20 + (1) * 20) == True
affirm foo ((0) * 20 + (5) * 30 + (1) * 70) == True

  • The data in the examples is not noisy, but let's assume that the real one is (just a little, one can determine where a step could take place by observing the plotting of the data.

I would be happy to hear ideas, thanks.


functions – Filter comments from other users. View only your own comments and comments from users of the editor role

I have a similar request to the question, but I'm not at all in php and I wouldn't know where to start to make such changes based on the answer provided.

It would be great if someone could help here. It is a simple school project where teachers can share homework with their students. Students should not be able to see other students' comments on an assignment.

Is there anyone who could help you with this task? The functions.php can be found on the link

Thanks in advance

Get the ID of the current page in php functions, meta-query filter

How can I get the ID of the current page in php functions when creating a meta-query filter? I have made many attempts but all return Null. The filter works as expected when I manually enter a number, but I need it to automatically echo the current post ID. Any advice is appreciated, thank you.

$args = array(
  'post_type' => 'project',
  'post_status' => 'publish',
  'post_parent' => 'HOW DO I GET CURRENT PAGE ID?',
  'meta_query' => $meta_query,
); 

Here is the full function:

add_action('wp_ajax_my_ajax_filter_search', 'my_ajax_filter_search_callback');
add_action('wp_ajax_nopriv_my_ajax_filter_search', 'my_ajax_filter_search_callback');

function my_ajax_filter_search_callback() {

  header("Content-Type: application/json");

  $meta_query = array('relation' => 'AND');

  if(isset($_GET('project_type'))) {
    $project_type = sanitize_text_field( $_GET('project_type') );
    $meta_query() = array(
        'key' => 'project_type',
        'value' => $project_type,
        'compare' => '='
    );
  }

  $args = array(
      'post_type' => 'project',
        'post_status' => 'publish',
        'post_parent' => 'HOW DO I GET CURRENT PAGE ID?',
      'meta_query' => $meta_query,
  );

  if ( $search_query->have_posts()) {

      $filter_result = array();

      while ( $search_query->have_posts() ) {

          $search_query->the_post();

          $filter_result() = array(
              "id" => get_the_ID(),
              "title" => get_the_title(),
              "permalink" => get_permalink(),
              "status" => get_field('status'),
              "tags" => get_field('tags'),
              "project_type" => get_field('project_type'),
          );
      }
      wp_reset_query();

      echo json_encode($filter_result);

  } else {
    echo 'no content';
  }
  wp_die();
}

Azure functions + AD B2C + CORS

I have a front end application that uses AD B2C for user management. For my backend, I want to use the Azure functions. I installed everything correctly and everything works independently.

Now, I want to protect certain requests that only connected users should be able to make.
I used this guide to configure everything.

I call the function with a GET request with the following URL:
https://{{project}}.azurewebsites.net/api/testFunction?name=test

When I use tutorial authentication, I get a CORS error now that I can't resolve it. The browser complains about URL:

https://{{tenantId}}.b2clogin.com/{{tenantId}}.onmicrosoft.com/oauth2/v2.0/authorize?response_type=id_token&redirect_uri=https%3A%2F%2F{{project}}.azurewebsites.net%2F.auth%2Flogin%2Faad%2Fcallback&client_id={{clientId}}&scope=openid+profile+email&response_mode=form_post&p={{signin policy}}&nonce={{}}&state=redir%3D%252Fapi%252FtestFunction%253Fname%253Dtest

Oddly enough, if I just opened the link in my browser, I get the right answer for authentication to seem to work.

I guess the URL I call redirects to b2clogin.com but i have no idea why this could cause a CORS error on my side. I turned on implicit flow, tried just about all CORS settings with Azure functions. Any help is greatly appreciated!

Internal functions to reduce the scope but could affect readability?

I'm writing a ViewModelfunction s which manages Ui entrance of View and it does two things:

  1. Save the data.
  2. Navigate the user elsewhere.

These two operations are not invoked anywhere other than from this function. I just think it complicates the reading, but I spent a few minutes looking at it and now my judgment is no longer relevant as I got used to this syntax. Do you guys think this is weird?

  fun handleUiEvent(event: UiEvent) {
         val goTo = { destination: Destination -> _destinations.value = destination }
         val saveItemAndThen = { item: Item, block: () -> Unit ->
             repository.save(item).subscribe({ block() })
         }

     when (event) {
         is AlbumSelected -> saveItemAndThen(event.item) { goTo(PlaylistScreen(event.item.id)) }
         is ArtistSelected -> saveItemAndThen(event.item) { goTo(ArtistScreen(event.item.id)) }
         is PlaylistSelected -> saveItemAndThen(event.item) { goTo(PlaylistScreen(event.item.id)) }
     }
 }


postgresql – Postgres security for functions with "security definer"

I was reading about possible security issues when creating functions in Postgres with "security definer". Official documentation suggests that search_path is set to a trust scheme followed by pg_temp. All the examples I could find had pg_temp at the end. Should I put pg_temp at the end, what would happen if we only defined search_path on the approved schema? Would this open security holes? And why would you put pg_temp in search_path anyway?

functions – PHP Store a variable of a function

I have the following code:

$s = "";
$t = "";

$userId = $auth->register($_POST('email'), $_POST('pass'), function ($selector, $token) {
    global $s;
    global $t;
    $s = $selector;
    $t = $token;
});

The problem I have is that if I use the variables $s y $t from outside the function, they are empty but if I echo from inside the function, they have content ($selector y $token).

probabilities – Cumulative functions of weakly dependent random variables

Assume $ X_1, dots, X_4 $ are Gaussian random variables with mean and variance
$$ mathbf E X_i = 0, quad mathbf E X_i ^ 2 = 1. $$
Suppose further that the random variables have some weak correlation
$$ mathbf E X_1 X_2 X_3 X_4 = kappa (X_1, X_2, X_3, X_4) = epsilon, $$
but that all the other common cumulants $ kappa $ are at least $ O ( epsilon ^ 2) $. Note that in particular the random variables can not to be jointly Gaussian.

Now i wonder if anything general can be said about cumulation $ f (X_1), dots, f (X_4) $ for well-behaved functions $ f $? For example, it seems that for $ f (x) = x ^ {2k-1} $ we have
$$ kappa (X_1 ^ {2k-1}, dots, X_4 ^ {2k-1}) = epsilon (2k-1) !! ^ 4 + O ( epsilon ^ 2) $$
and
$$ kappa (X_1 ^ {2k}, dots, X_4 ^ {2k}) = O ( epsilon ^ 2). $$
In light of this, it seems natural to assume that
$$ kappa (f (X_1), dots, f (X_4)) = epsilon Bigl ( mathbf E_ {X sim N (0,1)} f & # 39; (X) Bigr) ^ 4 + O ( epsilon ^ 2) tag {*}. $$

Question: Is correct? If so, can we prove it using something other than a polynomial approximation?

c # – Write pure functions but have a string

I am trying to play with Godot to learn C # and I was trying to create pure functions to make velocity, but I found that I repeated myself.

    public override void _PhysicsProcess(float delta)
    {
        base._PhysicsProcess(delta);
        Vector2 moveVelocity = velocity;

        moveVelocity = Run(moveVelocity);
        moveVelocity = Jump(moveVelocity);
        moveVelocity = Dash(moveVelocity);
        moveVelocity = Friction(moveVelocity);
        moveVelocity = Gravity(moveVelocity);

        Animate();

        velocity = MoveAndSlide(moveVelocity, Vector2.Up);

    }

Is there a better way to do the above method, so I don't copy moveVelocity over and over again but don't change velocity or create a new class property?

Something like

velocity = Apply(velocity,
  Run,
  Jump,
  Dash,
  Friction,
  Gravity);