Why is this integrand not integrating to a Bessel function?

I know from the identities of Bessel functions that the following is true: $ $ J_{m}\left( x \right) = \frac{ 1 }{ 2 \ \pi \ i^{m} } \int_{0}^{2 \pi} \ d\phi \ e^{i \left( x \cos{\phi} \ – \ m \ \phi \right)} \tag{0} $ $

However, when I try to integrate the following, Mathematica doesn’t actually integrate the result. It just spits back the input.

Assuming[Element[k, Reals] && Element[m, Integers], Integrate[Exp[I (m x + k Cos[x])],{x, 0, 2 Pi}]] 

Should I allow m to be more general, i.e., any numeric value (not necessarily fond of fractional Bessel function indices) or am I missing some other assumption that is preventing Mathematica from giving the proper result?

(I doubt this matters but for completeness, I have v12.1.1.0 and am using a Macbook Pro laptop.)

Note the linked question Evaluate the defining Integral of the Bessel functions of the first kind has several answers that kind of answer my question, but I am curious why the above does not actually integrate. That is, I specify the regions of validity clearly and arguments so Mathematica should recognize that the input is the integral form of the Bessel function. I want to know why it’s not evaluating, not just that it won’t or how to make it work by explicitly specifying the Bessel function index m using something like Table.

Calling a plugin function in a template [closed]

I’m using the WP-property plugin with the import addon. It imports properties from a local MLS. In the property edit screen, it displays the last import time and date in the meta box. I need to display this on the font end. (The plugin docs don’t provide a way to do this).

