Jump to content

Ghideon

Senior Members
  • Posts

    2599
  • Joined

  • Days Won

    21

Everything posted by Ghideon

  1. Found three: The finder method returns the value of the min element, not the index: find_the_min_element(self, i): ... return SSSort.arr[min] Change that to "return min". The indexes self.n-1should be self.n in two places, otherwise the last element is not sorted. Complete code below with my and Strange's suggestions, look for "# Changed by Ghideon" and "#Strange's fix" import random class SSSort: arr = [] # class var access by className.arr def __init__(self, n): self.n = n def generate1000_5digit_RandomNum(self): for i in range(self.n): num = random.randint(10000, 99999) SSSort.arr.append(num) for j in range(self.n): print("random {0}".format(SSSort.arr[j])) def find_the_min_element(self, i): min = i for j in range(i+1, self.n): if (SSSort.arr[j] < SSSort.arr[min]): min = j # Changed by Ghideon: return min def selectionSort(self): for i in range(self.n): min = self.find_the_min_element(i) #swap min and ith element of array #Strange's fix temp = SSSort.arr[min] SSSort.arr[min] = SSSort.arr[i] SSSort.arr[i] = temp for i in enumerate(SSSort.arr): print(i) def main(self): self.generate1000_5digit_RandomNum() self.selectionSort() if __name__ == "__main__": objSSSort = SSSort(20) objSSSort.main()
  2. I do not get what you mean here. By removing time you have effectively removed the rate of change, there is no change to be measured. I assume that by "measurement" you mean something from physics even if topic is in philosophy section. Also not that in the (well supported) theory of relativity time and space is not absolute. As @Strange said it is observer dependent. You could measure the cat to have a longer or shorter life depending on frame of reference. Personal note: Special Relativity states that two observers in relative movement does not necessarily agree about the order of two events. Hence I do not, from a philosophical point of view, see time, space or "space-time" as "linear".
  3. True. I have not tested an interactive session with google but google draw is good for creating and sharing pictures with symbols and/or hand writings. @André Delmont here is a link to a guide "Teaching Math with Google Drawings". There are examples and templates for creating hand-in material or slides for teachers. https://docs.google.com/document/d/1URZeW53_ieN0BY6PNpNyp67QCdHA7-98rDis6BHWLHM It focuses most on geometry but I think it may be useful for evaluating if the google tools are useful in your situation.
  4. When I paste there is a little box in my browser: If I paste one of your malfunctioning texts as rich text they are not displayed as math but as \( x := 0 \) . If I paste and click "paste and plain text instead" i get math \( x := 0 \)
  5. The three versions seems ok in my browser. Try copying and pasting a failing version from earlier post, and make sure to paste as plain text, my guess is that it will work.
  6. Test 1: This is a copy paste from post above \( x := 0 \) This is a paste as plain text \( x := 0 \) This is typed into the post \( x := 0 \) This is a copy paste of the version after "Then I type" from above \( x := 0 \) edit: There seems to be something weird with the ":" char because it is sent in html surrounded by <span> : <p> Then I type \(&nbsp; x <span>:</span>= 0 \), but I edit it to become like in the line above by adding the ":". </p>
  7. Testing a cut and paste of code above : \( f(x) := 0 \) When I check the HTML the server sends me I get the following for @taeto's line in the previous post: When you type in \( f(x) <span>:</span>= 0 \) does it render correctly with TeX? And in my browser it looks like the screenshot above My own line that i have in this edited post looks different, it is MathJax <span class="MathJax" id="MathJax-Element-6-Frame" tabindex="0" style=""><nobr> <span class="math" id="MathJax-Span-44" style="width: 4.903em; display: inline-block;"> <span style="display: inline-block; position: relative; width: 4.017em; height: 0px; font-size: 121%;"> <span style="position: absolute; clip: rect(1.243em, 1003.958em, 2.6em, -999.997em); top: -2.181em; left: 0em;"> <span class="mrow" id="MathJax-Span-45"><span class="mi" id="MathJax-Span-46" style="font-family: MathJax_Math-italic;">f <span style="display: inline-block; overflow: hidden; height: 1px; width: 0.062em;"></span> </span> <span class="mo" id="MathJax-Span-47" style="font-family: MathJax_Main;">(</span> <span class="mi" id="MathJax-Span-48" style="font-family: MathJax_Math-italic;">x</span> <span class="mo" id="MathJax-Span-49" style="font-family: MathJax_Main;">)</span><span class="mo" id="MathJax-Span-50" style="font-family: MathJax_Main; padding-left: 0.298em;">:<span style="font-family: MathJax_Main;">=</span> </span><span class="mn" id="MathJax-Span-51" style="font-family: MathJax_Main; padding-left: 0.298em;">0</span> </span> <span style="display: inline-block; width: 0px; height: 2.187em;"></span> </span> </span> <span style="display: inline-block; overflow: hidden; vertical-align: -0.354em; border-left-width: 0px; border-left-style: solid; width: 0px; height: 1.361em;"></span> </span> </nobr> </span> Test 2: \( f(x) := 0 \) Does the above line look wrong? edit: @taeto I have managed to reproduce your isse in my brower by copy pasting your string as rich text instead of plain text. If I paste as text it renders as math symbols
  8. @André Delmont Do you have access to Microsoft tools on the computer? I thing newer versions of Office could have what you look for if you share screen via Skype. Google for ink math assistant onenote Disclaimer: I have used handwriting a lot in onenote on big screens (as white board replacement) but not yet tried multiple simultaneous users.
  9. Thanks for feedback! To help any other member that may be interested: If this line TestRandom.arr[i] = num Is changed to this: TestRandom.arr.append(num) It will print random numbers There may be requirements in the homework for writing the program as in OP but if the task is to get 20 random numbers it can be expressed more compact: import random for i in range(20): print(random.randint(10000, 99999))
  10. It should render the same, at least on my browser. The config in the page source says math and backslash parenthesis can be used: inlineMath: [ ["\[math\]","\[\/math\]"], ["\\(","\\)"], ["\[latex\]","\[\/latex\]"] ], Does MathJax differ between browsers?
  11. Ghideon

    math test

    Three different modes tested: [math]f(x):=0[/math] \(f(x):=0\) [latex]f(x):=0[/latex] Code for above is [math]f(x):=0[/math] \(f(x):=0\) [latex]f(x):=0[/latex] Screendump from browser Mathjax-config: inlineMath: [ ["\[math\]","\[\/math\]"], ["\\(","\\)"], ["\[latex\]","\[\/latex\]"] ],
  12. Can you explain what that means? If your definition is identical to Pi then it is some redundant definition. If you get another value in your definition of Pi then your definition is wrong; it is not Pi anymore. As I said in a post above: pi, defined as circumference/diameter of a circle, seems to have an non ending sequence of decimals when expressed in base-10: 3.1415... that does not mean that circles, pi or their definitions are approximations. If you need to write Pi as a number maybe you could have look at base-Pi numbers at wikipedia.org/Non-integer_representation#Base_π or the source at http://datagenetics.com/blog/december22015/index.html
  13. Ghideon

    math test

    1: PNG: 2: Plain text: f(x):=0 3: text between math brackets: [math]f(x):=0[/math] 4: Screenshot of line 3 above before pushing submit:
  14. Here is my opinion after thinking about the above. I can definitely see @studiot's point of view, it is very familiar to me from some of my attempts at providing answers here on the forum. But personally I do often find that the interesting but badly stated questions are triggering me to think outside the box. My attempts at figuring out the question is often contributing to enhancing my knowledge just as much as my tries to provide an answer. But I think that those discussions are sometimes (often?) not very interesting for others to follow so in the general case it may not add much value to the site even if I personally enjoy that kind of topics. I have some vague idea about some kind of a "questions about questions" or "help me improve my question" or "How would a scientist ask"-section where one could submit a vague question and get help to enhance the question it until it can be properly addressed from a scientific point of view. "Bad" question could be moved to that section until "good enough". But I'm not sure it will help. Those in need of the section may be offended by a move or be discouraged from further questions. And it maybe it adds unnecessary work for moderators to move stuff around.
  15. That is a good point! I tried to account for that in my assumption, but may have failed. The acceleration is identical for both objects. That's why I defined the identical acceleration in the first phase and the identical force in the second phase of the question. I probably should have written that I assume the initial accelerating forces to be different for m1 and m2? From OP: "Now, consider an object that is light and one that is heavy, both going at the same acceleration, but with different forces acting".
  16. The times it takes to stop the objects are related as their masses: [math]m_{1}/m_{2}[/math] Since question is not very clear I do some assumptions there are two objects [math]m_{1}[/math] and [math]m_{2}[/math] where mass of [math]m_{1}[/math] < mass of [math]m_{2}[/math] at time [math]t_{0}[/math]=0 [math]m_{1}[/math] and [math]m_{2}[/math]are accelerated from rest with acceleration a. at time [math]t_{1}[/math] acceleration of [math]m_{1}[/math] and [math]m_{2}[/math] stops at time [math]t_{2}[/math] some kind of force F starts to affect [math]m_{1}[/math] and [math]m_{2}[/math]. Force [math]F[/math] is acting in opposite direction of movement of [math]m_{1}[/math] and [math]m_{2}[/math] Force [math]F[/math] acts independently on [math]m_{1}[/math] and [math]m_{2}[/math] until each object have stopped. Newtonian physics applies (low speeds, solid bodies) Apply some math: velocity [math]v[/math] for both objects [math]m_{1}[/math] and [math]m_{2}[/math] at time [math]t_{1}[/math] is then [math]v=a*t_{1}[/math] momentum at [math]t_{1}[/math] is [math]p_{1}=m_{1}*v[/math] and [math]p_{2}=m_{2}*v[/math] Impulse = change in momentum Force F is applied until objects are stopped, that means change of momentum is [math]p_{1}[/math] and [math]p_{2}[/math] for [math]m_{1}[/math] and [math]m_{2}[/math] If we label time to stop [math]m_{1}=t_{s1}[/math] and time to stop [math]m_{2}=t_{s2}[/math] then [math]t_{s1}=p_{1}/F=m_{1}*v/F[/math] [math]t_{s2}=p_{2}/F=m_{2}*v/F[/math] Result: [math]\frac{t_{s1}}{t_{s2}}=\frac{m_{1}}{m_{2}}[/math]
  17. Thanks for your reply. Your posted speculations do make much sense, sorry. Over here the surface of the earth does not have anything in common with a star. Are you maybe trying to claim things about the hot core of the earth? And how is that related to hydrogen fusion?
  18. Because: (bold by me) If you try to access an element that does not exist, Pythons answer is index out of range. Maybe you could try the list* functions in Python? There are plenty of references and tutorials online. *) Python supports lists, one of several available types of collections
  19. No additional photons are created. Again refer to the car light analogy i posted above. If the fog is dense enough the car will be visible only from a short distance for an observer in the fog. All photons are scattered before going very far. Same goes for laser. If amount of scattering is negligible a laser beam will reach moon and bounce back*. If there is dense dust or fog the laser will not be visible for anyone after some limited distance. The number of photons leaving the laser is finite. The more photons that are scattered the fewer and fewer will be left along the path of the beam. *) https://en.wikipedia.org/wiki/Lunar_Laser_Ranging_experiment
  20. If the laser is in the vacuum of space* and aiming into space there is no photons scatted. No observers around or behind the laser will see the beam. *) I was probably not clear on that point in my post Edit: Here is an analogy. On a really crystal clear night it is hard to see an approaching car behind a hill further down the road. If there is fog the scattered light will be visible before an approaching car is visible on the top of the hill: If the car had lasers as headlights and there were vacuum it would be impossible to see the laser light until the laser shines directly into the eyes of the observer. Does this help?
  21. In addition to the good answers above: let's assume the beam projected into the sky in Hong Kong instead would be project in space where there is almost perfect vacuum. None of the photons in the beam will scatter since there is no particles. In principle all photons will continue in a straight line. Then no observers will see any laser light, unless the observer is located exactly in a straight line from the laser.
  22. There seems to be some errors in that claim. If you mean earth that we live on, earth is not a star. Earth does not seem deadly. Large planets* in solar system are planets, not stars AFAIK. Are you maybe talking about brown dwarfs? *) gas planets
  23. It would help if you post the line numbers for the code when posting error messages referring to line numbers. Hints*: -What does "IndexError: list assignment index out of range" mean? -Does the variable arr contain an element at index i? *) Posted in Homework Help, no solution but hints will be given.
  24. I think more details are needed to make a comment. Otherwise I would have to write a rather long article to cover the topic. For instance, when you say "n" and sorting do you mean that there are n items to sort? Or do you imply that the algorithm is given some number of integers where all integers are less or equal to n? When stating "sorting algorithms like Bubble sort" do you mean a set of impractical algorithms that like bubble sort runs in O(n^2)?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.