calculus and analysis – How to do a fast numerical computation of an oscillatory integral including HeunC function using Mathematica?

I am trying to numerically compute the following integral in Mathematica

NIntegrate((x + 2)*Exp(2*I*a*(x + 2))*
  HeunC(-4*I*b, -4*I*b, 1 + 4*I*b, 1, -4*I*b, -x/2), {x, 1, 1000})

where HeunC is the confluent Heun function. Mathematica can numerically compute this integral for the known values of a and b. There are two problems here: When I increase the value of a and b, the integral becomes highly oscillatory and it takes a long time to be computed. Also, even for the small value of a and b, Mathematica spends a long time to compute this integral when the upper bound is 1000, but it is pretty fast when I decrease the upper bound. As an example, we can choose $a=5$ and $b=0.1$, and when I run the program, it takes longer than 5 minutes to compute the integral. Could you please help me with this problem? Thank you!

fitting – ProbitModelFit is causing kernel crashes in Mathematica 12.0

Thanks for contributing an answer to Mathematica Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

boolean computation – How can I use Mathematica to solve a complex truth-teller/liar logic problem?

You can enter the logic formulations into Mathematica like this — Copy & paste the following code, and you can see the symbols.

p = a (Equivalent) ((a (And) 
       b (And) (Not) c) (Or) (a (And) (Not) b (And) 
       c) (Or) ((Not) a (And) b (And) c));
q = b (Equivalent) (b (And) c);
r = c (Equivalent) ((Not) a (Or) (Not) b);
  1. We prefer lowercase variables, since some uppercase variables have special meanings (e.g., E for constant $e$, N for numerical value function).

  2. Most symbols (in the form of (...) as you see) have shortcuts to type and have built-in meanings. For example, a (Equivalent) b can be typed with a Esc equiv Esc b, and it’s just a more human-readable form of Equivalent(a, b) internally. That is, there’s not any difference from:

    p = Equivalent(a, (a && b && !c) || (a && !b && c) || (!a && b && c)); 
    q = Equivalent(b, b && c); 
    r = Equivalent(c, !a || !b);
    

Then you can use any of the following commands to get the result:

p (And) q (And) r // BooleanConvert
p (And) q (And) r // LogicalExpand
p (And) q (And) r // FullSimplify
! b && c

Hence $Pland Qland Requivlnot Bland C$, indicating B must be a liar and C must be a truth-teller. Truth table can be generated with:

TableForm(BooleanTable({a, b, c, p (And) q (And) r}, {a, b, c}), 
 TableHeadings -> {None, {"A", "B", "C", "P(And)Q(And)R"}})

reference request – Resources on python programming for Mathematica programmers

Are there any good guides to programming in python for people who are already very familiar to Mathematica. I understand that for some things the canonical python approach is different and it is good to learn that from a python guide from scratch but it would also often be useful to leverage some functional programming knowledge from Mathematica when programming in Python. It would be great if there was a guide explaining similar data structures and functions and the differences you have to be careful with when coming from Mathematica. For example I would like to know whether there are things like pure functions, @,/@, etc., that can be used in Python.

plotting – Mathematica Loop for a pattern

Thanks for contributing an answer to Mathematica Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

simplifying expressions – Simplify is giving wrong result in Mathematica

I am trying to do a simple multiplication of variables in Mathematica:

Simplify(n*(n + 1)*(n + 2)) /. {n -> 6*p + 1}

This gives me the output:

(1 + 6 p)^2 (2 + 6 p)

However, this is clearly wrong (unless I missed something).

The same things happens with Factor:

Factor(n*(n + 1)*(n + 2)) /. {n -> 6*p + 1}

I get the output:

12 p (1 + 3 p) (2 + 6 p)

This is also incorrect.

The correct answer would have been:

6 (6p + 1) (3p + 1) (2p + 1)

Why is Mathematica giving different results and how can I get the correct results?

Thanks.

wolfram mathematica – How to increase size of prefernce dialogue font?

after installing of wolfram Mathematica
I Found that size of preference dialogue font
is too small and it kinda hard for my eyes
is there a way to increase the font size
of the controllers

https://i.stack.imgur.com/N5fIh.png

my installation is on ubuntu 20.04
and wolfram version 12.1

equation solving – Perform Eliminate, Solve and Format at once in Mathematica

I have a series of equations where I use eliminate to get a new equation with desired variables. This equation is then solved for a specific variable and then the result is presented in a specific InputForm. Here is how I am doing it currently.

