Javascript algebra/algorithm maths

I'm trying to do do some algebra in jQuery/javascript based on some conditions and known variables but I'm not good enough at maths or javascript to understand how to write it.

So here's the conditions:

var w1 = h1/1.98

var w2 = h2/0.6355

h1 = h2

w1 + w2 = 1367

I'm not 100% sure but I think there may be enough info here to find out what w1, w2, h1 and h2 are. Does anyone know how I can create this calculation?


Here is the solution with variables as you need:

function algebra(c1, c2) {
  /* Given these equations
  w1 = h1/c1
  w2 = h2/c2
  h1 = h2
  w1 + w2 = 1367; */

  var w1 = 1367 * c2 / (c1 + c2), h1 = w1 * c1;
  return {w1:w1, w2:1367-w1, h1:h1, h2:h1};

Need Your Help

Saving MapFragment (Maps v2) State in Android

android android-fragments android-maps android-fragmentactivity

I'm working with the new GoogleMaps API (v2) and have some problems with the fragment. I have two fragments in my app (Map, List) and the user can switch between them. Works fine so far with this c...

View or Test README files *md in a browser prior to pushing to an online repository for rendering

firefox google-chrome browser github markdown

Is there an application or way to render a file in a browser on or offline? I am learning Markdown, and want instant feedback on some of my writing, as sometimes I forget a space or a b...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.