Approximation for Unknown Variable

Click For Summary
SUMMARY

The forum discussion centers on solving for the variable theta in the equation d = (vcos(θ)/g)(vsin(θ) + √(v²sin²(θ) - 2gh) using the Bisection method. The user seeks a more efficient solution than their current approach, which involves incrementing theta until the deviation from d is less than 0.0001. Participants highlight a units mismatch in the equation and suggest that the Bisection method is a more effective technique for this problem, emphasizing its efficiency over fixed-step approaches.

PREREQUISITES
  • Understanding of Bisection method for root-finding
  • Familiarity with trigonometric functions and their applications
  • Basic knowledge of numerical methods in computational science
  • Ability to analyze and debug mathematical equations
NEXT STEPS
  • Research the Bisection method in numerical analysis
  • Explore Monte Carlo methods for solving equations
  • Study error analysis in numerical approximations
  • Learn about alternative root-finding algorithms such as Newton-Raphson
USEFUL FOR

Students in computer science, mathematicians, and anyone interested in numerical methods for solving equations efficiently.

KingBigness
Messages
94
Reaction score
0

Homework Statement


Firstly sorry if this is in the wrong place. I have never submitted a question on this forum about a comp sci question.

I got an assignment that asked me to solve for a variable using Bisection of successive approximations. This however is not why I am here as I know you do not give answers to assignments.

I have done the assignment properly and submitted it so this is just for general knowledge. I was wondering if anyone could come up with a more efficient solution to this problem using other techniques that I may not have heard of before.


Homework Equations


d = \frac{vcos(\theta)}{g}(vsin(\theta)+\sqrt{v^{2}sin^{2}(\theta)-2gh}

Given v, g, h and d solve for theta.

Thanks for any ideas =D
 
Physics news on Phys.org
What are the values of those 4 variables?
 
NascentOxygen said:
What are the values of those 4 variables?

Inputted by the user.

I forgot to to say that theta will lie in the range

arctan(\frac{v^{2}}{g*d})\le \theta \le 90 degrees
 
KingBigness said:

Homework Statement


Firstly sorry if this is in the wrong place. I have never submitted a question on this forum about a comp sci question.

I got an assignment that asked me to solve for a variable using Bisection of successive approximations. This however is not why I am here as I know you do not give answers to assignments.

I have done the assignment properly and submitted it so this is just for general knowledge. I was wondering if anyone could come up with a more efficient solution to this problem using other techniques that I may not have heard of before.


Homework Equations


d = \frac{vcos(\theta)}{g}(vsin(\theta)+\sqrt{v^{2}sin^{2}(\theta)-2gh}

Given v, g, h and d solve for theta.

Thanks for any ideas =D

Could you please post your solution? We need to see that before we can be of much help.
 
berkeman said:
Could you please post your solution? We need to see that before we can be of much help.

Assumed you meant my code.

http://pastebin.com/X0Ni4ebz
 
KingBigness said:

Homework Equations


d = \frac{vcos(\theta)}{g}(vsin(\theta)+\sqrt{v^{2}sin^{2}(\theta)-2gh}

Given v, g, h and d solve for theta.

There's something fishy with the given equation... given the usual physical interpretation of the variables there is a units mismatch in the expression. Since the trig functions yield unitless results (so we can ignore them for purposes of unit analysis), both "d" and "v2/g" terms yield meters, but the radical term yields m/s.
 
gneill said:
There's something fishy with the given equation... given the usual physical interpretation of the variables there is a units mismatch in the expression. Since the trig functions yield unitless results (so we can ignore them for purposes of unit analysis), both "d" and "v2/g" terms yield meters, but the radical term yields m/s.

The equation was written by a computer scientist and it producing a real world value is beside the point.

The way I wrote my program to solve for theta was start with the lower limit of theta, trial it and see how much it deviated from d and if this deviation was more than 0.0001 then increment theta and try again until the deviation is less than 0.0001.
To me this doesn't seem very accurate in a real world situation (fine here because the answer only needs to be to two decimal places).

That's why I am here to ask you guys if you can think of a better method of solving it eg monte carlo etc.
 
KingBigness said:
The equation was written by a computer scientist and it producing a real world value is beside the point.
On the contrary, if you wish for help here then the onus rests with you to ensure you are not a cavalier waste of other's time.

The equation you provided is wrong. That's indisputable. Even blind Freddie can see it has mismatched brackets. So before you make yourself look a complete goose, go back and fix it to how it should be.

A lesson you should take from this is to learn to better proof-read your own posts.

Thanks to gneill for taking the time to highlight your oversight.
 
KingBigness said:
The equation was written by a computer scientist and it producing a real world value is beside the point.

The way I wrote my program to solve for theta was start with the lower limit of theta, trial it and see how much it deviated from d and if this deviation was more than 0.0001 then increment theta and try again until the deviation is less than 0.0001.
To me this doesn't seem very accurate in a real world situation (fine here because the answer only needs to be to two decimal places).

That's why I am here to ask you guys if you can think of a better method of solving it eg monte carlo etc.

There is a significant hint in the problem statement as you've written it: Bisection.

Do a search on "Bisection method". It'll be a lot more efficient than creeping up on the solution by fixed steps as you're doing.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
32
Views
2K
  • · Replies 13 ·
Replies
13
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K