# Tag Info

0

Too long for a comment - Your answer works, but I improvised this to my current problem and it doesn't seem to work.. Clear["Global*"] C1 = 10^(-10); C2 = 0.1*C1; R = 50; Tb = 0.1; Geb = 5*10^-15; Z0 = 50; L[Te_] := 10^-9 + 10^-9*(Te - 0.1); Zlcr[Te_, w_] := (1/R + 1/(I*L[Te]*w) + I*C1*w)^-1; Zload[Te_, w_] := -I*w*C2 + Zlcr[Te, w]; \[CapitalGamma][Te_, ...

0

This is a comment to Mark's (@MarkMcClure) answer (I do not have enough rep to comment). The Neumann[0,...] is not needed in this case. Neumann zero boundary conditions drop out of the FEM equations and play no role in the solution. If a boundary has no boundary condition prescribed then they are implicitly set to Neumann zero boundary values. This is why ...

1

This gives the solution to the equation: temp = Solve[eqn[x, y, z], D[y[x, z], x]] This extracts the value of the rule: res = D[y[x, z], x] /. temp This evaluates the result at the requested coordinates: res /. {x -> 1, y -> 1, z -> 1} (* {9} *)

2

Too small to post as comment, as I am not sure about your equations. First, You have few syntax errors. 1) it is I not i, 2) Need space, as in I z and not iz 3) You are solving for y[x,z] and not D[y[x,z],x 4) You are using y[x, z] == 2 but y[x,z] 5) do not know what y=2 is initial conditions mean. You mean y[0,z]=2 or y[x,0]=2? Also, why write g as you ...

0

Try: NDSolveValue[{2 - x*Abs[3/(2 - I z)]*2 x/(1 - 3 D[y[x, z], x]) == 3 y[x, z], y[0, z] == 2}, D[y[x, z], x], {x, 0, 1}, {z, 0, 1}] Initial conditions need to be set at a specific point, the complex is I not i. Then plot the derivative: Plot3D[%, {x, 0, 1}, {z, 0, 1}]

1

