Click here to Skip to main content
15,914,071 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: data bace problem Pin
Christian Graus16-Mar-08 11:14
protectorChristian Graus16-Mar-08 11:14 
GeneralRe: data bace problem Pin
asha_s16-Mar-08 22:47
asha_s16-Mar-08 22:47 
GeneralRe: data bace problem Pin
Christian Graus16-Mar-08 23:51
protectorChristian Graus16-Mar-08 23:51 
GeneralRe: data bace problem Pin
asha_s17-Mar-08 0:27
asha_s17-Mar-08 0:27 
GeneralRe: data bace problem Pin
Christian Graus17-Mar-08 0:47
protectorChristian Graus17-Mar-08 0:47 
GeneralRe: data bace problem Pin
asha_s17-Mar-08 1:05
asha_s17-Mar-08 1:05 
GeneralVB.Net expression solver Pin
Krirk16-Mar-08 4:10
Krirk16-Mar-08 4:10 
GeneralRe: VB.Net expression solver Pin
Luc Pattyn16-Mar-08 6:33
sitebuilderLuc Pattyn16-Mar-08 6:33 
Hi,

seems to me you need two things:

1. some code that evaluates an expression such as
y = (98.83*(a1^3))-(89127*a1)-53480000
or y = a1 ^ 3 - cos(a1) / (279 ^ 2) + 0.30293
for a specific value of a1

2. some code that finds the zeroes of y(a1), i.e. those values of a1 for which
y effectively becomes zero.


You can do 1. the lazy way by editing it into a source file, i.e. make a specific
program. Or you need a parser + expression evaluator, which have been handled
in several CP articles.

You can do 2. using a simple algorithm, I would suggest "Newton-Raphson" which
basically says: for a given approximation x to the solution,
x - y(x)/y'(x) is a better approximation.

Here y' is the derivative, which you can obtain in two ways:
- you could come up with its analytical form and add it to the source code as suchl
or you could do it symbolically by writing a parser + derivative generator,
I don't recall having seen one on CP yet.
- and you could approximate y'(x) by calculating y(x) and y(x+dx) and
setting y'(x)=(y(x+dx)-y(x))/dx which may be a good enough approximation
for small dx.

Warning: if you come up with an arbitrary expression in a1, there could be
zero, one, two, or any number of solutions. Since iterative approaches need
an initial guess, they tend to converge (at best) to one or a few of the solutions,
there is no easy way to find all solutions.

Warning2: Newton-Raphson may not converge at all, if your initial guess is
far away from a real solution but close to a local minimum/maximum, it may just
move and stay there.

Warning3: you will need defensive programming to protect yourself against
overflow, underflow, zero divide, and non-convergence.


There are some web sites that solve simple equations for you, and even tell
you how they do it. I don't remember having seen solutions for trig equations.

quadratics[^]

Newton[^]



Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.


GeneralRe: VB.Net expression solver Pin
Krirk17-Mar-08 18:23
Krirk17-Mar-08 18:23 
GeneralRe: VB.Net expression solver Pin
Luc Pattyn17-Mar-08 21:56
sitebuilderLuc Pattyn17-Mar-08 21:56 
Questionproblem in looping: Pin
arp_05915-Mar-08 13:04
arp_05915-Mar-08 13:04 
GeneralRe: problem in looping: Pin
Colin Angus Mackay15-Mar-08 14:10
Colin Angus Mackay15-Mar-08 14:10 
GeneralRe: problem in looping: Pin
The ANZAC15-Mar-08 18:27
The ANZAC15-Mar-08 18:27 
GeneralRe: problem in looping: Pin
Colin Angus Mackay16-Mar-08 2:02
Colin Angus Mackay16-Mar-08 2:02 
GeneralRe: problem in looping: Pin
The ANZAC16-Mar-08 2:03
The ANZAC16-Mar-08 2:03 
GeneralRe: problem in looping: Pin
MikeMarq15-Mar-08 14:27
MikeMarq15-Mar-08 14:27 
GeneralRe: problem in looping: Pin
parth.p15-Mar-08 15:30
parth.p15-Mar-08 15:30 
AnswerRe: problem in looping: Pin
Rajesh Anuhya17-Mar-08 1:10
professionalRajesh Anuhya17-Mar-08 1:10 
GeneralRe: problem in looping: Pin
Dave Kreskowiak17-Mar-08 7:19
mveDave Kreskowiak17-Mar-08 7:19 
Generaldate function problem Pin
soniasan15-Mar-08 11:01
soniasan15-Mar-08 11:01 
GeneralRe: date function problem Pin
Colin Angus Mackay15-Mar-08 12:26
Colin Angus Mackay15-Mar-08 12:26 
Questiondynamic crytal report - without DSN ? Pin
sejal_tank15-Mar-08 9:04
sejal_tank15-Mar-08 9:04 
AnswerRe: dynamic crytal report - without DSN ? Pin
Mycroft Holmes15-Mar-08 21:33
professionalMycroft Holmes15-Mar-08 21:33 
QuestionK8055 USB Experimental Interface Board Pin
CocaColaBoy15-Mar-08 6:35
CocaColaBoy15-Mar-08 6:35 
GeneralRe: K8055 USB Experimental Interface Board Pin
Dave Kreskowiak17-Mar-08 7:15
mveDave Kreskowiak17-Mar-08 7:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.