sqrt() 沒辦法對方程式開根號嗎?

25 views
Skip to first unread message

weianqq

unread,
Dec 6, 2009, 10:28:24 PM12/6/09
to 中文 Scilab 教育論壇
x=poly(0,'x');
p=x^2+2*x+1;
for x=1:6;
if x>0;
sqrt(p)
end
end




sqrt(p)
!--error 246
此參數型態沒有對應之函數定義,

檢查參數或重新定義函數 %p_sqrt 以便重載.

at line 8 of exec file called by :
exec("C:/DOCUME~1/weianqq/LOCALS~1/Temp/SCI_TMP_2608_/Untitled1.sce");
while executing a callback


Yung-Jang Lee

unread,
Dec 7, 2009, 7:55:38 AM12/7/09
to ade-s...@googlegroups.com
p 是多項式而不是函數, 你所想達成的通常是以函數如 :

function v=P(x)
   ..
endfunction


來完成.


如果要使用多項式, 可以使用 horner 指令來計算 多項式數值


因此

sqrt(horner(p,3))


代表計算多項式 p 在 x=3 時數值的開根






2009/12/7 weianqq <wei...@yahoo.com.tw>
Reply all
Reply to author
Forward
0 new messages