New answers tagged

0

Might be simpler to just use a high working precision and very small step size to assure accuracy: s = NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1}, y, {x, 0, 30},WorkingPrecision->50,MaxStepSize->1/5000] Bet that's pretty close to the actual value at x=30. I've solved them with precision=120 and step size=1/1000000 and accurate upwards to 50 ...


0

Is this what you want? NDSolve[{y'[x] == y[x] Cos[Sign[30 - x] x + y[x]], y[0] == 1}, y, {x, 0, 60}] %[[1, 1, 2]][0] - %[[1, 1, 2]][60] (* 0.0662557 *)


0

I tried something like this: sol[Tzero_, rzero_, rdash_, A_, B_, X_] := Module[{TZero = Tzero, rZero = rzero, rDash = rdash, Av = A, Bv = B, Xv = X, xL, xU, Dsol}, xL = -Xv; xU = Xv; Dsol = NDSolve[{T''[x] + T'[x]^2/(2 T[x] - 3) + (T'[x] r'[x])/ r[x] + (3 r'[x]^2)/(4 r[x] (2 T[x] - 3)) == 0, r''...


2

Your code is written in a style that makes it difficult to understand, but one thing is obvious: v must be given a value before any graphics can be displayed. Taking this into account and rewriting the code into something much simpler that I believe might be equivalent or close to equivalent to what you are trying get, I offer Manipulate[ {V, H, L, S} = {...


1

Fixed following steps from @rhermans 1) Delete directories $BaseDirectory, $UserBaseDirectory, $LocalBase, $CacheBaseDirectory 2) Re-activate Mathematica


4

The issue is caused by the top-level Evaluate interacting with the HoldForm wrappers returned by MessageMenu`Dump`$GetStack (which is defined as Stack[_]). This function is called twice when building the error message, explaining the two additional calls. How to find this We start by changing the definitions of the question a bit to make tracking easier: ...


0

Here we need to redefine all the constants and add boundary conditions for w t = 1; x = 0.1; a = 0.3; b = 0.5; d = 1; \[Phi] = \[Pi]/ 3; M = 0.5; Nt = 0.2; Nb = 0.2; Pr = 1; Ec = 0.1; Gr = 0.5; Gm = \ 0.5; k1 = 1; Br = 1; \[Lambda]1 = 0.5; h1 = -1 - k1*x - a*Sin[2*\[Pi]*(x - t) + \[Phi]]; h2 = 1 + k1*x + b*Sin[2*\[Pi]*(x - t)]; sol = NDSolve[{(1/(1 + \[...


6

Too long for a comment: ByteCount[mytest[data]] measures the memory required for the expression mytest[data]. The ByteCount of a Symbol is always zero; see the docs for ByteCount: Symbols are effectively always shared, so they give 0 byte count: In other words (I think), it does not count the memory required to store the symbol in the symbol/hash table....


6

Byte count is 64, for entry in indexed variable. Even if there is no data As mentioned in comment, use =. to clear specific index


3

StreamPlot is not designed to work with such domain specs. It ought to give a better message though. Actually it doesn't seem to validate the domain before sending it to the internal routines. (Probably, it used a standard plot validation, but the internal routines assume the limits are numeric, i.e., that it's a rectangle.) tr = Trace[ StreamPlot[{a, ...


3

No idea why it doesn't work as in Plot3D[ a b , {a, 0, 10}, {b, 0, a}]... Try RegionFunction StreamPlot[{a, b}, {a, 0, 10}, {b, 0, 10},RegionFunction -> Function[{a, b}, b < a]]


11

There are couple of problems with your code. It is an image, it would be way nicer not to have to rewrite it. Plotting Series If you go to ref / Series / Application you will see that Normal is used to plot a Series as otherwise O[x]^n will make Plot confused. Function definition Functions are defined more or less like that f[x_]:=... but if x is an ...


2

Here is another method that might work that retains essentially the same code you show in your question (unfortunately I do not have WM7 so I can't check if it will work for you). f[ee_] := Module[{e = ee, v0 = 100., a = 1.}, pot[x_] := If[Abs[x] <= a, -v0*(1 - Abs[x]/a), 0]; sol1 = NDSolve[{y''[x] + y[x]*(e - pot[x]) == 0, y[0] == 1, y'[0] == ...


4

First, see this answer to What are the most common pitfalls awaiting new users? for the use of _?NumericQ. A second issue is the dependence of a function on a global variable. This is particularly easy to overlook when the variable, such as x in sol1[], is not treated as a programming variable but as an inert symbol. However, Plot[.., {x,..}] sets the ...


2

How about using ParametricNDSolveValue: v0 = 100.; a = 1.; pot[x_] := If[Abs[x] <= a, -v0*(1 - Abs[x]/a), 0]; pfun = ParametricNDSolveValue[{sy1''[x] + sy1[x]*(e - pot[x]) == 0, sy1[0] == 1, sy1'[0] == 0}, sy1, {x, -a, 0}, e]; fun = pfun[-1.2]; Plot[Evaluate[D[fun[x], x]], {x, 0, -1}]


1

Maybe this will get you started: ff[r_?NumericQ, t_?NumericQ, l_?NumericQ] := NIntegrate[1/Sqrt[r] - 1/Sqrt[ll + r Sin[tt]], {tt, 0, t}, {ll, 0, l}]; Plot3D[ff[0.1, t, l], {t, 0, Pi}, {l, 0, 4}] In the original code, there was a restriction, r + l Sin[t] > 0, but I'm not sure how you want to handle that. You might use Piecewise[] or multiply the ...


0

You have defined f(x) = stuff but there is no x in the stuff. Instead, define f[d_,q_]:= stuff Then you can evaluate: f[1,1] 1/48 E^(-4 t) (-16 + 16 E^(-2 t) + 8 E^(4 t) + 48 C[1]) or f[x, x] // FullSimplify to see what happens in general.


Top 50 recent answers are included