I'd like to add to Mark's answer but do not have enough rep to do so in a comment. One can write: Needs["NDSolveFEM"] omega = ImplicitRegion[x^6 + y^4 <= 1, {x, y}]; m = ToElementMesh[omega]; uif = NDSolveValue[{Derivative[1, 0, 0][u][t, x, y] == Derivative[0, 0, 2][u][t, x, y] + Derivative[0, 2, 0][u][t, x, y], ...

3

Using V10's new FEM functionality, this problem can be solved as follows << NDSolveFEM; omega = ImplicitRegion[x^6 + y^4 <= 1, {x, y}]; mesh = ToElementMesh[omega, "MaxCellMeasure" -> {"Area" -> 0.005, "Length" -> 0.1}]; gamma = DirichletCondition[u[t, x, y] == 0, x^6 + y^4 == 1]; u = NDSolveValue[ {Derivative[1, 0, 0][u][t, x, y] ...

0

Instead of explaining too much, here is some correct MMA-code for your problem. By studying it (and the documentation of MMA) in detail you will discover the answer to your question: In[69]:= Clear[a, y, v, yy, vv, sol] In[70]:= sol = DSolve[{y'[t] == v[t] , v'[t] == -a^2 y[t], y[0] == 0, v[0] == 1}, {y[t], v[t]}, t]; In[71]:= {yy[t_, a_], vv[t_, a_]} ...

0

one way, if I understand you right (even though I think this will be closed :) Clear[v, t, y]; a = 9; eq1 = y'[t] == v[t]; eq2 = v'[t] == -a^2 y[t]; sol = First@DSolve[{eq1, eq2, y[0] == 1, v[0] == 2}, {v[t], y[t]}, t]; ParametricPlot[Evaluate@{v[t] /. sol, y[t] /. sol}, {t, 0, 1}] (as others mentioned, you have lots of syntax errors there)

4

I often do this sort of thing with Dt. It works on equations, too. It basically gives you the multivariate differential $${\partial f \over \partial x} \;dx + {\partial f \over \partial y} \;dy + \cdots = 0$$ To get $dy/dx$, set $dx = 1$ and any other differential other than $dy$ equal to zero. Then solve for $dy$ to get $dy = - ({\partial f /\partial ... 2 It maybe done by finding first the total derivative of a function f(x,y,z) f = Sin[y] + y - Sin[1/x] - x z; Dt[f] (*-z Dt[x] + (Cos[1/x] Dt[x])/x^2 + Dt[y] + Cos[y] Dt[y] - x Dt[z]*) then solve fro both Dt[y] and Dt[x] dy = Dt[y] /. Solve[Dt[f] == 0, Dt[y]][[1]]; dx = Dt[x] /. Solve[Dt[f] == 0, Dt[x]][[1]]; f2=dy/dx/. {x -> 3/10, y -> 4/10}; ... 0 Or using Derivative: y1[x_] := Sin[1/x] - 1/x - z y1'[0.3] 22.0186 y2[x_] := Sin[1/x] - 1/x - x*z y2'[0.3] 22.0186 - z y2''[0.3] -123.264 2 Comment: I think you want D instead of Derivative. Also == instead of =. And you probably want the functions defined with patterns z_ etc. But there are errors that you'll have to address. (Or perhaps someone else.) ClearAll[φ, η, r, u]; φ[z_] = q*(1/z + (-1*q)/(-1*z)); η[z_] := k*(1/z + (-1*q)/(-1*z)); r[ρ_, z_] := Sqrt[ρ^2 + z^2]; pde = D[u[t, ρ, z], ... 2 y[x_, z_] := Sin[1/x] - 1/x - z D[y[x, z], x] /. x -> 0.3 Not exactly sure what you wanted to do after that. Update 1 y[x_, z_] := Sin[1/x] - 1/x - x z D[y[x, z], x] /. {x -> 0.3, z -> 1} Update 2 eqn = Sin[y[x, z]] + y[x, z] == Sin[1/x] + x z Solve[ D[eqn, x] /. {x -> 0.3, z -> 0.5, y[x, z] -> 0.4}, D[y[x, z], x] /. {x -> ... 7 The sign of the radial coordinate is of course supposed to be non-negative, and indeed your example shows that the sign flips to a negative value after some time. However, this is an artifact of the special case you considered in the example: the case of zero angular momentum, pPhi = 0. If you give the angular momentum any arbitrarily small non-zero value, ... 1 It seems that you're missing a solution of Ef1. Try y = NDSolve[{eqnBo == 0, Eb1[r, 0] == 0, eqnDe == 0, Ef1[r, 0] == 0, Derivative[1, 0][Ef1][rn, t] == 0, Ef1[ro, t] == eo}, Ef1, {r, rn, ro}, {t, 0, 14400}]; Plot[Ef1[r, 14400] /. y, {r, rn, ro}, PlotRange -> Automatic] 1 I suggest going with the second approach: choose a set of points and follow their trajectories. To solve differential equations numerically, use NDSolve (as a documentation search quickly reveals). To plot a set of points in 2D, use ListPlot. This information, together the the documentation of the mentioned functions and some of the basic tutorials is ... 2 I think you don't need to have two equation to describe behavior of domain follows same PED. you may need to add UnitStep to the thermal diffusivity factor. check if this work for you (domain of length=1): sol = u[x, t] /. NDSolve[{ (1 - 0.5 UnitStep[x - 0.5]) D[u[x, t], t] == D[u[x, t], x, x], u[x, 0] == 0, u[0, t] == 300, (D[u[x, t], x] /. x -> 1) ... 2 You don't need two different functions because the position-dependent material parameter can be incorporated into a function that I'll call d[x] and that enters in a single heat conduction equation as follows: d[x_] := (1 + 4 UnitStep[5 - x])/5. heateq = d[x] D[u[x, t], t] == D[u[x, t], {x, 2}]; Plot[d[x], {x, 0, 10}, PlotRange -> {0, 1}, Exclusions ... 2 To give another answer for the one-dimensional harmonic oscillator, let's use a different approach based on the NDSolve functionality I alluded to in the linked answer. n = 2000; a = .02; grid = N[a Range[-n, n]]; derivative2 = NDSolveFiniteDifferenceDerivative[2, grid]["DifferentiationMatrix"] SparseArray[<20009>,{4001,4001}] potential = ... 2 To see the steps you can just ask Wolfram|Alpha :) WolframAlpha["r v[z] == Exp[z] + g v'[z] + s^2/2 v''[z]"] But if you're wanting to do it yourself, here's what I recommend. I'd do the following: guess = a Exp[z] + b Exp[c z]; odesub = ode /. {v[z] -> guess, Derivative[n_][v][z] :> D[guess, {z,n}]} // FullSimplify (* b E^(c z) (2 c g - 2 r + ... 1 ode = r v[z] == Exp[z] + g v'[z] + s^2/2 v''[z]; guess = {v -> (a Exp[#] + b Exp[c #] &)}; Resolve[ForAll[z, ode /. guess], Reals] (* ...a huge mess, after a while ... *) 0 First, your code contains simple mistake, you should distinguish [] from (), then your equations still can't be solved, it's a common problem for the boundary value problem (BVP) of nonlinear ODE(s), and the almost only solution as far as I know is "shooting method": u = 5/100; g = 2/10; s = NDSolve[{x''[t] == 4/(π^2 x[t]^3) - 10/(π^2 x[t]^2) - ... 3 Data Remove["Global`*"] G = 6.672*10^-11;(*Gravitational constant*) m = 5.97219*10^24;(*Mass of Earth*) r = 6.37101*10^6;(*Earth mean equatorial radius*) delT = 0.005;(*Step size*) nSteps = 10000; NDSolve result Clear[x, y, t]; soln = First@NDSolve[{ x''[t] == -((G m x[t])/(x[t]^2 + y[t]^2)^(3/2)), y''[t] == -((G m y[t])/(x[t]^2 + ... 3 Your problem is caused by a simple mistake. To solve a set of 2nd order ODEs with RK4, we need to rewrite the ODEs into a set of 1st order ODEs, like: $$u'(t)=\frac{G m x(t)}{(x(t)^2+y(t)^2)^{3/2}}$$ $$v'(t)=\frac{G m y(t)}{(x(t)^2+y(t)^2)^{3/2}}$$ $$x'(t)=u(t)$$ $$y'(t)=v(t)$$ Then compare the above equations with the corresponding part in your code, ... 9 You can write your own algorithm and use it from NDSolve. For example, for RK4: CRK4[]["Step"[rhs_, t_, h_, y_, yp_]] := Module[{k0, k1, k2, k3 }, k0 = h yp; k1 = h rhs[t + h/2, y + k0/2]; k2 = h rhs[t + h/2, y + k1/2]; k3 = h rhs[t + h/2, y + k2]; {h, (k0 + 2 k1 + 2 k2 + k3)/6}] CRK4[___]["DifferenceOrder"] := 4 CRK4[___]["StepMode"] := Fixed ... 7 expr = x^2 D[u[x, y], {x, 2}] - D[u[x, y], {y, 2}] + D[u[x, y], y]$Assumptions = {s > 0, t > 0} expr /. u -> (u[# Exp[#2], # Exp[-#2]] &) /. {x -> Sqrt[s t], y -> Log[Sqrt[s/t]]} // Simplify Second set of replacement rules is from: Eliminate[s == x Exp[y] && t == x ...

0

Just in case someone else need it (for example, quite possibly myself in the future), this is how I've done it (Note: In the answer a different change of variables has been used) s[x_, y_] := Log[x] + y t[x_, y_] := Log[x] - y Factor@D[u[s[x, y], t[x, y]], {x, 2}] FullSimplify@D[u[s[x, y], t[x, y]], y] Factor@D[u[s[x, y], t[x, y]], {y, 2}] x^2 D[u[s[x, y], ...

3

The easiest way to work with your sampled points is to derive an interpolating function from it. pts = {{0, 1.00799}, {0.1, 1.09268}, {0.2, 1.18921}, {0.3, 1.25086}, {0.4, 1.32473}, {0.5, 1.36879}, {0.6, 1.39813}, {0.7, 1.41114}, {0.8, 1.39531}, {0.9, 1.3986}, {1., 1.39468}}; f = Interpolation[pts]; Given f, to solve your ODE with Euler's ...

2

You can derive the radial solution to your differential equation as follows: Eq = -(D[f[x, y], {x, 2}] + D[f[x, y], {y, 2}]) + (x^2 + y^2 - 2) f[x,y] == 0; Assume that the solution is of the form fr[r] where r^2 = x^2 + y^2, and transform the {x, y} differential equation to the corresponding r differential equation. Eqr = Eq /. f -> (fr[Sqrt[#1^2 + ...

8

In order to give one possible answer, I'll just take the isotropic harmonic oscillator in 2D and do a finite-difference calculation by discretizing the xy plane with constant spacing a. Here is the construction of the resulting matrix for the Hamiltonian, h. I assume the origin of our spatial grid (where the potential minimum is) lies at {0,0}, and the ...

2

The Mathematica code you posted does not correspond to the equation you wrote. D[f[x],x] denotes/computes a single derivative. The second derivative, f''[x], should be written as D[f[x],{x,2}]. Please read the documentation of D. The correct way to translate this equation into Mathematica code is -(D[ψ[x, y], {x,2}] + D[ψ[x, y], {y,2}]) + (x^2 + y^2 - ...

3

Here is how you can solve the simple harmonic oscillator — i.e. quadratic potential — eigenvalue problem using Mathematica. For simplicity, I set all of the constants to unity. Define the differential (Schrödinger) equation. deqn = -(1/2) y''[x] + 1/2 x^2 y[x] == e y[x]; Solve the differential equation. sol = DSolve[deqn, y, x][[1]] (* {y -> ...

0

You can solve the characteristic polynomial of your matrix (equation(s)): CharacteristicPolynomial[ m, \[Lambda]] Solve[0 == %, \[Lambda]] or just use this function Eigenvalues[m]

0

I evaluated DSolve[-2 D[((α + γ/2) a + β/(2 a) - R a^3)*p[a], a] + D[(γ a^2 + β) p[a], {a, 2}] == 0, p[a], a] which is equivalent to the first formulation of your problem, but which eliminates the approximate coefficient (i.e., 0.5). Mathematica V9.0.1 returned {{p[a] -> a*E^(-((a^2*R)/γ) + ((R*β + α*γ - γ^2)*Log[β + a^2*γ])/γ^2)*C[1] + ...

5

Similar to yet distinct from the other solutions. Substitute two values for t (not a period apart), to create two independent equations. Then you will get a unique solution. Solve[-2 Exp[t] ((n + 3 m) Cos[2 t] + (-3 n + m) Sin[2 t]) == Exp[t] Cos[2 t] /. {{t -> 0}, {t -> 1}}, {n, m}] (* {{n -> -(1/20), m -> -(3/20)}} *) (Of course, the ...

5

Here is another way to solve problems of this type: create a system of at least two independent equations for the two variables a and b. How to do this if you only have one equation to begin with? In your case one side of the equation (Exp[t] Cos[2 t]) is independent of the unknowns, so I just evaluate that side at some specific values of t and use those as ...

5

You want to extract coefficients of terms in Cos[t] and other functions of t and find values of {A, B} that make these terms vanish. SolveAlways can do this sometimes (works reliably when input is polynomial, say). SolveAlways[ TrigExpand@{-2 Exp[t] ((A + 3 B) Cos[2 t] + (-3 A + B) Sin[2 t]) == Exp[t] Cos[2 t]}, {Sin[t], Cos[t]}] During ...

Top 50 recent answers are included