| Hi,I have 'Sage Version 4.6.1, Release Date: 2011-01-11' and I using next code to get roots of square equation: This way give very bad accuracy of the 1st root (Result1=-0.00138422288000584). What i do wrong? And How to get precision result with Sage? Thanks!
A note not related to your question; the only thing you need (or should) declare as a variable above is p. Assigning values to an identifier automatically changes its type in any case: try var('a'); type(a); a=0.01; type(a) to see what I mean.
kcrisman (Mar 08 '11) |
| Second edit: Based on the comment, I think you need to use higher-precision rings. I don't know if Maxima (which is what does our I hope that provides enough accuracy for your needs! ++++Edit: I see your question. You are saying that plugging 67... in yields something not quite right. This is going to happen with floating point approximations, especially when we pass things to Maxima, which we do here. Maxima is turning the floats into fractions, essentially, which means things will get off a little bit with such constants. The following will help you more: +++++ original Another thing that might work is not trying to approximate symbolic solutions which come I'm not sure what's happening here. If I don't do it quite the way you do, I get Plotting this seems to agree with these results.
is that possible to use another sage build-in block instead of maxima for arithmetics that more accurate?
avi9526 (Mar 08 '11)
Absolutely, but I was trying to answer your question most easily. You should look for documentation on RealField and other arbitrary (but fixed) precision fields, as well as interval arithmetic. Without knowing what you are trying to do, I can't be more specific. (I suspect Maxima also has such capabilities, but we don't wrap them.)
kcrisman (Mar 08 '11)
i do this for home task, so i have directives how i must solve main task (..writen 1980 in CCCP) also i dont want use find_root because roots can be complex and i must know where roots are. In variant #2 in ur answer u get little wrong root, same as i get, correct root #1 = -667666.665668165 - its not so far from -667666.665528360, but its for simple calculator, not for sage (my SRP-280 calculator gives better result than sage [-667666.665668]), some tasks need very good precision (my task not, but i want find way to exclude possible problems in next work)
avi9526 (Mar 09 '11) |
Asked: Mar 08 '11
Seen: 160 times
Last updated: Mar 11 '11
powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.