Community RSS Feed
https://community.wolfram.com
RSS Feed for Wolfram Community showing any discussions in tag Equation Solving sorted by activeGet symbolic expressions for summing sequences?
https://community.wolfram.com/groups/-/m/t/1636014
Hello!
Let's say that I am having this sequence:
a(n) = 2*a(n-1) - a(n-2) + 2*a(n-3) + a(n-4) + a(n-5) - a(n-7) - a(n-8)
with a[1] == 1, a[2] == 1, a[3] == 1, a[4] == 2, a[5] == 6, a[6] == 14, a[7] == 28, a[8] == 56 as the base cases.
Now, I want to find the sum of a(1)^3 + a(2)^3 + .... + a(n)^3 SYMBOLICALLY, with respect to the first 8 base cases. There will be of course some cross terms ie. a(1)*a(2), etc, but it should be in terms of only the first 8 base cases.
I can use the RecurrenceTable and Total for finding numbers, but how can I do it symbolically and also simplify it to only the first 8 base cases?
Thank you very much in advance.Thanos Papas2019-03-19T15:37:21ZSystem of algebraic equations with 6 variables
https://community.wolfram.com/groups/-/m/t/1638692
Hello,
I am new to Mathematica, and I just downloaded it tonight. I need to do a very specific procedure: calculate a complicated system of equations in 6 variables. I have tried for hours on end to do this, following the instructions as they are listed in Mathematica: "In a system of equations with multiple variables, you can solve for some or all of the variables by using a list in the second argument." I have done so, but my answer is given as one number, which makes no sense. My work is given below.
Solve[{44826600000*a+406601000000*b+
134691918588*c+656526*f+512206908*e+170700546*d-7642032.5==0,3757520000000*b
+406601000000*a+1233170000000*c+5925820*f+4678814294*e+
1544327542*d-69097900==0, 406601000000*c+134692000000*a+
1233170000000*b+1967580*f+1544327592*e+512206908*d -22936700==0,
170700546*a+1544327592*b+512206908*c+2550*f+1967580*e+656526*d-29327.5==0,
512206908*a+4678814150*b+1544327592*c+7634*f+5925818*e+1967580*d-87833==0,
10*f+656526*a+5925820*b+1967580*c+7634*e+2550*d-113.5==0},
{a,b,c,d,e,f}]
Answer: 4.06601 x 10^11.
What is this answer??? I should be getting a different value for a, b, c, d, e, and f, not a single number. Can someone please help me and tell me what exactly I am doing wrong?
Thanks!Quentin Moliterno2019-03-24T02:43:24ZSolving for an expression in cascades of stages and ladders
https://community.wolfram.com/groups/-/m/t/1638221
This may be a dumb question, but I often need to solve expressions for something other than a variable. As a trivial example, say we have a common-emitter amplifier:
Vout = Vsupply - (Vin - Vbe)((hfe + 1)/hfe) * RC/RE
And I want to solve it for the DC transfer function Vout/Vin. Can Mathematica do this, at all?
Now, I understand there is actually no solution here, but a small change makes it solvable (and still easy to reason around):
Vout = - (Vin - Vbe)((hfe + 1)/hfe)*RC/RE
Now, this simple example I can solve easily. But there are complex expression created in cascades of stages and ladders that get a bit more complex in hurry... But even being to solve the simple problems would be nice as a "calculator" function. I can calculate square roots and look up logarithms in tables myself also, but I sure prefer to work with a calculator.
Any ideas? Maybe I just missed something obvious?Jan Brittenson2019-03-23T05:18:07ZSolve a system of Differential Equations with EigenSystem DSolve MatrixExp?
https://community.wolfram.com/groups/-/m/t/1632964
In calculating a system of differential equations, I used 3 different methods: EigenSystem, DSolve and MatrixExp. DSolve and MatrixExp porduced the same answers but a different answers than EigenSystem and I don't understand why (See Attached). In all three cases, I used a default value of {1,1} for the values of the arbitrary constants. It appears that DSolve and MatrixExp simply dropped the negative exponent.
I don't understand what I am overlooking.
Thanks,
Mitch SandlinMitchell Sandlin2019-03-15T16:41:44ZSolve numerically a system of 5 ODEs using NDSolve?
https://community.wolfram.com/groups/-/m/t/1636689
Hello all!
I'm trying to solve numerically a system of 5 ODEs using `NDSolve[]`. The problem is that some of the solutions take negative values, which doesn't make sense from a physical point of view. Is there any way to force these functions to stay non-negative?
I've read about the command `WhenEvent[]`, but I don't know if it can be useful to fix this.
Thank you in advance for any help!
PD: This isn't my mathematical model, which is pretty large, but it might serve as an example:
\[Phi] = 0.08;
a = 0.7;
b = 0.8;
tmax = 200.0;
V0 = 1.0;
U0 = 1.0;
i = 1.0;
sol = NDSolve[{V[0] == V0, U[0] == U0,
V'[t] == V[t] - 1/3 V[t]^3 - U[t] + i,
U'[t] == \[Phi] (V[t] + a - b U[t])}, V[t], {t, 0, tmax},
DependentVariables -> {V[t], U[t]}, Method -> "Adams"];
Plot[V[t] /. sol, {t, 0, tmax}]David Aragonés2019-03-20T20:07:08ZNDSolve piecewise differential equations associated with a water hammer?
https://community.wolfram.com/groups/-/m/t/1636116
I am trying to solve the differential equations associated with water hammer. I have three pipe segments and I am using piecewise function for the differential equations. When I try to solve using NDSolve I get an error message " The function value {0,.....} is not a list of numbers with dimension {50} at {x,P[x,t],V[x,t]}={...}". Can someone please help me with this.
L1 = 3100; (*Length of first pipe*)
L2 = 2700;(*Length of second pipe*)
L3 = UnitConvert[Quantity[30., "ft"], "m"][[
1]];(*Length of third pipe*)
D1 = UnitConvert[Quantity[4, "in"], "m"][[
1]]; (*Diameter of first pipe *)
D2 = UnitConvert[Quantity[6, "in"], "m"][[
1]];(*Diameter of second pipe *)
D3 = UnitConvert[Quantity[1.75, "in"], "m"][[
1]];(*Diameter of third pipe *)
f = 0.002; (*Friction factor*)
\[Rho] = 1000; (*Density of fluid*)
Ef = 2.19*^9; (*Bulk modulous of fluid*)
Ep = 210*^9;(*Elastic modulous of pipe*)
ee = 4.5*^-5; (* Pipe roughness*)
\[Mu] =
0.001002; (* Fluid viscosity in Poise*)
Qmax = 0.1;
A1 = Pi/4 D1^2;
A2 = Pi/4 D2^2;
A3 = Pi/4 D3^2;
w = UnitConvert[Quantity[0.2, "in"], "m"][[1]];
solEe = Solve[1/EE == 1/Ef + 1/(w Ep), EE][[1]];
Ee = EE /. solEe;
c = Sqrt[Ee/\[Rho]];
pde1 = D[P[x, t], t] + \[Rho] c^2 D[V[x, t], x] == 0
sol1 = NDSolve[{pde1,
D[V[x, t], t] + 1/\[Rho] D[P[x, t], x] ==
Piecewise[{{-((f V[x, t] Abs[V[x, t]])/(2 D1)), 0 < x < L1},
{-((f V[x, t] Abs[V[x, t]])/(2 D2)) == 0, L1 < x < L1 + L2},
{-((f V[x, t] Abs[V[x, t]])/(2 D3)) == 0,
L1 + L2 < x < L1 + L2 + L3}}],
V[x, 0] == 0.,
P[x, 0] == 0.,
P[L1 + L2 + L3, t] == \[Rho]/(2 A3^2) (A3 V[L1 + L2 + L3, t])^2,
V[L1 + L2 + L3, t] == 10 t}, {P, V}, {x, 0, L1 + L2 + L3}, {t, 0,
12}]srinivas.gk2019-03-20T03:26:00ZNDSolve two coupled first order PDEs with specific boundary conditions?
https://community.wolfram.com/groups/-/m/t/1635326
Hi :-)
Reading and re-reading the NDSolve documentation, I don't understand the generic way to express boundary conditions. I want to solve the wave equation expressed as a system of two coupled first order equations on the voltage v(t,x) and current i(t,x). The initial v(0,x) has a bell shape and the initial i(0,x) is zero everywhere.
eq1 = D[v[t, x], x] + D[i[t, x], t] == 0;
eq2 = D[i[t, x], x] + D[v[t, x], t] == 0;
shape = D[0.125 Erf[(x - 0.5)/0.125], x];
ics ={v[0, x] == shape, i[0, x]==0};
Now the problem is to be numerically integrated with NDSolve over x in [0,1] and t in [0,2]. I want to specify either open ends v[t, 0] =v[t, 1]=0 or non reflective boundary conditions. In the first case I can do it:
region = Line[{{0}, {1}}];
bcs = {v[t, 0] == 0, v[t, 1] == 0};
sol = NDSolve[{eq1,eq2, ics, bcs}//Flatten, {v, i}, {t,0,2}, {x} \[Element] region]
How to do the same in the non-reflective (or impedence matched) case? All my attemps fail: calling
sol2 = NDSolve[{eq1,eq2, ics}//Flatten, {v, i}, {t,0,2}, {x} [Element] region]
without bcs renders a solution that does not correspond to the targeted case (by the way, which default bcs are assumed in this case?). Using v= Z i with Z=1 the wave and load impedence, i.e.
bcs2b = {v[t, 0] == i[t, 0] , v[t, 1] == i[t, 1]};
sol2b = NDSolve[{eq1,eq2, ics, bcs2b}//Flatten, {v, i}, {t,0,2}, {x} \[Element] region]
returns an error about "Cross-coupling of dependent variables in DirichletCondition".
bcs3c = {
Derivative[0,1][v][t, 0] ==-Derivative[1,0][i][t, 0] ,
Derivative[0,1][v][t, 1] ==-Derivative[1,0][i][t, 1] };
sol3c = NDSolve[{eq1,eq2, ics, bcs3c}//Flatten, {v, i}, {t,0,2}, {x} \[Element] region]
returns an error about too high order derivatives in boundary conditions.
How to proceed with this system of coupled first order PDEs? (note that I know how to do with a second order wave equation and Neumann values, but that's not my question). I want to express the conditions on v and i.
Thank you for your help.Denis Vion2019-03-18T19:56:07Z