# Tag Info

35

Well, here's my reply to a similar question from a while back: I'm looking for comprehensive and rather long answers to these questions. What's the difference between Mathematica and MATLAB? Several letters in the names. Can MATLAB do what Mathematica does and vise versa? Yes. Both are Turing complete. Good luck writing heavy symbolic work in MATLAB ...

15

I have just purchased both for personal use and am getting used to both. Before that I had various experience in other paradigms, including Lisp, Prolog, Algol-like languages, a bit of Fortran, C, etc. I like the two M's for their built-in graphics. MATLAB For me, I would say that, once you get used to MATLAB's syntax, everything is pretty straightforward. ...

14

I believe the main difference between Mathematica and MATLAB is that Mathematica is a (mostly rule-based) term rewriting language born for symbolic analysis that has developed a very extensive set of specific procedures, even in its core functionalities. MATLAB is a procedural language with a very limited (this is an advantage) set of core commands and was ...

9

I'm an experimental physicist. I use Mathematica occasionally and used to use MATLAB. I've since mostly replaced MATLAB by Python but can still speak to Mathematica and MATLAB. I use Mathematica for symbolic analytic calculations. If I know the equations that setup my problem and I want to come up with an analytical answer (so that I can immediately see the ...

9

The line Table[N[PHI30EQ[u], 30], {u, 0, 0.1, 0.001}] doesn't do what you think it does. You're asking for 30 digits of precision, but you supply u as a machine number. If you mix arbitrary precision and machine precision like that, you'll get machine precision answers. I suspect you instead want is: Table[N[PHI30EQ[u], 30], {u, 0, Rationalize[0.1], ...

7

I have abused Mathematica since version 3 and right out of the gate I will say that the Notebook interface remains unparalleled compared to other platforms: MATHLAB, Python, R, Stata (of which I have working experience). Although Livescripts have been a welcome addition to MATLAB, I still prefer Mathematica as a comfortable graphical interactive workspace. ...

7

There's a bisection method right here. Use bisect = ResourceFunction["BisectionMethodFindRoot"] bisect = ResourceFunction["BisectionMethodFindRoot"]; f[x_] := Cosh[2 Sinh[x^3 - 1] Exp[-x^2]] - 3 root = bisect[f[x], {x, 0.25, 1.0}, 9, 10000] Plot[f[x], {x, 0, 2}, PlotRange -> {-2, 3}, Epilog -> {Red, PointSize[Large], Point[{x /. ...

6

I think this is worth reporting to Support. For instance, using formula 7.5.8 from the DLMF: With[{x = N[8 + 1*^-28, 32]}, With[{ζ = Sqrt[π] (1 - I) x/2}, Im[(1 + I)/2 Erf[ζ]]]] 0.46021421439301448386198863207105 and the result is comparable to evaluating N[FresnelS[8 + 1*^-28], 32]. In theory, one is supposed to use the auxiliary functions $f(z)$ ...

6

After minor corrections and typo removing's we have stable result with some options: pts = 10; h = 1/pts; tmax = 50; (*length of square*)L = 1;(*Time integration*)T = 2;(*Diffusion \ parameter for the prey*)d1 = 0.00028;(*Diffusion parameter for the \ predator*)d2 = 0.00028;(*Fertility parameter for the prey*)a = \ 0.0001;(*Mortality parameter of the prey in ...

5

In general, Reduce is the most powerful Mathematica function for solving equations. Reduce[par == line && 0 < u < 2 Pi && -Pi < v < Pi, {t, u, v}, Reals] (* (t == AlgebraicNumber[Root[-18291750000 + 235480000*#1 - 237800*#1^2 + 48*#1^3 + #1^4 & , 1, 0], {0, 1/725, 0, 0}] && u == 2*ArcTan[AlgebraicNumber[...

4

The incorrect result is: FresnelS[N[8+1*^-28, 32]] //InputForm 0.46075248359440792463.970167826243401 Note that the precision of the output is 3.97, indicating that the 4th digit may not be accurate, which is exactly what you observe. If you increase the precision: FresnelS[N[8+1*^-28, 43]] //InputForm 0.46075248359440792463.970167826243401 You still ...

4

This interesting problem can be solved numerically by computing InterpolationFunctions for the two sums of integrals in the last two lines of code in the Question. λ2 = -(1/2) + r + 1/(1 + r) - r^2 Log[1 + 1/r]; k = 0.5; r = 0.5; t = Flatten[Table[ R1 = ImplicitRegion[θ (v + r) > r && 2 θ v s + (1 - θ) r > λ1, {{θ, 0, 1}, {v, 0, 1}}]; R2 = ...

4

In general, first try Reduce as already mentioned. But some more difficult curves will not reduce or Mathematica will hang. For example: par = {1, Erf[t], Cos[t]}; line = {1, 1/2, 0} + {0, 1, 1} s; Reduce[par == line && 0 < s < 2 && 0 < t < 2, {s, t}] Instead you can try minimizing the distance between the line and the curve: ...

4

To add to this discussion, I picked up Python in Visual Studio/Jupyter Lab for the note book feature a few years back. I have never used Matlab but my students have. I personally Mathematica to be absolutely unequaled for prototyping mathematical models. It provides so much to work out why things work and don't. For any kind of serious application work, I ...

4

Version 12.1.1 has a new PDE modeling tutorial on Modeling Mass Transport. The section Interphase Mass Transfer shows an example of how inter phase mass transport can be modeled with NDSolve. The related question of modeling phase change is shown in the section Transient PDEs with Nonlinear Transient Coefficients of the Finite Element Programming tutorial

4

It's a question of numerical precision. Set ky and ky to zero and plot the integrand ii, enlarge working precision and rationalize variable in Plot. ii[p_, u_] = 96*Cos[p/2]*(1 + I*kx*Cos[p] + I*ky*Sin[p])^(-7/2)*1/(6!* Sqrt[Pi])*(((Sqrt[ 2*u]/(Cos[ p/2]*(1 + I*kx*Cos[p] + I*ky*Sin[p])^(1/2)))^6 + 15/2*(Sqrt[ 2*u]/(Cos[...

3

The following problem is hidden by NIntegrate, but which is one of the common sources of the NIntegrate::izero message you get from the OP's code. Exp[-I*k*s]*s^(1/2 + 2)*Exp[-s]*Cos[f/2]* Exp[-Sqrt[8*s*u]/Cos[f/2]] /. {k -> 0, u -> 0.1} /. {f -> 1., s -> 1000.} General::munfl: Exp[-1032.23] is too small to represent as a normalized machine ...

3

The root cause of the difficulties encountered by the OP is that MeijerG, as implemented in Mathematica, often is not accurate when evaluated at machine precision. For instance, with the parameters, params = {p -> 1, q1 -> 1, q2 -> 1, q13 -> 1, qi1 -> 1, mu -> 3/2, L -> 3, gammak1 -> 1, BI -> 9, C1 -> 4, Bsd -> 4, M -&...

2

Too long for a comment. First, your F[w_,s_]:= (1/(s + (I*a*w)/mx + ((\[Sigma]^2 + a^2)*w^2)/(2*mx) + balpha/mx^2*s^(alpha - 1)*(I*w*a + 1/2*(\[Sigma]^2 + a^2)*w^2))) is a complex valued function. I don't see any reason why its inverse Fourier transform should be a real valued function. Second, up to the definition used by Mathematica, its inverse Fourier ...

2

I now realize that the question can be solved analytically, for the most part, although not with ImplicitRegion. The constraints embodied in R1 and R2 can be solved to obtain θ in terms of v and parameters. r1c1 = Reduce[θ (v + r) > r && v > 0, θ] // Last (* θ > 1/(1 + 2 v) *) r1c2 = Reduce[2 θ v s + (1 - θ) r > λ1 && v > 0 &...

2

You can integrate a DAE for your function with NDSolve. I used a low-order integration rule to get dense sampling when the second derivative is large in magnitude. I used a low PrecisionGoal so that the number of points would be low, which helps the visualization below show where the sampling is denser. You can change the precision as desired. approx = ...

1

We can use NDSolve[] to solve this problem as follows: system[j_] := {A1'[x] == I*\[Kappa]1*Conjugate[A2[x]]*A3[x]*A4[x]* E^(-I*\[CapitalDelta]kl*x) + I*A1[x]*(\[Alpha]11*Abs[A1[x]]^2 + \[Alpha]12* Abs[A2[x]]^2 + \[Alpha]13*Abs[A3[x]]^2 + \[Alpha]14* Abs[A4[x]]^2), A2'[x] == I*\[Kappa]2*Conjugate[A1[x]]*A3[x]*A4[x]*...

1

After modifying ParametricNDSolve to ParametricNDSolveValue (without argument brackets ...[x]) DEsols = ParametricNDSolveValue[system, {A1 , A2 , A3 , A4 }, {x, 0, 2000}, {j}] you can access A4 Plot[sols[0][[4]][x], {x, 0, 2000}] Unfortunately your system seems to be solvable only for j==0

1

for v5.2, s Conjugate[s] is fast too, ref the pic:

1

Just so you know, open source Maxima's "bfloat" function (which uses "fpprec" option defined from 0 to ∞ to set the machine precision) hasn't any limitations at all and theoretically can calculate up to infinity. However, in reality it depends on your hardware.

Only top voted, non community-wiki answers of a minimum length are eligible