File:Cubic graph special points repeated.svg

Original file (SVG file, nominally 512 × 512 pixels, file size: 7 KB)

Summary

Description Graphs showing the relationship between the roots, and turning, stationary and inflection points of a cubic polynomial, and its first and second derivatives by CMG Lee. Thanks to en:user:GalacticShoe for an algorithm to exactly draw a cubic polynomial segment with a cubic Bezier.
Source Own work
Author Cmglee
Other versions
Cubic graph special points.svg

Python script to find distinct non-zero integer values

#!/usr/bin/env python
import re
def eval_at(x): return a * x ** 3 + b * x ** 2 + c * x + d
def is_integer(x): return abs(x - int(x)) < 1e-5
def print_keyval(dic, re_key):
 print('\t'.join(sorted(['%s=%s' % (key, dic[key])
                         for key in dic if re.search(re_key, key)])))
## http://wolframalpha.com/input?i=expand+%28x-r1%29%28x-r2%29%5E2
## http://wolframalpha.com/input?i=differentiate+(x-r1)(x-r2)(x-r2)
## http://wolframalpha.com/input?i=solve+2r1*r2-2r1*x%2Br2^2-4r2*x%2B3x^2%3D0+for+x
## http://wolframalpha.com/input?i=differentiate+(x-r2)(x-(2r1%2Br2)%2F3)
## http://wolframalpha.com/input?i=solve+2x-2r1%2F3-4r2%2F3%3D0+for+x
## http://wolframalpha.com/input?i=y%3D(x-4)(x-1)^2
## http://www.wolframalpha.com/input?i=factorise+3x^2-12x%2B9

## Cubic bezier control points from left to right, to be populated
pts = [[-1,None], [None,None], [None,None], [5,None]]
n   = 4 ## search range = [-n, n]

for  r2 in range(n, -1 - n, -1):
 for r1 in range(n, r2    , -1):
  if r1 * r2 == 0: continue
  r_1 = (2 * r1 + r2) / 3.0
  r_2 = r2
  if is_integer(r_1) and r_1 != 0: r_1 = int(r_1)
  else:                            continue
  r__ = (r1 + 2 * r2) / 3.0
  if is_integer(r__) and r__ != 0: r__ = int(r__)
  else:                            continue
  if len(set([r1, r_1, r__])) < 3: continue
  a = 1
  b = -2 * r2 - r1
  c = r2 * (2 * r1 + r2)
  d = -r1 * r2 * r2
  p = pts[0][0]
  q = pts[3][0]
  pts[0][1] = eval_at(p)
  pts[3][1] = eval_at(q)
  pts[1][0] = (2 * p + q) / 3.0
  pts[1][1] = a * p * p * q + b * (p * p + 2 * p * q) / 3.0 + c * (2 * p + q) / 3.0 + d
  pts[2][0] = (p + 2 * q) / 3.0
  pts[2][1] = a * p * q * q + b * (q * q + 2 * p * q) / 3.0 + c * (p + 2 * q) / 3.0 + d
  print_keyval(locals(), r'^(r_*\d?|[abcd]|pts)$')

Licensing

I, the copyright holder of this work, hereby publish it under the following licenses:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
You may select the license of your choice.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

image/svg+xml

62626688038d3e1672b4ffed83c881346c2476d2

6,753 byte

512 pixel

512 pixel

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current04:21, 4 February 2024Thumbnail for version as of 04:21, 4 February 2024512 × 512 (7 KB)CmgleeShrink font and simplify labels // Editing SVG source code using c:User:Rillke/SVGedit.js
04:00, 4 February 2024Thumbnail for version as of 04:00, 4 February 2024512 × 512 (7 KB)CmgleeAlign text // Editing SVG source code using c:User:Rillke/SVGedit.js
01:43, 4 February 2024Thumbnail for version as of 01:43, 4 February 2024512 × 512 (6 KB)CmgleeAssorted improvements
15:47, 3 February 2024Thumbnail for version as of 15:47, 3 February 2024512 × 512 (6 KB)CmgleeFix missing dots // Editing SVG source code using c:User:Rillke/SVGedit.js
15:19, 3 February 2024Thumbnail for version as of 15:19, 3 February 2024512 × 512 (6 KB)Cmglee{{Information |Description=Graphs showing the relationship between the roots, and turning, stationary and inflection points of a cubic polynomial, and its first and second derivatives by CMG Lee. |Source={{own}} |Date= |Author= Cmglee |Permission= |other_versions={{source thumb|cubic_graph_special_points.svg}} }} Category:Cubic functions Category:Differential calculus

Metadata