how to evaluate with certain conditions and how to use arrays instead of separate variables
Subject: how to evaluate with certain conditions and how to use arrays instead of separate variables
From: Robert Dodier
Date: Sun, 2 Dec 2012 01:39:16 +0000 (UTC)
On 2012-12-01, =?utf-8?Q?foelsche at sbcglobal.net?= <foelsche at sbcglobal.net> wrote:
> I?m trying to avoid writing conditions (values of variables) repeatedly.
It looks like you are computing the first and second derivatives of
int1, and evaluating those things at a certain point. I'm pretty sure
that can be simplified. Let me think about it.
> This code does still not evaluate -- it hangs.
The program gets stuck in the evaluation of dintd4_, dintd5_, and
dintd6_, which are integrals with floating point numbers in them.
Replacing the floats with rational numbers allows integrate to succeed.
Maxima tries to accommodate floats to some extent, but such
accommodation has bugs in it, and Maxima is really most comfortable with
exact numbers (integers, rationals, and symbolic constants).
Incidentally, keepfloat=false doesn't seem to help integrate here.
The floats I found in the program are omega, h, and the list values1.
Instead of a float, assign 2*%pi*10^6 to omega, 10^-8 to h, and rat(foo)
to each item in values1 where foo is the float value.
Hope this helps,
Robert Dodier
PS. Here's what I get from running the modified program.
(%i62) float(dintd1_)
(%i63) print("d1=",%)
d1= 0.0
(%i64) float(ev(dintd1d1_,nouns))
(%i65) print("d1d1=",%)
d1d1= 6.666666666666667E-25
(%i66) float(ev(dintd2_,nouns))
(%i67) print("d2=",%)
d2= 0.0
(%i68) float(ev(dintd2d2_,nouns))
(%i69) print("d2d2=",%)
d2d2= 4.0E-41
(%i70) float(ev(dintd3_,nouns))
(%i71) print("d3=",%)
d3= 0.0
(%i72) float(ev(dintd3d3_,nouns))
(%i73) print("d3d3=",%)
d3d3= 2.857142857142857E-57
(%i74) float(ev(dintd4_,nouns))
(%i75) print("d4=",%)
d4= -2.093568384918827E-18
(%i76) float(ev(dintd4d4_,nouns))
(%i77) print("d4d4=",%)
d4d4= 6.8E-25
(%i78) float(ev(dintd5_,nouns))
(%i79) print("d5=",%)
d5= -1.570107400399431E-26
(%i80) float(ev(dintd5d5_,nouns))
(%i81) print("d5d5=",%)
d5d5= 4.08E-41
(%i82) float(ev(dintd6_,nouns))
(%i83) print("d6=",%)
d6= -1.256046556244365E-34
(%i84) float(ev(dintd6d6_,nouns))
(%i85) print("d6d6=",%)
d6d6= 2.914285714285714E-57
(%i86) float(ev(dintd7_,nouns))
(%i87) print("d7=",%)
d7= 0.0
(%i88) float(ev(dintd7d7_,nouns))
(%i89) print("d7d7=",%)
d7d7= 1.337944011735036E-26
(%i90) float(ev(dintd8_,nouns))
(%i91) print("d8=",%)
d8= 0.0
(%i92) float(ev(dintd8d8_,nouns))
(%i93) print("d8d8=",%)
d8d8= 8.046142052111392E-43
(%i94) float(ev(dintd9_,nouns))
(%i95) print("d9=",%)
d9= 0.0
(%i96) float(ev(dintd9d9_,nouns))
(%i97) print("d9d9=",%)
d9d9= 5.760477141801053E-59