I have to find the roots of a third degree polynomial in $\phi$ that depends from 3 parameters, namely $t,s,w\in \mathbb R$. In order to do that I've used the command Solve, in the following way:
Solve[
1/6*ϕ*(t^2 + ϕ^2) - 1/2*t*(s + (t*ϕ)/2) +w - (s*ϕ)/2
+ 1/12*t*(t - ϕ)*ϕ == 0, {ϕ}]
Ma...
@Emad (1) There's an inconsistency in the code fragment/error posted: Subscript[a, 2] is not the same as a[2]. (2) To approximate a solution to f == 0, g == 0, etc., minimize {f, g,...} . {f, g,...}, leaving out == 0. One could use a different norm if more appropriate. In Mathematica, you can only get one solution (at a time) this way. (3) Another approach is to solve six equations and select the solutions that satisfy the seventh.
I'm blanking on what should be a simple Cases statement. If data is a list of {x,y} Reals (datapoints in this case) and I want the points at x = Range[5], how do I set up the pattern?
@MichaelHale Thanks. It's the _? that I was missing; I was trying to use {x_,y_}/; ... The MemberQ will work nicely since the numbers I'm looking for don't always fit in a nice range
@bobthechemist Yeah, I tend to use Cases when most of the filtering involves the structure of the expressions, and Select when most of the filtering involves function evaluations on the expressions.
“What are the odds?” This phrase is often tossed around to point out seemingly coincidental occurrences, and it’s normally intended as a rhetorical question. Most people won’t even wager a guess; they know that the implied answer is usually “very slim.” However, I always find myself fascinated by this question. I like to think about [...]
@MichaelE2 Thanks for your respond. What you said in (3) is exactly what I want. Does Mathematica has a specific command or code for (3) or I should write my own code? Also, I search on literature and I found that least squares is the the methode that I can use for Nonlinear Overdetermined system of equations. Please give me idea if you can. Thanks
Or, because it is not exactly clear what you want, when you want to apply a function on each y1, y2, ... and return the same array {{x1, f[y1]},{x2,f[y2]}, ...} then you can use
@Emad Something like sols0 = Solve[{eqn2, eqn3, eqn4, eqn5, eqn6, eqn1},...]; sols = Select[sols, eqn11 < 10^-8 /. Equal -> Subtract /. #&]. One can try NSolve instead of Solve, too; but some systems of equations can't be solved, and it may be more complicated than this. The tolerance 10^-8 can be adjusted to suit.