Mathematical Calculation
Hello,
Does VB have built-in mathematical functions like integration? or I have to use a numerical method for mathematical calculations?
Thanks,
TK
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Data Bound Field Calculation And Restrict Decimal Places While Calculation In Code
Hi
I am working on a VB6 Windows application.
There are a lot of (40) numeric fields, the values for which I calculate in code but are not saved in database.
So is it possible to get the values calculated in a view (view could be reused in reports) while binding data. The values need to be recalculated in code on change of some other fields. So, what is a better approach. As we can't update the Bound textboxes in code, if the DataField property of the textbox is set, because the views are not updatable. Is there any better way of designing this.
Another Question is that i have the formula something like this for calculation:
txtTax.Text = txtCost.Text * Rate1/100
txtTotalAmt.text = txtCost.Text * rate2/100 + txtTax.Text
So the calculated value of Tax contains lot of decimal places. But i would like to have a precision of two decimal places, when its added to 2nd formula to calculate total amount. All the COnversion functions like Cdec, CSng , CDbl return lot of decimal places. So right now, i'm just formatting the tax value to
two decimal places and then adding to 2nd formula as shown below:
txtTax.Text = Format(txtTax.Text, "Fixed")
txtTotalAmt.text = format (txtCost.Text * rate2/100 + txtTax.Text,"Fixed")
Is this the right way for calculation or is there any other way of calculating to right precision?
Because using this method , if i'm again adding Total Amt with another similarly calculated value as shown below, it just appends them as string. eg. 100.00200.00
txtTotalAmt3.text = txtTotalAmt1.text + txtTotalAmt1.Text
So i used Val function:
txtTotalAmt3.text = val(txtTotalAmt1.text )+ val(txtTotalAmt1.Text ), which doesn't seems to be a good
approach.
Please help.
Thanks
Manual Calculation/auto Calculation
Hi
I'm using a set up where I use
CODE
With Application
.Calculation = xlManual
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False
END CODE
to stop my sheets calculating until I want them to.(Its the same as going into Tools, Options and clicking on the calculation tab and setting it to manual.)
But is there a way to action this line of code only when this workbook is opened, and then to execute the reverse when it is closed eg
CODE
With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False
END CODE
This is because once I set it to manually calc it does the same for all subsequent work books I open meaning the autosums and other formula dont work on other workbooks unless I calculate (F9) them. The reason I only want this particular workbook to only calculate when asked is because it is so very very big with so very many functions on it and this speeds it up hugely as it keeps repeatedly calcing otherwise.
many thanks.
Be
Help With Mathematical Conversions
hello all,
I am currently writing an application in VB 6.0, that will inventory all movies that the user has. When the user puts the information into the form that I have created, there is a section for movie length. I have two text boxes there, one for hours and one for minutes. What I would like to do, is make it so that this is the default display, hours and minutes. However, I don't want the user to have to do the calculation themself. So if the user enters the movie in hours and minutes, then I don't want anything to happen, but if the user enters length in only minutes then I want the application to convert that to hours and minutes and display in the appropriate text boxes. I have attached the boxes for clarification. I do not want an additional command button to make this calculation, what i would like is when the focus is removed from the minutes box, it automatically calculates. Can anyone here help with that, or is it possible?
Mathematical Delima
I've seen several program use the following numbers to determine certain flags.
1
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16384
32768
You add the ones you want together and it knows which ones you selected. I want to do this, but the only easy way I can think of is to add each set of numbers up and use a select case.
I know this can't be the best way at all. Is there any type of formula that is used for this? If not how can it be done easier? Thanks.
Mathematical Addition
I have 4 textboxes and I want to total them up and place the total number in a separate text box. When I try to add them up the output in the text box is something like 1234 instead of 10.
Mathematical Stuff
Does anyone know how to determine whether a variable (integer) is divisible (evenly) by another number? and, if not, what the remainder is?
My situation is that I generate a random number (0 to 242) and I need to know whether that random number is a factor of 6. It would also be helpful to know the remainder if it wasn't a factor of 6 Thanks in advance
Mathematical Problem With Atn
Does Atn take into consideration which quadrant the point is in.
Eg. Ans = Atn(-#/-#) 'this is a 4th quadrant inv. tan calc.
But i think it may just do it as a 1st quadrant calc.
??
Mathematical Problem With Mod
Hi everyone, I am performing a calculation in VB where I am using Mod, but i need a an answer with one decimal place. Here's what my code presently looks like.
These ='s that i've included are from an example of when it is run.
GHA = (GMST / 86400 + tF) * 360 'eg.=1248.71414964
GHA = GHA Mod 360# 'should = 168.7 but rather = 169
GHA = (GHA + 360) Mod 360#
I need this 0.7 decimal place, do i have to find the mod from first principles rather than doing gha mod 360 (if so anyone know how?) or else how do i do this?
Mathematical Problem
I have to determine between 3 sets of numbers using 3 different IF statements:
the sets are:
1. {1, 4, 7, 10, 13, ...}
2. {2, 5, 8, 11, 14, ...}
3. {3, 6, 9, 12, 15, ...}
I know I could do this using If x = 1 or x = 4 or x = 7 ...... then
but that is limited.
Mathematical Questions
Hello
first off, i looked for a large number calculator, but with no success i have decided that i would make one. but i don't know if vb would be able to handle the numbers i want to use. I want to be able to use numbers up to 700 digits long. If I can could anyone tell me how to set digit lengths or what i would need to do to enter digits that large. I haven't had much experience doing mathematics with vb.
thanks
Please Help (mathematical Functions)
im designing a calculator and its almost completed now what i need is to add afew functions like sine,cosine and tan and log. and also need some functions which convert decimal to hex and decimal to binary and vise versa. would you please list those functions for me or point me a page that has all those functions in a simple format?
Thanks in advance
Mathematical Computation In VB
i need to use VB for statistical modelling, numeric computation, and AI simulations. Do you think this feasible or i should better learn other languages? (i.e., hard time to come... ). Basically, I have not seen a form topic on numerical computation in VB...
Regards,
Ivo
Which OS For Mathematical Simulations Using VB?
Which OS for mathematical simulations using VB?
Can anyone recommend a good OS for the following.
I want to do some (long) mathematical simulations in VB – probably VB6 as I’ve done lots of it in the past.
So no connection to the net for the purposes of development, or the simulations – so no viruses, updates, ads, cookies, anything – bliss!
Just long calculations, possibly large or very large arrays, very basic graphics.
So I’m looking for an OS that is
- stable
- doesn’t get in the way in terms of processing or memory usage
(I used to be very happy with DOS)
Win 98?
XP? – I believe there’s ways to switch off lots of the OS for this sort of thing, but I don’t know how
My PC is too old for Vista
Non-windows OS?
Any help gratefully received
Using Mathematical Expressions
I need to use an equation with a plus/minus sign , the equation is
(-b +-Sqr(b ^ 2 - 4 * a * c)) / (2 * a) but the minus needs to appear right below the plus(such as if you were using it in standard mathematical form).. Does anyone know how I can use this in VB6? Thanks!
Mathematical Database
i want to make a mathematical Database program for example
column1 = column2 + column3
Table1.column5 = Table2.column6 - Table2.column4
using (VB and MsAccess)
could i make this relations in MsAccess?
(if no) how can i make this in VB
i know how to eddit, delete and update Database using VB, but how can i make the mathimatical relations?
Mathematical Combinations
Using Visual Basic functions, is it possible to do mathematical combination's (I do not know if that is the real name)
Here are some of example:
10 nCr 2 = 45
10 nCr 3 = 120
5 nCr 2 = 10
10 nCr 10 = 1
80 nCr 2 = 3160
ETC
Mathematical Operators
Just to doublecheck
For square root of numerical values 10,20
we use A=sqr(10+20)?
or A=10^(1/2)?
If to the power of something.
a= 10^2?
or
a=10**2?
Mathematical Problem
Hi,
I am working on a project to create a question bank to store all mathematical problems of a competetive exam.
My problem is how does the user enter the mathematical symbol like squreroot,square,cube cube root etc. Also for geometrical problems how to store diagrams??
ciao
Mathematical Symbols
anyone have any ideas or methods on having vb print things like integral signs or other mathematical notations on something like a form or picbox?
mael
Mathematical Notations
does anyone know how I can make vb print things like integral signs or square signs on forms or for printed output? I am having difficulty doing this.
thanks
mael
Mathematical Question
When the result of a calculation is negative (-20) how do you convert to positive (20)... so that it is allways positive?
thanks
Mathematical Expressions
Can you please tell me how to display mathematical expressions like squares, square roots and all in VB. I'm developing a online test for mathematical students. How do I store those mathematical expressions in database and how to display them without using image files. Can you please help me?
Mathematical Equations
hi! i have never worked with mathematical equations in vb, so i have no clue on where i could find info on how to do it.
all i need to do is to apply this formula:
dbm=-90+10log(V^2/R)
thanks!
Mathematical Fonts
I want to use all the mathematical symbols in my vb project.I am using
an MS Access table to store various detail about math subjects.I am not
getting a single font to enter the math texts into the table.Is there a
mathematical font or a font writer which has all the alphabets,numbers
and all the mathematical symbols in it.If there is any please notify
me
thank you
thamizhan
email: marathamizhan@yahoo.com
Mathematical Surface Using DirectX
I am wondering where to get started. I have read a number of articles on DirectX and have tried some of the examples. I think I have a fair understanding, but I am having difficulting (I am not sure where to start ) developing routines.
What I would like to do is to pass a 4d array (the array would consist of points in a 3d system as well as a color value for that point) and have the routine plot a nice surface or mesh contained within a form.
I thought directX would be the place to start as it would utilize the graphics card fully and would look pretty cool. I am aiming for a graph that is similar to:
http://www.graphicsserver.com/gallery/gallery.asp
Then under the 3d Graphs click on surface. Now graphics server is a really nice and really expensive package. Personally I don't think one activeX component should have so much stuff.
Any ideas or pointers would be greatly appreciated.
Thanks.
Working With Mathematical Equations
I am working on a program that must display mathematical equations, just like in equation editor. the user may edit the contents of the control and save its contents in a database. is that possible? thanks
Mathematical Loop Problem
I have a given number of objects and each object has a given number of positions depending on the object type.
what i need to get from this is a print out of all the possible position configurations.
How i propose to do it: each column represents a object and each number represents the objects current position.
(eg 3 objects, object 1 having positions 1-2, object 2 having positions 1-4, object 3 having positions 1-4 aswell.
1 1 1
1 1 2
1 1 3
1 1 4
1 2 1
1 2 2
1 2 3
1 2 4
1 3 1
1 3 2
1 3 3
1 3 4
1 4 1
1 4 2
1 4 3
1 4 4
2 1 1
2 1 2
2 1 3
2 1 4
2 2 1
2 2 2
2 2 3
2 2 4
2 3 1
2 3 2
2 3 3
2 3 4
2 4 1
2 4 2
2 4 3
2 4 4
How can i do this using loops if i know how many objects exist and the number of possible positions they each have?
Mathematical List Algorithm
I need an algorithm to find all the combinations of a variable length list of numbers that add up to a user-defined amount (often zero). Easy enough for any particular case but I am having trouble defining a simple general algorithm. Any help would be much appreciated.
Mathematical Expresions Parsing
Is it possible to enter a mathematical expression (like 34*sin(2)+1/(3^3) ) at run time and have it solved with Visual Basic ?
Easy Mathematical Operations
Hey I'm working on this Theory Database, so I can only use Data Control, no DAO or ADO, but i can use 1 or 2 SQL lines and need to know the easyiest way to do mathematical operations on data in a DB, it would basically be multiplying a number in each field together but i will have to do some other things as well... any ideas?
(Resolved)Mathematical Formula In Vb6
i wanted to calculate some values in the following manner
vat=txtprice / 1.04 * txtpercent %
example :
result=25 / 1.04 * 4%
the result will be 0.96
how to multiply by 4% in vb
txtprice is having price and txtpercent is havinvg only value of percent not the symbol of % while calculating i want to pick the txtpercent as 4% (value & %)
Mathematical Operations On Strings
I just inherited a program that does a bunch of mathematical operations on strings, ie, subtraction and multiplication. It appears that the complier converts the strings to single, does the operation, and converts it back. That is what I need but never used strings that way. I am nervous about this. What are the rules that the complier uses for these conditions? I don't get a type mismatch error even as the variables are declared as Strings and assigned to a mathematical operation.
Using Mathematical Symbols (Solved)
I am trying to use Superscript in my Labels but I can only get 0,1,2,3 in superscript. I need 0 to 9 as well as superscript left and right parenthesis. Any idea for help?
Mathematical Subtraction Of 2 Fields?
Hi i want to mathematically subtract 1field from another put the result in a textbox:
my code is as follows
txtTotal.Text = (.Fields("profit") - .Fields("cost"))
however some of the cost fields are deficit ie they have a minus in them so it adds , anyone know a way of fixing this
Mathematical Problem...<resolved>
hey,
Heres the background info, for my fishing game, there are 6 levels. When you accumulate enough points in a level your points are added to the endscreen which is only shown when you beat the 6th lvl and it tells you, your final score added up. So for each levels winning event where you accumulate enuf points it adds it to the Endscreen forms point label. Another aspect, which seems to be the one throwing the whole thing off, is that in each level you get confidence and hooks and during the level you use them up depending on how accurate you are you will have some left. So, it gives you a bonus 50 points for every confidence you have left over and a bonus 100 for each hook. This is the relevant coding for beating level 6...
If Points >= 5900 Then
Beep
MsgBox "Level 6 Completed! Congratulations! You have completed all levels!"
Endscreen.FinalScore.Caption = Endscreen.FinalScore.Caption + Points.Caption
Endscreen.FinalScore.Caption = Endscreen.FinalScore.Caption + (Confidence.Caption * 50)
Endscreen.FinalScore.Caption = Endscreen.FinalScore.Caption + (Hooks.Caption * 100)
Load Endscreen
Endscreen.Show
Though the whole system works for beating a single level, but it seems to mess up trying to add together the other points from previous levels. It seems to be multiplying together instead of adding because at the end of beating all 6 levels I got a total score of 49 million and somethin! Any help? If you need more info reply saying so. Thanks.
Drawing Mathematical Symbols - Help
Does anyone know the particulars on automating equation editor from a vb program. I need to write a program that can print out mathematical symbols like integral signs and such
thanks
Evaluate Mathematical Expression
Basically, i want the user to be able to input something like "1+1" in a textbox and then be able to calculate what that is. I know that this can be done in other languages using eval or a similar function, but i can't find one to do it in vb.
TIA
-TiReRa
Displaying Mathematical Expresion
Can you please tell me how to display mathematical expressions like squares, square roots and all in VB. I'm developing a online test for mathematical students. How do I store those mathematical expressions in database and how to display them without using image files. Can you please help me?
Mathematical Expressions Solving
Does some1 have a function or anything else that solves mathematical expressions?
The function should get a string (the expression) and return a double (the solution)
(4 Example: the string is "2.4-5.3*2-4(5+3)/sin(3.2)" so the function should return 688.66106 - i'm not sure but i think that this is the correct answer)
[Edited by yotam on 11-22-2000 at 08:51 AM]
Sets (of The Mathematical Variety)
is there any easy way that i can maintain a set of, say, strings, and be able to access them easily, possibly in order whilst ensuring uniquity (if that is a word)
Weird Mathematical Errors In VB5
I am trying to move an Image with a timer. The timer's interval is set to 50 and it moves the image 5 pixels to the right. After a while of moving it something strange happens. Instead of it moving 5 to the right, 5 to the right, 5 to the right, etc. it moves 4 to the right. So it says stuff like 159 and 176 etc. This is a bit odd. Does anyone know what's going on and how to fix it? Thanx.
Complex Mathematical Calculations
I need to take a complex number as input from user, eg. 3+j5 or simply j5
and perform several operation on these numbers
eg.
(3+j5/9+j7)*(2+j8)
and at last display result in the form of a+jb where a and b are real numbers.
is there any builtin function which takes comples numbers as input and perform operations on them?
Please do help me.
Saving Mathematical Eqations
We want to develop a question bank for our exam cell people. In this program we are supposed to save questions on all subjects. Some questions will have diagrams also. That part is cleared now. The problem now we face is to save chemistry equations and mathematics equations. Before the exam cell people used to edit the questions in Word using MS Equation. If we try to save the contents into a image data type it may work ....but i fear it will slow down the program. Any suggestions?
We are using VB6 and SQL Server 2000.
Crystal Reports 8.5 as reporting tool.
ADO methodes for the database updations.
We use DSN less connection.(OLEDB)
Edited by - yam on 6/21/2003 12:11:43 AM
Mathematical Formulas In A Database
I am trying to write a generic program using VB 6.0 that retrieves & evaluates formulas from an Access database. The problem that I am running into is that the formula is being read as a string instead of being evaluated as a formula. In particular, in one entry in my database I have the formulas rsRecordset("Charge")*rsRecordset("NumOfMinutes"). The formula is not being calculated and instead is being read in as a string. Any suggestions?
Thanks
Mathematical Formula In Database
Hello !
I have a field in my database which includes mathematical formulas.
How can I use these formulas in my VB- program ?
e.g.
dim a as integer
dim b as integer
a = 1
b = 2
x = Data1.Recordset.Fields(0) // including of field is "a + b" (type is text)
msgbox x
result: a + b
What I should do that result would be 3 ??
Mathematical Function Graphing Algorithm
I have written a program in visual basic that graphs any valid mathematical function entered by the user. The algorithm that I used is adequate, but I think that there are better, more efficient algorithms that I could apply. Does anyone have any insight on this? I'm looking for efficient algorithms. THank you.
mE tHE cLOWN
Mathematical Problem: Degrees In A Circle
Hi there!
Darn, i'm stuck on this mathematical problem.
I want to make a function witch inputs an X and Y point and output the degrees(0/360 = North 180 = South 90 = East 270 = West) compared to the world origin (0,0). So if the input is 25,25 the output would be 45 as in 45 degrees.
My friend told me the name of some ancient algoritm or formula for this but of course i forgot the name of it.
Any help is apprichiated, tnx!
|