FatAlbert
FatAlbert

Reputation: 4970

How do I write equations with sin in .NET Math class?

I know how to solve this using a calculator, but how do I solve it using the Math class in .NET?

(15/sin(v))=(10/sin(37))

Upvotes: 0

Views: 148

Answers (2)

Marc Gravell
Marc Gravell

Reputation: 1062865

Math doesn't offer a solver; it simply provides a few tools for common math operations. You would have to solve it manually, or fine a solver lib.

But anecdotally:

var v = 180 * Math.Asin(15 * Math.Sin(37 * Math.PI / 180) / 10) / Math.PI;
  // ~= 64.518 degrees

assuming you want your units in degrees.

Upvotes: 2

duffymo
duffymo

Reputation: 308763

If I read it correctly, this is nothing more than simple algebra.

15/sin(v) = 10/sin(37); 

I'll assume that 37 means "degrees". You'll want radians.

Multiply both sides by sin(37)*sin(v)/10:

15*sin(37)/10 = sin(v)

Solve for v:

v = inverse sin(1.5*sin(37))

Personally, I find the lack of mathematical knowledge on SO appalling. It's often not even high level math. People have issues with simple high school algebra. Forget about calculus! How can you be a competent programmer without such a fundamental skill?

Upvotes: 1

Related Questions