Jump to content

Math probelm (KOS related.)


glen.mack

Recommended Posts

I'm writing a program for a specific ship, where I'll be calculating a specific speed on the fly.

Over the course of about 30 seconds, I want my angle of ascent to smoothly change from 90 to Whatever angle brings me to and then maintains that speed.

I tried programming in a sigmoid curve...

FUNCTION SIG
{
PARAMETER v.
PARAMETER t.
SET v TO 1/(1+((constant:E)^(t))).
RETURN v.
}

No dice. The function either returns a null object or too many parameter calls. (no matter how many I input.)

Is there another option to calculate this on the fly? (without vecdraws, it's too complicated for me.)

Link to comment
Share on other sites

What's the design rationale for passing in v as a parameter when it never gets read by the function and it just calculates it anew? Why not just pass in t alone, calculate a local v, and return the v ?

FUNCTION SIG
{
  PARAMETER t.
  LOCAL v IS 1/(1+((constant:E)^(t))).
  RETURN v.
}

or even just eliminate the local altogether since it only lives long enough to be returned:

FUNCTION SIG
{
  PARAMETER t.
  RETURN 1/(1+((constant:E)^(t))).
}

 

Link to comment
Share on other sites

5 hours ago, Steven Mading said:

What's the design rationale for passing in v as a parameter when it never gets read by the function and it just calculates it anew? Why not just pass in t alone, calculate a local v, and return the v ?


FUNCTION SIG
{
  PARAMETER t.
  LOCAL v IS 1/(1+((constant:E)^(t))).
  RETURN v.
}

or even just eliminate the local altogether since it only lives long enough to be returned:


FUNCTION SIG
{
  PARAMETER t.
  RETURN 1/(1+((constant:E)^(t))).
}

 

It was just my attempt at getting the equation to work when t alone was throwing errors. (new to programming.)

 Both your format and mine return the plus of the equation as an object reference not set to an instance. For which I have no explanation.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...