Eliminate({f == x^2 + y^2, a == x + y, b == x y}, {x, y})
2 b + f == a^2

Solve(2 b + f == a^2, b)
{{b -> 1/2 (a^2 - f)}}

Format(b, InputForm) /. {b -> 1/2 (a^2 - f)}
(a^2 - f)/2

So, I copy the result from Eliminate and then solve it for my variable and then copy the output and format it later.

Is there an easier way to do all this? For example, can I somehow specify in a single step the variables I want to eliminate and the variable for which I want to solve the equation and then get the output in InputForm?

I will probably have to do this for a lot of equations. So, copying each output, again and again, gets very tiresome.

Thanks.

import – Convert GiNaC harmonic polylogarithms to HPL packages’ notation in mathematica

A general out put from GiNaC(https://www.ginac.de/) of harmonic polylogarithms is

H(a,b,c...,x)

We want to convert it to mathematica version (https://www.physik.uzh.ch/data/HPL/)

HPL({a,b,c...},x)

Note: we need “a general string expression” for the “a,b,c…” in
H(a,b,c...,x) as we have to dealing with a lot of H‘s like:

converting H(2,2,x),H(2,1,x),H(2,1,2,x),H(1,2,3,4,x),H(1,2,3,4,5,x),etc

to HPL({2,2},x),HPL({1,2},x),HPL({1,2,3},x),HPL({1,2,3,4},x),HPL({1,2,3,4,5},x)

When to trust the result of numerical integration in mathematica?

How does one know when to trust the result of numerical integration, using NIntegrate, for higher (5 or 6) dimensional integrals in mathematica? For example, I get the following result

In(3):= Integrate( Exp(-a^2 - b^2 - c^2 - x^2 - y^2 - z^2), {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, {a, -2, 2}, {b, -2, 2}, {c, -2, 2}) // N

Out(3)= 30.1462

whereas if I do the same integral numerically, I get

In(2):= NIntegrate( Exp(-a^2 - b^2 - c^2 - x^2 - y^2 - z^2), {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, {a, -2, 2}, {b, -2, 2}, {c, -2, 2}) // N


During evaluation of In(2):= NIntegrate::eincr: The global error of the strategy
 GlobalAdaptive has increased more than 2000 times. The global error is expected
 to decrease monotonically after a number of integrand evaluations. Suspect one
 of the following: the working precision is insufficient for the specified 
precision goal; the integrand is highly oscillatory or it is not a (piecewise) 
smooth function; or the true value of the integral is 0. Increasing the value of
 the GlobalAdaptive option MaxErrorIncreases might lead to a convergent 
numerical integration. NIntegrate obtained 30.14615590437465 and 
0.0001823733624988688 for the integral and error estimates.

Out(2)= 30.1462

This seems to indicate that one can trust the result of NIntegrate if the error estimate is a small percentage (~1%) of the estimated value of the integral. If that’s true then how would one understand the discrepancy in the values obtained in the following two cases when Mathematica does not report any errors.

In(102):= NIntegrate( Exp(-a^2 - b^2 - c^2 - x^2 + y^2), {x, -2, 2}, {y, -2, 2}, {a, -2, 2}, {b, -2, 2}, {c, -2, 2}, Method -> "AdaptiveMonteCarlo") // N

Out(102)= 298.918

In(104):= NIntegrate( Exp(-a^2 - b^2 - c^2 - x^2 + y^2), {x, -2, 2}, {y, -2, 2}, {a, -2, 2}, {b, -2, 2}, {c, -2, 2}, Method -> "MonteCarloRule") // N

Out(104)= 313.592

In the following example, I also get a result with an error bar that is a small (~2%) percentage of the value of the integral

In(7):= NIntegrate( Exp(-a^2 - b^2 - c^2 - x^2 - y^2 - z^2), {x, -5, 5}, {y, -5, 5}, {z, -5, 5}, {a, -5, 5}, {b, -5, 5}, {c, -5, 5}, Method -> "AdaptiveQuasiMonteCarlo") // N

During evaluation of In(7):= NIntegrate::maxp: The integral failed to converge 
after 1000100 integrand evaluations. NIntegrate obtained 0.29686054547957375 and 
0.005304460608762476 for the integral and error estimates.

Out(7)= 0.296861

but comparing it with the following analytic evaluation of the integral


Out(8)= 31.0063

we see that the answer is way off. Any guidance in this regard will be greatly appreciated.