Items tagged with codegen codegen Tagged Items Feed

Cannot calculate derivative (gradient) of a procedure returned by dsolve.

Say, I solve the equation:

S1 := dsolve([diff(y(x), x$2)-1.0325*diff(y(x), x)+1.36*y(x)=sin(2*x), y(0)=0, y(1)=1], numeric, y(x), 'output' = listprocedure);

Its solution easily can be retrieved and looks fine:

H:=rhs(S1[2]); 

plot(H(t), t = 0..1, thickness = 4);

3

But when I try to calculate the gradient of H, I receive the error:

H1 := codegen[GRADIENT](H);

Error, (in intrep/statement) unable to translate Array(1..4, {(1) = proc (outpoint) local X, Y, YP, yout, errproc, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; X := Vector(8, {(1) = .0, (2) = .14817993189456188, (3) = .31785812820433257, (4) = .47163479035679234, (5) = .6130306894371967, (6) = .7460958115245858, (7) = .8741894219027533, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 2, {(1, 1) = .0, (1, 2) = .47692145669848085, (2, 1) = 0.7710429970702501e-1, (2, 2) = .5707930170882397, (3, 1) = .1866916935738028, (3, 2) = .7299040171277492, (4, 1) = .3128649714509215, (4, 2) = .9171936...

Gradient of procedures defined by  ":= proc()" is calculated properly.

Hello,

I use maple for the determination of the symbolic relations between the geometric relations on multibody system.

I would like to create a dll function for the functions that I have determined symbolically.

I have already a paper presenting : 
- the transformation Maple --> code C with the package with(CodeGeneration)
- and the transformation code C --> another software.

I would like to directly create a dll function from my maple function with using code C. Is it possible and how ?

Thanks a lot for your help.

 

Hi all,

I'm using MAPLE 13 and I'd like to know if someone knows how to generate the variables associated to the CodeGeneration for C code. At this moment I need to create manually the variable generated from the C code.

Example:

JJ := Jacobian(convert(Pint, Vector), [P1xenu, P1yenu, P1zenu, roll, pitch, yaw, D1xbody, D1ybody, P2xenu, P2yenu, P2zenu, ROLL, PITCH, YAW, D2xbody, D2ybody]);

CodeGeneration['C'](JJ, optimize);

Output:

t1 = cov2 * cov2;
t2 = cov1 * cov1;
t4 = 0.1e1 / (t1 + t2);
t5.......

And in the C code I need to create:

double t1, t2, t3..... manually

I can I solve this issue?

Best regards

André Dias

Hello.
I'm new to Maple, so my question could appear idiotic. But, anyway. :-)

I want to understand the restrictions of code generation in Maple.
What functions could I convert to code?
Only listed in "Translation of Functions" block in this link?
http://www.maplesoft.com/support/help/MapleSim/view.aspx?path=CodeGeneration/General/TranslationDetails

For example, I've found this post - http://www.mapleprimes.com/posts/36616-Dynamic-Programming-In-Maple 

Could functions "Maximize" and "diff" be converted to Java, VB or something or not? If yes, how?

Thanks anyway. :-)

I have a maple classic code. at the end I convert a parametric matrix to fortran77 code. in optimized mode

now I need to edit the Fortran77 code to Fortran90. for this job I have another code to do that.

but how should I write the codegen output to a test file?

The version 16 of Maple does not know the function "pow", it is replaced by "power". Nevertheless, the codegen[optimize] procedure still generates it!  Moreower, it's not optimal even to write poser(..., 1/2)  as, most probably, the function sqrt must run faster. 

  Here's an example: (the function being optimized just contains some nested square roots)

> iang10 := [codegen[optimize](Re(int11), tryhard)];
[ 2 t17
Page 1 of 1