I found the function that displays this time and date (it is edited to suit my needs for a font-end display). The class name is class_wpp_property_import

      static public function wpp_publish_box_options( $  id ) {     global $  post, $  wp_properties;      if( !$  wpp_import_schedule_id = get_post_meta( $  post->ID, 'wpp_import_schedule_id', true ) ) {       return;     }      //** Get time stamp from new format ( Version 2.6.0+ ) */     $  import_time = get_post_meta( $  post->ID, 'wpp_import_time', true );      //** Get time stamp from old meta_key ( pre-version 2.6.0 ) if new meta_key does not exist */     if( empty( $  import_time ) ) {       $  import_time = get_post_meta( $  post->ID, 'wpp_xml_import', true );     }      if( !empty( $  import_time ) ) {       $  import_time = date_i18n( __( 'M j, Y @ G:i', ud_get_wpp_importer()->domain ), strtotime( $  import_time ) );       ?>        <div class="misc-pub-section xml_import_time misc-pub-section-last">         <span class="wpp_i_time_stamp"><?php printf( __( 'Imported on: <b>%1$  s</b>', ud_get_wpp_importer()->domain ), $  import_time, $  import_url, $  import_name ); ?>           <b></b></span>       </div>     <?php     }    } 

But when I add this (as a shortcode) I get a critical error. I’m using another plugin to create the shortcode easily.

I’ve also tried just using the HTML within the divs (also via shortcode) hoping that the function is firing anyhow, but no go. I’m wondering if it only fires on the backend.

Any help on this? I’ve been at it for a while and I think my brain is fried.

I tried calling the class, still get a critical error:

    class class_wpp_property_import {   static public function wpp_publish_box_options( $  id ) {     global $  post, $  wp_properties;      if( !$  wpp_import_schedule_id = get_post_meta( $  post->ID, 'wpp_import_schedule_id', true ) ) {       return;     }      //** Get time stamp from new format ( Version 2.6.0+ ) */     $  import_time = get_post_meta( $  post->ID, 'wpp_import_time', true );      //** Get time stamp from old meta_key ( pre-version 2.6.0 ) if new meta_key does not exist */     if( empty( $  import_time ) ) {       $  import_time = get_post_meta( $  post->ID, 'wpp_xml_import', true );     }      if( !empty( $  import_time ) ) {       $  import_time = date_i18n( __( 'M j, Y @ G:i', ud_get_wpp_importer()->domain ), strtotime( $  import_time ) );       ?>        <div class="misc-pub-section xml_import_time misc-pub-section-last">         <span class="wpp_i_time_stamp"><?php printf( __( 'Imported on: <b>%1$  s</b>', ud_get_wpp_importer()->domain ), $  import_time, $  import_url, $  import_name ); ?>           <b></b></span>       </div>     <?php     }    }}  

Function providing input and integration limits for NIntegrate

I am trying to define some custom function that evaluates the numeric integral of some complicated function. The problem is that I would like to include as an input the integration limits. A MWE follows

f[x_,y_]:= Exp[-2 x^2 y^2] test[x_?NumericQ,IntL_]:= NIntegrate[f[x, y],IntL] myIntL1= {y,-4 x^2,4x^2}; myIntL2= {y,-4 x^4,4x^4}; 

Then, if I evaluate for instance test[3,myIntL1] I get a problem concerning an invalid limit of integration.

Is there a clever way to fix this without defining several functions including the integration limits, such as

    test1[x_?NumericQ,IntL_]:= NIntegrate[f[x, y],{y,-4 x^2,4x^2}]     test2[x_?NumericQ,IntL_]:= NIntegrate[f[x, y],{y,-4 x^4,4x^4}] 

etc?

Of course, here everything looks simple, but in my case all the functions are rather long; some even purely numeric ones. Since I have multiple choices for the integration limits, it would be more practical to avoid defining test1[x_], test2[x_], ..., testN[x_]

Thanks in advance, Pablo

Pinch Gesture for Function Other than Zooming- Unity

I’m working on a game in which I want to pinch outwards on a character, which causes the character to split into 2 smaller copies of itself.

The method I’m thinking about using is to have the "pinch out" gesture destroy the game object and simultaneously create two instances of the smaller game object, and have them follow the fingers that pinch out. The action would also be reversible with the "pinch in" function.

My idea would be to do a raycast to detect the two-finger touch on the object (would I need a collider for that?), then use the beginning and ending touch points to determine if it is pinching out or in.

The problem is I am brand new to Unity and C# and have no idea how to write all of this. All of the tutorials for multi-touch gestures have to do with camera zoom, which is not what I am going for.

Can anyone tell me if I’m on the right track with my logic and provide some guidance on writing the code?

Function to recalculate shipping costs on subscriptions after renewal with Automatewoo

I’ve got a funky plugin that was custom made that adds a new random product from a group that a customer subscribes to.

Problem is, that the shipping doesn’t change depending on which product is selected, it stays with whatever was chosen initially.

Rather than paying more money to redevelop something that might already exist, is there any code that will recalculate shipping costs based on the item in the subscription? I have automatewoo, so could use a custom function from that and run it after a subscription payment has completed, I just don’t know how to code it.

Any support appreciated!

Jono.

Is it possible to ask Mathematica to give all the roots of the given function?

I have this equation

$ $ 36 \cos \frac{3 x}{4} \cos \frac{27 x}{20} \left(\cos \frac{3 x}{5} +2 \cos \frac{21 x}{10} \right)=0 $ $

Is it possible to ask Mathematica to give all the roots of the function on the domain $ 0<x<4\pi$ ? Preferably as a rational multiple of $ \pi$ ? (the plot of the function is attached)

36 Cos[(3 x)/4] Cos[(27 x)/20] (Cos[(3 x)/5] + 2 Cos[(21 x)/10]) == 0  

enter image description here

How to tell MMA to transform a number to a factorial,Is there a native function?

I came across the need to transform a number into a factorial n, with positive integer n, I have searched in the MMA information but I can’t find anything like that.

I imagine an input, which verifies that it is a factorial, and if it is, prints the number in its n-form!

if there is no native function any idea how to implement it?

for example

6402373705728000=18!

51090942171709420000 does not correspond to a factorial.

How to contour plot a quantized function?

I am trying to plot a function over a 2 dimensional region, which takes integer and half integer values.

However, due to numerical approximations and errors, the calculated value of the function sometimes becomes 0.99 or 1.01 instead of exactly 1. When I make a contour plot, it gives a certain color between 0 and 1, another color between 1 and 2, and so on. As a result, 0.99 and 1.01 acquire different colors (while I want both of them to be the same color, because they represent 1).

What would be an efficient way to plot different integers (approximately, upto numerical errors) and half integers with different colors in a contour (or a similar) plot?

Also, the function takes values between -2 and 2, so I don’t need to take care of all integers.

I cannot use floor function because that will send both 0.99 (should be 1) and 0.01 (should be 0) to 0.

Applying FunctionContinuous in Module to a function parameter

I have a function:

f[x_] = Tanh[2x - 1] * Cos[x] - Sin[x] / x 

which is discontinuous in $ x=0$ . I am building a Module[], which is supposed to calculating an integral of given function:

MyNIntegral[f_, x_, a_, b_, n_:1000] := Module[{division, result},   If[Not[FunctionContinuous[{f[s], a <= s <= b}, s]], Print["Error"], Print["It is good!"]]   division = Table[a + k * (b - a) / n, {k, 1, n - 1}];   result = (b - a) / n * (f[a] / 2 + Sum[f[division[[k]]], {k, 1, n - 1}] + f[b] / 2);   Return[result]; ] 

Obviously, the function generates the problem – division by zero, when a_ = 0. I would like to inform an user that such a problem occured and abort the evaluation of the Module[].

But some errors have shown up:

  • Set: Tag Times in division$ 651124False is Protected.
  • Part: specification division$ 651124[[1]] is longer than depth of object.
  • Part: specification division$ 651124[[2]] is longer than depth of object.
  • Part: specification division$ 651124[[3]] is longer than depth of object.

Is this caused by the protecion of passed arguments? What can I do with that? How to use a function on a function inside module?