The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Calling a CAS function in a program
11-04-2017, 01:30 AM (This post was last modified: 11-04-2017 08:26 PM by eulus.)
Post: #1
Calling a CAS function in a program
Hi,

I'm trying to write an HP program that numerically solves a system of nonlinear equations using the CAS function fsolve, with certain parameters depending on local variables (inputs). I get an "Error: Bad Argument Value" when trying to run the program, despite the same system getting solved just fine when I type it into CAS. The only thing I could find online was this post, where they discussed issues with using local variables in CAS functions, but nothing definitive was reached. Here's my code for reference:

Code:

EXPORT exponential_model()
BEGIN
  LOCAL V, R, Vr, Ir, n, Vt; // inputs
  LOCAL Is, Vd, Id; // outputs being solved for

  INPUT( {V, R, Vr, Ir, n, Vt},
    "Enter parameters", {},
    {"Voltage source", "Resistor", "Reference voltage", "Reference current", "Empirical constant", "Thermal voltage"} );
 
  RETURN CAS.fsolve({Ir=Is*(e^((Vr)/(n*Vt))-1),Id=(V-Vd)/R,Id=Is*(e^((Vd)/(n*Vt))-1)},{Vd,Id,Is});
END;

Thanks!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Calling a CAS function in a program - eulus - 11-04-2017 01:30 AM



User(s) browsing this thread: 1 Guest(s)