473,383 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

how to solve these equations

vj
Hi all,

I want to solve the two equations

u*tan(u)=w
and
u^2 + w^2=V^2, where V is a known constant, and u and w are the two
unknowns to be determined. Please can someone suggest me how to write a
code and solve these equations in C or C++? I am not an expert, but
have elementary working knowledge of C.

Thanks

vj

Aug 23 '06 #1
8 4778

vj wrote:
Hi all,

I want to solve the two equations

u*tan(u)=w
and
u^2 + w^2=V^2, where V is a known constant, and u and w are the two
unknowns to be determined. Please can someone suggest me how to write a
code and solve these equations in C or C++? I am not an expert, but
have elementary working knowledge of C.
You need algebra.

If these are a system then it can easily be solved using math.

If they are not a system the only way to "solve" such equations is to
loop until you get to a certain point close to the answer. It doesn't
look to me like that kind of problem though. Some equations are not
solvable but you know when you get close to your answer and how to
change the variable to get closer. I find this a lot in my job working
on software that makes use of fluid mechanics in calculations.

You can also solve them for input in one of the variables and output
the value of the other. This is also a simple matter of using basic
algebra to solve for a variable.

Aug 23 '06 #2
vj wrote:
I want to solve the two equations

u*tan(u)=w
and
u^2 + w^2=V^2, where V is a known constant, and u and w are the two
unknowns to be determined. Please can someone suggest me how to write
a code and solve these equations in C or C++? I am not an expert, but
have elementary working knowledge of C.
You need to look up "Newton-Raphson method", most likely. It's not
topical here. Try sci.math.* hierarchy.

Since you have elementary working knowledge of C, you already know how
"to write a code". Begin with "int main(" and proceed to write all
the necessary code for the algorithm that you already have. If you
don't have the algorithm, we can't help you. It's not a C++ language
problem.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 23 '06 #3
vj,

The first hit on google, if you search for "solving systems of
equations" (no quotes).

http://regentsprep.org/Regents/math/...picCode=syslin

Doug

vj wrote:
Hi all,

I want to solve the two equations

u*tan(u)=w
and
u^2 + w^2=V^2, where V is a known constant, and u and w are the two
unknowns to be determined. Please can someone suggest me how to write a
code and solve these equations in C or C++? I am not an expert, but
have elementary working knowledge of C.

Thanks

vj
Aug 23 '06 #4
On Wed, 23 Aug 2006 08:34:37 -0700, vj wrote:
Hi all,

I want to solve the two equations

u*tan(u)=w
and
u^2 + w^2=V^2, where V is a known constant, and u and w are the two
this looks like a trigonometrical problem. assume there is a triangle with
the right angle sides u ans w and the opposite side V, eg, pythagorian
triangle..

the first equation is tan(u)=w/u which is the normal definition of tan()
but the angle in numbers must be equal to one of the sides. I presume the
u in tan(u) is in radians not in degrees?

thats all i can see for now..
unknowns to be determined. Please can someone suggest me how to write a
code and solve these equations in C or C++? I am not an expert, but have
elementary working knowledge of C.

Thanks

vj
Aug 23 '06 #5
You need algebra.

If these are a system then it can easily be solved using math.

If they are not a system the only way to "solve" such equations is to
loop until you get to a certain point close to the answer. It doesn't
look to me like that kind of problem though. Some equations are not
solvable but you know when you get close to your answer and how to
change the variable to get closer. I find this a lot in my job working
on software that makes use of fluid mechanics in calculations.

You can also solve them for input in one of the variables and output
the value of the other. This is also a simple matter of using basic
algebra to solve for a variable.
my instinct tells me the solution to this problem is to loop until you get
close to an answer. basically a brute force solution
Aug 23 '06 #6
vj wrote:
Hi all,

I want to solve the two equations

u*tan(u)=w
and
u^2 + w^2=V^2, where V is a known constant, and u and w are the two
unknowns to be determined. Please can someone suggest me how to write a
code and solve these equations in C or C++? I am not an expert, but
have elementary working knowledge of C.

Thanks

vj
Replace w in the second equation with its expression in terms of u. Use
the trig identity 1 + tan^2 = sec^2 and apply a square root to make it
even simpler. Then look up Newton's method.
Aug 23 '06 #7
On Wed, 23 Aug 2006 17:04:10 GMT, Mark P
<us****@fall2005REMOVE.fastmailCAPS.fmwrote:
>vj wrote:
>Hi all,

I want to solve the two equations

u*tan(u)=w
and
u^2 + w^2=V^2, where V is a known constant, and u and w are the two
unknowns to be determined. Please can someone suggest me how to write a
code and solve these equations in C or C++? I am not an expert, but
have elementary working knowledge of C.

Thanks

vj

Replace w in the second equation with its expression in terms of u. Use
the trig identity 1 + tan^2 = sec^2 and apply a square root to make it
even simpler. Then look up Newton's method.
This query has all the earmarks of a homework problem, in my opinion.
Some help and guidance, like "look up Newton's method" might be
appropriate. I am not sure just how much more explicit information
would be.
Aug 23 '06 #8
Douglas Reed wrote:
vj,

Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or the group FAQ list:
<http://www.parashift.com/c++-faq-lite/how-to-post.html>


Brian (lots of 'em today)

Aug 23 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: smjmitchell | last post by:
Hi All, I need to display some equations on a form in VB (I will print the result in a text box beside the equation). The equations will in some cases be quite complicated and include...
7
by: Paddy McCarthy | last post by:
Hi, I am trying to use eval as little as possible but solve this problem. #If given:two or more lambda equations x=lambda : A < B y=lambda : C+6 >= 7 .... How do I create another lambda...
9
by: claymic | last post by:
I am trying to complete some math tutorials, and wanted to write an answer generator in C. The type of question is; "A doll costs $20, a toy car costs $6, a yoyo costs $1. What combination of...
2
by: DaRok28 | last post by:
// Program Description: // This program solves quadratic equations to find their roots. This // program takes values of a, b, and c as input and outputs the root(s). // The user can repeat the...
3
by: bttf | last post by:
hello. I am new to this forum. I really need a help about my c++ project. . I have to explain every step to my teacher , please help me.my question is: ----- write a program to read the...
1
by: dynamo | last post by:
Hi guys,i was wondering if anyone knows the code to solve equations using the newton raphson method in matlab.Or at least the algorithm.
1
by: yingzaji | last post by:
hi I was wondering about the odeint function in scipy. While I was solving the Van der pol equations, I found the function odeint is not suitable. I know there are some differences between...
0
by: yingzaji | last post by:
hi I was wondering about the odeint function in scipy. While I was solving the Van der pol equations, I found the function odeint is not suitable. I know there are some differences between...
4
by: Kelie | last post by:
Hello group, Is there any packages in Python that will help me solve functions similar to this: x = a*(1+bx)**2.5-c where a, b, c is known and the task to solve x? Thank you, Kelie
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.