The following warnings occurred:
Warning [2] Undefined array key 254314 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 254322 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 254326 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 254346 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 254347 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 254374 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 254399 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 254451 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $thread - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $fid - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 254374 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 254451 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $lang - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Attempt to read property "messages_in_thread" on null - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks





[HP-Prime CAS] Vector Calculus Library



#9

Hello

Start to program a library of vector calculus, in different coordinates (spherical, cylindrical and Cartesian) for the current commands grad fromHP-CAS only work on Cartesian Coordinates =(.
 

First command or function (test) gradient of a function in (x, y, z)

f2(x,y,z):=x^3+y²+z; [ENTER]

[d(f2(x,y,z),x),d(f2(x,y,z),y),d(f2(x,y,z),z)] ; [ENTER] => [3*x²,2*y,1] // ok

// definition as function

gradient(f(x,y,z)):=[d(f(x,y,z),x),d(f(x,y,z),y),d(f(x,y,z),z)]; [ENTER] Done

gradient(x^3+y²+z); [ENTER] [0,0,0] ?? What mistake I'm making?

gradient CAS mathematica

http://www.wolframalpha.com/input/?i=gradient%28x%5E3%2By%C2%B2%2Bz%29

Edited: 30 Oct 2013, 11:32 p.m. after one or more responses were posted


#10

Does this do anything different then the built in capability?

toolbox->calculus->differential->Gradient

grad(x^3+y^2+z,[x,y,z]) -> [3*x^2,2*y,1]

TW


#11

The first version (dradient, divergence) is exactly like the command to bring the hp-prime, but only works in Cartesian coordinates, my purpose is to operate in spherical and cylindrical coordinates =)

I'm waiting for an answer where I am wrong encoding my code for gradent ...


#12

Quote:
The first version (dradient, divergence) is exactly like the command to bring the hp-prime, but only works in Cartesian coordinates, my purpose is to operate in spherical and cylindrical coordinates =)

I'm waiting for an answer where I am wrong encoding my code for gradent ...


gradient(f):=[ diff(f,x), diff(f,y), diff(f,z) ]

The input variable of any function (in this case, of gradient) must be exactly that: a variable. You may want to make your gradient function more robust by allowing users to specify the variables of the function, though (rather than assuming it will always be x, y, and z).

gradient(f,v):=[diff(f,v(1)), diff(f,v(2)), diff(f,v(3)) ];
gradient(x^2*y+z, {x,y,z});

#13

Quote:


gradient(f):=[ diff(f,x), diff(f,y), diff(f,z) ]

The input variable of any function (in this case, of gradient) must be exactly that: a variable. You may want to make your gradient function more robust by allowing users to specify the variables of the function, though (rather than assuming it will always be x, y, and z).

gradient(f,v):=[diff(f,v(1)), diff(f,v(2)), diff(f,v(3)) ];
gradient(x^2*y+z, {x,y,z});

You probably have to enter this in algebraic mode since there seems to be a bug in textbook mode regarding vectors/matrices and entries consisting of functions.


#14

Quote:
You probably have to enter this in algebraic mode since there seems to be a bug in textbook mode regarding vectors/matrices and entries consisting of functions.

thanks Han

On the entry line and within array [] the [,] key used to skip to the next element, and I can not writing the expression f(x,y) ...

[request for hp]

I think one solution is to [shift-lock]+[,] = ,

Edited: 30 Oct 2013, 11:20 p.m.

#15

Han if I define my original function with diff, not fail, if define symbol d fail, is a possible BUG?

// step to step

f2(x,y,z):=x^3+y²+z; [ENTER]

[d(f2(x,y,z),x),d(f2(x,y,z),y),d(f2(x,y,z),z)] ; [ENTER] => [3*x²,2*y,1] // ok

[diff(f2(x,y,z),x) , diff(f2(x,y,z),y), diff(f2(x,y,z),z)]; [ENTER] => [3*x²,2*y,1] // ok

// define

gradient(f(x,y,z)):= [diff(f(x,y,z),x), diff(f(x,y,z),y), diff(f(x,y,z),z)]; [ENTER] Done

gradient(x^3+y²+z); [ENTER] => [3*x²,2*y,1] // ok


gradient(f(x,y,z)):= [d(f(x,y,z),x),d(f(x,y,z),y),d(f(x,y,z),z)]; [ENTER] Done

