comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » solve cubic polynomial for dummies?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: solve cubic polynomial for dummies? [message #88437 is a reply to message #88425] Thu, 24 April 2014 13:30 Go to previous message
mga1 is currently offline  mga1
Messages: 2
Registered: April 2014
Junior Member
Fantastic thanks. Final code used posted below. Ended up using cuberoot but fz_roots worked also:

pro cubesolve,coeff,y

coeff = [1.00000, -2.02300, 2.87770, -1.94410]

Y = [0, 0.95]

N_values=n_elements(y)


for i=0, N_values-1 do begin

val=y[i]
; c = coeff
; c[0] = coeff[0]-val
; roots = fz_roots(c,/double)
; print,roots

x = CUBEROOT([1.00000-val, -2.02300, 2.87770, -1.94410])

print, x

endfor

end
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Upload a file on a website
Next Topic: H5D_Read on compound type (GDL)

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 12:42:17 PDT 2025

Total time taken to generate the page: 1.59898 seconds