Editing Symbolic package

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 5: Line 5:
 
=== Demos and usage examples ===
 
=== Demos and usage examples ===
  
* '''I'm trying to substitute a double value into an expression.  How can I avoid getting "warning: Using rat() heuristics for double-precision input (is this what you wanted?)".'''
+
* ''' I'm trying to substitute a double value into an expression.  How can I avoid getting "warning: Using rat() heuristics for double-precision input (is this what you wanted?)"
  
 
In general, you should be very careful when converting floating point ("doubles") to symbolic variables, that's why the warning is bothering you.
 
In general, you should be very careful when converting floating point ("doubles") to symbolic variables, that's why the warning is bothering you.
Line 79: Line 79:
 
% have fun and change it if you want to.
 
% have fun and change it if you want to.
  
f = @(x) x.^2 + 3*x - 1 + 5*x.*sin(x);
+
f=@(x) x.^2 +3*x-1 + 5*x.*sin(x);
  
% these next lines take the Anonymous function into a symbolic formula
+
% the next 2 line take the Anonymous function into a symbolic formula
  
pkg load symbolic
 
 
syms x;
 
syms x;
ff = f(x);
+
 
 +
ff=formula(f(x));
  
 
% now calculate the derivative of the function
 
% now calculate the derivative of the function
  
ffd = diff(ff, x);
+
ffd=diff(ff);
  
 
% and convert it back to an Anonymous function
 
% and convert it back to an Anonymous function
  
df = function_handle(ffd)
+
df=function_handle(ffd)
  
  
% this uses the interval pkg to find all the roots between -15 an 10  
+
% this uses the interval pkg. to find all the roots between -15 an 10  
  
pkg load interval
 
 
fzero (f, infsup (-15, 10), df)
 
fzero (f, infsup (-15, 10), df)
  

Please note that all contributions to Octave may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Octave:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Template used on this page: