Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Can anyone see what is wrong with my syntax? It looks like I have successfully assigned the result of Solve to a function. I want Mathematica to return me an numeric value of the function fc1.

eq1 = (x - Subscript[c, 1])^2 + (Subscript[τ, c] + 
      Tan[Subscript[ϕ, LIN]] x)^2 == (Subscript[σ, SF] - 
      Subscript[c, 1])^2 + Subscript[τ, SF]^2;
eq2 = (x - Subscript[c, 
      1]) + (Subscript[τ, c] + 
       Tan[Subscript[ϕ, LIN]] x) Tan[Subscript[ϕ, LIN]] == 0;
sols = Solve[eq1 && eq2, {Subscript[c, 1], x}]

fc1[Subscript[τ, c] _, Subscript[ϕ, LIN] _, Subscript[σ, SF] _, Subscript[τ, SF] _] := 
  Subscript[c, 1] /. sols[[1]][[1]]

ans = fc1[50, π/6*1.1, 1000, 800]
N[ans, 3]

enter image description here

share|improve this question

1 Answer 1

Probably best not to try to use subscripts in this way, but use explicit symbol names, e.g.:

ClearAll[eq1, eq2, fc1, sols]

eq1 = (x - c1)^2 + (tauc + Tan[philin] x)^2 == (sigmasf - c1)^2 + tausf^2;
eq2 = (x - c1) + (tauc + Tan[philin] x) Tan[philin] == 0;

sols = Solve[eq1 && eq2, {c1, x}];


fc1[tauc_, philin_, sigmasf_, tausf_] := Evaluate@(c1 /. sols[[1]][[1]])


ans = fc1[50, π/6*1.1, 1000, 800]


N[ans, 3]

(*
1454.2 -463.075 I
1454.2 -463.075 I
*)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.