« first day (2377 days earlier)      last day (24 days later) » 

11:28 PM
Journeyman Geek has unfrozen this room.
 
woot woot!
Ok.....
I'm trying to find a value within a function f(x)
I have two bounds (upper and lower)
and the function should be quadratic in nature
problem is that the quadratic might be either positive or negative
 
You have it in the form ax^2 + bx + c, or is the actual function hidden from you?
It's OK if any of those constants are negative, I think the math should work out the same
 
no I don't have the function known to me per se
well I guess I kinda do
this should help us a little
This is the specific file that I'm working with
go down to cell 23
the transfer_ellipse function
that's what I'm trying to get working correctly
 
Bob
ow.
 
Oof, this appears to be a good ways over my head
 
11:37 PM
ya...
it's really simple honestly
the thing that I'm trying to do
the whole designing the transfer ellipse isn't so much
it's why it's a grad course :P
I'm trying to reduce it down to something simple.....
 
Bob
@BenN waaaaaay over mine
hm
 
Well, hm, how is it currently working? Does it work in some cases?
 
def find_val():
    upper = 100
    lower = 0
    found = False


    while not found:
        i = upper - lower / 2
        val = f(i)

        if desired_val - tolerance < val < desired_val + tolerance:
            found = True
        elif val > desired_val:
            lower = i
        else:
            upper = i
 
I only know some of these words from watching KSP videos
 
ok... this is basically what I'm trying to do
 
Bob
11:45 PM
@KronoS So did you just need the pos result, or both, or ..?
 
BUT... val may be inverted and therefore the upper and lower would have to be inverted
I just don't know exactly how to do that
@BenN yes it does....
specifically in the example of the earth to venus case
 
Bob
ah
 
Probably silly question, but by inverted do you mean negative?
 
BUT I took a different apprach
@BenN not necessarily
think of a simple parabola
 
Oh, OK, I think I see
 
Bob
11:47 PM
@KronoS and you don't have access to the quadratic formula?
if you did, you'd take the determinant and figure out whether it's inverted from there...
at least that's all I remember :(
 
well... its actually a cos wave
 
Bob
o.O
 
but I'm looking at a small section of it, which makes it more like a quadratic
t = (E - e sin E) / n
that's the specific formula
 
Oh, that can be handled I think, one moment
 
Bob
soooooooo... by "inverted" what you really mean is "decreasing"?
 
11:49 PM
I'm altering values of E to find a specific t
 
Bob
more accurately, that the differential is, uh, negative?
 
If you take the derivative of that sine wave and find zeros in the range, that should do it?
 
Bob
whoops. derivative.
 
Keep a little list of the values at the critical points and choose the one that makes the biggest/bestest value, and don't forget the ends of the range
 
11:51 PM
dt/dE = (1 - e cos E) / n I think
 
wow... much link failure
 
Calculus I can do, physics not so much :)
 
Bob
@BenN if the bounds are already known and you only need to swap them, then it'd be easier to just check if it's pos or neg at that point, no?
 
@BenN I'm not trying to find a max/min though... just a value
 
Oh
 
Bob
11:52 PM
this is bringing back horrible memories :P
 
looking for a specific value of t, by altering E
 
Bob
yea so, if the derivative is negative at that point then it looks like an "inverted" parabola part of the wave
 
perhaps what I can do... is divide up the range into sections
 
Or check whether the value gets "worse" after taking a small step in the direction the current code would suggest
 
examine the value at the edges of those sections and then refine it down that way
:/
 
11:57 PM
Would it be feasible to just scan the entire range in steps of tolerance to see which try is closest?
Actually, since the derivative is pretty manageable, you could evaluate that to tell you which way to go
 

« first day (2377 days earlier)      last day (24 days later) »