gradient(x^3+y²+z); [ENTER] => [0,0,0] ?? // BUG?

PD: on the entry line" another problem with v([1]) extraction of elements of a list, matrix ([m,n]), I can only be from an external editor (copy/paste) or encode in "algebraic" entry =(

sample
gradient2(f(x,y,z),v):=[diff(f(x,y,z),v([1])),diff(f(x,y,z),v([2])),diff(f(x,y,z),v([3]))];


Edited: 31 Oct 2013, 12:05 a.m.


#16

Quote:
Han if I define my original function with diff, not fail, if define symbol d fail, is a possible BUG?

Possibly -- it really depends on whether d is meant as a numerical command or a CAS command. The documentation says it is supposed to compute numerical derivatives. However, it appears the developers have allowed it to also compute symbolic derivatives.

Quote:
// step to step

f2(x,y,z):=x^3+y²+z; [ENTER]

[d(f2(x,y,z),x),d(f2(x,y,z),y),d(f2(x,y,z),z)] ; [ENTER] => [3*x²,2*y,1] // ok

[diff(f2(x,y,z),x) , diff(f2(x,y,z),y), diff(f2(x,y,z),z)]; [ENTER] => [3*x²,2*y,1] // ok

// define

gradient(f(x,y,z)):= [diff(f(x,y,z),x), diff(f(x,y,z),y), diff(f(x,y,z),z)]; [ENTER] Done

gradient(x^3+y²+z); [ENTER] => [3*x²,2*y,1] // ok


You should avoid using non-standard variables. When you create the CAS function gradient, your code above uses "f(x,y,z)" to mean a function of three variables as the desired input. However, the CAS interprets this as a single variable whose name is "f(x,y,z)" and does not see it as a function. To see my point, type:

myfunc(x*Y+Z):=SIN(x*Y+Z);
myfunc(2); ==> SIN(2)

Everything works as if "x*Y+Z" is a valid variable -- but you should avoid this. (It may be an un-intended "feature" but it is not a good use of placeholder variables)

Quote:
gradient(f(x,y,z)):= [d(f(x,y,z),x),d(f(x,y,z),y),d(f(x,y,z),z)]; [ENTER] Done

gradient(x^3+y²+z); [ENTER] => [0,0,0] ?? // BUG?


Again, I am not sure of the intended behavior of d but if it is a numerical derivative, there is a good chance the parser is evaluating the partial of "f(x,y,z)" as a variable, which would be considered a constant with respect to x, y, or z.

Quote:
PD: on the entry line" another problem with v([1]) extraction of elements of a list, matrix ([m,n]), I can only be from an external editor (copy/paste) or encode in "algebraic" entry =(

v(1) and v[1] are different in CAS mode. There was a discussion earlier about this. One counts from 0 the other from 1 (I don't remember which). And yes, there is also a bug with textbook mode and the use of the [,] key.


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP Prime: CAS taylor Alberto Candel 5 3,861 12-13-2013, 09:45 PM
Last Post: Alberto Candel
  HP Prime CAS curiosity bluesun08 11 4,701 12-10-2013, 01:03 PM
Last Post: Han
  [HP-Prime CAS] "Warning, ^ (Command) Is ambiguous on non square matrices"?? CompSystems 1 2,129 12-07-2013, 07:15 PM
Last Post: CompSystems
  HP Prime: complex numbers in CAS. Alberto Candel 1 1,847 12-06-2013, 02:36 PM
Last Post: parisse
  HP Prime: Proper Use of Home View and CAS View James Williams 9 4,159 12-05-2013, 02:44 PM
Last Post: James Williams
  [HP Prime] plotfunc() bug in CAS Chris Pem10 2 2,354 12-04-2013, 02:46 PM
Last Post: Chris Pem10
  HP Prime: adding an entry to a vector Alberto Candel 12 3,903 12-02-2013, 01:18 PM
Last Post: Alberto Candel
  HP Prime: Home/CAS? Alasdair McAndrew 11 3,768 11-26-2013, 02:48 PM
Last Post: Alberto Candel
  HP Prime - vector question bluesun08 3 1,742 11-18-2013, 07:26 PM
Last Post: Han
  HP Prime numerical precision in CAS and HOME Javier Goizueta 5 2,342 11-16-2013, 03:51 AM
Last Post: Paul Dale

Forum Jump: