| |

VerySource

 Forgot password?
 Register
Search
View: 944|Reply: 3

Several mathematical problems in VB programming

[Copy link]

1

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-9 09:20:01
| Show all posts |Read mode
1. In numerical simulation algorithms, the problem of generating a numerical sequence that conforms to a normal random distribution is often used. Find information online and write a VB program to generate a normal numerical sequence with a mean of 100 and a variance of 20.
2. Using a two-dimensional array, write a general program that uses the elimination method to solve multivariate linear equations (once when programming is five yuan).
3. Programmatically solve one of the twelve questions of "Major Surplus" in Volume Seven of Ancient Mathematical Masterpiece "Nine Chapters of Arithmetic" and check the calculation results on the computer:
There is a wall five feet thick today, and the two rats are facing each other. Rats are one foot a day, and mice are one foot a day. Rats are doubled daily, and mice are half daily. Ask Geometry Day? Each wears geometry?
荅 said: two days, two of seventeen minutes. Rats wore three feet four inches and twelve 17 centimeters, and mice wore one foot five inches and seventeen centimeters.
4. Goldbach conjecture: (a) Any even number ≥ 6 can be expressed as the sum of two odd prime numbers. (b) Any odd number ≥ 9 can be expressed as the sum of three odd prime numbers. This famous mathematical problem has attracted the attention of thousands of mathematicians in the world. 200 years have passed and no one has proven it. Goldbach conjectured that this would become an elusive "pearl" in the crown of mathematics. The best current result was proved by Chinese mathematician Chen Jingrun in 1966, called Chen's Theorem. "Any even large number is the sum of a prime number and a natural number, and the latter is just two prime numbers The product of "" is usually abbreviated to this result as a large even number that can be expressed as "1 + 2". Trial programming to verify Chen's theorem, that is, input (> = 6) an arbitrarily large even number and use trial and error to verify that it can be decomposed into a sum of the product of a prime number and two prime numbers. If there is no solution, it indicates that Chen's theorem is not there. End.

Oh, see if there are any masters :)
Reply

Use magic Report

1

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

 Author| Post time: 2020-1-9 21:09:01
| Show all posts
The specific implementation language can be standard C or VB ~ In fact, the languages ​​are interlinked, it depends on the specific implementation algorithm :)
Reply

Use magic Report

0

Threads

18

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-24 13:45:02
| Show all posts
Agree upstairs
Reply

Use magic Report

0

Threads

34

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-1-25 18:00:01
| Show all posts
// Try programming to verify Chen's theorem, that is, input (> = 6) an arbitrarily large even number and use trial and error to verify that it can be decomposed into the sum of a prime number and two prime numbers. And the program ends.
Private Sub Command1_Click ()
Dim n, n1, n2, i, j
n = Val (Text1)
For i = 2 To n
    If zs (i) Then
        For j = 2 To (n-i) / 2
            If (n-i) Mod j = 0 Then
                If zs (j) And zs ((n-i) / j) Then
                    MsgBox n&"="&i&"+"&j&"*"&(n-i) / j
                    Exit Sub
                End If
            End If
        Next
    End If
Next
MsgBox "Does not exist"
End Sub

Function zs (s) As Boolean
Dim i
For i = 2 To Sqr (s)
    If s Mod i = 0 Then zs = False: Exit Function
Next
zs = True
End Function
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list