Author Topic: Best way to plot Hyperbolic Cosine curve  (Read 4626 times)

0 Members and 1 Guest are viewing this topic.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Best way to plot Hyperbolic Cosine curve
« on: September 04, 2007, 03:52:15 PM »
OK, so Autocad wont draw one of these out of the box that I know of, so any idea how I should proceed?  All ideas welcome
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

SDETERS

  • Guest
Re: Best way to plot Hyperbolic Cosine curve
« Reply #1 on: September 04, 2007, 05:09:38 PM »
What is the x and y formula and or function to plot the points to?


David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Best way to plot Hyperbolic Cosine curve
« Reply #2 on: September 04, 2007, 05:51:50 PM »
cosh(x)=1/2(e^x + e^-x)
taken from here
« Last Edit: September 04, 2007, 05:52:55 PM by CmdrDuh »
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

SDETERS

  • Guest
Re: Best way to plot Hyperbolic Cosine curve
« Reply #3 on: September 04, 2007, 06:05:57 PM »
Looked in me notes

I can not find anything where I have done this before. 

I have all kinds of different splines I can make but this is not one of them

Sorry

Swift

  • Swamp Rat
  • Posts: 596
Re: Best way to plot Hyperbolic Cosine curve
« Reply #4 on: September 04, 2007, 09:48:09 PM »
Hey Duh
Long time, No see
It's been a long day but see if this is in the neighborhood of being right

Code: [Select]
Option Explicit

Public Sub CMDRDUH()

Dim pl As AcadLWPolyline
Dim lowbound As Double
Dim upbound As Double
Dim step As Double
Dim e As Double
Dim pi As Double
Dim i As Double
Dim k As Integer
Dim coords() As Double
Dim start As Integer
Dim finish As Integer

start = 0
e = 2.7182818284
pi = 3.14159265

lowbound = 0
upbound = pi * 2

step = 0.01

finish = (upbound - lowbound) / step
ReDim coords(finish * 2 + 1)
i = 0: k = 0

For i = lowbound To upbound Step step

    coords(k) = i
    k = k + 1
    coords(k) = 0.5 * (e ^ i + e ^ -1)
    'coords(k) = Sin(i)
    k = k + 1
Next i

Set pl = ThisDrawing.ModelSpace.AddLightWeightPolyline(coords)

End Sub

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Best way to plot Hyperbolic Cosine curve
« Reply #5 on: September 05, 2007, 12:45:33 AM »
Looks good Swift
Can this be expressed as a spline?

Swift

  • Swamp Rat
  • Posts: 596
Re: Best way to plot Hyperbolic Cosine curve
« Reply #6 on: September 05, 2007, 08:01:51 AM »
That can be used to graph any function valid in two dimensions

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Best way to plot Hyperbolic Cosine curve
« Reply #7 on: September 05, 2007, 10:00:46 AM »
Cool, I will give that a try!  Thanks Swift
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Best way to plot Hyperbolic Cosine curve
« Reply #8 on: September 05, 2007, 10:05:40 AM »
    coords(k) = 0.5 * (e ^ i + e ^ -1)
Hey Swift, should this be 0.5*(e^i+e^-i) or -1?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Best way to plot Hyperbolic Cosine curve
« Reply #9 on: September 05, 2007, 10:06:03 AM »
It looks like it draws the curve either way though, so Im confused
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Swift

  • Swamp Rat
  • Posts: 596
Re: Best way to plot Hyperbolic Cosine curve
« Reply #10 on: September 05, 2007, 10:12:49 AM »
    coords(k) = 0.5 * (e ^ i + e ^ -1)
Hey Swift, should this be 0.5*(e^i+e^-i) or -1?

Your right...Sorry about that. The reason its not real noticible is the proximity of i to 1

Swift

  • Swamp Rat
  • Posts: 596
Re: Best way to plot Hyperbolic Cosine curve
« Reply #11 on: September 05, 2007, 10:15:27 AM »
That can be used to graph any function valid in two dimensions

Should be for a well behaved function. For instance if you try to graph tan over pi/2 you'll get an error