As a student of grade two , Math problems are always troubling me . Especially the preparatory examination here ( That is, the two best high schools here recruit students one year in advance , An examination to select top students ) nearly , The math problems I'm facing are getting more and more painful .
see , Trouble is coming. :
Pictured , In the square ABCD in ,E In the ray BC On , Connect AE、CE, be DE/AE The minimum value of is ________.
Get this question , Confidence slowly I calmly set AB:CE by 1:x, namely AB=k,CE=xk, So the original formula ( Set to y)=[k^2+(xk)^2]^0.5/[k^2+(k+xk)^2]^0.5( there “^” On behalf of the power ). That's all we need [k^2+(xk)^2]/[k^2+(k+xk)^2] The minimum value of ! This is a problem of finding the minimum value of an algebraic formula .
But …… The more you look at it, the more wrong it is . This algebraic expression is a fraction , However, the same type of questions we often contact are only integral forms . With my impression of six junior high school math books , I can't help asking questions : Is this really the content of junior high school ? There seems to be no mention in the book ?
however , In the spirit of hard-working old scalper , I spent hours there with this topic fruitlessly . Final , I gave up .
But maybe it's inspiration from a dream , The next morning , It occurred to me that : Why not pass a Python Program to enumerate one by one , Choose an approximate value from them ?
therefore , The first program came out :
k=1
answer=100
myx=0
for x in range(10):
y=(k**2+(x*k)**2)**0.5/(k**2+(k+x*k)**2)**0.5
if y<answer:
answer=y
myx=x
print(answer,myx)
Output results :
0.6324555320336759 1
alas , The more you look at it, the more something goes wrong ?
Last , I finally found the problem : Traverse like this x, Its values are all integers , In fact, the smallest y The corresponding x It doesn't have to be an integer .
Good. , Let's change :
k=1
answer=100
myx=0
for x in range(10000):
x=x/1000
y=(k**2+(x*k)**2)**0.5/(k**2+(k+x*k)**2)**0.5
if y<answer:
answer=y
myx=x
print(answer,myx)
Output :
0.6180339889095493 0.618
There's no problem with this ? There is still a problem . How can you be sure of x The range of ?
This problem seems fatal , But it's not completely incomprehensible . We can roughly infer that ,y The change trend of should be first down and then up or first up and then down ( This reasoning is instinctive to me , So that I can't explain the process in detail , But it can be concluded by reasoning ), Since it is to find the minimum , Of course, it is the former . therefore , because x from o.618 To 1 Is increasing , therefore x It must be 0.618 Or below , And these numbers obviously we have traversed to ( At least in a certain precision ). Next , All we need is to improve the accuracy , So as to get a result closer to the real value , And use it to guess the right answer .
Final , With high accuracy ( The procedure is roughly the same as before , Just increase the traversal value and x A multiple of reduction , Not listed here ), We get the results :
0.6180339887498948 0.618034
We all know , Before the decimal point of the golden ratio 65 Bit is equal to 0.6180339887498948482045868343656381177203091798057628621354486227, The first few digits of this number are completely consistent with the result of our traversal . We have reason to believe that , The answer is the golden ratio (5^0.5-1)/2. therefore , We use it perfectly Python That solved the problem .
Of course , Later, our teacher explained to us how to solve this problem without procedures : Try to change the unknown part of the formula into x+a/x In the form of , This formula will never be less than 2a^0.5. such , We can get the maximum value .
General idea : Sudoku nine lines and nine columns , One list Pack a line , You need a nested two-level list There will be a lot of numbers at first , I don't want to assign values one by one Then we must find a way to be lazy Then there is exhaustion , How to scientifically exhaust The first part : entry An online Sudoku website ...
original text :https://blog.csdn.net/yunzifengqing/article/details/81941592 Problem description : Yes 6 Suspects A.B.C.D.E.F, The following facts are known : A.B ...
Preface In the last article [python Advanced ] Explain metaclasses and their applications in detail 1 in , We mentioned some pre knowledge about metaclasses , Introduces class objects , Creating classes dynamically , Use type Create a class , In this section, we will continue to talk about ~~~ 5. send ⽤type Create with ...
python collections Module details original text :http://www.cnblogs.com/dahu-daqing/p/7040490.html 1. Module introduction collections It contains some special ...
Python Solve based on Backtracking 01 Example of knapsack problem This article mainly introduces Python Solve based on Backtracking 01 knapsack problem , Combined with the example form, the paper analyzes Python Backtracking method adopts depth first strategy to search and solve 01 Knapsack problem related operating skills , Friends in need ...
python Basics —— Enumeration class When we need to define constants , One way to do this is to use uppercase variables, defined by integers , For example, month : JAN = 1 FEB = 2 MAR = 3 ... NOV = 11 DEC = 12 The advantage is simplicity ...
Python Detailed explanation of string method This article was originally published in laiyonghao ( Love flowers and butterflies ) The blog of (http://blog.csdn.net/lanphaday), Rumeng reprint , Please keep the full text intact , Do not remove this statement and author information . ...
/*===================================== Perfect cube Total time limit : 1000ms Memory limit : 65536kB describe a The cube of = b The cube of + c The cube of + d The establishment of ...
Find prime numbers quickly The time limit :1000 ms | Memory limit :65535 KB difficulty :3 describe Now I'll give you a positive integer N, I want you to quickly find out where 2.....N All the primes in these numbers . Input Give a positive integer number N(N ...
python time Module details from :http://blog.csdn.net/kiki113/article/details/4033017 python The embedded time Template translation and description One . brief introduction ...
as everyone knows ,Switch Cycle ratio if...else... Cycle efficiency is much better , When case When you have the same code structure , How to simplify the code structure , It can make the code more universal ? I found it on the Internet , A lot of them are copy and paste , Others look too complicated ...
BufferedImage img = removeBackgroud(file);// Remove ghosting //bufferedimage convert to inputstream ByteArrayOutputStre ...
Reading methods : Zoom in to 200%. If you've used it word You should know ctrl Key to use the mouse wheel to zoom .
expr "text.sh" : ".*\.sh" &>/dev/null && echo "yes" ||e ...
when you install windows 7 OS, the system ask for you enter username and password, then you have not ...
private List<FMDS_FarmPlotNewInfo> GetSame(List<FMDS_FarmPlotNewInfo> lst) { List<FMD ...
The eye of Hang Seng Technology author Lin Jingzhong We are concerned about the operation of a business system in the following aspects : Functionality . stability . efficiency . Security . The performance of a system includes network performance . application performance . Middleware performance . Database performance and so on . Today, from the perspective of database performance ...
Due to the needs of the company's projects , Change it to WPF Development , So you need to learn WPF, The first problem I encountered was when I displayed the pictures , Write absolute path , The picture shows no problem , But when writing relative paths , I found that the picture could not be displayed properly , I did some research on the Internet , The answer is to ...
One . Uninstall delete mysql 1 sudo apt-get autoremove --purge mysql-server-5.02 sudo apt-get remove mysql-server3 s ...
1 taskDelay taskDelay(n) Delay the task that calls this function n individual tick( Kernel clock cycle ). The task is voluntarily abandoned within the specified time CPU, except taskDelay(0) special For task scheduling ( take CPU hand over ...