equal
deleted
inserted
replaced
16 --{*define exponential function using standard part *} |
16 --{*define exponential function using standard part *} |
17 "exphr x = st(sumhr (0, whn, %n. inverse(real (fact n)) * (x ^ n)))" |
17 "exphr x = st(sumhr (0, whn, %n. inverse(real (fact n)) * (x ^ n)))" |
18 |
18 |
19 definition |
19 definition |
20 sinhr :: "real => hypreal" where |
20 sinhr :: "real => hypreal" where |
21 "sinhr x = st(sumhr (0, whn, %n. (if even(n) then 0 else |
21 "sinhr x = st(sumhr (0, whn, %n. sin_coeff n * x ^ n))" |
22 ((-1) ^ ((n - 1) div 2))/(real (fact n))) * (x ^ n)))" |
|
23 |
22 |
24 definition |
23 definition |
25 coshr :: "real => hypreal" where |
24 coshr :: "real => hypreal" where |
26 "coshr x = st(sumhr (0, whn, %n. (if even(n) then |
25 "coshr x = st(sumhr (0, whn, %n. cos_coeff n * x ^ n))" |
27 ((-1) ^ (n div 2))/(real (fact n)) else 0) * x ^ n))" |
|
28 |
26 |
29 |
27 |
30 subsection{*Nonstandard Extension of Square Root Function*} |
28 subsection{*Nonstandard Extension of Square Root Function*} |
31 |
29 |
32 lemma STAR_sqrt_zero [simp]: "( *f* sqrt) 0 = 0" |
30 lemma STAR_sqrt_zero [simp]: "( *f* sqrt) 0 = 0" |
240 [OF hypnat_one_less_hypnat_omega, symmetric]) |
238 [OF hypnat_one_less_hypnat_omega, symmetric]) |
241 apply (rule st_unique, simp) |
239 apply (rule st_unique, simp) |
242 apply (rule subst [where P="\<lambda>x. 1 \<approx> x", OF _ approx_refl]) |
240 apply (rule subst [where P="\<lambda>x. 1 \<approx> x", OF _ approx_refl]) |
243 apply (rule rev_mp [OF hypnat_one_less_hypnat_omega]) |
241 apply (rule rev_mp [OF hypnat_one_less_hypnat_omega]) |
244 apply (rule_tac x="whn" in spec) |
242 apply (rule_tac x="whn" in spec) |
245 apply (unfold sumhr_app, transfer, simp) |
243 apply (unfold sumhr_app, transfer, simp add: cos_coeff_def) |
246 done |
244 done |
247 |
245 |
248 lemma STAR_exp_zero_approx_one [simp]: "( *f* exp) (0::hypreal) @= 1" |
246 lemma STAR_exp_zero_approx_one [simp]: "( *f* exp) (0::hypreal) @= 1" |
249 apply (subgoal_tac "( *f* exp) (0::hypreal) = 1", simp) |
247 apply (subgoal_tac "( *f* exp) (0::hypreal) = 1", simp) |
250 apply (transfer, simp) |
248 apply (transfer, simp) |
404 |
402 |
405 (* |
403 (* |
406 Goalw [NSLIM_def] "(%h. ((x powr h) - 1) / h) -- 0 --NS> ln x" |
404 Goalw [NSLIM_def] "(%h. ((x powr h) - 1) / h) -- 0 --NS> ln x" |
407 *) |
405 *) |
408 |
406 |
409 lemma HFinite_sin [simp]: |
407 lemma HFinite_sin [simp]: "sumhr (0, whn, %n. sin_coeff n * x ^ n) \<in> HFinite" |
410 "sumhr (0, whn, %n. (if even(n) then 0 else |
|
411 (-1 ^ ((n - 1) div 2))/(real (fact n))) * x ^ n) |
|
412 \<in> HFinite" |
|
413 unfolding sumhr_app |
408 unfolding sumhr_app |
414 apply (simp only: star_zero_def starfun2_star_of) |
409 apply (simp only: star_zero_def starfun2_star_of) |
415 apply (rule NSBseqD2) |
410 apply (rule NSBseqD2) |
416 apply (rule NSconvergent_NSBseq) |
411 apply (rule NSconvergent_NSBseq) |
417 apply (rule convergent_NSconvergent_iff [THEN iffD1]) |
412 apply (rule convergent_NSconvergent_iff [THEN iffD1]) |
418 apply (rule summable_convergent_sumr_iff [THEN iffD1]) |
413 apply (rule summable_convergent_sumr_iff [THEN iffD1]) |
419 apply (simp only: One_nat_def summable_sin) |
414 apply (rule summable_sin) |
420 done |
415 done |
421 |
416 |
422 lemma STAR_sin_zero [simp]: "( *f* sin) 0 = 0" |
417 lemma STAR_sin_zero [simp]: "( *f* sin) 0 = 0" |
423 by transfer (rule sin_zero) |
418 by transfer (rule sin_zero) |
424 |
419 |
430 apply (drule approx_mult1 [where c = x]) |
425 apply (drule approx_mult1 [where c = x]) |
431 apply (auto intro: Infinitesimal_subset_HFinite [THEN subsetD] |
426 apply (auto intro: Infinitesimal_subset_HFinite [THEN subsetD] |
432 simp add: mult_assoc) |
427 simp add: mult_assoc) |
433 done |
428 done |
434 |
429 |
435 lemma HFinite_cos [simp]: |
430 lemma HFinite_cos [simp]: "sumhr (0, whn, %n. cos_coeff n * x ^ n) \<in> HFinite" |
436 "sumhr (0, whn, %n. (if even(n) then |
|
437 (-1 ^ (n div 2))/(real (fact n)) else |
|
438 0) * x ^ n) \<in> HFinite" |
|
439 unfolding sumhr_app |
431 unfolding sumhr_app |
440 apply (simp only: star_zero_def starfun2_star_of) |
432 apply (simp only: star_zero_def starfun2_star_of) |
441 apply (rule NSBseqD2) |
433 apply (rule NSBseqD2) |
442 apply (rule NSconvergent_NSBseq) |
434 apply (rule NSconvergent_NSBseq) |
443 apply (rule convergent_NSconvergent_iff [THEN iffD1]) |
435 apply (rule convergent_NSconvergent_iff [THEN iffD1]) |